use of org.jnosql.diana.api.column.ColumnDeleteQuery in project jnosql-diana by eclipse.
the class DefaultDeleteQueryBuilderTest method shouldDeleteColumns.
@Test
public void shouldDeleteColumns() {
String columnFamily = "columnFamily";
ColumnDeleteQuery query = delete("column", "column2").from(columnFamily).build();
assertThat(query.getColumns(), containsInAnyOrder("column", "column2"));
assertFalse(query.getCondition().isPresent());
assertEquals(columnFamily, query.getColumnFamily());
}
use of org.jnosql.diana.api.column.ColumnDeleteQuery in project jnosql-diana by eclipse.
the class DefaultDeleteQueryBuilderTest method shouldSelectWhereNameEq.
@Test
public void shouldSelectWhereNameEq() {
String columnFamily = "columnFamily";
String name = "Ada Lovelace";
ColumnDeleteQuery query = delete().from(columnFamily).where("name").eq(name).build();
ColumnCondition condition = query.getCondition().get();
Column column = condition.getColumn();
assertTrue(query.getColumns().isEmpty());
assertEquals(columnFamily, query.getColumnFamily());
assertEquals(Condition.EQUALS, condition.getCondition());
assertEquals("name", column.getName());
assertEquals(name, column.get());
}
use of org.jnosql.diana.api.column.ColumnDeleteQuery in project jnosql-diana by eclipse.
the class DefaultDeleteQueryBuilderTest method shouldSelectWhereNameLte.
@Test
public void shouldSelectWhereNameLte() {
String columnFamily = "columnFamily";
Number value = 10;
ColumnDeleteQuery query = delete().from(columnFamily).where("name").lte(value).build();
ColumnCondition columnCondition = query.getCondition().get();
Column column = columnCondition.getColumn();
assertTrue(query.getColumns().isEmpty());
assertEquals(columnFamily, query.getColumnFamily());
assertEquals(Condition.LESSER_EQUALS_THAN, columnCondition.getCondition());
assertEquals("name", column.getName());
assertEquals(value, column.get());
}
use of org.jnosql.diana.api.column.ColumnDeleteQuery in project jnosql-diana by eclipse.
the class DefaultDeleteQueryBuilderTest method shouldDelete.
@Test
public void shouldDelete() {
String columnFamily = "columnFamily";
ColumnDeleteQuery query = delete().from(columnFamily).build();
assertTrue(query.getColumns().isEmpty());
assertFalse(query.getCondition().isPresent());
assertEquals(columnFamily, query.getColumnFamily());
}
use of org.jnosql.diana.api.column.ColumnDeleteQuery in project jnosql-diana by eclipse.
the class DefaultDeleteQueryBuilderTest method shouldSelectWhereNameBetween.
@Test
public void shouldSelectWhereNameBetween() {
String columnFamily = "columnFamily";
Number valueA = 10;
Number valueB = 20;
ColumnDeleteQuery query = delete().from(columnFamily).where("name").between(valueA, valueB).build();
ColumnCondition condition = query.getCondition().get();
Column column = condition.getColumn();
assertTrue(query.getColumns().isEmpty());
assertEquals(columnFamily, query.getColumnFamily());
assertEquals(Condition.BETWEEN, condition.getCondition());
assertEquals("name", column.getName());
assertThat(column.get(new TypeReference<List<Number>>() {
}), Matchers.contains(10, 20));
}
Aggregations