use of com.datastax.oss.driver.api.core.type.TupleType in project java-driver by datastax.
the class DataTypeDetachableTest method attaching_list_should_attach_its_element.
@Test
public void attaching_list_should_attach_its_element() {
TupleType tuple = DataTypes.tupleOf(DataTypes.INT);
ListType list = DataTypes.listOf(tuple);
assertThat(tuple.isDetached()).isTrue();
assertThat(list.isDetached()).isTrue();
list.attach(attachmentPoint);
assertThat(tuple.isDetached()).isFalse();
}
use of com.datastax.oss.driver.api.core.type.TupleType in project java-driver by datastax.
the class DataTypeDetachableTest method attaching_udt_should_attach_all_of_its_subtypes.
@Test
public void attaching_udt_should_attach_all_of_its_subtypes() {
TupleType tuple = DataTypes.tupleOf(DataTypes.INT);
UserDefinedType udt = new UserDefinedTypeBuilder(CqlIdentifier.fromInternal("ks"), CqlIdentifier.fromInternal("type")).withField(CqlIdentifier.fromInternal("field1"), DataTypes.INT).withField(CqlIdentifier.fromInternal("field2"), tuple).build();
assertThat(tuple.isDetached()).isTrue();
assertThat(udt.isDetached()).isTrue();
udt.attach(attachmentPoint);
assertThat(tuple.isDetached()).isFalse();
}
use of com.datastax.oss.driver.api.core.type.TupleType in project java-driver by datastax.
the class DataTypeDetachableTest method set_should_be_attached_if_its_element_is.
@Test
public void set_should_be_attached_if_its_element_is() {
TupleType tuple = DataTypes.tupleOf(DataTypes.INT);
SetType set = DataTypes.setOf(tuple);
assertThat(tuple.isDetached()).isTrue();
assertThat(set.isDetached()).isTrue();
tuple.attach(attachmentPoint);
assertThat(set.isDetached()).isFalse();
}
use of com.datastax.oss.driver.api.core.type.TupleType in project java-driver by datastax.
the class DataTypeDetachableTest method manually_created_tuple_should_be_detached.
@Test
public void manually_created_tuple_should_be_detached() {
TupleType tuple = DataTypes.tupleOf(DataTypes.INT, DataTypes.TEXT);
assertThat(tuple.isDetached()).isTrue();
}
use of com.datastax.oss.driver.api.core.type.TupleType in project java-driver by datastax.
the class DataTypeDetachableTest method map_should_be_attached_if_its_elements_are.
@Test
public void map_should_be_attached_if_its_elements_are() {
TupleType tuple1 = DataTypes.tupleOf(DataTypes.INT);
TupleType tuple2 = DataTypes.tupleOf(DataTypes.TEXT);
MapType map = DataTypes.mapOf(tuple1, tuple2);
assertThat(tuple1.isDetached()).isTrue();
assertThat(tuple2.isDetached()).isTrue();
assertThat(map.isDetached()).isTrue();
tuple1.attach(attachmentPoint);
assertThat(map.isDetached()).isTrue();
tuple2.attach(attachmentPoint);
assertThat(map.isDetached()).isFalse();
}
Aggregations