@Test public void testUpdateLoadedJobs_PDI16777() { JobEntryTrans trans = new JobEntryTrans(); trans.setRunConfiguration( "key" ); JobMeta meta = new JobMeta(); meta.addJobEntry( new JobEntryCopy( trans ) ); JobMeta[] jobs = new JobMeta[] { meta }; doReturn( jobs ).when( spoon ).getLoadedJobs(); DefaultRunConfiguration config = new DefaultRunConfiguration(); config.setName( "Test" ); config.setServer( "localhost" ); delegate.updateLoadedJobs( "key", config ); assertEquals( "Test", trans.getRunConfiguration() ); assertEquals( "localhost", trans.getRemoteSlaveServerName() ); }
protected void updateLoadedJobs( String key, RunConfiguration runConfig ) { for ( JobMeta job : spoonSupplier.get().getLoadedJobs() ) { for ( int i = 0; i < job.nrJobEntries(); i++ ) { JobEntryInterface entry = job.getJobEntry( i ).getEntry(); if ( entry instanceof JobEntryRunConfigurableInterface ) { JobEntryRunConfigurableInterface jet = (JobEntryRunConfigurableInterface) entry; if ( jet.getRunConfiguration() != null ) { if ( jet.getRunConfiguration().equals( key ) ) { try { ExtensionPointHandler.callExtensionPoint( job.getLogChannel(), KettleExtensionPoint.JobEntryTransSave.id, new Object[] { job, runConfig.getName() } ); } catch ( KettleException e ) { spoonSupplier.get().getLog().logBasic( "Unable to set run configuration in job " + job.getName() ); } jet.setRunConfiguration( runConfig.getName() ); if ( runConfig instanceof DefaultRunConfiguration ) { jet.setRemoteSlaveServerName( ( (DefaultRunConfiguration) runConfig ).getServer() ); jet.setLoggingRemoteWork( ( (DefaultRunConfiguration) runConfig ).isLogRemoteExecutionLocally() ); } jet.setChanged(); } } } } } }
RunConfigurationDelegate { protected void updateLoadedJobs( String key, RunConfiguration runConfig ) { for ( JobMeta job : spoonSupplier.get().getLoadedJobs() ) { for ( int i = 0; i < job.nrJobEntries(); i++ ) { JobEntryInterface entry = job.getJobEntry( i ).getEntry(); if ( entry instanceof JobEntryRunConfigurableInterface ) { JobEntryRunConfigurableInterface jet = (JobEntryRunConfigurableInterface) entry; if ( jet.getRunConfiguration() != null ) { if ( jet.getRunConfiguration().equals( key ) ) { try { ExtensionPointHandler.callExtensionPoint( job.getLogChannel(), KettleExtensionPoint.JobEntryTransSave.id, new Object[] { job, runConfig.getName() } ); } catch ( KettleException e ) { spoonSupplier.get().getLog().logBasic( "Unable to set run configuration in job " + job.getName() ); } jet.setRunConfiguration( runConfig.getName() ); if ( runConfig instanceof DefaultRunConfiguration ) { jet.setRemoteSlaveServerName( ( (DefaultRunConfiguration) runConfig ).getServer() ); jet.setLoggingRemoteWork( ( (DefaultRunConfiguration) runConfig ).isLogRemoteExecutionLocally() ); } jet.setChanged(); } } } } } } }
RunConfigurationDelegate { protected void updateLoadedJobs( String key, RunConfiguration runConfig ) { for ( JobMeta job : spoonSupplier.get().getLoadedJobs() ) { for ( int i = 0; i < job.nrJobEntries(); i++ ) { JobEntryInterface entry = job.getJobEntry( i ).getEntry(); if ( entry instanceof JobEntryRunConfigurableInterface ) { JobEntryRunConfigurableInterface jet = (JobEntryRunConfigurableInterface) entry; if ( jet.getRunConfiguration() != null ) { if ( jet.getRunConfiguration().equals( key ) ) { try { ExtensionPointHandler.callExtensionPoint( job.getLogChannel(), KettleExtensionPoint.JobEntryTransSave.id, new Object[] { job, runConfig.getName() } ); } catch ( KettleException e ) { spoonSupplier.get().getLog().logBasic( "Unable to set run configuration in job " + job.getName() ); } jet.setRunConfiguration( runConfig.getName() ); if ( runConfig instanceof DefaultRunConfiguration ) { jet.setRemoteSlaveServerName( ( (DefaultRunConfiguration) runConfig ).getServer() ); jet.setLoggingRemoteWork( ( (DefaultRunConfiguration) runConfig ).isLogRemoteExecutionLocally() ); } jet.setChanged(); } } } } } } RunConfigurationDelegate( RunConfigurationService configurationManager ); }
RunConfigurationDelegate { protected void updateLoadedJobs( String key, RunConfiguration runConfig ) { for ( JobMeta job : spoonSupplier.get().getLoadedJobs() ) { for ( int i = 0; i < job.nrJobEntries(); i++ ) { JobEntryInterface entry = job.getJobEntry( i ).getEntry(); if ( entry instanceof JobEntryRunConfigurableInterface ) { JobEntryRunConfigurableInterface jet = (JobEntryRunConfigurableInterface) entry; if ( jet.getRunConfiguration() != null ) { if ( jet.getRunConfiguration().equals( key ) ) { try { ExtensionPointHandler.callExtensionPoint( job.getLogChannel(), KettleExtensionPoint.JobEntryTransSave.id, new Object[] { job, runConfig.getName() } ); } catch ( KettleException e ) { spoonSupplier.get().getLog().logBasic( "Unable to set run configuration in job " + job.getName() ); } jet.setRunConfiguration( runConfig.getName() ); if ( runConfig instanceof DefaultRunConfiguration ) { jet.setRemoteSlaveServerName( ( (DefaultRunConfiguration) runConfig ).getServer() ); jet.setLoggingRemoteWork( ( (DefaultRunConfiguration) runConfig ).isLogRemoteExecutionLocally() ); } jet.setChanged(); } } } } } } RunConfigurationDelegate( RunConfigurationService configurationManager ); void edit( RunConfiguration runConfiguration ); void delete( RunConfiguration runConfiguration ); void create(); List<RunConfiguration> load(); }
RunConfigurationDelegate { protected void updateLoadedJobs( String key, RunConfiguration runConfig ) { for ( JobMeta job : spoonSupplier.get().getLoadedJobs() ) { for ( int i = 0; i < job.nrJobEntries(); i++ ) { JobEntryInterface entry = job.getJobEntry( i ).getEntry(); if ( entry instanceof JobEntryRunConfigurableInterface ) { JobEntryRunConfigurableInterface jet = (JobEntryRunConfigurableInterface) entry; if ( jet.getRunConfiguration() != null ) { if ( jet.getRunConfiguration().equals( key ) ) { try { ExtensionPointHandler.callExtensionPoint( job.getLogChannel(), KettleExtensionPoint.JobEntryTransSave.id, new Object[] { job, runConfig.getName() } ); } catch ( KettleException e ) { spoonSupplier.get().getLog().logBasic( "Unable to set run configuration in job " + job.getName() ); } jet.setRunConfiguration( runConfig.getName() ); if ( runConfig instanceof DefaultRunConfiguration ) { jet.setRemoteSlaveServerName( ( (DefaultRunConfiguration) runConfig ).getServer() ); jet.setLoggingRemoteWork( ( (DefaultRunConfiguration) runConfig ).isLogRemoteExecutionLocally() ); } jet.setChanged(); } } } } } } RunConfigurationDelegate( RunConfigurationService configurationManager ); void edit( RunConfiguration runConfiguration ); void delete( RunConfiguration runConfiguration ); void create(); List<RunConfiguration> load();  }