Search in sources :

Example 11 with TupleType

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();
}
Also used : ListType(com.datastax.oss.driver.api.core.type.ListType) TupleType(com.datastax.oss.driver.api.core.type.TupleType) Test(org.junit.Test)

Example 12 with TupleType

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();
}
Also used : TupleType(com.datastax.oss.driver.api.core.type.TupleType) UserDefinedType(com.datastax.oss.driver.api.core.type.UserDefinedType) Test(org.junit.Test)

Example 13 with TupleType

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();
}
Also used : SetType(com.datastax.oss.driver.api.core.type.SetType) TupleType(com.datastax.oss.driver.api.core.type.TupleType) Test(org.junit.Test)

Example 14 with TupleType

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();
}
Also used : TupleType(com.datastax.oss.driver.api.core.type.TupleType) Test(org.junit.Test)

Example 15 with TupleType

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();
}
Also used : TupleType(com.datastax.oss.driver.api.core.type.TupleType) MapType(com.datastax.oss.driver.api.core.type.MapType) Test(org.junit.Test)

Aggregations

TupleType (com.datastax.oss.driver.api.core.type.TupleType)32 Test (org.junit.Test)22 UserDefinedType (com.datastax.oss.driver.api.core.type.UserDefinedType)13 TupleValue (com.datastax.oss.driver.api.core.data.TupleValue)12 ListType (com.datastax.oss.driver.api.core.type.ListType)7 MapType (com.datastax.oss.driver.api.core.type.MapType)6 SetType (com.datastax.oss.driver.api.core.type.SetType)6 UdtValue (com.datastax.oss.driver.api.core.data.UdtValue)5 UserDefinedTypeBuilder (com.datastax.oss.driver.internal.core.type.UserDefinedTypeBuilder)5 ByteBuffer (java.nio.ByteBuffer)5 DataType (com.datastax.oss.driver.api.core.type.DataType)4 BigInteger (java.math.BigInteger)4 CustomType (com.datastax.oss.driver.api.core.type.CustomType)3 DefaultTupleValue (com.datastax.oss.driver.internal.core.data.DefaultTupleValue)3 LineString (com.datastax.dse.driver.api.core.data.geometry.LineString)2 Point (com.datastax.dse.driver.api.core.data.geometry.Point)2 Polygon (com.datastax.dse.driver.api.core.data.geometry.Polygon)2 Geo (com.datastax.dse.driver.api.core.graph.predicates.Geo)2 DseDataTypes (com.datastax.dse.driver.api.core.type.DseDataTypes)2 CqlIdentifier (com.datastax.oss.driver.api.core.CqlIdentifier)2