@Override public ByteBuffer serialize(String value, ProtocolVersion protocolVersion) throws InvalidTypeException { return TypeCodec.cint() .serialize(value == null ? null : Integer.parseInt(value), protocolVersion); }
@Test(groups = "short") public void should_create_token_from_partition_key() { Metadata metadata = cluster().getMetadata(); Row row = session().execute("SELECT token(i) FROM foo WHERE i = 1").one(); Token expected = row.getToken(0); ProtocolVersion protocolVersion = cluster().getConfiguration().getProtocolOptions().getProtocolVersion(); assertThat(metadata.newToken(TypeCodec.cint().serialize(1, protocolVersion))) .isEqualTo(expected); }
ks1, TypeCodec.cint() .serialize( testKey, cluster().getConfiguration().getProtocolOptions().getProtocolVersion()));
ks1, TypeCodec.cint() .serialize( testKey, cluster().getConfiguration().getProtocolOptions().getProtocolVersion()));
@Override public ByteBuffer serialize(String value, ProtocolVersion protocolVersion) throws InvalidTypeException { return TypeCodec.cint() .serialize(value == null ? null : Integer.parseInt(value), protocolVersion); }
@Override public ByteBuffer serialize(MyInt value, ProtocolVersion protocolVersion) throws InvalidTypeException { return TypeCodec.cint().serialize(value.i, protocolVersion); }
@Test(groups = "short") public void should_create_token_from_partition_key() { Metadata metadata = cluster().getMetadata(); Row row = session().execute("SELECT token(i) FROM foo WHERE i = 1").one(); Token expected = row.getToken(0); ProtocolVersion protocolVersion = cluster().getConfiguration().getProtocolOptions().getProtocolVersion(); assertThat(metadata.newToken(TypeCodec.cint().serialize(1, protocolVersion))) .isEqualTo(expected); }
@Override public ByteBuffer serialize(MyInt value, ProtocolVersion protocolVersion) throws InvalidTypeException { return TypeCodec.cint().serialize(value.i, protocolVersion); }