Search in sources :

Example 1 with ControllerRegistryBuilder

use of io.crnk.core.engine.internal.dispatcher.ControllerRegistryBuilder in project crnk-framework by crnk-project.

the class ControllerRegistryBuilderTest method onBuildShouldAddAllControllers.

@Test
public void onBuildShouldAddAllControllers() throws Exception {
    // GIVEN
    PropertiesProvider propertiesProvider = Mockito.mock(PropertiesProvider.class);
    ResourceFilterDirectory resourceFilterDirectory = Mockito.mock(ResourceFilterDirectory.class);
    ControllerRegistryBuilder sut = new ControllerRegistryBuilder(null, null, null, propertiesProvider, resourceFilterDirectory, (List) Collections.emptyList());
    // WHEN
    ControllerRegistry result = sut.build();
    // THEN
    result.getController(new ResourcePath("path"), "GET");
}
Also used : PropertiesProvider(io.crnk.core.engine.properties.PropertiesProvider) ControllerRegistry(io.crnk.core.engine.internal.dispatcher.ControllerRegistry) ResourcePath(io.crnk.core.engine.internal.dispatcher.path.ResourcePath) ResourceFilterDirectory(io.crnk.core.engine.filter.ResourceFilterDirectory) ControllerRegistryBuilder(io.crnk.core.engine.internal.dispatcher.ControllerRegistryBuilder) Test(org.junit.Test)

Example 2 with ControllerRegistryBuilder

use of io.crnk.core.engine.internal.dispatcher.ControllerRegistryBuilder in project crnk-framework by crnk-project.

the class CrnkBoot method createRequestDispatcher.

private HttpRequestProcessorImpl createRequestDispatcher(ExceptionMapperRegistry exceptionMapperRegistry) {
    ControllerRegistryBuilder controllerRegistryBuilder = newControllerRegistryBuilder(resourceRegistry, moduleRegistry.getTypeParser(), objectMapper, propertiesProvider, moduleRegistry.getContext().getResourceFilterDirectory(), moduleRegistry.getResourceModificationFilters());
    ControllerRegistry controllerRegistry = controllerRegistryBuilder.build();
    this.documentMapper = controllerRegistryBuilder.getDocumentMapper();
    QueryAdapterBuilder queryAdapterBuilder;
    if (queryParamsBuilder != null) {
        queryAdapterBuilder = new QueryParamsAdapterBuilder(queryParamsBuilder, moduleRegistry);
    } else {
        queryAdapterBuilder = new QuerySpecAdapterBuilder(querySpecDeserializer, moduleRegistry);
    }
    return new HttpRequestProcessorImpl(moduleRegistry, controllerRegistry, exceptionMapperRegistry, queryAdapterBuilder);
}
Also used : ControllerRegistry(io.crnk.core.engine.internal.dispatcher.ControllerRegistry) QuerySpecAdapterBuilder(io.crnk.core.queryspec.internal.QuerySpecAdapterBuilder) QueryParamsAdapterBuilder(io.crnk.legacy.internal.QueryParamsAdapterBuilder) QueryAdapterBuilder(io.crnk.core.engine.query.QueryAdapterBuilder) HttpRequestProcessorImpl(io.crnk.core.engine.internal.http.HttpRequestProcessorImpl) ControllerRegistryBuilder(io.crnk.core.engine.internal.dispatcher.ControllerRegistryBuilder)

Aggregations

ControllerRegistry (io.crnk.core.engine.internal.dispatcher.ControllerRegistry)2 ControllerRegistryBuilder (io.crnk.core.engine.internal.dispatcher.ControllerRegistryBuilder)2 ResourceFilterDirectory (io.crnk.core.engine.filter.ResourceFilterDirectory)1 ResourcePath (io.crnk.core.engine.internal.dispatcher.path.ResourcePath)1 HttpRequestProcessorImpl (io.crnk.core.engine.internal.http.HttpRequestProcessorImpl)1 PropertiesProvider (io.crnk.core.engine.properties.PropertiesProvider)1 QueryAdapterBuilder (io.crnk.core.engine.query.QueryAdapterBuilder)1 QuerySpecAdapterBuilder (io.crnk.core.queryspec.internal.QuerySpecAdapterBuilder)1 QueryParamsAdapterBuilder (io.crnk.legacy.internal.QueryParamsAdapterBuilder)1 Test (org.junit.Test)1