use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-diana-driver by eclipse.
the class CassandraColumnFamilyManagerAsyncTest method shouldInsertColumnsAsync.
@Test
public void shouldInsertColumnsAsync() {
ColumnEntity columnEntity = getColumnFamily();
columnEntityManager.insert(columnEntity);
}
use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-diana-driver by eclipse.
the class CassandraColumnFamilyManagerAsyncTest 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(COLUMN_FAMILY, singletonList(Columns.of("id", 10L)));
columns.forEach(columnFamily::add);
return columnFamily;
}
use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-diana-driver by eclipse.
the class CassandraColumnFamilyManagerAsyncTest method shouldUpdateColumnsAsync.
@Test
public void shouldUpdateColumnsAsync() {
ColumnEntity columnEntity = getColumnFamily();
columnEntityManager.update(columnEntity);
}
use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-diana-driver by eclipse.
the class CassandraColumnFamilyManagerAsyncTest method shouldUpdateColumnsAsyncWithCallBack.
@Test
public void shouldUpdateColumnsAsyncWithCallBack() {
ColumnEntity columnEntity = getColumnFamily();
AtomicBoolean callBack = new AtomicBoolean(false);
columnEntityManager.update(columnEntity, c -> callBack.set(true));
await().untilTrue(callBack);
ColumnQuery query = select().from(COLUMN_FAMILY).where("id").eq(10L).build();
AtomicReference<List<ColumnEntity>> entities = new AtomicReference<>(emptyList());
columnEntityManager.select(query, entities::set);
await().until(() -> entities.get().size(), not(equalTo(0)));
assertThat(entities.get(), contains(columnEntity));
}
use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-diana-driver by eclipse.
the class CassandraColumnFamilyManagerAsyncTest method shouldReturnErrorWhenInsertWithCallbackNull.
@Test
public void shouldReturnErrorWhenInsertWithCallbackNull() {
ColumnEntity entity = ColumnEntity.of(COLUMN_FAMILY);
assertThrows(NullPointerException.class, () -> {
columnEntityManager.insert(entity, (Consumer<ColumnEntity>) null);
});
}
Aggregations