@Test public void testRunsATrans() throws Exception { TransMeta parentMeta = new TransMeta( this.getClass().getResource( "subtrans-executor-parent.ktr" ).getPath(), new Variables() ); TransMeta subMeta = new TransMeta( this.getClass().getResource( "subtrans-executor-sub.ktr" ).getPath(), new Variables() ); LoggingObjectInterface loggingObject = new LoggingObject( "anything" ); Trans parentTrans = new Trans( parentMeta, loggingObject ); SubtransExecutor subtransExecutor = new SubtransExecutor( parentTrans, subMeta, true, new TransExecutorData(), new TransExecutorParameters() ); RowMetaInterface rowMeta = parentMeta.getStepFields( "Data Grid" ); List<RowMetaAndData> rows = Arrays.asList( new RowMetaAndData( rowMeta, "Pentaho", 1L ), new RowMetaAndData( rowMeta, "Pentaho", 2L ), new RowMetaAndData( rowMeta, "Pentaho", 3L ), new RowMetaAndData( rowMeta, "Pentaho", 4L ) ); subtransExecutor.execute( rows ); verify( this.logChannel ) .logBasic( "\n" + "------------> Linenr 1------------------------------\n" + "name = Pentaho\n" + "sum = 10\n" + "\n" + "====================" ); }
public Result execute( List<RowMetaAndData> rows ) throws KettleException { if ( rows.isEmpty() ) { return null; } this.transExecutorData.groupTimeStart = System.currentTimeMillis(); Trans subtrans = this.createSubtrans(); this.transExecutorData.setExecutorTrans( subtrans ); passParametersToTrans( subtrans, rows.get( 0 ) ); Result result = new Result(); result.setRows( rows ); subtrans.setPreviousResult( result ); subtrans.prepareExecution( this.parentTrans.getArguments() ); subtrans.startThreads(); subtrans.waitUntilFinished(); return subtrans.getResult(); }
SubtransExecutor { public Result execute( List<RowMetaAndData> rows ) throws KettleException { if ( rows.isEmpty() ) { return null; } this.transExecutorData.groupTimeStart = System.currentTimeMillis(); Trans subtrans = this.createSubtrans(); this.transExecutorData.setExecutorTrans( subtrans ); passParametersToTrans( subtrans, rows.get( 0 ) ); Result result = new Result(); result.setRows( rows ); subtrans.setPreviousResult( result ); subtrans.prepareExecution( this.parentTrans.getArguments() ); subtrans.startThreads(); subtrans.waitUntilFinished(); return subtrans.getResult(); } }
SubtransExecutor { public Result execute( List<RowMetaAndData> rows ) throws KettleException { if ( rows.isEmpty() ) { return null; } this.transExecutorData.groupTimeStart = System.currentTimeMillis(); Trans subtrans = this.createSubtrans(); this.transExecutorData.setExecutorTrans( subtrans ); passParametersToTrans( subtrans, rows.get( 0 ) ); Result result = new Result(); result.setRows( rows ); subtrans.setPreviousResult( result ); subtrans.prepareExecution( this.parentTrans.getArguments() ); subtrans.startThreads(); subtrans.waitUntilFinished(); return subtrans.getResult(); } SubtransExecutor( Trans parentTrans, TransMeta subtransMeta, boolean shareVariables,
                           TransExecutorData transExecutorData, TransExecutorParameters parameters ); }
SubtransExecutor { public Result execute( List<RowMetaAndData> rows ) throws KettleException { if ( rows.isEmpty() ) { return null; } this.transExecutorData.groupTimeStart = System.currentTimeMillis(); Trans subtrans = this.createSubtrans(); this.transExecutorData.setExecutorTrans( subtrans ); passParametersToTrans( subtrans, rows.get( 0 ) ); Result result = new Result(); result.setRows( rows ); subtrans.setPreviousResult( result ); subtrans.prepareExecution( this.parentTrans.getArguments() ); subtrans.startThreads(); subtrans.waitUntilFinished(); return subtrans.getResult(); } SubtransExecutor( Trans parentTrans, TransMeta subtransMeta, boolean shareVariables,
                           TransExecutorData transExecutorData, TransExecutorParameters parameters ); Result execute( List<RowMetaAndData> rows ); }
SubtransExecutor { public Result execute( List<RowMetaAndData> rows ) throws KettleException { if ( rows.isEmpty() ) { return null; } this.transExecutorData.groupTimeStart = System.currentTimeMillis(); Trans subtrans = this.createSubtrans(); this.transExecutorData.setExecutorTrans( subtrans ); passParametersToTrans( subtrans, rows.get( 0 ) ); Result result = new Result(); result.setRows( rows ); subtrans.setPreviousResult( result ); subtrans.prepareExecution( this.parentTrans.getArguments() ); subtrans.startThreads(); subtrans.waitUntilFinished(); return subtrans.getResult(); } SubtransExecutor( Trans parentTrans, TransMeta subtransMeta, boolean shareVariables,
                           TransExecutorData transExecutorData, TransExecutorParameters parameters ); Result execute( List<RowMetaAndData> rows );  }