use of org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration in project pentaho-kettle by pentaho.
the class RunConfigurationManagerTest method testLoadByName.
@Test
public void testLoadByName() {
DefaultRunConfiguration defaultRunConfiguration = (DefaultRunConfiguration) executionConfigurationManager.load("Default Configuration");
assertNotNull(defaultRunConfiguration);
assertEquals(defaultRunConfiguration.getName(), "Default Configuration");
}
use of org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration in project pentaho-kettle by pentaho.
the class RunConfigurationManagerTest method testGetRunConfigurationByType.
@Test
public void testGetRunConfigurationByType() {
DefaultRunConfiguration defaultRunConfiguration = (DefaultRunConfiguration) executionConfigurationManager.getRunConfigurationByType(DefaultRunConfiguration.TYPE);
SparkRunConfiguration sparkRunConfiguration = (SparkRunConfiguration) executionConfigurationManager.getRunConfigurationByType(SparkRunConfiguration.TYPE);
assertNotNull(defaultRunConfiguration);
assertNotNull(sparkRunConfiguration);
}
use of org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration in project pentaho-kettle by pentaho.
the class RunConfigurationImportExtensionPointTest method shouldCreateRunConfigurationsForSlaveServer.
@Test
public void shouldCreateRunConfigurationsForSlaveServer() throws Exception {
JobMeta jobMeta = mock(JobMeta.class);
JobEntryCopy jobEntryCopy1 = mock(JobEntryCopy.class);
JobEntryCopy jobEntryCopy2 = mock(JobEntryCopy.class);
JobEntryCopy jobEntryCopy3 = mock(JobEntryCopy.class);
JobEntryTrans trans1 = mock(JobEntryTrans.class);
JobEntryTrans trans2 = mock(JobEntryTrans.class);
JobEntryTrans trans3 = mock(JobEntryTrans.class);
ArgumentCaptor<DefaultRunConfiguration> rcCaptor = ArgumentCaptor.forClass(DefaultRunConfiguration.class);
when(jobMeta.getEmbeddedMetaStore()).thenReturn(embeddedMetaStore);
when(jobMeta.getSlaveServers()).thenReturn(Arrays.asList(new SlaveServer("carte1", "host1", "1234", "user", "passw"), new SlaveServer("carte2", "host2", "1234", "user", "passw")));
when(jobMeta.getJobCopies()).thenReturn(Arrays.asList(jobEntryCopy1, jobEntryCopy2, jobEntryCopy3));
when(jobEntryCopy1.getEntry()).thenReturn(trans1);
when(jobEntryCopy2.getEntry()).thenReturn(trans2);
when(jobEntryCopy3.getEntry()).thenReturn(trans3);
when(trans1.getRemoteSlaveServerName()).thenReturn("carte1");
when(trans2.getRemoteSlaveServerName()).thenReturn("carte1");
when(trans3.getRemoteSlaveServerName()).thenReturn("carte2");
when(trans1.getRunConfiguration()).thenReturn(null);
when(trans2.getRunConfiguration()).thenReturn(null);
when(trans3.getRunConfiguration()).thenReturn(null);
when(runConfigurationManager.getNames()).thenReturn(Collections.singletonList("pentaho_auto_carte1_config"));
runConfigurationImportExtensionPoint.callExtensionPoint(log, jobMeta);
verify(runConfigurationManager, times(2)).save(rcCaptor.capture());
verify(trans1).setRunConfiguration("pentaho_auto_carte1_config_1");
verify(trans2).setRunConfiguration("pentaho_auto_carte1_config_1");
verify(trans3).setRunConfiguration("pentaho_auto_carte2_config");
List<DefaultRunConfiguration> allValues = rcCaptor.getAllValues();
DefaultRunConfiguration runConfiguration1 = allValues.get(0);
assertEquals("pentaho_auto_carte1_config_1", runConfiguration1.getName());
assertEquals("carte1", runConfiguration1.getServer());
DefaultRunConfiguration runConfiguration2 = allValues.get(1);
assertEquals("pentaho_auto_carte2_config", runConfiguration2.getName());
assertEquals("carte2", runConfiguration2.getServer());
}
use of org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration in project pentaho-kettle by pentaho.
the class RunConfigurationDelegateTest method testDelete.
@Test
public void testDelete() throws Exception {
RunConfigurationDeleteDialog dialog = mock(RunConfigurationDeleteDialog.class);
whenNew(RunConfigurationDeleteDialog.class).withAnyArguments().thenReturn(dialog);
DefaultRunConfiguration config = new DefaultRunConfiguration();
config.setName("Test");
config.setServer("localhost");
doReturn(SWT.YES).when(dialog).open();
delegate.delete(config);
verify(service, times(1)).delete("Test");
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 testEdit.
@Test
public void testEdit() throws Exception {
RunConfigurationDialog dialog = mock(RunConfigurationDialog.class);
whenNew(RunConfigurationDialog.class).withAnyArguments().thenReturn(dialog);
DefaultRunConfiguration config = new DefaultRunConfiguration();
config.setName("Test");
config.setServer("localhost");
doReturn(config).when(dialog).open();
doNothing().when(delegate).updateLoadedJobs("Test", config);
delegate.edit(config);
verify(delegate, times(1)).updateLoadedJobs("Test", config);
verify(service, times(1)).delete("Test");
verify(service, times(1)).save(config);
verify(spoon, times(1)).refreshTree();
}
Aggregations