use of org.jnosql.diana.api.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 org.jnosql.diana.api.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 org.jnosql.diana.api.column.ColumnEntity in project jnosql-diana-driver by eclipse.
the class CassandraColumnFamilyManagerTest method shouldInsertJustKey.
@Test
public void shouldInsertJustKey() {
Column key = Columns.of("id", 10L);
ColumnEntity columnEntity = ColumnEntity.of(COLUMN_FAMILY);
columnEntity.add(key);
entityManager.insert(columnEntity);
}
use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-diana-driver by eclipse.
the class CassandraReturnQueryAsync method run.
@Override
public void run() {
try {
ResultSet resultSet = this.resultSet.get();
List<ColumnEntity> entities = resultSet.all().stream().map(CassandraConverter::toDocumentEntity).collect(Collectors.toList());
consumer.accept(entities);
} catch (InterruptedException | ExecutionException e) {
throw new ExecuteAsyncQueryException(e);
}
}
use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-artemis by eclipse.
the class DefaultColumnTemplateAsyncTest method shouldUpdateIterable.
@Test
public void shouldUpdateIterable() {
ColumnEntity entity = ColumnEntity.of("Person");
entity.addAll(Stream.of(columns).collect(Collectors.toList()));
subject.update(singletonList(this.person));
verify(managerMock).update(captor.capture(), Mockito.any(Consumer.class));
ColumnEntity value = captor.getValue();
assertEquals(entity.getName(), value.getName());
}
Aggregations