Search in sources :

Example 6 with ScheduleRepositoryImpl

use of io.crnk.core.mock.repository.ScheduleRepositoryImpl in project crnk-framework by crnk-project.

the class MultiValuedRelationIdLookupTest method setup.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Before
public void setup() {
    super.setup();
    scheduleRepository = new ScheduleRepositoryImpl();
    schedule3 = new Schedule();
    schedule3.setId(3L);
    schedule3.setName("test");
    scheduleRepository.save(schedule3);
    schedule4 = new Schedule();
    schedule4.setId(4L);
    schedule4.setName("test");
    scheduleRepository.save(schedule4);
}
Also used : ScheduleRepositoryImpl(io.crnk.core.mock.repository.ScheduleRepositoryImpl) Schedule(io.crnk.core.mock.models.Schedule) Before(org.junit.Before)

Example 7 with ScheduleRepositoryImpl

use of io.crnk.core.mock.repository.ScheduleRepositoryImpl in project crnk-framework by crnk-project.

the class SerializeOnlyIdRelationIdLookupTest method setup.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Before
public void setup() {
    super.setup();
    scheduleRepository = new ScheduleRepositoryImpl();
    schedule = new Schedule();
    schedule.setId(3L);
    schedule.setName("test");
    scheduleRepository.save(schedule);
}
Also used : ScheduleRepositoryImpl(io.crnk.core.mock.repository.ScheduleRepositoryImpl) Schedule(io.crnk.core.mock.models.Schedule) Before(org.junit.Before)

Example 8 with ScheduleRepositoryImpl

use of io.crnk.core.mock.repository.ScheduleRepositoryImpl in project crnk-framework by crnk-project.

the class SerializeEagerRelationIdLookupTest method setup.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Before
public void setup() {
    super.setup();
    scheduleRepository = new ScheduleRepositoryImpl();
    schedule = new Schedule();
    schedule.setId(3L);
    schedule.setName("test");
    scheduleRepository.save(schedule);
}
Also used : ScheduleRepositoryImpl(io.crnk.core.mock.repository.ScheduleRepositoryImpl) Schedule(io.crnk.core.mock.models.Schedule) Before(org.junit.Before)

Example 9 with ScheduleRepositoryImpl

use of io.crnk.core.mock.repository.ScheduleRepositoryImpl in project crnk-framework by crnk-project.

the class OwnerFowardingRelationshipRepositoryTest method setup.

@Before
public void setup() {
    MockRepositoryUtil.clear();
    CrnkBoot boot = new CrnkBoot();
    boot.setServiceDiscovery(new ReflectionsServiceDiscovery(MockConstants.TEST_MODELS_PACKAGE));
    boot.setServiceUrlProvider(new ConstantServiceUrlProvider(ResourceRegistryTest.TEST_MODELS_URL));
    boot.boot();
    resourceRegistry = boot.getResourceRegistry();
    RegistryEntry entry = resourceRegistry.getEntry(RelationIdTestResource.class);
    relRepository = (ForwardingRelationshipRepository) entry.getRelationshipRepository("testSerializeEager", null).getRelationshipRepository();
    RelationshipMatcher taskProjectMatcher = new RelationshipMatcher().rule().source(Task.class).target(Project.class).add();
    taskProjectRepository = new ForwardingRelationshipRepository(Task.class, taskProjectMatcher, ForwardingDirection.OWNER, ForwardingDirection.OWNER);
    taskProjectRepository.setResourceRegistry(resourceRegistry);
    projectTaskRepository = new ForwardingRelationshipRepository(Project.class, taskProjectMatcher, ForwardingDirection.OWNER, ForwardingDirection.OWNER);
    projectTaskRepository.setResourceRegistry(resourceRegistry);
    testRepository = (RelationIdTestRepository) entry.getResourceRepository().getResourceRepository();
    testRepository.setResourceRegistry(resourceRegistry);
    resource = new RelationIdTestResource();
    resource.setId(2L);
    resource.setName("relationId");
    testRepository.create(resource);
    scheduleRepository = new ScheduleRepositoryImpl();
    schedule3 = new Schedule();
    schedule3.setId(3L);
    schedule3.setName("schedule");
    scheduleRepository.create(schedule3);
    for (int i = 0; i < 10; i++) {
        schedule = new Schedule();
        schedule.setId(4L + i);
        schedule.setName("schedule");
        scheduleRepository.create(schedule);
        projectRepository = new ProjectRepository();
        project = new Project();
        project.setId(42L + i);
        project.setName("project");
        projectRepository.save(project);
        taskRepository = new TaskRepository();
        task = new Task();
        task.setId(13L + i);
        task.setName("task");
        taskRepository.save(task);
    }
}
Also used : Task(io.crnk.core.mock.models.Task) ProjectRepository(io.crnk.core.mock.repository.ProjectRepository) ForwardingRelationshipRepository(io.crnk.core.repository.foward.ForwardingRelationshipRepository) TaskRepository(io.crnk.core.mock.repository.TaskRepository) RegistryEntry(io.crnk.core.engine.registry.RegistryEntry) RelationshipMatcher(io.crnk.core.repository.RelationshipMatcher) ScheduleRepositoryImpl(io.crnk.core.mock.repository.ScheduleRepositoryImpl) Project(io.crnk.core.mock.models.Project) CrnkBoot(io.crnk.core.boot.CrnkBoot) Schedule(io.crnk.core.mock.models.Schedule) ReflectionsServiceDiscovery(io.crnk.core.module.discovery.ReflectionsServiceDiscovery) ConstantServiceUrlProvider(io.crnk.core.engine.url.ConstantServiceUrlProvider) RelationIdTestResource(io.crnk.core.mock.models.RelationIdTestResource) Before(org.junit.Before)

