use of net.n2oapp.framework.ui.controller.query.SimpleDefaultValuesController in project n2o-framework by i-novus-llc.
the class DefaultValuesControllerTest method testQuery.
private GetDataResponse testQuery(String path, ReadCompileTerminalPipeline<ReadCompileBindTerminalPipeline> pipeline, Map<String, String[]> params) {
N2oInvocationFactory invocationFactory = Mockito.mock(N2oInvocationFactory.class);
TestDataProviderEngine testDataProviderEngine = new TestDataProviderEngine();
testDataProviderEngine.setResourceLoader(new DefaultResourceLoader());
Mockito.when(invocationFactory.produce(Mockito.any(Class.class))).thenReturn(testDataProviderEngine);
ContextEngine contextEngine = Mockito.mock(ContextEngine.class);
UserContext userContext = new UserContext(contextEngine);
ContextProcessor contextProcessor = new ContextProcessor(userContext);
N2oQueryProcessor queryProcessor = new N2oQueryProcessor(invocationFactory, new N2oQueryExceptionHandler());
N2oEnvironment env = new N2oEnvironment();
env.setContextProcessor(contextProcessor);
queryProcessor.setEnvironment(env);
N2oSubModelsProcessor subModelsProcessor = Mockito.mock(N2oSubModelsProcessor.class);
Mockito.doNothing().when(subModelsProcessor);
DataProcessingStack dataProcessingStack = Mockito.mock(SpringDataProcessingStack.class);
SimpleDefaultValuesController valuesController = new SimpleDefaultValuesController(dataProcessingStack, queryProcessor, subModelsProcessor, null, null);
Map<String, Object> map = new HashMap<>();
map.put("SimpleDefaultValuesController", valuesController);
N2oRouter router = new N2oRouter(builder.getEnvironment(), pipeline);
N2oControllerFactory factory = new N2oControllerFactory(map);
factory.setEnvironment(builder.getEnvironment());
DataController controller = new DataController(factory, builder.getEnvironment(), router);
return controller.getData(path, params, userContext);
}
use of net.n2oapp.framework.ui.controller.query.SimpleDefaultValuesController in project n2o-framework by i-novus-llc.
the class N2oController method createControllerFactory.
private ControllerFactory createControllerFactory(MetadataEnvironment environment) {
N2oSubModelsProcessor subModelsProcessor = new N2oSubModelsProcessor(queryProcessor, domainProcessor);
subModelsProcessor.setEnvironment(environment);
Map<String, Object> beans = new HashMap<>();
beans.put("queryController", new QueryController(dataProcessingStack, queryProcessor, subModelsProcessor, messageBuilder, environment));
beans.put("operationController", new OperationController(dataProcessingStack, operationProcessor, messageBuilder, environment));
beans.put("copyValuesController", new CopyValuesController(dataProcessingStack, queryProcessor, subModelsProcessor, messageBuilder, environment));
beans.put("simpleDefaultValuesController", new SimpleDefaultValuesController(dataProcessingStack, queryProcessor, subModelsProcessor, messageBuilder, environment));
return new N2oControllerFactory(beans);
}
Aggregations