use of org.pentaho.di.trans.dataservice.optimization.OptimizationImpactInfo in project pdi-dataservice-server-plugin by pentaho.
the class MongodbInputParameterGenerationTest method testPreviewWithConversionFailure.
@Test
public void testPreviewWithConversionFailure() throws KettleException {
when(mongodbPredicate.asFilterCriteria()).thenThrow(new PushDownOptimizationException("FAILURE"));
OptimizationImpactInfo impact = preview(condition, parameterGeneration, stepInterface);
assertThat(impact.getStepName(), equalTo(MOCK_STEPNAME));
assertThat(impact.getQueryBeforeOptimization(), equalTo(TEST_JSON_QUERY));
assertFalse(impact.isModified());
assertThat(impact.getErrorMsg(), containsString("FAILURE"));
}
use of org.pentaho.di.trans.dataservice.optimization.OptimizationImpactInfo in project pdi-dataservice-server-plugin by pentaho.
the class ParameterPushdownTest method testPreview.
@Test
public void testPreview() throws Exception {
query("WHERE ARTIST = 'The Rolling Stones' AND ALBUM = 'Let it Bleed' ");
when(transMeta.getParameterDefault(anyString())).thenReturn("<default>");
OptimizationImpactInfo preview = parameterPushdown.preview(executor, optimizationMeta);
assertThat(preview.getErrorMsg(), emptyOrNullString());
assertThat(preview.isModified(), is(true));
assertThat(preview.getQueryBeforeOptimization(), equalTo("ARTIST_FIELD = <default>\n" + "ALBUM_FIELD = <default>\n" + "LIVE_FIELD = <default>"));
assertThat(preview.getQueryAfterOptimization(), equalTo("ARTIST_FIELD = artist: \"The Rolling Stones\",\n" + "ALBUM_FIELD = album: \"Let it Bleed\",\n" + "LIVE_FIELD = <default>"));
}
use of org.pentaho.di.trans.dataservice.optimization.OptimizationImpactInfo in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceTestModel method getOptimizationImpactDescription.
public String getOptimizationImpactDescription() {
StringBuilder builder = new StringBuilder();
builder.append("\n");
if (optimizationImpact.size() == 0) {
builder.append("[No Push Down Optimizations Defined]\n");
}
for (OptimizationImpactInfo info : optimizationImpact) {
builder.append(info.getDescription());
builder.append("\n- - - - - - - - - - - - - - - - - - - - - -\n\n");
}
return builder.toString();
}
use of org.pentaho.di.trans.dataservice.optimization.OptimizationImpactInfo in project pdi-dataservice-server-plugin by pentaho.
the class MongodbInputParameterGenerationTest method testQueryBeforeOptimizationWithConversionFailure.
@Test
public void testQueryBeforeOptimizationWithConversionFailure() throws KettleException {
when(mongodbPredicate.asFilterCriteria()).thenThrow(new PushDownOptimizationException("FAILURE"));
OptimizationImpactInfo impact = preview(condition, parameterGeneration, stepInterface);
assertThat(impact.getQueryBeforeOptimization(), equalTo(TEST_JSON_QUERY));
}
use of org.pentaho.di.trans.dataservice.optimization.OptimizationImpactInfo in project pdi-dataservice-server-plugin by pentaho.
the class MongodbInputParameterGenerationTest method testPreviewWithoutModification.
@Test
public void testPreviewWithoutModification() {
when(parameterGeneration.getParameterName()).thenReturn("DifferentParamName");
when(parameterGeneration.setQueryParameter(TEST_JSON_QUERY, "mockedFilter")).thenReturn(TEST_JSON_QUERY);
OptimizationImpactInfo impact = preview(condition, parameterGeneration, stepInterface);
assertThat(impact.getStepName(), equalTo(MOCK_STEPNAME));
assertThat(impact.getQueryBeforeOptimization(), equalTo(TEST_JSON_QUERY));
assertThat(impact.getQueryAfterOptimization(), equalTo(""));
assertFalse(impact.isModified());
assertThat(impact.getErrorMsg(), equalTo(""));
}
Aggregations