use of org.pentaho.di.trans.dataservice.ui.model.DataServiceModel in project pdi-dataservice-server-plugin by pentaho.
the class ParameterGenerationController method runAutoGenerate.
public void runAutoGenerate() throws XulException {
DataServiceModel dialogModel = model.getDialogModel();
try {
AutoOptimizationService autoOptimizationService = factory.createAutoOptimizationService();
Collection<PushDownOptimizationMeta> found = autoOptimizationService.apply(dialogModel.getDataService());
if (dialogModel.addAll(found)) {
model.updateParameterMap();
}
info(getString(PKG, "ParameterGenerationController.AutoGen.Title"), getString(PKG, "ParameterGenerationController.AutoGen.Message", found.size()));
} catch (Exception e) {
String message = getString(PKG, "ParameterGenerationController.AutoGen.Error");
getLogChannel().logError(message, e);
error(getString(PKG, "ParameterGenerationController.AutoGen.Title"), message);
}
}
use of org.pentaho.di.trans.dataservice.ui.model.DataServiceModel in project pdi-dataservice-server-plugin by pentaho.
the class ParameterGenerationControllerTest method testRunAutoGenerate.
@Test
public void testRunAutoGenerate() throws Exception {
DataServiceModel dataServiceModel = mock(DataServiceModel.class);
when(model.getDialogModel()).thenReturn(dataServiceModel);
AutoParameterGenerationService parameterGenerationService = mock(AutoParameterGenerationService.class);
when(factory.createAutoOptimizationService()).thenReturn(parameterGenerationService);
DataServiceMeta dataServiceMeta = mock(DataServiceMeta.class);
when(dataServiceModel.getDataService()).thenReturn(dataServiceMeta);
List<PushDownOptimizationMeta> generatedOptimizations = ImmutableList.of(mock(PushDownOptimizationMeta.class));
when(parameterGenerationService.apply(dataServiceMeta)).thenReturn(generatedOptimizations);
when(dataServiceModel.addAll(generatedOptimizations)).thenReturn(true);
controller.runAutoGenerate();
verify(dataServiceModel).addAll(generatedOptimizations);
verify(model).updateParameterMap();
verify(messageBox).open();
}
use of org.pentaho.di.trans.dataservice.ui.model.DataServiceModel in project pdi-dataservice-server-plugin by pentaho.
the class ServiceCacheControllerTest method testBindingsAux.
private void testBindingsAux() throws Exception {
// Override Controller to inject our mocks
controller = new ServiceCacheController(factory) {
@Override
protected PushDownOptimizationMeta locateServiceCacheMeta(DataServiceModel model) {
assertThat(model, sameInstance(ServiceCacheControllerTest.this.model));
return meta;
}
@Override
protected LogChannelInterface getLogChannel() {
return log;
}
};
controller.setXulDomContainer(xulDomContainer);
controller.setBindingFactory(bindingFactory);
meta = new PushDownOptimizationMeta();
meta.setType(serviceCache = mock(ServiceCache.class));
meta.setEnabled(true);
when(serviceCache.getConfiguredTimeToLive()).thenReturn("1200");
}
use of org.pentaho.di.trans.dataservice.ui.model.DataServiceModel in project pdi-dataservice-server-plugin by pentaho.
the class ParameterGenerationOverlay method apply.
@Override
public void apply(DataServiceDialog dialog) throws KettleException {
DataServiceModel dialogModel = dialog.getModel();
TransMeta transMeta = dialogModel.getTransMeta();
ParameterGenerationController controller = factory.createController(dialogModel);
dialog.applyOverlay(this, XUL_OVERLAY).addEventHandler(controller);
controller.initBindings(findSupportedSteps(transMeta).keySet().asList());
}
Aggregations