use of io.crnk.core.module.discovery.ReflectionsServiceDiscovery 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);
}
use of io.crnk.core.module.discovery.ReflectionsServiceDiscovery in project crnk-framework by crnk-project.
the class HttpRequestContextAwareTest method check.
@Test
public void check() throws IOException {
HttTestModule testModule = Mockito.mock(HttTestModule.class);
CrnkBoot boot = new CrnkBoot();
boot.setServiceUrlProvider(new ConstantServiceUrlProvider("http://localhost:8080"));
boot.setServiceDiscovery(new ReflectionsServiceDiscovery(MockConstants.TEST_MODELS_PACKAGE));
boot.addModule(testModule);
boot.boot();
Mockito.verify(testModule, Mockito.times(1)).setHttpRequestContextProvider(Mockito.any(HttpRequestContextProvider.class));
}
use of io.crnk.core.module.discovery.ReflectionsServiceDiscovery in project crnk-framework by crnk-project.
the class PathBuilderTest method prepare.
@Before
public void prepare() {
CrnkBoot boot = new CrnkBoot();
boot.setServiceDiscovery(new ReflectionsServiceDiscovery(MockConstants.TEST_MODELS_PACKAGE));
boot.setServiceUrlProvider(new ConstantServiceUrlProvider(ResourceRegistryTest.TEST_MODELS_URL));
boot.boot();
pathBuilder = new PathBuilder(boot.getResourceRegistry());
RegistryEntry entry = boot.getResourceRegistry().findEntry(Task.class);
ResourceRepositoryInformation repositoryInformation = entry.getRepositoryInformation();
repositoryInformation.getActions().put("someRepositoryAction", Mockito.mock(RepositoryAction.class));
repositoryInformation.getActions().put("someResourceAction", Mockito.mock(RepositoryAction.class));
}
use of io.crnk.core.module.discovery.ReflectionsServiceDiscovery in project crnk-framework by crnk-project.
the class ControllerRegistryTest method prepare.
@Before
public void prepare() {
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();
}
use of io.crnk.core.module.discovery.ReflectionsServiceDiscovery in project crnk-framework by crnk-project.
the class ConstraintViolationImplTest method setup.
@Before
public void setup() {
boot = new CrnkBoot();
boot.addModule(ValidationModule.create());
boot.setServiceDiscovery(new ReflectionsServiceDiscovery("io.crnk.validation.mock.repository"));
boot.boot();
errorData = Mockito.spy(new ErrorDataBuilder().setDetail("testMessage").addMetaField(ConstraintViolationExceptionMapper.META_RESOURCE_TYPE, "tasks").setSourcePointer("name").build());
ResourceRegistry resourceRegistry = boot.getResourceRegistry();
violation = ConstraintViolationImpl.fromError(resourceRegistry, errorData);
}
Aggregations