use of jakarta.nosql.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());
}
use of jakarta.nosql.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(), Matchers.contains(Sort.of("name", SortType.ASC)));
}
use of jakarta.nosql.column.ColumnQuery in project jnosql-diana by eclipse.
the class DefaultSelectQueryBuilderTest method shouldSelectSkip.
@Test
public void shouldSelectSkip() {
String columnFamily = "columnFamily";
ColumnQuery query = select().from(columnFamily).skip(10).build();
assertTrue(query.getColumns().isEmpty());
assertFalse(query.getCondition().isPresent());
assertEquals(columnFamily, query.getColumnFamily());
assertEquals(10L, query.getSkip());
}
use of jakarta.nosql.column.ColumnQuery in project jnosql-diana by eclipse.
the class DefaultSelectQueryBuilderTest method shouldExecuteSingleResultManager.
@Test
public void shouldExecuteSingleResultManager() {
ColumnFamilyManager manager = Mockito.mock(ColumnFamilyManager.class);
ArgumentCaptor<ColumnQuery> queryCaptor = ArgumentCaptor.forClass(ColumnQuery.class);
String columnFamily = "columnFamily";
Optional<ColumnEntity> entities = select().from(columnFamily).getSingleResult(manager);
Mockito.verify(manager).singleResult(queryCaptor.capture());
checkQuery(queryCaptor, columnFamily);
}
use of jakarta.nosql.column.ColumnQuery in project jnosql-diana by eclipse.
the class DefaultSelectQueryBuilderTest method shouldSelectColumns.
@Test
public void shouldSelectColumns() {
String columnFamily = "columnFamily";
ColumnQuery query = select("column", "column2").from(columnFamily).build();
assertThat(query.getColumns(), containsInAnyOrder("column", "column2"));
assertFalse(query.getCondition().isPresent());
assertEquals(columnFamily, query.getColumnFamily());
}
Aggregations