Search in sources :

Example 6 with RelationshipMatcher

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

the class OppositeFowardingRelationshipRepositoryTest 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();
    testRepository = (RelationIdTestRepository) resourceRegistry.getEntry(RelationIdTestResource.class).getResourceRepository().getResourceRepository();
    RelationshipMatcher relMatcher = new RelationshipMatcher().rule().source(RelationIdTestResource.class).target(RelationIdTestResource.class).add();
    relRepository = new ForwardingRelationshipRepository(RelationIdTestResource.class, relMatcher, ForwardingDirection.OPPOSITE, ForwardingDirection.OPPOSITE);
    relRepository.setResourceRegistry(resourceRegistry);
}
Also used : CrnkBoot(io.crnk.core.boot.CrnkBoot) ForwardingRelationshipRepository(io.crnk.core.repository.foward.ForwardingRelationshipRepository) ReflectionsServiceDiscovery(io.crnk.core.module.discovery.ReflectionsServiceDiscovery) ConstantServiceUrlProvider(io.crnk.core.engine.url.ConstantServiceUrlProvider) RelationshipMatcher(io.crnk.core.repository.RelationshipMatcher) RelationIdTestResource(io.crnk.core.mock.models.RelationIdTestResource) Before(org.junit.Before)

Aggregations

RelationshipMatcher (io.crnk.core.repository.RelationshipMatcher)6 ForwardingRelationshipRepository (io.crnk.core.repository.foward.ForwardingRelationshipRepository)3 CrnkBoot (io.crnk.core.boot.CrnkBoot)2 RepositoryMethodAccess (io.crnk.core.engine.information.repository.RepositoryMethodAccess)2 RelationshipRepositoryInformationImpl (io.crnk.core.engine.internal.information.repository.RelationshipRepositoryInformationImpl)2 ConstantServiceUrlProvider (io.crnk.core.engine.url.ConstantServiceUrlProvider)2 RelationIdTestResource (io.crnk.core.mock.models.RelationIdTestResource)2 ReflectionsServiceDiscovery (io.crnk.core.module.discovery.ReflectionsServiceDiscovery)2 Before (org.junit.Before)2 RelationshipRepositoryInformation (io.crnk.core.engine.information.repository.RelationshipRepositoryInformation)1 RepositoryInformation (io.crnk.core.engine.information.repository.RepositoryInformation)1 RepositoryInformationProvider (io.crnk.core.engine.information.repository.RepositoryInformationProvider)1 ResourceRepositoryInformation (io.crnk.core.engine.information.repository.ResourceRepositoryInformation)1 ResourceFieldAccess (io.crnk.core.engine.information.resource.ResourceFieldAccess)1 ResourceInformation (io.crnk.core.engine.information.resource.ResourceInformation)1 RegistryEntry (io.crnk.core.engine.registry.RegistryEntry)1 ResponseRelationshipEntry (io.crnk.core.engine.registry.ResponseRelationshipEntry)1 Project (io.crnk.core.mock.models.Project)1 Schedule (io.crnk.core.mock.models.Schedule)1 Task (io.crnk.core.mock.models.Task)1