use of org.jnosql.diana.api.column.ColumnDeleteQuery in project jnosql-artemis by eclipse.
the class DefaultColumnMapperDeleteBuilderTest method shouldSelectWhereNameOr.
@Test
public void shouldSelectWhereNameOr() {
ColumnDeleteQuery query = mapperBuilder.deleteFrom(Person.class).where("id").between(10, 20).or("name").eq("Ada").build();
ColumnDeleteQuery queryExpected = delete().from("Person").where("_id").between(10L, 20L).or("name").eq("Ada").build();
assertEquals(queryExpected, query);
}
use of org.jnosql.diana.api.column.ColumnDeleteQuery in project jnosql-artemis by eclipse.
the class DefaultColumnMapperDeleteBuilderTest method shouldSelectWhereNameEq.
@Test
public void shouldSelectWhereNameEq() {
ColumnDeleteQuery query = mapperBuilder.deleteFrom(Person.class).where("name").eq("Ada").build();
ColumnDeleteQuery queryExpected = delete().from("Person").where("name").eq("Ada").build();
assertEquals(queryExpected, query);
}
use of org.jnosql.diana.api.column.ColumnDeleteQuery in project jnosql-diana-driver by eclipse.
the class CassandraColumnFamilyManagerAsyncTest method shouldDeleteWithCallBack.
@Test
public void shouldDeleteWithCallBack() {
AtomicBoolean callback = new AtomicBoolean(false);
ColumnDeleteQuery deleteQuery = delete().from(COLUMN_FAMILY).where("id").eq(10L).build();
columnEntityManager.delete(deleteQuery, v -> callback.set(true));
await().untilTrue(callback);
ColumnQuery query = select().from(COLUMN_FAMILY).where("id").eq(10L).build();
AtomicReference<List<ColumnEntity>> entities = new AtomicReference<>(emptyList());
callback.set(false);
Consumer<List<ColumnEntity>> result = (l) -> {
callback.set(true);
entities.set(l);
};
columnEntityManager.select(query, result);
await().untilTrue(callback);
assertTrue(entities.get().isEmpty());
}
use of org.jnosql.diana.api.column.ColumnDeleteQuery in project jnosql-diana-driver by eclipse.
the class CassandraColumnFamilyManagerTest method shouldDeleteColumnFamily.
@Test
public void shouldDeleteColumnFamily() {
entityManager.insert(getColumnFamily());
ColumnEntity.of(COLUMN_FAMILY, singletonList(Columns.of("id", 10L)));
ColumnQuery query = select().from(COLUMN_FAMILY).where("id").eq(10L).build();
ColumnDeleteQuery deleteQuery = delete().from(COLUMN_FAMILY).where("id").eq(10L).build();
entityManager.delete(deleteQuery);
List<ColumnEntity> entities = entityManager.cql("select * from newKeySpace.newColumnFamily where id=10;");
assertTrue(entities.isEmpty());
}
use of org.jnosql.diana.api.column.ColumnDeleteQuery in project jnosql-diana by eclipse.
the class DefaultDeleteQueryBuilderTest method shouldSelectWhereNameGt.
@Test
public void shouldSelectWhereNameGt() {
String columnFamily = "columnFamily";
Number value = 10;
ColumnDeleteQuery query = delete().from(columnFamily).where("name").gt(value).build();
ColumnCondition condition = query.getCondition().get();
Column column = condition.getColumn();
assertTrue(query.getColumns().isEmpty());
assertEquals(columnFamily, query.getColumnFamily());
assertEquals(Condition.GREATER_THAN, condition.getCondition());
assertEquals("name", column.getName());
assertEquals(value, column.get());
}
Aggregations