use of jakarta.nosql.mapping.Pagination in project jnosql-diana by eclipse.
the class GraphPageTest method shouldPaginate.
@Test
public void shouldPaginate() {
Pagination pagination = Pagination.page(1).size(1);
Page<Person> page = template.getTraversalVertex().orderBy("name").desc().page(pagination);
assertNotNull(page);
List<Person> people = page.<Person>getContent().collect(Collectors.toList());
Person first = template.getTraversalVertex().orderBy("name").desc().<Person>getResult().findFirst().get();
assertEquals(pagination, page.getPagination());
assertEquals(1, people.size());
}
use of jakarta.nosql.mapping.Pagination in project jnosql-diana by eclipse.
the class GraphPageTest method shouldStream.
@Test
public void shouldStream() {
Pagination pagination = Pagination.page(1).size(1);
Page<Person> page = template.getTraversalVertex().orderBy("name").desc().page(pagination);
assertNotNull(page);
Stream<Person> people = page.get();
assertEquals(pagination, page.getPagination());
assertEquals(poliana.getName(), people.map(Person::getName).collect(joining()));
}
use of jakarta.nosql.mapping.Pagination in project jnosql-diana by eclipse.
the class DefaultColumnQueryPaginationTest method shouldCreateColumnQueryPagination.
@Test
public void shouldCreateColumnQueryPagination() {
ColumnQuery query = select().from("column").build();
Pagination pagination = Pagination.page(1).size(2);
ColumnQueryPagination queryPagination = ColumnQueryPagination.of(query, pagination);
assertNotNull(queryPagination);
isQueryEquals(query, pagination, queryPagination);
}
use of jakarta.nosql.mapping.Pagination in project jnosql-diana by eclipse.
the class ColumnPageTest method shouldGetContent.
@Test
public void shouldGetContent() {
Pagination pagination = Pagination.page(1).size(1);
Page<Person> page = createPage(pagination);
List<Person> people = page.getContent().collect(Collectors.toList());
assertEquals(1, people.size());
assertEquals(0L, people.get(0).getId());
}
use of jakarta.nosql.mapping.Pagination in project jnosql-diana by eclipse.
the class ColumnPageTest method shouldCreateCollectionFromCollectionFactory.
@Test
public void shouldCreateCollectionFromCollectionFactory() {
Pagination pagination = Pagination.page(1).size(1);
Page<Person> page = createPage(pagination);
ArrayList<Person> people = page.getContent(ArrayList::new);
assertEquals(1, people.size());
}
Aggregations