本文整理汇总了Java中org.pentaho.di.trans.steps.injector.InjectorMeta类的典型用法代码示例。如果您正苦于以下问题:Java InjectorMeta类的具体用法?Java InjectorMeta怎么用?Java InjectorMeta使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InjectorMeta类属于org.pentaho.di.trans.steps.injector包,在下文中一共展示了InjectorMeta类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: generateInjectorStep
import org.pentaho.di.trans.steps.injector.InjectorMeta; //导入依赖的package包/类
private StepMeta generateInjectorStep() {
InjectorMeta meta = new InjectorMeta();
meta.allocate(serviceFields.size());
for (int i=0;i<serviceFields.size();i++) {
ValueMetaInterface valueMeta = serviceFields.getValueMeta(i);
meta.getFieldname()[i] = valueMeta.getName();
meta.getType()[i] = valueMeta.getType();
meta.getLength()[i] = valueMeta.getLength();
meta.getPrecision()[i] = valueMeta.getPrecision();
}
StepMeta stepMeta = new StepMeta("Injector", meta);
stepMeta.setLocation(xLocation, 50);
xLocation+=100;
stepMeta.setDraw(true);
return stepMeta;
}
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:17,代码来源:SqlTransMeta.java
示例2: handleInputDataSet
import org.pentaho.di.trans.steps.injector.InjectorMeta; //导入依赖的package包/类
private void handleInputDataSet(LogChannelInterface log, String inputSetName, TransUnitTest unitTest, TransMeta transMeta, StepMeta stepMeta, FactoriesHierarchy factoriesHierarchy) throws KettleException {
TransUnitTestSetLocation inputLocation = unitTest.findInputLocation( stepMeta.getName() );
if (inputLocation!=null) {
inputSetName = inputLocation.getDataSetName();
}
if (log.isDetailed()) {
log.logDetailed("Replacing step '"+stepMeta.getName()+"' with an Injector for dataset '"+inputSetName+"'");
}
DataSet dataSet;
try {
dataSet = factoriesHierarchy.getSetFactory().loadElement(inputSetName);
} catch (MetaStoreException e) {
throw new KettleException("Unable to load data set '"+inputSetName+"'");
}
// OK, this step needs to be replaced by an Injector step...
// Which fields do we need to use?
//
final RowMetaInterface stepFields = DataSetConst.getStepOutputFields(log, transMeta, stepMeta, dataSet, inputLocation);
if (log.isDetailed()) {
log.logDetailed("Input Data Set '"+inputSetName+"' Injector fields : '"+stepFields.toString());
}
InjectorMeta injectorMeta = new InjectorMeta();
injectorMeta.allocate( stepFields.size() );
for (int x=0;x<stepFields.size();x++) {
injectorMeta.getFieldname()[x] = stepFields.getValueMeta( x ).getName();
injectorMeta.getType()[x] = stepFields.getValueMeta( x ).getType();
injectorMeta.getLength()[x] = stepFields.getValueMeta( x ).getLength();
injectorMeta.getPrecision()[x] = stepFields.getValueMeta( x ).getPrecision();
// Only the step metadata, type...
stepMeta.setStepMetaInterface( injectorMeta );
stepMeta.setStepID( PluginRegistry.getInstance().getPluginId( StepPluginType.class, injectorMeta) );
}
}
开发者ID:mattcasters,项目名称:pentaho-pdi-dataset,代码行数:40,代码来源:ChangeTransMetaPriorToExecutionExtensionPoint.java
示例3: generateTestTransformation
import org.pentaho.di.trans.steps.injector.InjectorMeta; //导入依赖的package包/类
public static TransMeta generateTestTransformation(VariableSpace parent, StepMetaInterface oneMeta, String oneStepname)
{
StepLoader stepLoader = StepLoader.getInstance();
TransMeta previewMeta = new TransMeta(parent);
// First the injector step...
//
InjectorMeta zeroMeta = new InjectorMeta();
StepMeta zero = new StepMeta(stepLoader.getStepPluginID(zeroMeta), INJECTOR_STEPNAME, zeroMeta);
zero.setLocation(50,50);
zero.setDraw(true);
previewMeta.addStep(zero);
// Then the middle step to test...
//
StepMeta one = new StepMeta(stepLoader.getStepPluginID(oneMeta), oneStepname, oneMeta);
one.setLocation(150,50);
one.setDraw(true);
previewMeta.addStep(one);
// Then we add the dummy step to read the results from
//
DummyTransMeta twoMeta = new DummyTransMeta();
StepMeta two = new StepMeta(stepLoader.getStepPluginID(twoMeta), DUMMY_STEPNAME, twoMeta); //$NON-NLS-1$
two.setLocation(250,50);
two.setDraw(true);
previewMeta.addStep(two);
// Add the hops between the 3 steps.
//
TransHopMeta zeroOne = new TransHopMeta(zero, one);
previewMeta.addTransHop(zeroOne);
TransHopMeta oneTwo= new TransHopMeta(one, two);
previewMeta.addTransHop(oneTwo);
return previewMeta;
}
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:39,代码来源:TransTestFactory.java
示例4: generateTestTransformation
import org.pentaho.di.trans.steps.injector.InjectorMeta; //导入依赖的package包/类
public static TransMeta generateTestTransformation(VariableSpace parent, StepMetaInterface oneMeta, String oneStepname)
{
PluginRegistry registry = PluginRegistry.getInstance();
TransMeta previewMeta = new TransMeta(parent);
// First the injector step...
//
InjectorMeta zeroMeta = new InjectorMeta();
StepMeta zero = new StepMeta(registry.getPluginId(StepPluginType.class, zeroMeta), INJECTOR_STEPNAME, zeroMeta);
zero.setLocation(50,50);
zero.setDraw(true);
previewMeta.addStep(zero);
// Then the middle step to test...
//
StepMeta one = new StepMeta(registry.getPluginId(StepPluginType.class, oneMeta), oneStepname, oneMeta);
one.setLocation(150,50);
one.setDraw(true);
previewMeta.addStep(one);
// Then we add the dummy step to read the results from
//
DummyTransMeta twoMeta = new DummyTransMeta();
StepMeta two = new StepMeta(registry.getPluginId(StepPluginType.class, twoMeta), DUMMY_STEPNAME, twoMeta); //$NON-NLS-1$
two.setLocation(250,50);
two.setDraw(true);
previewMeta.addStep(two);
// Add the hops between the 3 steps.
//
TransHopMeta zeroOne = new TransHopMeta(zero, one);
previewMeta.addTransHop(zeroOne);
TransHopMeta oneTwo= new TransHopMeta(one, two);
previewMeta.addTransHop(oneTwo);
return previewMeta;
}
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:39,代码来源:TransTestFactory.java
示例5: createInjectorStep
import org.pentaho.di.trans.steps.injector.InjectorMeta; //导入依赖的package包/类
/**
* Create an injector step.
*
* @param name
* @param registry
* @return StepMeta
*/
public static synchronized StepMeta createInjectorStep(String name, PluginRegistry pluginRegistry) {
// create an injector step...
InjectorMeta injectorMeta = new InjectorMeta();
// Set the information of the injector
String injectorPid = pluginRegistry.getPluginId(StepPluginType.class, injectorMeta);
StepMeta injectorStep = new StepMeta(injectorPid, name, (StepMetaInterface)injectorMeta);
return injectorStep;
}
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:18,代码来源:TestUtilities.java
示例6: createInjectorStep
import org.pentaho.di.trans.steps.injector.InjectorMeta; //导入依赖的package包/类
public StepMeta createInjectorStep( TransMeta transMeta, PluginRegistry registry ) {
//
// create an injector step...
//
String injectorStepname = "injector step";
InjectorMeta im = new InjectorMeta();
// Set the information of the injector.
String injectorPid = registry.getPluginId( StepPluginType.class, im );
StepMeta injectorStep = new StepMeta( injectorPid, injectorStepname, im );
transMeta.addStep( injectorStep );
return injectorStep;
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:15,代码来源:CsvInputBase.java
示例7: createInjectorStep
import org.pentaho.di.trans.steps.injector.InjectorMeta; //导入依赖的package包/类
/**
* Create an injector step.
*
* @param name
* @param registry
* @return StepMeta
*/
public static synchronized StepMeta createInjectorStep( String name, PluginRegistry pluginRegistry ) {
// create an injector step...
InjectorMeta injectorMeta = new InjectorMeta();
// Set the information of the injector
String injectorPid = pluginRegistry.getPluginId( StepPluginType.class, injectorMeta );
StepMeta injectorStep = new StepMeta( injectorPid, name, injectorMeta );
return injectorStep;
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:18,代码来源:TestUtilities.java
示例8: getInjectorStepMeta
import org.pentaho.di.trans.steps.injector.InjectorMeta; //导入依赖的package包/类
static StepMeta getInjectorStepMeta( RowMetaInterface outputRowMeta ) {
InjectorMeta zeroMeta = new InjectorMeta();
// Sets output fields for cases when no rows are sent to the test step, but metadata is still needed
if ( outputRowMeta != null && outputRowMeta.size() > 0 ) {
String[] fieldName = new String[outputRowMeta.size()];
int[] fieldLength = new int[outputRowMeta.size()];
int[] fieldPrecision = new int[outputRowMeta.size()];
int[] fieldType = new int[outputRowMeta.size()];
for ( int i = 0; i < outputRowMeta.size(); i++ ) {
ValueMetaInterface field = outputRowMeta.getValueMeta( i );
fieldName[i] = field.getName();
fieldLength[i] = field.getLength();
fieldPrecision[i] = field.getPrecision();
fieldType[i] = field.getType();
}
zeroMeta.setFieldname( fieldName );
zeroMeta.setLength( fieldLength );
zeroMeta.setPrecision( fieldPrecision );
zeroMeta.setType( fieldType );
}
StepMeta zero = new StepMeta( registry.getPluginId( StepPluginType.class, zeroMeta ), INJECTOR_STEPNAME, zeroMeta );
zero.setLocation( 50, 50 );
zero.setDraw( true );
return zero;
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:29,代码来源:TransTestFactory.java
示例9: createInjectorStep
import org.pentaho.di.trans.steps.injector.InjectorMeta; //导入依赖的package包/类
/**
* Create an injector step.
*
* @param name
* @param registry
* @return StepMeta
*/
public static synchronized StepMeta createInjectorStep( String name, PluginRegistry pluginRegistry ) {
// create an injector step...
InjectorMeta injectorMeta = new InjectorMeta();
// Set the information of the injector
String injectorPid = pluginRegistry.getPluginId( StepPluginType.class, injectorMeta );
StepMeta injectorStep = new StepMeta( injectorPid, name, injectorMeta );
return injectorStep;
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:18,代码来源:TestUtilities.java
示例10: getInjectorStepMeta
import org.pentaho.di.trans.steps.injector.InjectorMeta; //导入依赖的package包/类
static StepMeta getInjectorStepMeta() {
InjectorMeta zeroMeta = new InjectorMeta();
StepMeta zero = new StepMeta( registry.getPluginId( StepPluginType.class, zeroMeta ), INJECTOR_STEPNAME, zeroMeta );
zero.setLocation( 50, 50 );
zero.setDraw( true );
return zero;
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:8,代码来源:TransTestFactory.java
示例11: InjectorDialog
import org.pentaho.di.trans.steps.injector.InjectorMeta; //导入依赖的package包/类
public InjectorDialog(Shell parent, Object in, TransMeta transMeta, String sname)
{
super(parent, (BaseStepMeta)in, transMeta, sname);
input=(InjectorMeta)in;
}
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:6,代码来源:InjectorDialog.java
示例12: testCaseSensitiveNoPreviousSort
import org.pentaho.di.trans.steps.injector.InjectorMeta; //导入依赖的package包/类
public void testCaseSensitiveNoPreviousSort() throws Exception
{
EnvUtil.environmentInit();
//
// Create a new transformation...
//
TransMeta transMeta = new TransMeta();
transMeta.setName("uniquerowstest");
StepLoader steploader = StepLoader.getInstance();
//
// create an injector step...
//
String injectorStepname = "injector step";
InjectorMeta im = new InjectorMeta();
// Set the information of the injector.
String injectorPid = steploader.getStepPluginID(im);
StepMeta injectorStep = new StepMeta(injectorPid, injectorStepname, (StepMetaInterface)im);
transMeta.addStep(injectorStep);
//
// Create a unique rows step
//
String uniqueRowsStepname = "unique rows step";
UniqueRowsMeta urm = new UniqueRowsMeta();
urm.setCompareFields(new String[] {"KEY"});
urm.setCaseInsensitive(new boolean[] {false});
String uniqueRowsStepPid = steploader.getStepPluginID(urm);
StepMeta uniqueRowsStep = new StepMeta(uniqueRowsStepPid, uniqueRowsStepname, (StepMetaInterface)urm);
transMeta.addStep(uniqueRowsStep);
transMeta.addTransHop(new TransHopMeta(injectorStep, uniqueRowsStep));
//
// Create a dummy step
//
String dummyStepname = "dummy step";
DummyTransMeta dm = new DummyTransMeta();
String dummyPid = steploader.getStepPluginID(dm);
StepMeta dummyStep = new StepMeta(dummyPid, dummyStepname, (StepMetaInterface)dm);
transMeta.addStep(dummyStep);
transMeta.addTransHop(new TransHopMeta(uniqueRowsStep, dummyStep));
// Now execute the transformation...
Trans trans = new Trans(transMeta);
trans.prepareExecution(null);
StepInterface si = trans.getStepInterface(dummyStepname, 0);
RowStepCollector dummyRc = new RowStepCollector();
si.addRowListener(dummyRc);
RowProducer rp = trans.addRowProducer(injectorStepname, 0);
trans.startThreads();
// add rows
List<RowMetaAndData> inputList = createData();
for ( RowMetaAndData rm : inputList )
{
rp.putRow(rm.getRowMeta(), rm.getData());
}
rp.finished();
trans.waitUntilFinished();
List<RowMetaAndData> resultRows = dummyRc.getRowsWritten();
checkRows(createResultDataCaseSensitiveNoPreviousSort(), resultRows);
}
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:75,代码来源:UniqueRowsTest.java
示例13: testCaseInsensitiveNoPreviousSort
import org.pentaho.di.trans.steps.injector.InjectorMeta; //导入依赖的package包/类
public void testCaseInsensitiveNoPreviousSort() throws Exception
{
EnvUtil.environmentInit();
//
// Create a new transformation...
//
TransMeta transMeta = new TransMeta();
transMeta.setName("uniquerowstest");
StepLoader steploader = StepLoader.getInstance();
//
// create an injector step...
//
String injectorStepname = "injector step";
InjectorMeta im = new InjectorMeta();
// Set the information of the injector.
String injectorPid = steploader.getStepPluginID(im);
StepMeta injectorStep = new StepMeta(injectorPid, injectorStepname, (StepMetaInterface)im);
transMeta.addStep(injectorStep);
//
// Create a unique rows step
//
String uniqueRowsStepname = "unique rows step";
UniqueRowsMeta urm = new UniqueRowsMeta();
urm.setCompareFields(new String[] {"KEY"});
urm.setCaseInsensitive(new boolean[] {true});
String uniqueRowsStepPid = steploader.getStepPluginID(urm);
StepMeta uniqueRowsStep = new StepMeta(uniqueRowsStepPid, uniqueRowsStepname, (StepMetaInterface)urm);
transMeta.addStep(uniqueRowsStep);
transMeta.addTransHop(new TransHopMeta(injectorStep, uniqueRowsStep));
//
// Create a dummy step
//
String dummyStepname = "dummy step";
DummyTransMeta dm = new DummyTransMeta();
String dummyPid = steploader.getStepPluginID(dm);
StepMeta dummyStep = new StepMeta(dummyPid, dummyStepname, (StepMetaInterface)dm);
transMeta.addStep(dummyStep);
transMeta.addTransHop(new TransHopMeta(uniqueRowsStep, dummyStep));
// Now execute the transformation...
Trans trans = new Trans(transMeta);
trans.prepareExecution(null);
StepInterface si = trans.getStepInterface(dummyStepname, 0);
RowStepCollector dummyRc = new RowStepCollector();
si.addRowListener(dummyRc);
RowProducer rp = trans.addRowProducer(injectorStepname, 0);
trans.startThreads();
// add rows
List<RowMetaAndData> inputList = createData();
for ( RowMetaAndData rm : inputList )
{
rp.putRow(rm.getRowMeta(), rm.getData());
}
rp.finished();
trans.waitUntilFinished();
List<RowMetaAndData> resultRows = dummyRc.getRowsWritten();
checkRows(createResultDataCaseInsensitiveNoPreviousSort(), resultRows);
}
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:75,代码来源:UniqueRowsTest.java
示例14: setUp
import org.pentaho.di.trans.steps.injector.InjectorMeta; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
KettleEnvironment.init();
/* SET UP TRANSFORMATION */
// Create a new transformation...
TransMeta transMeta = new TransMeta();
transMeta.setName("insert/update test");
// Add the database connections
for (int i = 0; i < databasesXML.length; i++) {
DatabaseMeta databaseMeta = new DatabaseMeta(databasesXML[i]);
transMeta.addDatabase(databaseMeta);
}
DatabaseMeta dbInfo = transMeta.findDatabase("db");
/* SET UP DATABASE */
// Create target table
db = new Database(transMeta, dbInfo);
db.connect();
String source = db.getCreateTableStatement(TARGET_TABLE, getTargetTableRowMeta(), null, false, null, true);
db.execStatement(source);
// populate target table
for (String sql : insertStatement) {
db.execStatement(sql);
}
/* SET UP TRANSFORMATION STEPS */
PluginRegistry registry = PluginRegistry.getInstance();
// create an injector step...
String injectorStepName = "injector step";
InjectorMeta im = new InjectorMeta();
// Set the information of the injector.
String injectorPid = registry.getPluginId(StepPluginType.class, im);
StepMeta injectorStep = new StepMeta(injectorPid, injectorStepName, (StepMetaInterface) im);
transMeta.addStep(injectorStep);
// create the update step...
String updateStepName = "insert/update [" + TARGET_TABLE + "]";
insupd = new InsertUpdateMeta();
insupd.setDatabaseMeta(transMeta.findDatabase("db"));
insupd.setTableName(TARGET_TABLE);
insupd.setUpdateLookup(new String[] { "VALUE" , "ROW_ORDER"});
insupd.setUpdateStream(new String[] { "VALUE" , "ROW_ORDER"});
insupd.setUpdate(new Boolean[] { true, false });
String fromid = registry.getPluginId(StepPluginType.class, insupd);
StepMeta updateStep = new StepMeta(fromid, updateStepName, (StepMetaInterface) insupd);
updateStep.setDescription("insert/update data in table [" + TARGET_TABLE + "] on database [" + dbInfo + "]");
transMeta.addStep(updateStep);
TransHopMeta hi = new TransHopMeta(injectorStep, updateStep);
transMeta.addTransHop(hi);
/* PREPARE TRANSFORMATION EXECUTION */
trans = new Trans(transMeta);
trans.prepareExecution(null);
StepInterface si = trans.getStepInterface(updateStepName, 0);
rc = new RowStepCollector();
si.addRowListener(rc);
rp = trans.addRowProducer(injectorStepName, 0);
}
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:76,代码来源:InsertUpdateTest.java
示例15: setUp
import org.pentaho.di.trans.steps.injector.InjectorMeta; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
KettleEnvironment.init();
/* SET UP TRANSFORMATION */
// Create a new transformation...
TransMeta transMeta = new TransMeta();
transMeta.setName("update test");
// Add the database connections
for (int i = 0; i < databasesXML.length; i++) {
DatabaseMeta databaseMeta = new DatabaseMeta(databasesXML[i]);
transMeta.addDatabase(databaseMeta);
}
DatabaseMeta dbInfo = transMeta.findDatabase("db");
/* SET UP DATABASE */
// Create target table
db = new Database(transMeta, dbInfo);
db.connect();
String source = db.getCreateTableStatement(TARGET_TABLE, getTargetTableRowMeta(), null, false, null, true);
db.execStatement(source);
// populate target table
for (String sql : insertStatement) {
db.execStatement(sql);
}
/* SET UP TRANSFORMATION STEPS */
PluginRegistry registry = PluginRegistry.getInstance();
// create an injector step...
String injectorStepName = "injector step";
InjectorMeta im = new InjectorMeta();
// Set the information of the injector.
String injectorPid = registry.getPluginId(StepPluginType.class, im);
StepMeta injectorStep = new StepMeta(injectorPid, injectorStepName, (StepMetaInterface) im);
transMeta.addStep(injectorStep);
// create the update step...
String updateStepName = "update [" + TARGET_TABLE + "]";
upd = new UpdateMeta();
upd.setDatabaseMeta(transMeta.findDatabase("db"));
upd.setTableName(TARGET_TABLE);
upd.setUpdateLookup(new String[] { "VALUE" });
upd.setUpdateStream(new String[] { "VALUE" });
upd.setErrorIgnored(true);
String fromid = registry.getPluginId(StepPluginType.class, upd);
StepMeta updateStep = new StepMeta(fromid, updateStepName, (StepMetaInterface) upd);
updateStep.setDescription("update data in table [" + TARGET_TABLE + "] on database [" + dbInfo + "]");
transMeta.addStep(updateStep);
TransHopMeta hi = new TransHopMeta(injectorStep, updateStep);
transMeta.addTransHop(hi);
/* PREPARE TRANSFORMATION EXECUTION */
trans = new Trans(transMeta);
trans.prepareExecution(null);
StepInterface si = trans.getStepInterface(updateStepName, 0);
rc = new RowStepCollector();
si.addRowListener(rc);
rp = trans.addRowProducer(injectorStepName, 0);
}
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:75,代码来源:UpdateTest.java
示例16: testCaseSensitiveNoPreviousSort
import org.pentaho.di.trans.steps.injector.InjectorMeta; //导入依赖的package包/类
public void testCaseSensitiveNoPreviousSort() throws Exception
{
KettleEnvironment.init();
//
// Create a new transformation...
//
TransMeta transMeta = new TransMeta();
transMeta.setName("uniquerowstest");
PluginRegistry registry = PluginRegistry.getInstance();
//
// create an injector step...
//
String injectorStepname = "injector step";
InjectorMeta im = new InjectorMeta();
// Set the information of the injector.
String injectorPid = registry.getPluginId(StepPluginType.class, im);
StepMeta injectorStep = new StepMeta(injectorPid, injectorStepname, (StepMetaInterface)im);
transMeta.addStep(injectorStep);
//
// Create a unique rows step
//
String uniqueRowsStepname = "unique rows step";
UniqueRowsMeta urm = new UniqueRowsMeta();
urm.setCompareFields(new String[] {"KEY"});
urm.setCaseInsensitive(new boolean[] {false});
String uniqueRowsStepPid = registry.getPluginId(StepPluginType.class, urm);
StepMeta uniqueRowsStep = new StepMeta(uniqueRowsStepPid, uniqueRowsStepname, (StepMetaInterface)urm);
transMeta.addStep(uniqueRowsStep);
transMeta.addTransHop(new TransHopMeta(injectorStep, uniqueRowsStep));
//
// Create a dummy step
//
String dummyStepname = "dummy step";
DummyTransMeta dm = new DummyTransMeta();
String dummyPid = registry.getPluginId(StepPluginType.class, dm);
StepMeta dummyStep = new StepMeta(dummyPid, dummyStepname, (StepMetaInterface)dm);
transMeta.addStep(dummyStep);
transMeta.addTransHop(new TransHopMeta(uniqueRowsStep, dummyStep));
// Now execute the transformation...
Trans trans = new Trans(transMeta);
trans.prepareExecution(null);
StepInterface si = trans.getStepInterface(dummyStepname, 0);
RowStepCollector dummyRc = new RowStepCollector();
si.addRowListener(dummyRc);
RowProducer rp = trans.addRowProducer(injectorStepname, 0);
trans.startThreads();
// add rows
List<RowMetaAndData> inputList = createData();
for ( RowMetaAndData rm : inputList )
{
rp.putRow(rm.getRowMeta(), rm.getData());
}
rp.finished();
trans.waitUntilFinished();
List<RowMetaAndData> resultRows = dummyRc.getRowsWritten();
checkRows(createResultDataCaseSensitiveNoPreviousSort(), resultRows);
}
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:75,代码来源:UniqueRowsTest.java
示例17: testCaseInsensitiveNoPreviousSort
import org.pentaho.di.trans.steps.injector.InjectorMeta; //导入依赖的package包/类
public void testCaseInsensitiveNoPreviousSort() throws Exception
{
KettleEnvironment.init();
//
// Create a new transformation...
//
TransMeta transMeta = new TransMeta();
transMeta.setName("uniquerowstest");
PluginRegistry registry = PluginRegistry.getInstance();
//
// create an injector step...
//
String injectorStepname = "injector step";
InjectorMeta im = new InjectorMeta();
// Set the information of the injector.
String injectorPid = registry.getPluginId(StepPluginType.class, im);
StepMeta injectorStep = new StepMeta(injectorPid, injectorStepname, (StepMetaInterface)im);
transMeta.addStep(injectorStep);
//
// Create a unique rows step
//
String uniqueRowsStepname = "unique rows step";
UniqueRowsMeta urm = new UniqueRowsMeta();
urm.setCompareFields(new String[] {"KEY"});
urm.setCaseInsensitive(new boolean[] {true});
String uniqueRowsStepPid = registry.getPluginId(StepPluginType.class, urm);
StepMeta uniqueRowsStep = new StepMeta(uniqueRowsStepPid, uniqueRowsStepname, (StepMetaInterface)urm);
transMeta.addStep(uniqueRowsStep);
transMeta.addTransHop(new TransHopMeta(injectorStep, uniqueRowsStep));
//
// Create a dummy step
//
String dummyStepname = "dummy step";
DummyTransMeta dm = new DummyTransMeta();
String dummyPid = registry.getPluginId(StepPluginType.class, dm);
StepMeta dummyStep = new StepMeta(dummyPid, dummyStepname, (StepMetaInterface)dm);
transMeta.addStep(dummyStep);
transMeta.addTransHop(new TransHopMeta(uniqueRowsStep, dummyStep));
// Now execute the transformation...
Trans trans = new Trans(transMeta);
trans.prepareExecution(null);
StepInterface si = trans.getStepInterface(dummyStepname, 0);
RowStepCollector dummyRc = new RowStepCollector();
si.addRowListener(dummyRc);
RowProducer rp = trans.addRowProducer(injectorStepname, 0);
trans.startThreads();
// add rows
List<RowMetaAndData> inputList = createData();
for ( RowMetaAndData rm : inputList )
{
rp.putRow(rm.getRowMeta(), rm.getData());
}
rp.finished();
trans.waitUntilFinished();
List<RowMetaAndData> resultRows = dummyRc.getRowsWritten();
checkRows(createResultDataCaseInsensitiveNoPreviousSort(), resultRows);
}
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:75,代码来源:UniqueRowsTest.java
示例18: testExecSQLRow1
import org.pentaho.di.trans.steps.injector.InjectorMeta; //导入依赖的package包/类
/**
* Basic Test case for Exec SQL Row. This tests a commit size of zero (i.e. autocommit)
*/
@Test
public void testExecSQLRow1() throws Exception {
KettleEnvironment.init();
//
// Create a new transformation...
//
TransMeta transMeta = new TransMeta();
transMeta.setName( "transname" );
// Add the database connections
for ( int i = 0; i < databasesXML.length; i++ ) {
DatabaseMeta databaseMeta = new DatabaseMeta( databasesXML[i] );
transMeta.addDatabase( databaseMeta );
}
DatabaseMeta dbInfo = transMeta.findDatabase( "db" );
PluginRegistry registry = PluginRegistry.getInstance();
//
// create an injector step...
//
String injectorStepname = "injector step";
InjectorMeta im = new InjectorMeta();
// Set the information of the injector.
String injectorPid = registry.getPluginId( StepPluginType.class, im );
StepMeta injectorStep = new StepMeta( injectorPid, injectorStepname, im );
transMeta.addStep( injectorStep );
//
// create the Exec SQL Row step...
//
String stepName = "delete from [" + execsqlrow_testtable + "]";
ExecSQLRowMeta execsqlmeta = new ExecSQLRowMeta();
execsqlmeta.setDatabaseMeta( transMeta.findDatabase( "db" ) );
execsqlmeta.setCommitSize( 0 ); // use Autocommit
execsqlmeta.setSqlFieldName( "SQL" );
String execSqlRowId = registry.getPluginId( StepPluginType.class, execsqlmeta );
StepMeta execSqlRowStep = new StepMeta( execSqlRowId, stepName, execsqlmeta );
execSqlRowStep.setDescription( "Deletes information from table ["
+ execsqlrow_testtable + "] on database [" + dbInfo + "]" );
transMeta.addStep( execSqlRowStep );
TransHopMeta hi = new TransHopMeta( injectorStep, execSqlRowStep );
transMeta.addTransHop( hi );
// Now execute the transformation...
Trans trans = new Trans( transMeta );
trans.prepareExecution( null );
StepInterface si = trans.getStepInterface( stepName, 0 );
RowStepCollector rc = new RowStepCollector();
si.addRowListener( rc );
RowProducer rp = trans.addRowProducer( injectorStepname, 0 );
trans.startThreads();
// add rows
List<RowMetaAndData> inputList = createDataRows();
for ( RowMetaAndData rm : inputList ) {
rp.putRow( rm.getRowMeta(), rm.getData() );
}
rp.finished();
trans.waitUntilFinished();
List<RowMetaAndData> resultRows = rc.getRowsWritten();
List<RowMetaAndData> goldRows = createResultDataRows();
checkRows( goldRows, resultRows );
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:78,代码来源:ExecSQLRowIT.java
示例19: testExecSQLRow2
import org.pentaho.di.trans.steps.injector.InjectorMeta; //导入依赖的package包/类
/**
* Basic Test case for Exec SQL Row. This tests a commit size of one (i.e. "simulated" autocommit)
*/
@Test
public void testExecSQLRow2() throws Exception {
KettleEnvironment.init();
//
// Create a new transformation...
//
TransMeta transMeta = new TransMeta();
transMeta.setName( "transname" );
// Add the database connections
for ( int i = 0; i < databasesXML.length; i++ ) {
DatabaseMeta databaseMeta = new DatabaseMeta( databasesXML[i] );
transMeta.addDatabase( databaseMeta );
}
DatabaseMeta dbInfo = transMeta.findDatabase( "db" );
PluginRegistry registry = PluginRegistry.getInstance();
//
// create an injector step...
//
String injectorStepname = "injector step";
InjectorMeta im = new InjectorMeta();
// Set the information of the injector.
String injectorPid = registry.getPluginId( StepPluginType.class, im );
StepMeta injectorStep = new StepMeta( injectorPid, injectorStepname, im );
transMeta.addStep( injectorStep );
//
// create the Exec SQL Row step...
//
String stepName = "delete from [" + execsqlrow_testtable + "]";
ExecSQLRowMeta execsqlmeta = new ExecSQLRowMeta();
execsqlmeta.setDatabaseMeta( transMeta.findDatabase( "db" ) );
execsqlmeta.setCommitSize( 1 );
execsqlmeta.setSqlFieldName( "SQL" );
String execSqlRowId = registry.getPluginId( StepPluginType.class, execsqlmeta );
StepMeta execSqlRowStep = new StepMeta( execSqlRowId, stepName, execsqlmeta );
execSqlRowStep.setDescription( "Deletes information from table ["
+ execsqlrow_testtable + "] on database [" + dbInfo + "]" );
transMeta.addStep( execSqlRowStep );
TransHopMeta hi = new TransHopMeta( injectorStep, execSqlRowStep );
transMeta.addTransHop( hi );
// Now execute the transformation...
Trans trans = new Trans( transMeta );
trans.prepareExecution( null );
StepInterface si = trans.getStepInterface( stepName, 0 );
RowStepCollector rc = new RowStepCollector();
si.addRowListener( rc );
RowProducer rp = trans.addRowProducer( injectorStepname, 0 );
trans.startThreads();
// add rows
List<RowMetaAndData> inputList = createDataRows();
for ( RowMetaAndData rm : inputList ) {
rp.putRow( rm.getRowMeta(), rm.getData() );
}
rp.finished();
trans.waitUntilFinished();
List<RowMetaAndData> resultRows = rc.getRowsWritten();
List<RowMetaAndData> goldRows = createResultDataRows();
checkRows( goldRows, resultRows );
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:78,代码来源:ExecSQLRowIT.java
示例20: testExecSQLRow3
import org.pentaho.di.trans.steps.injector.InjectorMeta; //导入依赖的package包/类
/**
* Basic Test case for Exec SQL Row. This tests a commit size of two (i.e. not autocommit and not the input row size)
*/
@Test
public void testExecSQLRow3() throws Exception {
KettleEnvironment.init();
//
// Create a new transformation...
//
TransMeta transMeta = new TransMeta();
transMeta.setName( "transname" );
// Add the database connections
for ( int i = 0; i < databasesXML.length; i++ ) {
DatabaseMeta databaseMeta = new DatabaseMeta( databasesXML[i] );
transMeta.addDatabase( databaseMeta );
}
DatabaseMeta dbInfo = transMeta.findDatabase( "db" );
PluginRegistry registry = PluginRegistry.getInstance();
//
// create an injector step...
//
String injectorStepname = "injector step";
InjectorMeta im = new InjectorMeta();
// Set the information of the injector.
String injectorPid = registry.getPluginId( StepPluginType.class, im );
StepMeta injectorStep = new StepMeta( injectorPid, injectorStepname, im );
transMeta.addStep( injectorStep );
//
// create the Exec SQL Row step...
//
String stepName = "delete from [" + execsqlrow_testtable + "]";
ExecSQLRowMeta execsqlmeta = new ExecSQLRowMeta();
execsqlmeta.setDatabaseMeta( transMeta.findDatabase( "db" ) );
execsqlmeta.setCommitSize( 2 );
execsqlmeta.setSqlFieldName( "SQL" );
String execSqlRowId = registry.getPluginId( StepPluginType.class, execsqlmeta );
StepMeta execSqlRowStep = new StepMeta( execSqlRowId, stepName, execsqlmeta );
execSqlRowStep.setDescription( "Deletes information from table ["
+ execsqlrow_testtable + "] on database [" + dbInfo + "]" );
transMeta.addStep( execSqlRowStep );
TransHopMeta hi = new TransHopMeta( injectorStep, execSqlRowStep );
transMeta.addTransHop( hi );
// Now execute the transformation...
Trans trans = new Trans( transMeta );
trans.prepareExecution( null );
StepInterface si = trans.getStepInterface( stepName, 0 );
RowStepCollector rc = new RowStepCollector();
si.addRowListener( rc );
RowProducer rp = trans.addRowProducer( injectorStepname, 0 );
trans.startThreads();
// add rows
List<RowMetaAndData> inputList = createDataRows();
for ( RowMetaAndData rm : inputList ) {
rp.putRow( rm.getRowMeta(), rm.getData() );
}
rp.finished();
trans.waitUntilFinished();
List<RowMetaAndData> resultRows = rc.getRowsWritten();
List<RowMetaAndData> goldRows = createResultDataRows();
checkRows( goldRows, resultRows );
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:78,代码来源:ExecSQLRowIT.java
注:本文中的org.pentaho.di.trans.steps.injector.InjectorMeta类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论