use of org.jnosql.diana.api.column.ColumnQuery in project jnosql-diana by eclipse.
the class DefaultSelectQueryBuilderTest method shouldSelectWhereNameGte.
@Test
public void shouldSelectWhereNameGte() {
String columnFamily = "columnFamily";
Number value = 10;
ColumnQuery query = select().from(columnFamily).where("name").gte(value).build();
ColumnCondition condition = query.getCondition().get();
Column column = condition.getColumn();
assertTrue(query.getColumns().isEmpty());
assertEquals(columnFamily, query.getColumnFamily());
assertEquals(Condition.GREATER_EQUALS_THAN, condition.getCondition());
assertEquals("name", column.getName());
assertEquals(value, column.get());
}
use of org.jnosql.diana.api.column.ColumnQuery in project jnosql-diana by eclipse.
the class DefaultSelectQueryBuilderTest method shouldSelectLimit.
@Test
public void shouldSelectLimit() {
String columnFamily = "columnFamily";
ColumnQuery query = select().from(columnFamily).limit(10).build();
assertTrue(query.getColumns().isEmpty());
assertFalse(query.getCondition().isPresent());
assertEquals(columnFamily, query.getColumnFamily());
assertEquals(10L, query.getMaxResults());
}
use of org.jnosql.diana.api.column.ColumnQuery in project jnosql-diana by eclipse.
the class DefaultSelectQueryBuilderTest method shouldSelectOrderAsc.
@Test
public void shouldSelectOrderAsc() {
String columnFamily = "columnFamily";
ColumnQuery query = select().from(columnFamily).orderBy("name").asc().build();
assertTrue(query.getColumns().isEmpty());
assertFalse(query.getCondition().isPresent());
assertEquals(columnFamily, query.getColumnFamily());
assertThat(query.getSorts(), contains(Sort.of("name", ASC)));
}
use of org.jnosql.diana.api.column.ColumnQuery in project jnosql-diana by eclipse.
the class DefaultSelectQueryBuilderTest method shouldSelectWhereNameOr.
@Test
public void shouldSelectWhereNameOr() {
String columnFamily = "columnFamily";
String name = "Ada Lovelace";
ColumnQuery query = select().from(columnFamily).where("name").eq(name).or("age").gt(10).build();
ColumnCondition condition = query.getCondition().get();
Column column = condition.getColumn();
List<ColumnCondition> conditions = column.get(new TypeReference<List<ColumnCondition>>() {
});
assertEquals(Condition.OR, condition.getCondition());
assertThat(conditions, containsInAnyOrder(eq(Column.of("name", name)), ColumnCondition.gt(Column.of("age", 10))));
}
use of org.jnosql.diana.api.column.ColumnQuery in project jnosql-diana by eclipse.
the class DefaultSelectQueryBuilderTest method shouldSelect.
@Test
public void shouldSelect() {
String columnFamily = "columnFamily";
ColumnQuery query = select().from(columnFamily).build();
assertTrue(query.getColumns().isEmpty());
assertFalse(query.getCondition().isPresent());
assertEquals(columnFamily, query.getColumnFamily());
}
Aggregations