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();
}
Aggregations