Example 10 with ScheduleRepositoryImpl

use of io.crnk.core.mock.repository.ScheduleRepositoryImpl in project crnk-framework by crnk-project.

the class NestedRelationIdLookupTest method setup.

@SuppressWarnings({ "rawtypes", "unchecked" })
@Before
public void setup() {
    super.setup();
    scheduleRepository = new ScheduleRepositoryImpl();
    schedule = new Schedule();
    schedule.setId(3L);
    schedule.setName("test");
    scheduleRepository.save(schedule);
    testRepository = new RelationIdTestRepository();
    child = new RelationIdTestResource();
    child.setId(1L);
    child.setName("child");
    testRepository.save(child);
    child.setTestSerializeEager(schedule);
}
Also used : ScheduleRepositoryImpl(io.crnk.core.mock.repository.ScheduleRepositoryImpl) RelationIdTestRepository(io.crnk.core.mock.repository.RelationIdTestRepository) Schedule(io.crnk.core.mock.models.Schedule) RelationIdTestResource(io.crnk.core.mock.models.RelationIdTestResource) Before(org.junit.Before)

Aggregations

Schedule (io.crnk.core.mock.models.Schedule)12 ScheduleRepositoryImpl (io.crnk.core.mock.repository.ScheduleRepositoryImpl)12 Before (org.junit.Before)12 RelationIdTestResource (io.crnk.core.mock.models.RelationIdTestResource)3 CrnkBoot (io.crnk.core.boot.CrnkBoot)2 RegistryEntry (io.crnk.core.engine.registry.RegistryEntry)2 ConstantServiceUrlProvider (io.crnk.core.engine.url.ConstantServiceUrlProvider)2 Project (io.crnk.core.mock.models.Project)2 Task (io.crnk.core.mock.models.Task)2 ProjectRepository (io.crnk.core.mock.repository.ProjectRepository)2 RelationIdTestRepository (io.crnk.core.mock.repository.RelationIdTestRepository)2 TaskRepository (io.crnk.core.mock.repository.TaskRepository)2 ReflectionsServiceDiscovery (io.crnk.core.module.discovery.ReflectionsServiceDiscovery)2 ResourceIdentifier (io.crnk.core.engine.document.ResourceIdentifier)1 RelationshipMatcher (io.crnk.core.repository.RelationshipMatcher)1 ForwardingRelationshipRepository (io.crnk.core.repository.foward.ForwardingRelationshipRepository)1 ImplicitOwnerBasedRelationshipRepository (io.crnk.core.repository.implicit.ImplicitOwnerBasedRelationshipRepository)1