mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-12-01 15:37:14 +00:00
ENH: Optimized binary form for UUID (Type 1) (#1308)
* ENH: Optimized binary form for UUID (Type 1) * added missing parameter in test
This commit is contained in:
1 parent
18ca3403ac
commit
e252f71792
9 files changed
+126
-47
No files matched your search
@@ -9,7 +9,7 @@ public class DefaultSqlRowTest {
|
||||
@Test
|
||||
public void test_keyConversion() {
|
||||
|
||||
DefaultSqlRow row = new DefaultSqlRow(16, 0.5f, "T");
|
||||
DefaultSqlRow row = new DefaultSqlRow(16, 0.5f, "T", false);
|
||||
row.put("Foo", "hello");
|
||||
|
||||
assertThat(row.containsKey("foo")).isTrue();
|
||||
|
||||
@@ -12,10 +12,22 @@ public class TestScalarTypeUUIDBinaryConversion {
|
||||
|
||||
UUID id = UUID.randomUUID();
|
||||
|
||||
byte[] bytes = ScalarTypeUUIDBinary.convertToBytes(id);
|
||||
byte[] bytes = ScalarTypeUUIDBinary.convertToBytes(id, false);
|
||||
Assert.assertEquals(16, bytes.length);
|
||||
|
||||
UUID id2 = ScalarTypeUUIDBinary.convertFromBytes(bytes);
|
||||
UUID id2 = ScalarTypeUUIDBinary.convertFromBytes(bytes, false);
|
||||
Assert.assertEquals(id, id2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConversionOptimized() {
|
||||
|
||||
UUID id = UUID.randomUUID();
|
||||
|
||||
byte[] bytes = ScalarTypeUUIDBinary.convertToBytes(id, true);
|
||||
Assert.assertEquals(16, bytes.length);
|
||||
|
||||
UUID id2 = ScalarTypeUUIDBinary.convertFromBytes(bytes, true);
|
||||
Assert.assertEquals(id, id2);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user