use of org.apache.cassandra.db.marshal.TimeUUIDType in project eiger by wlloyd.
the class UUIDTests method testTimeUUIDType.
@Test
public void testTimeUUIDType() throws UnknownHostException {
TimeUUIDType comp = TimeUUIDType.instance;
ByteBuffer first = ByteBuffer.wrap(UUIDGen.decompose(UUIDGen.makeType1UUIDFromHost(InetAddress.getByName("127.0.0.1"))));
ByteBuffer second = ByteBuffer.wrap(UUIDGen.decompose(UUIDGen.makeType1UUIDFromHost(InetAddress.getByName("127.0.0.1"))));
assert comp.compare(first, second) < 0;
assert comp.compare(second, first) > 0;
ByteBuffer sameAsFirst = ByteBuffer.wrap(UUIDGen.decompose(UUIDGen.getUUID(first)));
assert comp.compare(first, sameAsFirst) == 0;
}
use of org.apache.cassandra.db.marshal.TimeUUIDType in project janusgraph by JanusGraph.
the class UUIDTest method timeUUIDComparison.
@Test
public void timeUUIDComparison() {
TimeUUIDType ti = TimeUUIDType.instance;
UUID zu = UUID.fromString(z);
UUID vu = UUID.fromString(v);
ByteBuffer zb = ti.decompose(zu);
ByteBuffer vb = ti.decompose(vu);
assertEquals(-1, ti.compare(zb, vb));
assertEquals(1, zu.compareTo(vu));
assertEquals(1, ti.compare(vb, zb));
assertEquals(-1, vu.compareTo(zu));
}
use of org.apache.cassandra.db.marshal.TimeUUIDType in project cassandra by apache.
the class UUIDTests method testTimeUUIDType.
@Test
public void testTimeUUIDType() {
TimeUUIDType comp = TimeUUIDType.instance;
ByteBuffer first = ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes());
ByteBuffer second = ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes());
assert comp.compare(first, second) < 0;
assert comp.compare(second, first) > 0;
ByteBuffer sameAsFirst = ByteBuffer.wrap(UUIDGen.decompose(UUIDGen.getUUID(first)));
assert comp.compare(first, sameAsFirst) == 0;
}
use of org.apache.cassandra.db.marshal.TimeUUIDType in project titan by thinkaurelius.
the class UUIDTest method timeUUIDComparison.
@Test
public void timeUUIDComparison() {
TimeUUIDType ti = TimeUUIDType.instance;
UUID zu = UUID.fromString(z);
UUID vu = UUID.fromString(v);
ByteBuffer zb = ti.decompose(zu);
ByteBuffer vb = ti.decompose(vu);
assertEquals(-1, ti.compare(zb, vb));
assertEquals(1, zu.compareTo(vu));
assertEquals(1, ti.compare(vb, zb));
assertEquals(-1, vu.compareTo(zu));
}
Aggregations