use of org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration in project pentaho-kettle by pentaho.
the class RunConfigurationDelegate method create.
public void create() {
List<String> names = configurationManager.getNames();
String name = BaseMessages.getString(PKG, "RunConfigurationPopupMenuExtension.Configuration.Default") + " ";
int index = 1;
while (names.contains(name + String.valueOf(index))) {
index++;
}
name = name + String.valueOf(index);
DefaultRunConfiguration defaultRunConfiguration = new DefaultRunConfiguration();
defaultRunConfiguration.setName(name);
RunConfigurationDialog dialog = new RunConfigurationDialog(spoonSupplier.get().getShell(), configurationManager, defaultRunConfiguration);
RunConfiguration savedRunConfiguration = dialog.open();
if (savedRunConfiguration != null) {
configurationManager.save(savedRunConfiguration);
spoonSupplier.get().refreshTree();
}
}
use of org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration in project pentaho-kettle by pentaho.
the class RunConfigurationDelegateTest method testCreate.
@Test
public void testCreate() throws Exception {
RunConfigurationDialog dialog = mock(RunConfigurationDialog.class);
whenNew(RunConfigurationDialog.class).withAnyArguments().thenReturn(dialog);
List<String> list = new ArrayList<>();
list.add("Configuration 1");
DefaultRunConfiguration config = new DefaultRunConfiguration();
config.setName("Test");
config.setServer("localhost");
doReturn(list).when(service).getNames();
doReturn(config).when(dialog).open();
delegate.create();
verify(service, times(1)).save(config);
verify(spoon, times(1)).refreshTree();
}
use of org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration in project pentaho-kettle by pentaho.
the class RunConfigurationDelegateTest method testUpdateLoadedJobs_PDI16777.
@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());
}
use of org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration in project pentaho-kettle by pentaho.
the class RunConfigurationImportExtensionPoint method createSlaveServerRunConfigurations.
private List<RunConfiguration> createSlaveServerRunConfigurations(List<String> existingConfigurationNames, AbstractMeta abstractMeta) {
List<RunConfiguration> runConfigurations = new ArrayList<>();
if (abstractMeta instanceof JobMeta) {
JobMeta jobMeta = (JobMeta) abstractMeta;
Map<String, List<JobEntryTrans>> slaveServerGroups = jobMeta.getJobCopies().stream().map(JobEntryCopy::getEntry).filter(entry -> entry instanceof JobEntryTrans).map(entry -> (JobEntryTrans) entry).filter(entry -> Utils.isEmpty(entry.getRunConfiguration())).filter(entry -> !Utils.isEmpty(entry.getRemoteSlaveServerName())).collect(Collectors.groupingBy(JobEntryTrans::getRemoteSlaveServerName));
slaveServerGroups.forEach((remoteServerName, entries) -> {
String runConfigurationName = createRunConfigurationName(existingConfigurationNames, remoteServerName);
DefaultRunConfiguration runConfiguration = createRunConfiguration(runConfigurationName, remoteServerName);
runConfigurations.add(runConfiguration);
entries.forEach(e -> e.setRunConfiguration(runConfiguration.getName()));
});
}
return runConfigurations;
}
use of org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration in project pentaho-kettle by pentaho.
the class RunConfigurationManagerTest method testSaveAndDelete.
@Test
public void testSaveAndDelete() {
DefaultRunConfiguration defaultRunConfiguration = new DefaultRunConfiguration();
defaultRunConfiguration.setName("New Run Configuration");
executionConfigurationManager.save(defaultRunConfiguration);
DefaultRunConfiguration loadedRunConfiguration = (DefaultRunConfiguration) executionConfigurationManager.load("New Run Configuration");
assertEquals(loadedRunConfiguration.getName(), defaultRunConfiguration.getName());
executionConfigurationManager.delete("New Run Configuration");
loadedRunConfiguration = (DefaultRunConfiguration) executionConfigurationManager.load("New Run Configuration");
assertNull(loadedRunConfiguration);
}
Aggregations