use of net.n2oapp.framework.engine.modules.stack.SpringDataProcessingStack in project n2o-framework by i-novus-llc.
the class DataControllerTest method testOperation.
private SetDataResponse testOperation(String path, ReadCompileTerminalPipeline<ReadCompileBindTerminalPipeline> pipeline, Map<String, String[]> params, DataSet body) {
N2oInvocationFactory invocationFactory = Mockito.mock(N2oInvocationFactory.class);
TestDataProviderEngine testDataProviderEngine = new TestDataProviderEngine();
testDataProviderEngine.setResourceLoader(new DefaultResourceLoader());
Mockito.when(invocationFactory.produce(Mockito.any(Class.class))).thenReturn(testDataProviderEngine);
N2oInvocationProcessor invocationProcessor = new N2oInvocationProcessor(invocationFactory);
invocationProcessor.setEnvironment(builder.getEnvironment());
N2oValidationModule validationModule = new N2oValidationModule(new ValidationProcessor(invocationProcessor));
Map<String, DataProcessing> moduleMap = new HashMap<>();
moduleMap.put("validationModule", validationModule);
N2oOperationProcessor operationProcessor = new N2oOperationProcessor(invocationProcessor, new N2oOperationExceptionHandler());
ApplicationContext context = Mockito.mock(ApplicationContext.class);
Mockito.when(context.getBeansOfType(DataProcessing.class)).thenReturn(moduleMap);
DataProcessingStack dataProcessingStack = new SpringDataProcessingStack();
((SpringDataProcessingStack) dataProcessingStack).setApplicationContext(context);
N2oRouter router = new N2oRouter(builder.getEnvironment(), pipeline);
ContextEngine contextEngine = Mockito.mock(ContextEngine.class);
Map<String, Object> map = new HashMap<>();
AlertMessageBuilder messageBuilder = new AlertMessageBuilder(builder.getEnvironment().getMessageSource(), null);
OperationController operationController = new OperationController(dataProcessingStack, operationProcessor, messageBuilder, builder.getEnvironment());
map.put("operationController", operationController);
N2oControllerFactory factory = new N2oControllerFactory(map);
factory.setEnvironment(builder.getEnvironment());
DataController controller = new DataController(factory, builder.getEnvironment(), router);
controller.setMessageBuilder(messageBuilder);
return controller.setData(path, params, null, body, new UserContext(contextEngine));
}
use of net.n2oapp.framework.engine.modules.stack.SpringDataProcessingStack in project n2o-framework by i-novus-llc.
the class N2oEngineConfiguration method dataProcessingStack.
@Bean
@ConditionalOnMissingBean
public DataProcessingStack dataProcessingStack(ApplicationContext context) {
SpringDataProcessingStack dataProcessingStack = new SpringDataProcessingStack();
dataProcessingStack.setApplicationContext(context);
return dataProcessingStack;
}
Aggregations