org.apache.cassandra.db.marshal.TimestampType Java Examples
The following examples show how to use
org.apache.cassandra.db.marshal.TimestampType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CellValidatorTest.java From deep-spark with Apache License 2.0 | 6 votes |
public void testValidatorClassToKind() { assertEquals(Kind.validatorClassToKind(null), Kind.NOT_A_COLLECTION); assertEquals(Kind.validatorClassToKind(TimeUUIDType.class), Kind.NOT_A_COLLECTION); assertEquals(Kind.validatorClassToKind(UTF8Type.class), Kind.NOT_A_COLLECTION); assertEquals(Kind.validatorClassToKind(Int32Type.class), Kind.NOT_A_COLLECTION); assertEquals(Kind.validatorClassToKind(BooleanType.class), Kind.NOT_A_COLLECTION); assertEquals(Kind.validatorClassToKind(TimestampType.class), Kind.NOT_A_COLLECTION); assertEquals(Kind.validatorClassToKind(DecimalType.class), Kind.NOT_A_COLLECTION); assertEquals(Kind.validatorClassToKind(LongType.class), Kind.NOT_A_COLLECTION); assertEquals(Kind.validatorClassToKind(DoubleType.class), Kind.NOT_A_COLLECTION); assertEquals(Kind.validatorClassToKind(FloatType.class), Kind.NOT_A_COLLECTION); assertEquals(Kind.validatorClassToKind(InetAddressType.class), Kind.NOT_A_COLLECTION); assertEquals(Kind.validatorClassToKind(IntegerType.class), Kind.NOT_A_COLLECTION); assertEquals(Kind.validatorClassToKind(UUIDType.class), Kind.NOT_A_COLLECTION); assertEquals(Kind.validatorClassToKind(SetType.class), Kind.SET); assertEquals(Kind.validatorClassToKind(ListType.class), Kind.LIST); assertEquals(Kind.validatorClassToKind(MapType.class), Kind.MAP); }
Example #2
Source File: CassandraTypeConverterTest.java From debezium-incubator with Apache License 2.0 | 5 votes |
@Test public void testTimestamp() { DataType timestampType = DataType.timestamp(); AbstractType<?> convertedType = CassandraTypeConverter.convert(timestampType); TimestampType expectedType = TimestampType.instance; Assert.assertEquals(expectedType, convertedType); }
Example #3
Source File: CassandraTypeConverterTest.java From debezium-incubator with Apache License 2.0 | 5 votes |
@Test public void testTuple() { // tuple containing timestamp and smallint. // tuples are always frozen, so we don't need to test that. // we don't care about the protocol version or the codec registry. DataType tupleType = TupleType.of(null, null, DataType.timestamp(), DataType.smallint()); AbstractType<?> convertedType = CassandraTypeConverter.convert(tupleType); List<AbstractType<?>> innerAbstractTypes = new ArrayList<>(2); innerAbstractTypes.add(TimestampType.instance); innerAbstractTypes.add(ShortType.instance); org.apache.cassandra.db.marshal.TupleType expectedType = new org.apache.cassandra.db.marshal.TupleType(innerAbstractTypes); Assert.assertEquals(expectedType, convertedType); }
Example #4
Source File: CassandraTypeDeserializerTest.java From debezium-incubator with Apache License 2.0 | 5 votes |
@Test public void testTimestampType() { Date timestamp = new Date(); Long expectedLongTimestamp = timestamp.getTime(); ByteBuffer serializedTimestamp = TimestampType.instance.decompose(timestamp); Object deserializedTimestamp = CassandraTypeDeserializer.deserialize(TimestampType.instance, serializedTimestamp); Assert.assertEquals(expectedLongTimestamp, deserializedTimestamp); }
Example #5
Source File: CassandraTypeDeserializerTest.java From debezium-incubator with Apache License 2.0 | 5 votes |
@Test @FixFor("DBZ-1967") public void testReversedType() { Date timestamp = new Date(); Long expectedLongTimestamp = timestamp.getTime(); ByteBuffer serializedTimestamp = TimestampType.instance.decompose(timestamp); ReversedType<?> reversedTimeStampType = ReversedType.getInstance(TimestampType.instance); Object deserializedTimestamp = CassandraTypeDeserializer.deserialize(reversedTimeStampType, serializedTimestamp); Assert.assertEquals(expectedLongTimestamp, deserializedTimestamp); }
Example #6
Source File: TimeuuidFcts.java From stratio-cassandra with Apache License 2.0 | 5 votes |
public ByteBuffer execute(List<ByteBuffer> parameters) { ByteBuffer bb = parameters.get(0); if (bb == null) return null; return ByteBuffer.wrap(UUIDGen.decompose(UUIDGen.minTimeUUID(TimestampType.instance.compose(bb).getTime()))); }
Example #7
Source File: TimeuuidFcts.java From stratio-cassandra with Apache License 2.0 | 5 votes |
public ByteBuffer execute(List<ByteBuffer> parameters) { ByteBuffer bb = parameters.get(0); if (bb == null) return null; return ByteBuffer.wrap(UUIDGen.decompose(UUIDGen.maxTimeUUID(TimestampType.instance.compose(bb).getTime()))); }
Example #8
Source File: TimeuuidFcts.java From stratio-cassandra with Apache License 2.0 | 5 votes |
public ByteBuffer execute(List<ByteBuffer> parameters) { ByteBuffer bb = parameters.get(0); if (bb == null) return null; return TimestampType.instance.decompose(new Date(UUIDGen.unixTimestamp(UUIDGen.getUUID(bb)))); }