use of io.crnk.test.mock.repository.TaskRepository in project crnk-framework by crnk-project.
the class ControllerTest method setup.
@Before
public void setup() {
TaskRepository repo = new TaskRepository();
Task task = new Task();
task.setName("test value");
task.setId(1L);
repo.save(task);
}
use of io.crnk.test.mock.repository.TaskRepository 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.TaskRepository in project crnk-framework by crnk-project.
the class UriInfoServiceUrlProviderTest method setup.
@Before
public void setup() {
TaskRepository repo = new TaskRepository();
Task task = new Task();
task.setName("test");
task.setId(1L);
repo.save(task);
}
use of io.crnk.test.mock.repository.TaskRepository 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;
}
use of io.crnk.test.mock.repository.TaskRepository in project crnk-framework by crnk-project.
the class MetaModuleTest method createRegistryEntry.
private RegistryEntry createRegistryEntry() {
ModuleRegistry moduleRegistry = boot.getModuleRegistry();
RegistryEntryBuilder entryBuilder = moduleRegistry.getContext().newRegistryEntryBuilder();
entryBuilder.resource().resourceClass(Task.class).resourceType("someNewTask");
entryBuilder.resourceRepository().instance(new TaskRepository());
return entryBuilder.build();
}
Aggregations