Search in sources :

Example 1 with AutoParameterGenerationService

use of org.pentaho.di.trans.dataservice.optimization.paramgen.AutoParameterGenerationService 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)

Aggregations

Test (org.junit.Test)1 DataServiceMeta (org.pentaho.di.trans.dataservice.DataServiceMeta)1 PushDownOptimizationMeta (org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta)1 AutoParameterGenerationService (org.pentaho.di.trans.dataservice.optimization.paramgen.AutoParameterGenerationService)1 DataServiceModel (org.pentaho.di.trans.dataservice.ui.model.DataServiceModel)1