use of org.pentaho.di.trans.steps.cubeoutput.CubeOutputMeta in project pentaho-kettle by pentaho.
the class CubeInputStepIntIT method testPDI12897.
@Test
public void testPDI12897() throws KettleException, IOException {
File tempOutputFile = File.createTempFile("testPDI11374", ".cube");
tempOutputFile.deleteOnExit();
String stepName = "Cube Output";
CubeOutputMeta meta = new CubeOutputMeta();
meta.setDefault();
meta.setFilename(tempOutputFile.getAbsolutePath());
TransMeta transMeta = TransTestFactory.generateTestTransformation(null, meta, stepName);
List<RowMetaAndData> inputList = getSampleData();
TransTestFactory.executeTestTransformation(transMeta, TransTestFactory.INJECTOR_STEPNAME, stepName, TransTestFactory.DUMMY_STEPNAME, inputList);
try {
Thread.sleep(1000);
} catch (InterruptedException ignored) {
// Continue
}
// Now, check the result
Variables varSpace = new Variables();
varSpace.setVariable("ROWS", "2");
String checkStepName = "Cube Input";
CubeInputMeta inputMeta = new CubeInputMeta();
inputMeta.setFilename(tempOutputFile.getAbsolutePath());
inputMeta.setRowLimit("${ROWS}");
transMeta = TransTestFactory.generateTestTransformation(varSpace, inputMeta, checkStepName);
// Remove the Injector hop, as it's not needed for this transformation
TransHopMeta injectHop = transMeta.findTransHop(transMeta.findStep(TransTestFactory.INJECTOR_STEPNAME), transMeta.findStep(stepName));
transMeta.removeTransHop(transMeta.indexOfTransHop(injectHop));
inputList = new ArrayList<RowMetaAndData>();
List<RowMetaAndData> result = TransTestFactory.executeTestTransformation(transMeta, TransTestFactory.INJECTOR_STEPNAME, stepName, TransTestFactory.DUMMY_STEPNAME, inputList);
assertNotNull(result);
assertEquals(2, result.size());
assertEquals(1, result.get(0).getRowMeta().size());
assertEquals(ValueMetaInterface.TYPE_STRING, result.get(0).getValueMeta(0).getType());
assertEquals("col1", result.get(0).getValueMeta(0).getName());
assertEquals("data1", result.get(0).getString(0, "fail"));
assertEquals("data2", result.get(1).getString(0, "fail"));
}
use of org.pentaho.di.trans.steps.cubeoutput.CubeOutputMeta in project pentaho-kettle by pentaho.
the class CubeInputStepIntIT method testNoLimit.
@Test
public void testNoLimit() throws KettleException, IOException {
File tempOutputFile = File.createTempFile("testNoLimit", ".cube");
tempOutputFile.deleteOnExit();
String stepName = "Cube Output";
CubeOutputMeta meta = new CubeOutputMeta();
meta.setDefault();
meta.setFilename(tempOutputFile.getAbsolutePath());
TransMeta transMeta = TransTestFactory.generateTestTransformation(null, meta, stepName);
List<RowMetaAndData> inputList = getSampleData();
TransTestFactory.executeTestTransformation(transMeta, TransTestFactory.INJECTOR_STEPNAME, stepName, TransTestFactory.DUMMY_STEPNAME, inputList);
try {
Thread.sleep(1000);
} catch (InterruptedException ignored) {
// Continue
}
// Now, check the result
String checkStepName = "Cube Input";
CubeInputMeta inputMeta = new CubeInputMeta();
inputMeta.setFilename(tempOutputFile.getAbsolutePath());
transMeta = TransTestFactory.generateTestTransformation(null, inputMeta, checkStepName);
// Remove the Injector hop, as it's not needed for this transformation
TransHopMeta injectHop = transMeta.findTransHop(transMeta.findStep(TransTestFactory.INJECTOR_STEPNAME), transMeta.findStep(stepName));
transMeta.removeTransHop(transMeta.indexOfTransHop(injectHop));
inputList = new ArrayList<RowMetaAndData>();
List<RowMetaAndData> result = TransTestFactory.executeTestTransformation(transMeta, TransTestFactory.INJECTOR_STEPNAME, stepName, TransTestFactory.DUMMY_STEPNAME, inputList);
assertNotNull(result);
assertEquals(5, result.size());
assertEquals(1, result.get(0).getRowMeta().size());
assertEquals(ValueMetaInterface.TYPE_STRING, result.get(0).getValueMeta(0).getType());
assertEquals("col1", result.get(0).getValueMeta(0).getName());
assertEquals("data1", result.get(0).getString(0, "fail"));
assertEquals("data2", result.get(1).getString(0, "fail"));
assertEquals("data3", result.get(2).getString(0, "fail"));
assertEquals("data4", result.get(3).getString(0, "fail"));
assertEquals("data5", result.get(4).getString(0, "fail"));
}
use of org.pentaho.di.trans.steps.cubeoutput.CubeOutputMeta in project pentaho-kettle by pentaho.
the class CubeInputStepIntIT method testNumericLimit.
@Test
public void testNumericLimit() throws KettleException, IOException {
File tempOutputFile = File.createTempFile("testNumericLimit", ".cube");
tempOutputFile.deleteOnExit();
String stepName = "Cube Output";
CubeOutputMeta meta = new CubeOutputMeta();
meta.setDefault();
meta.setFilename(tempOutputFile.getAbsolutePath());
TransMeta transMeta = TransTestFactory.generateTestTransformation(null, meta, stepName);
List<RowMetaAndData> inputList = getSampleData();
TransTestFactory.executeTestTransformation(transMeta, TransTestFactory.INJECTOR_STEPNAME, stepName, TransTestFactory.DUMMY_STEPNAME, inputList);
try {
Thread.sleep(1000);
} catch (InterruptedException ignored) {
// Continue
}
// Now, check the result
String checkStepName = "Cube Input";
CubeInputMeta inputMeta = new CubeInputMeta();
inputMeta.setFilename(tempOutputFile.getAbsolutePath());
inputMeta.setRowLimit("3");
transMeta = TransTestFactory.generateTestTransformation(null, inputMeta, checkStepName);
// Remove the Injector hop, as it's not needed for this transformation
TransHopMeta injectHop = transMeta.findTransHop(transMeta.findStep(TransTestFactory.INJECTOR_STEPNAME), transMeta.findStep(stepName));
transMeta.removeTransHop(transMeta.indexOfTransHop(injectHop));
inputList = new ArrayList<RowMetaAndData>();
List<RowMetaAndData> result = TransTestFactory.executeTestTransformation(transMeta, TransTestFactory.INJECTOR_STEPNAME, stepName, TransTestFactory.DUMMY_STEPNAME, inputList);
assertNotNull(result);
assertEquals(3, result.size());
assertEquals(1, result.get(0).getRowMeta().size());
assertEquals(ValueMetaInterface.TYPE_STRING, result.get(0).getValueMeta(0).getType());
assertEquals("col1", result.get(0).getValueMeta(0).getName());
assertEquals("data1", result.get(0).getString(0, "fail"));
assertEquals("data2", result.get(1).getString(0, "fail"));
assertEquals("data3", result.get(2).getString(0, "fail"));
}
Aggregations