Search in sources :

Example 1 with ScheduleListMeta

use of io.crnk.test.mock.repository.ScheduleRepository.ScheduleListMeta in project crnk-framework by crnk-project.

the class QuerySpecClientTest method testInterfaceAccess.

@Test
public void testInterfaceAccess() {
    // tag::interfaceAccess[]
    ScheduleRepository scheduleRepository = client.getResourceRepository(ScheduleRepository.class);
    Schedule schedule = new Schedule();
    schedule.setId(13L);
    schedule.setName("mySchedule");
    scheduleRepository.create(schedule);
    QuerySpec querySpec = new QuerySpec(Schedule.class);
    ScheduleList list = scheduleRepository.findAll(querySpec);
    Assert.assertEquals(1, list.size());
    ScheduleListMeta meta = list.getMeta();
    ScheduleListLinks links = list.getLinks();
    Assert.assertNotNull(meta);
    Assert.assertNotNull(links);
// end::interfaceAccess[]
}
Also used : Schedule(io.crnk.test.mock.models.Schedule) ScheduleRepository(io.crnk.test.mock.repository.ScheduleRepository) ScheduleListMeta(io.crnk.test.mock.repository.ScheduleRepository.ScheduleListMeta) ScheduleList(io.crnk.test.mock.repository.ScheduleRepository.ScheduleList) ScheduleListLinks(io.crnk.test.mock.repository.ScheduleRepository.ScheduleListLinks) QuerySpec(io.crnk.core.queryspec.QuerySpec) Test(org.junit.Test)

Example 2 with ScheduleListMeta

use of io.crnk.test.mock.repository.ScheduleRepository.ScheduleListMeta in project crnk-framework by crnk-project.

the class QuerySpecClientTest method testCreate.

@Test
public void testCreate() {
    ScheduleRepository scheduleRepository = client.getResourceRepository(ScheduleRepository.class);
    Schedule schedule = new Schedule();
    schedule.setName("mySchedule");
    scheduleRepository.create(schedule);
    QuerySpec querySpec = new QuerySpec(Schedule.class);
    ScheduleList list = scheduleRepository.findAll(querySpec);
    Assert.assertEquals(1, list.size());
    schedule = list.get(0);
    Assert.assertNotNull(schedule.getId());
    ScheduleListMeta meta = list.getMeta();
    ScheduleListLinks links = list.getLinks();
    Assert.assertNotNull(meta);
    Assert.assertNotNull(links);
}
Also used : Schedule(io.crnk.test.mock.models.Schedule) ScheduleRepository(io.crnk.test.mock.repository.ScheduleRepository) ScheduleListMeta(io.crnk.test.mock.repository.ScheduleRepository.ScheduleListMeta) ScheduleList(io.crnk.test.mock.repository.ScheduleRepository.ScheduleList) ScheduleListLinks(io.crnk.test.mock.repository.ScheduleRepository.ScheduleListLinks) QuerySpec(io.crnk.core.queryspec.QuerySpec) Test(org.junit.Test)

Aggregations

QuerySpec (io.crnk.core.queryspec.QuerySpec)2 Schedule (io.crnk.test.mock.models.Schedule)2 ScheduleRepository (io.crnk.test.mock.repository.ScheduleRepository)2 ScheduleList (io.crnk.test.mock.repository.ScheduleRepository.ScheduleList)2 ScheduleListLinks (io.crnk.test.mock.repository.ScheduleRepository.ScheduleListLinks)2 ScheduleListMeta (io.crnk.test.mock.repository.ScheduleRepository.ScheduleListMeta)2 Test (org.junit.Test)2