use of org.pentaho.di.trans.steps.rowgenerator.RowGeneratorMeta in project pentaho-kettle by pentaho.
the class JsonOutputTest method createRowGeneratorStep.
/**
* Creates a row generator step for this class..
*
* @param name
* @param registry
* @return
*/
private StepMeta createRowGeneratorStep(String name, PluginRegistry registry) {
// Default the name if it is empty
String testFileOutputName = (Utils.isEmpty(name) ? "generate rows" : name);
// create the RowGenerator and Step Meta
RowGeneratorMeta rowGeneratorMeta = new RowGeneratorMeta();
String rowGeneratorPid = registry.getPluginId(StepPluginType.class, rowGeneratorMeta);
StepMeta generateRowsStep = new StepMeta(rowGeneratorPid, testFileOutputName, rowGeneratorMeta);
// Set the field names, types and values
rowGeneratorMeta.setFieldName(new String[] { "Id", "State", "City" });
rowGeneratorMeta.setFieldType(new String[] { "Integer", "String", "String" });
rowGeneratorMeta.setValue(new String[] { "1", "Florida", "Orlando" });
rowGeneratorMeta.setFieldLength(new int[] { -1, -1, -1 });
rowGeneratorMeta.setFieldPrecision(new int[] { -1, -1, -1 });
rowGeneratorMeta.setGroup(new String[] { "", "", "" });
rowGeneratorMeta.setDecimal(new String[] { "", "", "" });
rowGeneratorMeta.setCurrency(new String[] { "", "", "" });
rowGeneratorMeta.setFieldFormat(new String[] { "", "", "" });
rowGeneratorMeta.setRowLimit("10");
// return the step meta
return generateRowsStep;
}
use of org.pentaho.di.trans.steps.rowgenerator.RowGeneratorMeta in project pentaho-kettle by pentaho.
the class JobEntryTransIntIT method createPDI14676Transformation.
private String createPDI14676Transformation() throws IOException, KettleException {
// Setup Transformation
String rowGenStepName = "Generate Rows";
RowGeneratorMeta rowGenMeta = new RowGeneratorMeta();
rowGenMeta.setRowLimit(String.valueOf(Integer.MAX_VALUE));
rowGenMeta.setNeverEnding(true);
rowGenMeta.setIntervalInMs("0");
rowGenMeta.allocate(0);
TransMeta tMeta = TransTestFactory.generateTestTransformation(new Variables(), rowGenMeta, rowGenStepName);
// Remove the Injector step, as it's not needed for this transformation
TransHopMeta hopToRemove = tMeta.findTransHop(tMeta.findStep(TransTestFactory.INJECTOR_STEPNAME), tMeta.findStep(rowGenStepName));
tMeta.removeTransHop(tMeta.indexOfTransHop(hopToRemove));
tMeta.removeStep(tMeta.indexOfStep(tMeta.findStep(TransTestFactory.INJECTOR_STEPNAME)));
// Write transformation to temp file, for use within a job
String transFilename = TestUtilities.createEmptyTempFile(this.getClass().getSimpleName() + "_PDI14676_", ".ktr");
FileObject transFile = TestUtils.getFileObject(transFilename);
OutputStream outStream = transFile.getContent().getOutputStream();
PrintWriter pw = new PrintWriter(outStream);
pw.write(tMeta.getXML());
pw.close();
outStream.close();
return transFilename;
}
use of org.pentaho.di.trans.steps.rowgenerator.RowGeneratorMeta in project pentaho-kettle by pentaho.
the class TextFileOutputIT method createRowGeneratorStep.
/**
* Creates a row generator step for this class..
*
* @param name
* @param registry
* @return
*/
private StepMeta createRowGeneratorStep(String name, PluginRegistry registry) {
// Default the name if it is empty
String testFileOutputName = (Utils.isEmpty(name) ? "generate rows" : name);
// create the RowGenerator and Step Meta
RowGeneratorMeta rowGeneratorMeta = new RowGeneratorMeta();
String rowGeneratorPid = registry.getPluginId(StepPluginType.class, rowGeneratorMeta);
StepMeta generateRowsStep = new StepMeta(rowGeneratorPid, testFileOutputName, rowGeneratorMeta);
// Set the field names, types and values
rowGeneratorMeta.setFieldName(new String[] { "Id", "State", "City" });
rowGeneratorMeta.setFieldType(new String[] { "Integer", "String", "String" });
rowGeneratorMeta.setValue(new String[] { "1", "Orlando", "Florida" });
rowGeneratorMeta.setFieldLength(new int[] { -1, -1, -1 });
rowGeneratorMeta.setFieldPrecision(new int[] { -1, -1, -1 });
rowGeneratorMeta.setGroup(new String[] { "", "", "" });
rowGeneratorMeta.setDecimal(new String[] { "", "", "" });
rowGeneratorMeta.setCurrency(new String[] { "", "", "" });
rowGeneratorMeta.setFieldFormat(new String[] { "", "", "" });
rowGeneratorMeta.setRowLimit("10");
// return the step meta
return generateRowsStep;
}
use of org.pentaho.di.trans.steps.rowgenerator.RowGeneratorMeta in project pentaho-kettle by pentaho.
the class CarteIT method generateTestTransformation.
// CHECKSTYLE:Indentation:OFF
public static Trans generateTestTransformation() {
RowGeneratorMeta A = new RowGeneratorMeta();
A.allocate(3);
A.setRowLimit("10000000");
A.getFieldName()[0] = "ID";
A.getFieldType()[0] = ValueMetaFactory.getValueMetaName(ValueMetaInterface.TYPE_INTEGER);
A.getFieldLength()[0] = 7;
A.getValue()[0] = "1234";
A.getFieldName()[1] = "Name";
A.getFieldType()[1] = ValueMetaFactory.getValueMetaName(ValueMetaInterface.TYPE_STRING);
A.getFieldLength()[1] = 35;
A.getValue()[1] = "Some name";
A.getFieldName()[2] = "Last updated";
A.getFieldType()[2] = ValueMetaFactory.getValueMetaName(ValueMetaInterface.TYPE_DATE);
A.getFieldFormat()[2] = "yyyy/MM/dd";
A.getValue()[2] = "2010/02/09";
TransMeta transMeta = TransPreviewFactory.generatePreviewTransformation(null, A, "A");
transMeta.setName("CarteUnitTest");
transMeta.setSizeRowset(2500);
transMeta.setFeedbackSize(50000);
transMeta.setUsingThreadPriorityManagment(false);
return new Trans(transMeta);
}
Aggregations