@Override public void run() { try { start.await(); } catch ( InterruptedException e ) { throw new RuntimeException(); } // run while ( !isStopped() ) { try { tr.fireTransFinishedListeners(); // clean array blocking queue tr.waitUntilFinished(); } catch ( KettleException e ) { throw new RuntimeException(); } } } }
@Test ( expected = KettleException.class ) public void testFireTransFinishedListenersExceptionOnTransFinished() throws Exception { Trans trans = new Trans(); TransListener mockListener = mock( TransListener.class ); doThrow( KettleException.class ).when( mockListener ).transFinished( trans ); trans.setTransListeners( Collections.singletonList( mockListener ) ); trans.fireTransFinishedListeners(); }
@Test public void testFireTransFinishedListeners() throws Exception { Trans trans = new Trans(); TransListener mockListener = mock( TransListener.class ); trans.setTransListeners( Collections.singletonList( mockListener ) ); trans.fireTransFinishedListeners(); verify( mockListener ).transFinished( trans ); }
/** * PDI-14948 - Execution of trans with no steps never ends */ @Test ( timeout = 1000 ) public void transWithNoStepsIsNotEndless() throws Exception { Trans transWithNoSteps = new Trans( new TransMeta() ); transWithNoSteps = spy( transWithNoSteps ); transWithNoSteps.prepareExecution( new String[] {} ); transWithNoSteps.startThreads(); // check trans lifecycle is not corrupted verify( transWithNoSteps ).fireTransStartedListeners(); verify( transWithNoSteps ).fireTransFinishedListeners(); }
@Override public void stepFinished( Trans trans, StepMeta stepMeta, StepInterface step ) { synchronized ( Trans.this ) { nrOfFinishedSteps++; if ( nrOfFinishedSteps >= steps.size() ) { // Set the finished flag // setFinished( true ); // Grab the performance statistics one last time (if enabled) // addStepPerformanceSnapShot(); try { fireTransFinishedListeners(); } catch ( Exception e ) { step.setErrors( step.getErrors() + 1L ); log.logError( getName() + " : " + BaseMessages.getString( PKG, "Trans.Log.UnexpectedErrorAtTransformationEnd" ), e ); } } // If a step fails with an error, we want to kill/stop the others // too... // if ( step.getErrors() > 0 ) { log.logMinimal( BaseMessages.getString( PKG, "Trans.Log.TransformationDetectedErrors" ) ); log.logMinimal( BaseMessages.getString( PKG, "Trans.Log.TransformationIsKillingTheOtherSteps" ) ); killAllNoWait(); } } } };
fireTransFinishedListeners(); } catch ( KettleException e ) {