Search in sources :

Example 1 with DefaultHasMoreResourcesMetaInformation

use of io.crnk.core.resource.meta.DefaultHasMoreResourcesMetaInformation in project crnk-framework by crnk-project.

the class HasNextPageTestRepository method findAll.

@Override
public ResourceList<Task> findAll(QuerySpec querySpec) {
    DefaultResourceList<Task> list = new DefaultResourceList<>();
    list.setMeta(new DefaultHasMoreResourcesMetaInformation());
    querySpec.apply(tasks, list);
    return list;
}
Also used : Task(io.crnk.core.mock.models.Task) DefaultHasMoreResourcesMetaInformation(io.crnk.core.resource.meta.DefaultHasMoreResourcesMetaInformation) DefaultResourceList(io.crnk.core.resource.list.DefaultResourceList)

Example 2 with DefaultHasMoreResourcesMetaInformation

use of io.crnk.core.resource.meta.DefaultHasMoreResourcesMetaInformation in project crnk-framework by crnk-project.

the class HasNextPageTestRepository method findAll.

@Override
public ResourceList<Task> findAll(Iterable<Long> ids, QuerySpec querySpec) {
    DefaultResourceList<Task> list = new DefaultResourceList<>();
    list.setMeta(new DefaultHasMoreResourcesMetaInformation());
    querySpec.apply(tasks, list);
    return list;
}
Also used : Task(io.crnk.core.mock.models.Task) DefaultHasMoreResourcesMetaInformation(io.crnk.core.resource.meta.DefaultHasMoreResourcesMetaInformation) DefaultResourceList(io.crnk.core.resource.list.DefaultResourceList)

Example 3 with DefaultHasMoreResourcesMetaInformation

use of io.crnk.core.resource.meta.DefaultHasMoreResourcesMetaInformation in project crnk-framework by crnk-project.

the class InMemoryEvaluatorTest method testNextPageMetaInformationIsTrue.

@Test
public void testNextPageMetaInformationIsTrue() {
    QuerySpec spec = new QuerySpec(Task.class);
    DefaultResourceList<Task> results = new DefaultResourceList<>();
    results.setMeta(new DefaultHasMoreResourcesMetaInformation());
    spec.setLimit(2L);
    spec.apply(tasks, results);
    Assert.assertEquals(2, results.size());
    HasMoreResourcesMetaInformation meta = results.getMeta(HasMoreResourcesMetaInformation.class);
    Assert.assertTrue(meta.getHasMoreResources());
}
Also used : Task(io.crnk.core.mock.models.Task) DefaultHasMoreResourcesMetaInformation(io.crnk.core.resource.meta.DefaultHasMoreResourcesMetaInformation) DefaultResourceList(io.crnk.core.resource.list.DefaultResourceList) HasMoreResourcesMetaInformation(io.crnk.core.resource.meta.HasMoreResourcesMetaInformation) DefaultHasMoreResourcesMetaInformation(io.crnk.core.resource.meta.DefaultHasMoreResourcesMetaInformation) Test(org.junit.Test)

Example 4 with DefaultHasMoreResourcesMetaInformation

use of io.crnk.core.resource.meta.DefaultHasMoreResourcesMetaInformation in project crnk-framework by crnk-project.

the class InMemoryEvaluatorTest method testNextPageMetaInformationIsFalse.

@Test
public void testNextPageMetaInformationIsFalse() {
    QuerySpec spec = new QuerySpec(Task.class);
    DefaultResourceList<Task> results = new DefaultResourceList<>();
    results.setMeta(new DefaultHasMoreResourcesMetaInformation());
    spec.setLimit(5L);
    spec.apply(tasks, results);
    HasMoreResourcesMetaInformation meta = results.getMeta(HasMoreResourcesMetaInformation.class);
    Assert.assertEquals(5, results.size());
    Assert.assertFalse(meta.getHasMoreResources());
}
Also used : Task(io.crnk.core.mock.models.Task) DefaultHasMoreResourcesMetaInformation(io.crnk.core.resource.meta.DefaultHasMoreResourcesMetaInformation) DefaultResourceList(io.crnk.core.resource.list.DefaultResourceList) HasMoreResourcesMetaInformation(io.crnk.core.resource.meta.HasMoreResourcesMetaInformation) DefaultHasMoreResourcesMetaInformation(io.crnk.core.resource.meta.DefaultHasMoreResourcesMetaInformation) Test(org.junit.Test)

Aggregations

Task (io.crnk.core.mock.models.Task)4 DefaultResourceList (io.crnk.core.resource.list.DefaultResourceList)4 DefaultHasMoreResourcesMetaInformation (io.crnk.core.resource.meta.DefaultHasMoreResourcesMetaInformation)4 HasMoreResourcesMetaInformation (io.crnk.core.resource.meta.HasMoreResourcesMetaInformation)2 Test (org.junit.Test)2