Search in sources :

Example 6 with ColumnQueryPagination

use of jakarta.nosql.mapping.column.ColumnQueryPagination in project jnosql-diana by eclipse.

the class ColumnPageTest method shouldExecuteQueryPagination.

@Test
public void shouldExecuteQueryPagination() {
    Pagination pagination = Pagination.page(1).size(2);
    ColumnQueryPagination query = ColumnQueryPagination.of(select().from("person").build(), pagination);
    subject.select(query);
    verify(managerMock).select(query);
}
Also used : Pagination(jakarta.nosql.mapping.Pagination) ColumnQueryPagination(jakarta.nosql.mapping.column.ColumnQueryPagination) ColumnQueryPagination(jakarta.nosql.mapping.column.ColumnQueryPagination) Test(org.junit.jupiter.api.Test)

Example 7 with ColumnQueryPagination

use of jakarta.nosql.mapping.column.ColumnQueryPagination 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);
}
Also used : ColumnQuery(jakarta.nosql.column.ColumnQuery) Pagination(jakarta.nosql.mapping.Pagination) ColumnQueryPagination(jakarta.nosql.mapping.column.ColumnQueryPagination) ColumnQueryPagination(jakarta.nosql.mapping.column.ColumnQueryPagination) Test(org.junit.jupiter.api.Test)

Example 8 with ColumnQueryPagination

use of jakarta.nosql.mapping.column.ColumnQueryPagination in project jnosql-diana by eclipse.

the class ColumnPageTest method setUp.

@BeforeEach
public void setUp() {
    managerMock = Mockito.mock(ColumnFamilyManager.class);
    columnEventPersistManager = Mockito.mock(ColumnEventPersistManager.class);
    captor = ArgumentCaptor.forClass(ColumnEntity.class);
    Instance<ColumnFamilyManager> instance = Mockito.mock(Instance.class);
    when(instance.get()).thenReturn(managerMock);
    this.subject = new DefaultColumnTemplate(converter, instance, new DefaultColumnWorkflow(columnEventPersistManager, converter), columnEventPersistManager, classMappings, converters);
    Pagination pagination = Pagination.page(1).size(1);
    ColumnQueryPagination query = ColumnQueryPagination.of(select().from("person").build(), pagination);
    for (int index = 0; index <= 10; index++) {
        Column[] columns = new Column[] { Column.of("age", index), Column.of("name", "Ada " + index), Column.of("_id", (long) index) };
        ColumnEntity columnEntity = ColumnEntity.of("Person");
        columnEntity.addAll(Stream.of(columns).collect(Collectors.toList()));
        when(managerMock.select(query)).thenReturn(Stream.of(columnEntity));
        query = query.next();
    }
}
Also used : Pagination(jakarta.nosql.mapping.Pagination) ColumnQueryPagination(jakarta.nosql.mapping.column.ColumnQueryPagination) ColumnQueryPagination(jakarta.nosql.mapping.column.ColumnQueryPagination) ColumnEventPersistManager(jakarta.nosql.mapping.column.ColumnEventPersistManager) ColumnEntity(jakarta.nosql.column.ColumnEntity) ColumnFamilyManager(jakarta.nosql.column.ColumnFamilyManager) Column(jakarta.nosql.column.Column) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

Pagination (jakarta.nosql.mapping.Pagination)8 ColumnQueryPagination (jakarta.nosql.mapping.column.ColumnQueryPagination)8 Test (org.junit.jupiter.api.Test)7 ColumnQuery (jakarta.nosql.column.ColumnQuery)5 Person (jakarta.nosql.tck.entities.Person)3 Column (jakarta.nosql.column.Column)1 ColumnEntity (jakarta.nosql.column.ColumnEntity)1 ColumnFamilyManager (jakarta.nosql.column.ColumnFamilyManager)1 ColumnEventPersistManager (jakarta.nosql.mapping.column.ColumnEventPersistManager)1 ColumnTemplate (jakarta.nosql.mapping.column.ColumnTemplate)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1