use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-diana-driver by eclipse.
the class HBaseColumnFamilyManagerTest method shouldDeleteEntities.
@Test
public void shouldDeleteEntities() {
columnFamilyManager.insert(createEntity());
columnFamilyManager.insert(createEntity2());
ColumnQuery query = select().from(FAMILY).where(ID_FIELD).eq("otaviojava").or(ID_FIELD).eq("poliana").build();
ColumnDeleteQuery deleteQuery = delete().from(FAMILY).where(ID_FIELD).eq("otaviojava").or(ID_FIELD).eq("poliana").build();
columnFamilyManager.delete(deleteQuery);
List<ColumnEntity> entities = columnFamilyManager.select(query);
assertTrue(entities.isEmpty());
}
use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-diana-driver by eclipse.
the class HBaseColumnFamilyManagerTest method shouldSave.
@Test
public void shouldSave() {
ColumnEntity entity = createEntity();
columnFamilyManager.insert(entity);
}
use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-diana-driver by eclipse.
the class CassandraColumnFamilyManagerAsyncTest method shouldReturnErrorWhenInsertWithTTLNull.
@Test
public void shouldReturnErrorWhenInsertWithTTLNull() {
ColumnEntity entity = ColumnEntity.of(COLUMN_FAMILY);
assertThrows(NullPointerException.class, () -> {
columnEntityManager.insert(entity, (Duration) null);
});
assertThrows(NullPointerException.class, () -> {
columnEntityManager.insert(singletonList(entity), (Duration) null);
});
}
use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-diana-driver by eclipse.
the class CassandraColumnFamilyManagerAsyncTest method shouldReturnErrorWhenSaveWithCallbackNull.
@Test
public void shouldReturnErrorWhenSaveWithCallbackNull() {
ColumnEntity entity = ColumnEntity.of(COLUMN_FAMILY);
assertThrows(NullPointerException.class, () -> {
columnEntityManager.update(entity, (Consumer<ColumnEntity>) null);
});
}
use of org.jnosql.diana.api.column.ColumnEntity in project jnosql-diana-driver by eclipse.
the class CassandraColumnFamilyManagerAsyncTest method shouldInsertColumnsAsyncWithCallBack.
@Test
public void shouldInsertColumnsAsyncWithCallBack() {
ColumnEntity columnEntity = getColumnFamily();
AtomicBoolean callBack = new AtomicBoolean(false);
columnEntityManager.insert(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));
}
Aggregations