SynchronizationListener implements ContentChangedListener, StepMetaChangeListenerInterface { @Override public void onStepChange( TransMeta transMeta, StepMeta oldMeta, StepMeta newMeta ) { if ( Objects.equal( oldMeta.getName(), newMeta.getName() ) ) { return; } try { DataServiceMeta dataService = delegate.getDataServiceByStepName( transMeta, oldMeta.getName() ); if ( dataService != null ) { dataService.setStepname( newMeta.getName() ); delegate.save( dataService ); } } catch ( MetaStoreException e ) { delegate.getLogChannel().logError( e.getMessage(), e ); } } SynchronizationListener( DataServiceDelegate delegate,
                                  DataServiceReferenceSynchronizer synchronizer ); @Override void contentChanged( Object parentObject ); @Override void contentSafe( Object parentObject ); @Override void onStepChange( TransMeta transMeta, StepMeta oldMeta, StepMeta newMeta ); void install( TransMeta transMeta ); boolean isPrompt(); void setPrompt( boolean prompt );  }
@Test public void testOnStepChange() throws Exception { StepMeta oldMeta = mock( StepMeta.class ); StepMeta newMeta = mock( StepMeta.class ); when( oldMeta.getName() ).thenReturn( "ORIGINAL STEP" ); when( newMeta.getName() ).thenReturn( "ORIGINAL STEP" ); service.onStepChange( transMeta, oldMeta, newMeta ); when( newMeta.getName() ).thenReturn( "DIFFERENT STEP" ); service.onStepChange( transMeta, oldMeta, newMeta ); verifyNoMoreInteractions( dataServiceMeta ); when( delegate.getDataServiceByStepName( transMeta, "ORIGINAL STEP" ) ) .thenReturn( dataServiceMeta ); service.onStepChange( transMeta, oldMeta, newMeta ); verify( dataServiceMeta ).setStepname( "DIFFERENT STEP" ); verify( delegate ).save( dataServiceMeta ); }