Search in sources :

Example 1 with ProjectMeta

use of io.crnk.test.mock.models.Project.ProjectMeta in project crnk-framework by crnk-project.

the class ProjectRepository method save.

@Override
public <S extends Project> S save(S entity) {
    entity.setId((long) (THREAD_LOCAL_REPOSITORY.size() + 1));
    THREAD_LOCAL_REPOSITORY.put(entity.getId(), entity);
    ProjectLinks links = new ProjectLinks();
    links.setValue("someLinkValue");
    entity.setLinks(links);
    ProjectMeta meta = new ProjectMeta();
    meta.setValue("someMetaValue");
    entity.setMeta(meta);
    return entity;
}
Also used : ProjectLinks(io.crnk.test.mock.models.Project.ProjectLinks) ProjectMeta(io.crnk.test.mock.models.Project.ProjectMeta)

Example 2 with ProjectMeta

use of io.crnk.test.mock.models.Project.ProjectMeta in project crnk-framework by crnk-project.

the class InformationClientTest method testMeta.

@Test
public void testMeta() {
    QuerySpec querySpec = new QuerySpec(Project.class);
    ResourceList<Project> list = projectRepo.findAll(querySpec);
    ProjectsMetaInformation metaInformation = list.getMeta(ProjectsMetaInformation.class);
    Assert.assertEquals("testMeta", metaInformation.getMetaValue());
    Project project = list.get(0);
    ProjectMeta projectMeta = project.getMeta();
    Assert.assertNotNull(projectMeta);
    Assert.assertEquals("someMetaValue", projectMeta.getValue());
}
Also used : Project(io.crnk.test.mock.models.Project) QuerySpec(io.crnk.core.queryspec.QuerySpec) ProjectsMetaInformation(io.crnk.test.mock.repository.ProjectRepository.ProjectsMetaInformation) ProjectMeta(io.crnk.test.mock.models.Project.ProjectMeta) Test(org.junit.Test)

Aggregations

ProjectMeta (io.crnk.test.mock.models.Project.ProjectMeta)2 QuerySpec (io.crnk.core.queryspec.QuerySpec)1 Project (io.crnk.test.mock.models.Project)1 ProjectLinks (io.crnk.test.mock.models.Project.ProjectLinks)1 ProjectsMetaInformation (io.crnk.test.mock.repository.ProjectRepository.ProjectsMetaInformation)1 Test (org.junit.Test)1