本文整理汇总了Java中org.pentaho.di.trans.step.StepIOMetaInterface类的典型用法代码示例。如果您正苦于以下问题:Java StepIOMetaInterface类的具体用法?Java StepIOMetaInterface怎么用?Java StepIOMetaInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StepIOMetaInterface类属于org.pentaho.di.trans.step包,在下文中一共展示了StepIOMetaInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clone
import org.pentaho.di.trans.step.StepIOMetaInterface; //导入依赖的package包/类
public Object clone() {
MergeJoinMeta retval = (MergeJoinMeta) super.clone();
int nrKeys1 = keyFields1.length;
int nrKeys2 = keyFields2.length;
retval.allocate( nrKeys1, nrKeys2 );
System.arraycopy( keyFields1, 0, retval.keyFields1, 0, nrKeys1 );
System.arraycopy( keyFields2, 0, retval.keyFields2, 0, nrKeys2 );
StepIOMetaInterface stepIOMeta = new StepIOMeta( true, true, false, false, false, false );
List<StreamInterface> infoStreams = getStepIOMeta().getInfoStreams();
for ( StreamInterface infoStream : infoStreams ) {
stepIOMeta.addStream( new Stream( infoStream ) );
}
retval.ioMeta = stepIOMeta;
return retval;
}
示例2: init
import org.pentaho.di.trans.step.StepIOMetaInterface; //导入依赖的package包/类
/**
* @see StepInterface#init(org.pentaho.di.trans.step.StepMetaInterface , org.pentaho.di.trans.step.StepDataInterface)
*/
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) {
meta = (MultiMergeJoinMeta) smi;
data = (MultiMergeJoinData) sdi;
if ( super.init( smi, sdi ) ) {
StepIOMetaInterface stepIOMeta = meta.getStepIOMeta();
String[] inputStepNames = meta.getInputSteps();
String inputStepName;
List<StreamInterface> infoStreams = stepIOMeta.getInfoStreams();
StreamInterface stream;
for ( int i = 0; i < infoStreams.size(); i++ ) {
inputStepName = inputStepNames[i];
stream = infoStreams.get( i );
if ( stream.getStepMeta() == null ) {
logError( BaseMessages.getString( PKG, "MultiMergeJoin.Log.UnableToFindReferenceStream", inputStepName ) );
return false;
}
}
String joinType = meta.getJoinType();
for ( int i = 0; i < MultiMergeJoinMeta.join_types.length; ++i ) {
if ( joinType.equalsIgnoreCase( MultiMergeJoinMeta.join_types[i] ) ) {
data.optional = MultiMergeJoinMeta.optionals[i];
return true;
}
}
logError( BaseMessages.getString( PKG, "MultiMergeJoin.Log.InvalidJoinType", meta.getJoinType() ) );
return false;
}
return true;
}
示例3: firstStreamIsExecutionStatistics
import org.pentaho.di.trans.step.StepIOMetaInterface; //导入依赖的package包/类
@Test
public void firstStreamIsExecutionStatistics() throws Exception {
StreamInterface stream = mockStream();
StepIOMetaInterface stepIo = mockStepIo( stream, 0 );
TransExecutorMeta meta = new TransExecutorMeta();
meta = spy( meta );
when( meta.getStepIOMeta() ).thenReturn( stepIo );
doCallRealMethod().when( meta ).handleStreamSelection( any( StreamInterface.class ) );
meta.handleStreamSelection( stream );
assertEquals( stream.getStepMeta(), meta.getExecutionResultTargetStepMeta() );
}
示例4: secondStreamIsInternalTransformationsOutput
import org.pentaho.di.trans.step.StepIOMetaInterface; //导入依赖的package包/类
@Test
public void secondStreamIsInternalTransformationsOutput() throws Exception {
StreamInterface stream = mockStream();
StepIOMetaInterface stepIo = mockStepIo( stream, 1 );
TransExecutorMeta meta = new TransExecutorMeta();
meta = spy( meta );
when( meta.getStepIOMeta() ).thenReturn( stepIo );
doCallRealMethod().when( meta ).handleStreamSelection( any( StreamInterface.class ) );
meta.handleStreamSelection( stream );
assertEquals( stream.getStepMeta(), meta.getOutputRowsSourceStepMeta() );
}
示例5: thirdStreamIsExecutionResultFiles
import org.pentaho.di.trans.step.StepIOMetaInterface; //导入依赖的package包/类
@Test
public void thirdStreamIsExecutionResultFiles() throws Exception {
StreamInterface stream = mockStream();
StepIOMetaInterface stepIo = mockStepIo( stream, 2 );
TransExecutorMeta meta = new TransExecutorMeta();
meta = spy( meta );
when( meta.getStepIOMeta() ).thenReturn( stepIo );
doCallRealMethod().when( meta ).handleStreamSelection( any( StreamInterface.class ) );
meta.handleStreamSelection( stream );
assertEquals( stream.getStepMeta(), meta.getResultFilesTargetStepMeta() );
}
示例6: forthStreamIsExecutorsInput
import org.pentaho.di.trans.step.StepIOMetaInterface; //导入依赖的package包/类
@Test
public void forthStreamIsExecutorsInput() throws Exception {
StreamInterface stream = mockStream();
StepIOMetaInterface stepIo = mockStepIo( stream, 3 );
TransExecutorMeta meta = new TransExecutorMeta();
meta = spy( meta );
when( meta.getStepIOMeta() ).thenReturn( stepIo );
doCallRealMethod().when( meta ).handleStreamSelection( any( StreamInterface.class ) );
meta.handleStreamSelection( stream );
assertEquals( stream.getStepMeta(), meta.getExecutorsOutputStepMeta() );
}
示例7: mockStepIo
import org.pentaho.di.trans.step.StepIOMetaInterface; //导入依赖的package包/类
@SuppressWarnings( "unchecked" )
private static StepIOMetaInterface mockStepIo( StreamInterface stream, int desiredIndex ) {
List<StreamInterface> list = mock( List.class );
when( list.indexOf( stream ) ).thenReturn( desiredIndex );
when( list.get( eq( desiredIndex ) ) ).thenReturn( stream );
StepIOMetaInterface stepIo = mock( StepIOMetaInterface.class );
when( stepIo.getTargetStreams() ).thenReturn( list );
return stepIo;
}
示例8: getIoMeta
import org.pentaho.di.trans.step.StepIOMetaInterface; //导入依赖的package包/类
public StepIOMetaInterface getIoMeta() {
return ioMeta;
}
示例9: setIoMeta
import org.pentaho.di.trans.step.StepIOMetaInterface; //导入依赖的package包/类
public void setIoMeta( StepIOMetaInterface ioMeta ) {
this.ioMeta = ioMeta;
}
示例10: drawLine
import org.pentaho.di.trans.step.StepIOMetaInterface; //导入依赖的package包/类
private void drawLine(StepMeta fs, StepMeta ts, TransHopMeta hi, boolean is_candidate) {
int line[] = getLine(fs, ts);
EColor col;
ELineStyle linestyle=ELineStyle.SOLID;
int activeLinewidth = linewidth;
if (is_candidate)
{
col = EColor.BLUE;
}
else
{
if (hi.isEnabled())
{
if (fs.isSendingErrorRowsToStep(ts))
{
col = EColor.RED;
linestyle = ELineStyle.DOT;
activeLinewidth = linewidth+1;
}
else
{
col = EColor.BLACK;
}
}
else
{
col = EColor.GRAY;
}
}
if (hi.split) activeLinewidth = linewidth+2;
// Check to see if the source step is an info step for the target step.
//
StepIOMetaInterface ioMeta = ts.getStepMetaInterface().getStepIOMeta();
List<StreamInterface> infoStreams = ioMeta.getInfoStreams();
if (!infoStreams.isEmpty()) {
// Check this situation, the source step can't run in multiple copies!
//
for (StreamInterface stream : infoStreams) {
if (fs.getName().equalsIgnoreCase(stream.getStepname())) {
// This is the info step over this hop!
//
if (fs.getCopies()>1) {
// This is not a desirable situation, it will always end in error.
// As such, it's better not to give feedback on it.
// We do this by drawing an error icon over the hop...
//
col=EColor.RED;
}
}
}
}
gc.setForeground(col);
gc.setLineStyle(linestyle);
gc.setLineWidth(activeLinewidth);
drawArrow(line, fs, ts);
if (hi.split) gc.setLineWidth(linewidth);
gc.setForeground(EColor.BLACK);
gc.setBackground(EColor.BACKGROUND);
gc.setLineStyle(ELineStyle.SOLID);
}
示例11: testInfoStreams_single
import org.pentaho.di.trans.step.StepIOMetaInterface; //导入依赖的package包/类
/**
* Tests that info steps are correctly identified via StepMetaInterface.getStepIOMeta()
*/
public void testInfoStreams_single() throws Exception {
KettleEnvironment.init();
PluginRegistry registry = PluginRegistry.getInstance();
//
// Create a new transformation with a row generator that feeds a Mapping (Sub-Transformation) Step
//
TransMeta transMeta = new TransMeta();
transMeta.setName("Mapping Info Test"); //$NON-NLS-1$
StepMeta rowGenerator = buildRowGeneratorStep(registry, "Generate Rows"); //$NON-NLS-1$
transMeta.addStep(rowGenerator);
String mappingName = "mapping"; //$NON-NLS-1$
MappingMeta mappingMeta = new MappingMeta();
mappingMeta.setSpecificationMethod(ObjectLocationSpecificationMethod.FILENAME);
mappingMeta.setFileName("test/org/pentaho/di/trans/steps/mapping/subtrans.ktr"); //$NON-NLS-1$
String mappingInputStepName = "input"; //$NON-NLS-1$
mappingMeta
.setInputMappings(Collections.singletonList(createMappingDef(rowGenerator.getName(), mappingInputStepName, "string", "a"))); //$NON-NLS-1$ //$NON-NLS-2$
String mappingPid = registry.getPluginId(StepPluginType.class, mappingMeta);
StepMeta mapping = new StepMeta(mappingPid, mappingName, mappingMeta);
transMeta.addStep(mapping);
TransHopMeta hopGeneratorToMapping = new TransHopMeta(rowGenerator, mapping);
transMeta.addTransHop(hopGeneratorToMapping);
Trans trans = new Trans(transMeta);
trans.prepareExecution(null);
// Mimic how a transformation is loaded and initialized from TransMeta.loadXML() or KettleDatabaseRepositoryTransDelegate.loadTransformation()
// so the StepMeta references are wired up in the MappingMeta properly
// (Copied from TransMeta.loadXML())
for (int i = 0; i < transMeta.nrSteps(); i++) {
StepMeta stepMeta = transMeta.getStep(i);
StepMetaInterface sii = stepMeta.getStepMetaInterface();
if (sii != null)
sii.searchInfoAndTargetSteps(transMeta.getSteps());
}
// Verify the transformation was configured properly
assertEquals("Transformation not initialized properly", 2, transMeta.nrSteps()); //$NON-NLS-1$
StepMeta meta = transMeta.getStep(1);
assertTrue("Transformation not initialized properly", meta.getStepMetaInterface() instanceof MappingMeta); //$NON-NLS-1$
MappingMeta loadedMappingMeta = (MappingMeta) meta.getStepMetaInterface();
assertEquals("Expected a single input mapping definition", 1, loadedMappingMeta.getInputMappings().size()); //$NON-NLS-1$
StepIOMetaInterface ioMeta = loadedMappingMeta.getStepIOMeta();
assertEquals("Expected a single Info Stream", 1, ioMeta.getInfoStreams().size()); //$NON-NLS-1$
assertEquals("Expected a single Info Step", 1, loadedMappingMeta.getInfoSteps().length); //$NON-NLS-1$
// Verify the transformation can be executed
StepInterface si = trans.getStepInterface(mappingName, 0);
RowStepCollector rc = new RowStepCollector();
si.addRowListener(rc);
trans.startThreads();
trans.waitUntilFinished();
assertEquals(1, rc.getRowsRead().size());
assertEquals(1, rc.getRowsWritten().size());
}
示例12: testInfoStreams_single
import org.pentaho.di.trans.step.StepIOMetaInterface; //导入依赖的package包/类
/**
* Tests that info steps are correctly identified via StepMetaInterface.getStepIOMeta()
*/
public void testInfoStreams_single() throws Exception {
KettleEnvironment.init();
PluginRegistry registry = PluginRegistry.getInstance();
//
// Create a new transformation with a row generator that feeds a Mapping (Sub-Transformation) Step
//
TransMeta transMeta = new TransMeta();
transMeta.setName("Mapping Info Test"); //$NON-NLS-1$
StepMeta rowGenerator = buildRowGeneratorStep(registry, "Generate Rows"); //$NON-NLS-1$
transMeta.addStep(rowGenerator);
String mappingName = "mapping"; //$NON-NLS-1$
MappingMeta mappingMeta = new MappingMeta();
mappingMeta.setSpecificationMethod(ObjectLocationSpecificationMethod.FILENAME);
mappingMeta.setFileName("test-src/org/pentaho/di/trans/steps/mapping/subtrans.ktr"); //$NON-NLS-1$
String mappingInputStepName = "input"; //$NON-NLS-1$
mappingMeta
.setInputMappings(Collections.singletonList(createMappingDef(rowGenerator.getName(), mappingInputStepName, "string", "a"))); //$NON-NLS-1$ //$NON-NLS-2$
String mappingPid = registry.getPluginId(StepPluginType.class, mappingMeta);
StepMeta mapping = new StepMeta(mappingPid, mappingName, mappingMeta);
transMeta.addStep(mapping);
TransHopMeta hopGeneratorToMapping = new TransHopMeta(rowGenerator, mapping);
transMeta.addTransHop(hopGeneratorToMapping);
Trans trans = new Trans(transMeta);
trans.prepareExecution(null);
// Mimic how a transformation is loaded and initialized from TransMeta.loadXML() or KettleDatabaseRepositoryTransDelegate.loadTransformation()
// so the StepMeta references are wired up in the MappingMeta properly
// (Copied from TransMeta.loadXML())
for (int i = 0; i < transMeta.nrSteps(); i++) {
StepMeta stepMeta = transMeta.getStep(i);
StepMetaInterface sii = stepMeta.getStepMetaInterface();
if (sii != null)
sii.searchInfoAndTargetSteps(transMeta.getSteps());
}
// Verify the transformation was configured properly
assertEquals("Transformation not initialized properly", 2, transMeta.nrSteps()); //$NON-NLS-1$
StepMeta meta = transMeta.getStep(1);
assertTrue("Transformation not initialized properly", meta.getStepMetaInterface() instanceof MappingMeta); //$NON-NLS-1$
MappingMeta loadedMappingMeta = (MappingMeta) meta.getStepMetaInterface();
assertEquals("Expected a single input mapping definition", 1, loadedMappingMeta.getInputMappings().size()); //$NON-NLS-1$
StepIOMetaInterface ioMeta = loadedMappingMeta.getStepIOMeta();
assertEquals("Expected a single Info Stream", 1, ioMeta.getInfoStreams().size()); //$NON-NLS-1$
assertEquals("Expected a single Info Step", 1, loadedMappingMeta.getInfoSteps().length); //$NON-NLS-1$
// Verify the transformation can be executed
StepInterface si = trans.getStepInterface(mappingName, 0);
RowStepCollector rc = new RowStepCollector();
si.addRowListener(rc);
trans.startThreads();
trans.waitUntilFinished();
assertEquals(1, rc.getRowsRead().size());
assertEquals(1, rc.getRowsWritten().size());
}
示例13: testInfoStreams_single
import org.pentaho.di.trans.step.StepIOMetaInterface; //导入依赖的package包/类
/**
* Tests that info steps are correctly identified via StepMetaInterface.getStepIOMeta()
*/
public void testInfoStreams_single() throws Exception {
KettleEnvironment.init();
PluginRegistry registry = PluginRegistry.getInstance();
//
// Create a new transformation with a row generator that feeds a Mapping (Sub-Transformation) Step
//
TransMeta transMeta = new TransMeta();
transMeta.setName( "Mapping Info Test" );
StepMeta rowGenerator = buildRowGeneratorStep( registry, "Generate Rows" );
transMeta.addStep( rowGenerator );
String mappingName = "mapping";
MappingMeta mappingMeta = new MappingMeta();
mappingMeta.setSpecificationMethod( ObjectLocationSpecificationMethod.FILENAME );
mappingMeta.setFileName( "test/org/pentaho/di/trans/steps/mapping/subtrans.ktr" );
String mappingInputStepName = "input";
mappingMeta.setInputMappings( Collections.singletonList( createMappingDef(
rowGenerator.getName(), mappingInputStepName, "string", "a" ) ) );
String mappingPid = registry.getPluginId( StepPluginType.class, mappingMeta );
StepMeta mapping = new StepMeta( mappingPid, mappingName, mappingMeta );
transMeta.addStep( mapping );
TransHopMeta hopGeneratorToMapping = new TransHopMeta( rowGenerator, mapping );
transMeta.addTransHop( hopGeneratorToMapping );
Trans trans = new Trans( transMeta );
trans.prepareExecution( null );
// Mimic how a transformation is loaded and initialized from TransMeta.loadXML() or
// KettleDatabaseRepositoryTransDelegate.loadTransformation()
// so the StepMeta references are wired up in the MappingMeta properly
// (Copied from TransMeta.loadXML())
for ( int i = 0; i < transMeta.nrSteps(); i++ ) {
StepMeta stepMeta = transMeta.getStep( i );
StepMetaInterface sii = stepMeta.getStepMetaInterface();
if ( sii != null ) {
sii.searchInfoAndTargetSteps( transMeta.getSteps() );
}
}
// Verify the transformation was configured properly
assertEquals( "Transformation not initialized properly", 2, transMeta.nrSteps() );
StepMeta meta = transMeta.getStep( 1 );
assertTrue( "Transformation not initialized properly", meta.getStepMetaInterface() instanceof MappingMeta );
MappingMeta loadedMappingMeta = (MappingMeta) meta.getStepMetaInterface();
assertEquals( "Expected a single input mapping definition", 1, loadedMappingMeta.getInputMappings().size() );
StepIOMetaInterface ioMeta = loadedMappingMeta.getStepIOMeta();
assertEquals( "Expected a single Info Stream", 1, ioMeta.getInfoStreams().size() );
assertEquals( "Expected a single Info Step", 1, loadedMappingMeta.getInfoSteps().length );
// Verify the transformation can be executed
StepInterface si = trans.getStepInterface( mappingName, 0 );
RowStepCollector rc = new RowStepCollector();
si.addRowListener( rc );
trans.startThreads();
trans.waitUntilFinished();
assertEquals( 1, rc.getRowsRead().size() );
assertEquals( 1, rc.getRowsWritten().size() );
}
示例14: getStepIOMeta
import org.pentaho.di.trans.step.StepIOMetaInterface; //导入依赖的package包/类
/**
* Returns the Input/Output metadata for this step. The generator step only produces output, does not accept input!
*/
public StepIOMetaInterface getStepIOMeta() {
return new StepIOMeta( false, true, false, false, false, false );
}
示例15: getStepIOMeta
import org.pentaho.di.trans.step.StepIOMetaInterface; //导入依赖的package包/类
/**
* Returns the Input/Output metadata for this step.
*
*/
@Override
public StepIOMetaInterface getStepIOMeta() {
return new StepIOMeta( isDynamicCommand(), true, false, false, false, false );
}