use of io.crnk.core.module.discovery.ReflectionsServiceDiscovery in project crnk-framework by crnk-project.
the class HttpRequestProcessorImplTest method prepare.
@Before
public void prepare() {
CrnkBoot boot = new CrnkBoot();
boot.setServiceDiscovery(new ReflectionsServiceDiscovery(MockConstants.TEST_MODELS_PACKAGE));
boot.addModule(new ActionTestModule());
boot.boot();
resourceRegistry = boot.getResourceRegistry();
moduleRegistry = boot.getModuleRegistry();
}
use of io.crnk.core.module.discovery.ReflectionsServiceDiscovery in project crnk-framework by crnk-project.
the class JsonApiRequestProcessorTest method setup.
@Before
public void setup() {
TaskRepository.clear();
boot = new CrnkBoot();
boot.addModule(new Module() {
@Override
public String getModuleName() {
return "test";
}
@Override
public void setupModule(ModuleContext context) {
moduleContext = context;
}
});
boot.setServiceUrlProvider(new ConstantServiceUrlProvider("http://localhost:8080"));
boot.setServiceDiscovery(new ReflectionsServiceDiscovery(MockConstants.TEST_MODELS_PACKAGE));
boot.boot();
Task task = new Task();
task.setId(1L);
task.setName("SomeTask");
task.setLinksInformation(new TaskLinks());
TaskRepository tasks = new TaskRepository();
tasks.save(task);
processor = new JsonApiRequestProcessor(moduleContext);
requestContextBase = Mockito.mock(HttpRequestContextBase.class);
requestContext = new HttpRequestContextBaseAdapter(requestContextBase);
HttpRequestContextProvider requestContextProvider = boot.getModuleRegistry().getHttpRequestContextProvider();
requestContextProvider.onRequestStarted(requestContext);
}
use of io.crnk.core.module.discovery.ReflectionsServiceDiscovery in project crnk-framework by crnk-project.
the class ResourceFilterTest method prepare.
@Before
public void prepare() {
boot = new CrnkBoot();
boot.setServiceDiscovery(new ReflectionsServiceDiscovery(MockConstants.TEST_MODELS_PACKAGE));
boot.setServiceUrlProvider(new ConstantServiceUrlProvider(ResourceRegistryTest.TEST_MODELS_URL));
SimpleModule filterModule = new SimpleModule("filter");
filterModule.addResourceFilter(filter);
boot.addModule(filterModule);
boot.boot();
resourceRegistry = boot.getResourceRegistry();
}
use of io.crnk.core.module.discovery.ReflectionsServiceDiscovery in project crnk-framework by crnk-project.
the class BaseControllerTest method prepare.
@Before
public void prepare() {
modificationFilter = Mockito.spy(new ResourceModificationFilterBase());
modificationFilters = Arrays.asList(modificationFilter);
CrnkBoot boot = new CrnkBoot();
boot.setServiceUrlProvider(new ConstantServiceUrlProvider(ResourceRegistryTest.TEST_MODELS_URL));
boot.setServiceDiscovery(new ReflectionsServiceDiscovery(MockConstants.TEST_MODELS_PACKAGE));
boot.boot();
objectMapper = boot.getObjectMapper();
resourceRegistry = boot.getResourceRegistry();
moduleRegistry = boot.getModuleRegistry();
pathBuilder = new PathBuilder(resourceRegistry);
typeParser = moduleRegistry.getTypeParser();
documentMapper = boot.getDocumentMapper();
MockRepositoryUtil.clear();
emptyTaskQuery = new QuerySpecAdapter(new QuerySpec(Task.class), resourceRegistry);
emptyProjectQuery = new QuerySpecAdapter(new QuerySpec(Project.class), resourceRegistry);
emptyUserQuery = new QuerySpecAdapter(new QuerySpec(User.class), resourceRegistry);
emptyComplexPojoQuery = new QuerySpecAdapter(new QuerySpec(ComplexPojo.class), resourceRegistry);
emptyMemorandumQuery = new QuerySpecAdapter(new QuerySpec(Memorandum.class), resourceRegistry);
}
use of io.crnk.core.module.discovery.ReflectionsServiceDiscovery in project crnk-framework by crnk-project.
the class CrnkBootTest method setServiceLocator.
@Test
public void setServiceLocator() {
JsonServiceLocator locator = mock(JsonServiceLocator.class);
PropertiesProvider propertiesProvider = mock(PropertiesProvider.class);
Mockito.when(propertiesProvider.getProperty(eq(CrnkProperties.RESOURCE_SEARCH_PACKAGE))).thenReturn("a.b.c");
CrnkBoot boot = new CrnkBoot();
boot.setPropertiesProvider(propertiesProvider);
boot.setServiceLocator(locator);
boot.setServiceDiscoveryFactory(mock(ServiceDiscoveryFactory.class));
boot.boot();
ReflectionsServiceDiscovery serviceDiscovery = (ReflectionsServiceDiscovery) boot.getServiceDiscovery();
Assert.assertSame(locator, serviceDiscovery.getLocator());
}
Aggregations