Search in sources :

Example 16 with Project

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

the class InheritanceClientTest method setup.

@Before
public void setup() {
    super.setup();
    taskRepo = client.getRepositoryForType(Task.class);
    projectRepo = client.getRepositoryForType(Project.class);
    relRepo = client.getRepositoryForType(Project.class, Task.class);
    Task baseTask = new Task();
    baseTask.setId(Long.valueOf(1));
    baseTask.setName("baseTask");
    taskRepo.create(baseTask);
    TaskSubType taskSubType = new TaskSubType();
    taskSubType.setId(Long.valueOf(2));
    taskSubType.setName("taskSubType");
    taskSubType.setSubTypeValue(13);
    taskRepo.create(taskSubType);
    Project project = new Project();
    project.setId(1L);
    project.setName("project0");
    project.setTasks(Arrays.asList(baseTask, taskSubType));
    projectRepo.create(project);
    relRepo.addRelations(project, Arrays.asList(baseTask.getId(), taskSubType.getId()), "tasks");
}
Also used : Project(io.crnk.test.mock.models.Project) Task(io.crnk.test.mock.models.Task) TaskSubType(io.crnk.test.mock.models.TaskSubType) Before(org.junit.Before)

Example 17 with Project

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

the class InformationClientTest method testLinks.

@Test
public void testLinks() {
    QuerySpec querySpec = new QuerySpec(Project.class);
    ResourceList<Project> list = projectRepo.findAll(querySpec);
    ProjectsLinksInformation lnksInformation = list.getLinks(ProjectsLinksInformation.class);
    Assert.assertEquals("testLink", lnksInformation.getLinkValue());
    Project project = list.get(0);
    ProjectLinks projectLinks = project.getLinks();
    Assert.assertNotNull(projectLinks);
    Assert.assertEquals("someLinkValue", projectLinks.getValue());
}
Also used : Project(io.crnk.test.mock.models.Project) ProjectsLinksInformation(io.crnk.test.mock.repository.ProjectRepository.ProjectsLinksInformation) ProjectLinks(io.crnk.test.mock.models.Project.ProjectLinks) QuerySpec(io.crnk.core.queryspec.QuerySpec) Test(org.junit.Test)

Aggregations

Project (io.crnk.test.mock.models.Project)17 Task (io.crnk.test.mock.models.Task)12 Test (org.junit.Test)7 QuerySpec (io.crnk.core.queryspec.QuerySpec)6 Schedule (io.crnk.test.mock.models.Schedule)3 DefaultResourceList (io.crnk.core.resource.list.DefaultResourceList)2 QueryParams (io.crnk.legacy.queryParams.QueryParams)2 Before (org.junit.Before)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2 ObjectProxy (io.crnk.client.internal.proxy.ObjectProxy)1 ProjectLinks (io.crnk.test.mock.models.Project.ProjectLinks)1 ProjectMeta (io.crnk.test.mock.models.Project.ProjectMeta)1 TaskSubType (io.crnk.test.mock.models.TaskSubType)1 ProjectRepository (io.crnk.test.mock.repository.ProjectRepository)1 ProjectsLinksInformation (io.crnk.test.mock.repository.ProjectRepository.ProjectsLinksInformation)1 ProjectsMetaInformation (io.crnk.test.mock.repository.ProjectRepository.ProjectsMetaInformation)1 TaskRepository (io.crnk.test.mock.repository.TaskRepository)1 Serializable (java.io.Serializable)1 JsonFluentAssert (net.javacrumbs.jsonunit.fluent.JsonFluentAssert)1 Span (org.springframework.cloud.sleuth.Span)1