Search in sources :

Example 6 with DefaultRunConfiguration

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");
}
Also used : DefaultRunConfiguration(org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration) Test(org.junit.Test)

Example 7 with DefaultRunConfiguration

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);
}
Also used : SparkRunConfiguration(org.pentaho.di.engine.configuration.impl.spark.SparkRunConfiguration) DefaultRunConfiguration(org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration) Test(org.junit.Test)

Example 8 with DefaultRunConfiguration

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());
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) JobEntryTrans(org.pentaho.di.job.entries.trans.JobEntryTrans) DefaultRunConfiguration(org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration) SlaveServer(org.pentaho.di.cluster.SlaveServer) Test(org.junit.Test)

Example 9 with DefaultRunConfiguration

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();
}
Also used : DefaultRunConfiguration(org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 10 with DefaultRunConfiguration

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();
}
Also used : DefaultRunConfiguration(org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

DefaultRunConfiguration (org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration)14 Test (org.junit.Test)10 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)5 ArrayList (java.util.ArrayList)4 JobMeta (org.pentaho.di.job.JobMeta)4 JobEntryTrans (org.pentaho.di.job.entries.trans.JobEntryTrans)4 JobEntryCopy (org.pentaho.di.job.entry.JobEntryCopy)4 RunConfiguration (org.pentaho.di.engine.configuration.api.RunConfiguration)3 DefaultRunConfigurationProvider (org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfigurationProvider)3 SparkRunConfiguration (org.pentaho.di.engine.configuration.impl.spark.SparkRunConfiguration)3 LogChannelInterface (org.pentaho.di.core.logging.LogChannelInterface)2 RunConfigurationProvider (org.pentaho.di.engine.configuration.api.RunConfigurationProvider)2 SparkRunConfigurationExecutor (org.pentaho.di.engine.configuration.impl.spark.SparkRunConfigurationExecutor)2 SparkRunConfigurationProvider (org.pentaho.di.engine.configuration.impl.spark.SparkRunConfigurationProvider)2 MemoryMetaStore (org.pentaho.metastore.stores.memory.MemoryMetaStore)2 MetastoreLocator (org.pentaho.osgi.metastore.locator.api.MetastoreLocator)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Comparator (java.util.Comparator)1 List (java.util.List)1 Map (java.util.Map)1