use of io.crnk.test.mock.repository.ProjectRepository in project crnk-framework by crnk-project.
the class BasicSpringBootTest method testRelationshipInclusion.
@Test
public void testRelationshipInclusion() {
Project project = new Project();
ProjectRepository projectRepository = new ProjectRepository();
projectRepository.save(project);
Task task = new Task();
task.setProject(project);
TaskRepository taskRepository = new TaskRepository();
taskRepository.save(task);
RestTemplate testRestTemplate = new RestTemplate();
ResponseEntity<String> response = testRestTemplate.getForEntity("http://localhost:" + this.port + "/api/tasks?include[tasks]=schedule%2Cproject", String.class);
assertEquals(HttpStatus.OK, response.getStatusCode());
JsonFluentAssert included = assertThatJson(response.getBody()).node("included");
included.isArray().ofLength(1);
}
use of io.crnk.test.mock.repository.ProjectRepository in project crnk-framework by crnk-project.
the class MetaModuleProducer method createRepositoryModule.
@Produces
@ApplicationScoped
public Module createRepositoryModule() {
SimpleModule module = new SimpleModule("mock");
module.addRepository(new ScheduleRepositoryImpl());
module.addRepository(new ProjectRepository());
module.addRepository(new TaskRepository());
module.addRepository(new ProjectToTaskRepository());
module.addRepository(new ScheduleToTaskRepository());
module.addRepository(new TaskSubtypeRepository());
module.addRepository(new TaskToProjectRepository());
module.addRepository(new TaskToScheduleRepo());
return module;
}
Aggregations