public boolean chosesTargetSteps() { if ( getStepMetaInterface() != null ) { List<StreamInterface> targetStreams = getStepMetaInterface().getStepIOMeta().getTargetStreams(); return targetStreams.isEmpty(); } return false; }
/** * Determines whether or not a certain step is informative. This means that the previous step is sending information * to this step, but only informative. This means that this step is using the information to process the actual stream * of data. We use this in StreamLookup, TableInput and other types of steps. * * @param this_step * The step that is receiving information. * @param prev_step * The step that is sending information * @return true if prev_step if informative for this_step. */ public boolean isStepInformative( StepMeta this_step, StepMeta prev_step ) { String[] infoSteps = this_step.getStepMetaInterface().getStepIOMeta().getInfoStepnames(); if ( infoSteps == null ) { return false; } for ( int i = 0; i < infoSteps.length; i++ ) { if ( prev_step.getName().equalsIgnoreCase( infoSteps[i] ) ) { return true; } } return false; }
public SingleThreadedTransExecutor( final Trans trans ) { this.trans = trans; this.log = trans.getLogChannel(); steps = trans.getSteps(); // Always disable thread priority management, it will always slow us down... // for ( StepMetaDataCombi combi : steps ) { combi.step.setUsingThreadPriorityManagment( false ); } sortSteps(); done = new boolean[steps.size()]; nrDone = 0; stepInfoStreams = new ArrayList<List<StreamInterface>>(); stepInfoRowSets = new ArrayList<List<RowSet>>(); for ( StepMetaDataCombi combi : steps ) { List<StreamInterface> infoStreams = combi.stepMeta.getStepMetaInterface().getStepIOMeta().getInfoStreams(); stepInfoStreams.add( infoStreams ); List<RowSet> infoRowSets = new ArrayList<RowSet>(); for ( StreamInterface infoStream : infoStreams ) { RowSet infoRowSet = trans.findRowSet( infoStream.getStepname(), 0, combi.stepname, 0 ); if ( infoRowSet != null ) { infoRowSets.add( infoRowSet ); } } stepInfoRowSets.add( infoRowSets ); } }
/** * Get the informational steps for a certain step. An informational step is a step that provides information for * lookups, etc. * * @param stepMeta * The name of the step * @return An array of the informational steps found */ public StepMeta[] getInfoStep( StepMeta stepMeta ) { String[] infoStepName = stepMeta.getStepMetaInterface().getStepIOMeta().getInfoStepnames(); if ( infoStepName == null ) { return null; } StepMeta[] infoStep = new StepMeta[infoStepName.length]; for ( int i = 0; i < infoStep.length; i++ ) { infoStep[i] = findStep( infoStepName[i] ); } return infoStep; }
private boolean checkNumberOfCopies( TransMeta transMeta, StepMeta stepMeta ) { boolean enabled = true; List<StepMeta> prevSteps = transMeta.findPreviousSteps( stepMeta ); for ( StepMeta prevStep : prevSteps ) { // See what the target steps are. // If one of the target steps is our original step, we can't start multiple copies // String[] targetSteps = prevStep.getStepMetaInterface().getStepIOMeta().getTargetStepnames(); if ( targetSteps != null ) { for ( int t = 0; t < targetSteps.length && enabled; t++ ) { if ( !Utils.isEmpty( targetSteps[ t ] ) && targetSteps[ t ].equalsIgnoreCase( stepMeta.getName() ) ) { enabled = false; } } } } return enabled; }
@Test public void getThisStepFieldsPassesClonedInfoRowMeta() throws Exception { // given StepMetaInterface smi = mock( StepMetaInterface.class ); StepIOMeta ioMeta = mock( StepIOMeta.class ); when( smi.getStepIOMeta() ).thenReturn( ioMeta ); StepMeta thisStep = mockStepMeta( "thisStep" ); StepMeta nextStep = mockStepMeta( "nextStep" ); when( thisStep.getStepMetaInterface() ).thenReturn( smi ); RowMeta row = new RowMeta(); when( smi.getTableFields() ).thenReturn( row ); // when transMeta.getThisStepFields( thisStep, nextStep, row ); // then verify( smi, never() ).getFields( any(), any(), eq( new RowMetaInterface[] { row } ), any(), any(), any(), any() ); }
private StepMetaInterface stepMetaInterfaceWithFields( StepMetaInterface smi, List<String> infoStepnames, List<String> fieldNames ) throws KettleStepException { RowMeta rowMetaWithFields = new RowMeta(); StepIOMeta stepIOMeta = mock( StepIOMeta.class ); when( stepIOMeta.getInfoStepnames() ).thenReturn( infoStepnames.toArray( new String[ 0 ] ) ); fieldNames.stream() .forEach( field -> rowMetaWithFields.addValueMeta( new ValueMetaString( field ) ) ); StepMetaInterface newSmi = spy( smi ); when( newSmi.getStepIOMeta() ).thenReturn( stepIOMeta ); doAnswer( (Answer<Void>) invocationOnMock -> { RowMetaInterface passedRmi = (RowMetaInterface) invocationOnMock.getArguments()[ 0 ]; passedRmi.addRowMeta( rowMetaWithFields ); return null; } ).when( newSmi ) .getFields( any(), any(), any(), any(), any(), any(), any() ); return newSmi; }
@Test public void getThisStepFieldsPassesCloneRowMeta() throws Exception { final String overriddenValue = "overridden"; StepMeta nextStep = mockStepMeta( "nextStep" ); StepMetaInterface smi = mock( StepMetaInterface.class ); StepIOMeta ioMeta = mock( StepIOMeta.class ); when( smi.getStepIOMeta() ).thenReturn( ioMeta ); doAnswer( new Answer<Object>() { @Override public Object answer( InvocationOnMock invocation ) throws Throwable { RowMetaInterface rmi = (RowMetaInterface) invocation.getArguments()[ 0 ]; rmi.clear(); rmi.addValueMeta( new ValueMetaString( overriddenValue ) ); return null; } } ).when( smi ).getFields( any( RowMetaInterface.class ), anyString(), any( RowMetaInterface[].class ), eq( nextStep ), any( VariableSpace.class ), any( Repository.class ), any( IMetaStore.class ) ); StepMeta thisStep = mockStepMeta( "thisStep" ); when( thisStep.getStepMetaInterface() ).thenReturn( smi ); RowMeta rowMeta = new RowMeta(); rowMeta.addValueMeta( new ValueMetaString( "value" ) ); RowMetaInterface thisStepsFields = transMeta.getThisStepFields( thisStep, nextStep, rowMeta ); assertEquals( 1, thisStepsFields.size() ); assertEquals( overriddenValue, thisStepsFields.getValueMeta( 0 ).getName() ); }
final StepMetaInterface stepMetaInterface = step.getStepMetaInterface(); if ( stepMetaInterface != null ) { final StepIOMetaInterface stepIOMeta = stepMetaInterface.getStepIOMeta(); if ( stepIOMeta != null ) { for ( StreamInterface stream : stepIOMeta.getInfoStreams() ) {
Const.indexOfString( ts.getName(), fs.getStepMetaInterface().getStepIOMeta().getTargetStepnames() ) >= 0; StepIOMetaInterface ioMeta = fs.getStepMetaInterface().getStepIOMeta(); StreamInterface targetStream = ioMeta.findTargetStream( ts ); if ( targetStream != null ) { StepIOMetaInterface ioMeta = ts.getStepMetaInterface().getStepIOMeta(); String[] infoStepnames = ioMeta.getInfoStepnames();
StepIOMetaInterface fromIoMeta = fromStep.getStepMetaInterface().getStepIOMeta(); List<StreamInterface> targetStreams = fromIoMeta.getTargetStreams(); if ( forward ) { StepIOMetaInterface toIoMeta = toStep.getStepMetaInterface().getStepIOMeta(); List<StreamInterface> infoStreams = toIoMeta.getInfoStreams(); if ( !forward ) {
StepIOMetaInterface ioMeta = ts.getStepMetaInterface().getStepIOMeta(); List<StreamInterface> infoStreams = ioMeta.getInfoStreams(); if ( !infoStreams.isEmpty() ) {
&& ( ( startHopStep != null && !startHopStep.equals( stepMeta ) ) || ( endHopStep != null && !endHopStep .equals( stepMeta ) ) ) ) { StepIOMetaInterface ioMeta = stepMeta.getStepMetaInterface().getStepIOMeta(); if ( candidate == null ) {
int alpha = gc.getAlpha(); StepIOMetaInterface ioMeta = stepMeta.getStepMetaInterface().getStepIOMeta(); ioMeta = showTargetStreamsStep.getStepMetaInterface().getStepIOMeta(); List<StreamInterface> targetStreams = ioMeta.getTargetStreams(); int targetsWidth = 0;
masterTargetStep.getStepMetaInterface().getStepIOMeta().getInfoStepnames(); if ( infoStepNames != null ) { StepMeta[] is = new StepMeta[infoStepNames.length]; masterTargetStep.getStepMetaInterface().getStepIOMeta().setInfoSteps( infoSteps ); String[] infoStepNames = slaveStep.getStepMetaInterface().getStepIOMeta().getInfoStepnames(); if ( infoStepNames != null ) { StepMeta[] is = new StepMeta[infoStepNames.length]; slaveStep.getStepMetaInterface().getStepIOMeta().setInfoSteps( infoSteps ); TransMeta slave = getSlaveTransformation( clusterSchema, slaveServer ); StepMeta slaveStep = slave.findStep( originalStep.getName() ); String[] infoStepNames = slaveStep.getStepMetaInterface().getStepIOMeta().getInfoStepnames(); if ( infoStepNames != null ) { StepMeta[] is = new StepMeta[infoStepNames.length]; slaveStep.getStepMetaInterface().getStepIOMeta().setInfoSteps( infoSteps );
StepIOMetaInterface fromIo = fromStep.getStepMetaInterface().getStepIOMeta(); for ( StreamInterface stream : fromIo.getTargetStreams() ) { if ( stream.getStepMeta() != null && stream.getStepMeta().equals( toStep ) ) { StepIOMetaInterface toIo = toStep.getStepMetaInterface().getStepIOMeta(); for ( StreamInterface stream : toIo.getInfoStreams() ) { if ( stream.getStepMeta() != null && stream.getStepMeta().equals( fromStep ) ) {