use of jakarta.nosql.column.ColumnEntity in project jnosql-diana-driver by eclipse.
the class CassandraColumnFamilyManagerTest method shouldReturnListUDT.
@Test
public void shouldReturnListUDT() {
ColumnEntity entity = createEntityWithIterable();
entityManager.insert(entity);
ColumnQuery query = select().from("contacts").where("user").eq("otaviojava").build();
ColumnEntity columnEntity = entityManager.singleResult(query).get();
List<List<Column>> names = (List<List<Column>>) columnEntity.find("names").get().get();
assertEquals(3, names.size());
assertTrue(names.stream().allMatch(n -> n.size() == 2));
}
use of jakarta.nosql.column.ColumnEntity in project jnosql-diana-driver by eclipse.
the class CassandraColumnFamilyManagerTest method shouldSupportListUDTs.
@Test
public void shouldSupportListUDTs() {
ColumnEntity entity = createEntityWithIterable();
entityManager.insert(entity);
}
use of jakarta.nosql.column.ColumnEntity in project jnosql-diana-driver by eclipse.
the class CassandraColumnFamilyManagerTest method getColumnFamily.
private ColumnEntity getColumnFamily() {
Map<String, Object> fields = new HashMap<>();
fields.put("name", "Cassandra");
fields.put("version", 3.2);
fields.put("options", asList(1, 2, 3));
List<Column> columns = Columns.of(fields);
ColumnEntity columnFamily = ColumnEntity.of(Constants.COLUMN_FAMILY, singletonList(Columns.of("id", 10L)));
columns.forEach(columnFamily::add);
return columnFamily;
}
use of jakarta.nosql.column.ColumnEntity in project jnosql-diana-driver by eclipse.
the class CassandraColumnFamilyManagerTest method createEntityWithIterable.
private ColumnEntity createEntityWithIterable() {
ColumnEntity entity = ColumnEntity.of("contacts");
entity.add(Column.of("user", "otaviojava"));
List<Iterable<Column>> columns = new ArrayList<>();
columns.add(asList(Column.of("firstname", "Poliana"), Column.of("lastname", "Santana")));
columns.add(asList(Column.of("firstname", "Ada"), Column.of("lastname", "Lovelace")));
columns.add(asList(Column.of("firstname", "Maria"), Column.of("lastname", "Goncalves")));
UDT udt = UDT.builder("fullname").withName("names").addUDTs(columns).build();
entity.add(udt);
return entity;
}
use of jakarta.nosql.column.ColumnEntity in project jnosql-diana-driver by eclipse.
the class CassandraColumnFamilyManagerTest method shouldInsertColumns.
@Test
public void shouldInsertColumns() {
ColumnEntity columnEntity = getColumnFamily();
entityManager.insert(columnEntity);
}
Aggregations