Search in sources :

Example 1 with DataServiceModel

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);
    }
}
Also used : DataServiceModel(org.pentaho.di.trans.dataservice.ui.model.DataServiceModel) PushDownOptimizationMeta(org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta) AutoOptimizationService(org.pentaho.di.trans.dataservice.optimization.AutoOptimizationService) BaseMessages.getString(org.pentaho.di.i18n.BaseMessages.getString) XulException(org.pentaho.ui.xul.XulException)

Example 2 with DataServiceModel

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();
}
Also used : DataServiceMeta(org.pentaho.di.trans.dataservice.DataServiceMeta) DataServiceModel(org.pentaho.di.trans.dataservice.ui.model.DataServiceModel) PushDownOptimizationMeta(org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta) AutoParameterGenerationService(org.pentaho.di.trans.dataservice.optimization.paramgen.AutoParameterGenerationService) Test(org.junit.Test)

Example 3 with DataServiceModel

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");
}
Also used : DataServiceModel(org.pentaho.di.trans.dataservice.ui.model.DataServiceModel) PushDownOptimizationMeta(org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta) LogChannelInterface(org.pentaho.di.core.logging.LogChannelInterface)

Example 4 with DataServiceModel

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());
}
Also used : DataServiceModel(org.pentaho.di.trans.dataservice.ui.model.DataServiceModel) TransMeta(org.pentaho.di.trans.TransMeta)

Aggregations

DataServiceModel (org.pentaho.di.trans.dataservice.ui.model.DataServiceModel)4 PushDownOptimizationMeta (org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta)3 Test (org.junit.Test)1 LogChannelInterface (org.pentaho.di.core.logging.LogChannelInterface)1 BaseMessages.getString (org.pentaho.di.i18n.BaseMessages.getString)1 TransMeta (org.pentaho.di.trans.TransMeta)1 DataServiceMeta (org.pentaho.di.trans.dataservice.DataServiceMeta)1 AutoOptimizationService (org.pentaho.di.trans.dataservice.optimization.AutoOptimizationService)1 AutoParameterGenerationService (org.pentaho.di.trans.dataservice.optimization.paramgen.AutoParameterGenerationService)1 XulException (org.pentaho.ui.xul.XulException)1