Search in sources :

Example 11 with DefaultRunConfiguration

use of org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration in project pentaho-kettle by pentaho.

the class RunConfigurationDelegateTest method testUpdateLoadedJobs_Exception.

@Test
public void testUpdateLoadedJobs_Exception() throws Exception {
    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");
    LogChannelInterface log = mock(LogChannelInterface.class);
    doReturn(log).when(spoon).getLog();
    PowerMockito.mockStatic(ExtensionPointHandler.class);
    PowerMockito.when(ExtensionPointHandler.class, "callExtensionPoint", any(), any(), any()).thenThrow(KettleException.class);
    delegate.updateLoadedJobs("key", config);
    verify(log, times(1)).logBasic(any());
}
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) ExtensionPointHandler(org.pentaho.di.core.extension.ExtensionPointHandler) LogChannelInterface(org.pentaho.di.core.logging.LogChannelInterface) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 12 with DefaultRunConfiguration

use of org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration in project pentaho-kettle by pentaho.

the class RunConfigurationImportExtensionPoint method createRunConfiguration.

private DefaultRunConfiguration createRunConfiguration(String configurationName, String slaveServerName) {
    DefaultRunConfiguration runConfiguration = new DefaultRunConfiguration();
    runConfiguration.setName(configurationName);
    runConfiguration.setServer(slaveServerName);
    runConfiguration.setLocal(false);
    runConfiguration.setRemote(true);
    return runConfiguration;
}
Also used : DefaultRunConfiguration(org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration)

Example 13 with DefaultRunConfiguration

use of org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration in project pentaho-kettle by pentaho.

the class RunConfigurationManagerTest method setup.

@Before
public void setup() throws Exception {
    MemoryMetaStore memoryMetaStore = new MemoryMetaStore();
    MetastoreLocator metastoreLocator = createMetastoreLocator(memoryMetaStore);
    DefaultRunConfigurationProvider defaultRunConfigurationProvider = new DefaultRunConfigurationProvider(metastoreLocator, defaultRunConfigurationExecutor);
    SparkRunConfigurationExecutor sparkRunConfigurationExecutor = new SparkRunConfigurationExecutor(null);
    SparkRunConfigurationProvider sparkRunConfigurationProvider = new SparkRunConfigurationProvider(metastoreLocator, sparkRunConfigurationExecutor);
    List<RunConfigurationProvider> runConfigurationProviders = new ArrayList<>();
    runConfigurationProviders.add(sparkRunConfigurationProvider);
    executionConfigurationManager = new RunConfigurationManager(runConfigurationProviders);
    executionConfigurationManager.setDefaultRunConfigurationProvider(defaultRunConfigurationProvider);
    DefaultRunConfiguration defaultRunConfiguration = new DefaultRunConfiguration();
    defaultRunConfiguration.setName("Default Configuration");
    defaultRunConfiguration.setDescription("Default Configuration Description");
    defaultRunConfiguration.setLocal(true);
    executionConfigurationManager.save(defaultRunConfiguration);
    SparkRunConfiguration sparkRunConfiguration = new SparkRunConfiguration();
    sparkRunConfiguration.setName("Spark Configuration");
    sparkRunConfiguration.setDescription("Spark Configuration Description");
    sparkRunConfiguration.setUrl("127.0.0.1");
    executionConfigurationManager.save(sparkRunConfiguration);
}
Also used : MemoryMetaStore(org.pentaho.metastore.stores.memory.MemoryMetaStore) DefaultRunConfigurationProvider(org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfigurationProvider) SparkRunConfigurationProvider(org.pentaho.di.engine.configuration.impl.spark.SparkRunConfigurationProvider) SparkRunConfiguration(org.pentaho.di.engine.configuration.impl.spark.SparkRunConfiguration) SparkRunConfigurationExecutor(org.pentaho.di.engine.configuration.impl.spark.SparkRunConfigurationExecutor) ArrayList(java.util.ArrayList) DefaultRunConfiguration(org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration) MetastoreLocator(org.pentaho.osgi.metastore.locator.api.MetastoreLocator) SparkRunConfigurationProvider(org.pentaho.di.engine.configuration.impl.spark.SparkRunConfigurationProvider) RunConfigurationProvider(org.pentaho.di.engine.configuration.api.RunConfigurationProvider) DefaultRunConfigurationProvider(org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfigurationProvider) Before(org.junit.Before)

Example 14 with DefaultRunConfiguration

use of org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration in project pentaho-kettle by pentaho.

the class RunConfigurationManagerTest method testOrdering.

@Test
public void testOrdering() {
    MemoryMetaStore memoryMetaStore = new MemoryMetaStore();
    MetastoreLocator metastoreLocator = createMetastoreLocator(memoryMetaStore);
    DefaultRunConfigurationProvider defaultRunConfigurationProvider = new DefaultRunConfigurationProvider(metastoreLocator, defaultRunConfigurationExecutor);
    SparkRunConfigurationExecutor sparkRunConfigurationExecutor = new SparkRunConfigurationExecutor(null);
    SparkRunConfigurationProvider sparkRunConfigurationProvider = new SparkRunConfigurationProvider(metastoreLocator, sparkRunConfigurationExecutor);
    List<RunConfigurationProvider> runConfigurationProviders = new ArrayList<>();
    runConfigurationProviders.add(sparkRunConfigurationProvider);
    executionConfigurationManager = new RunConfigurationManager(runConfigurationProviders);
    executionConfigurationManager.setDefaultRunConfigurationProvider(defaultRunConfigurationProvider);
    DefaultRunConfiguration defaultRunConfiguration1 = new DefaultRunConfiguration();
    defaultRunConfiguration1.setName("z");
    executionConfigurationManager.save(defaultRunConfiguration1);
    DefaultRunConfiguration defaultRunConfiguration2 = new DefaultRunConfiguration();
    defaultRunConfiguration2.setName("f");
    executionConfigurationManager.save(defaultRunConfiguration2);
    DefaultRunConfiguration defaultRunConfiguration3 = new DefaultRunConfiguration();
    defaultRunConfiguration3.setName("x");
    executionConfigurationManager.save(defaultRunConfiguration3);
    SparkRunConfiguration sparkRunConfiguration = new SparkRunConfiguration();
    sparkRunConfiguration.setName("d");
    executionConfigurationManager.save(sparkRunConfiguration);
    DefaultRunConfiguration defaultRunConfiguration5 = new DefaultRunConfiguration();
    defaultRunConfiguration5.setName("a");
    executionConfigurationManager.save(defaultRunConfiguration5);
    List<RunConfiguration> runConfigurations = executionConfigurationManager.load();
    assertEquals(runConfigurations.get(0).getName(), DefaultRunConfigurationProvider.DEFAULT_CONFIG_NAME);
    assertEquals(runConfigurations.get(1).getName(), "a");
    assertEquals(runConfigurations.get(2).getName(), "d");
    assertEquals(runConfigurations.get(3).getName(), "f");
    assertEquals(runConfigurations.get(4).getName(), "x");
    assertEquals(runConfigurations.get(5).getName(), "z");
    List<String> names = executionConfigurationManager.getNames();
    assertEquals(names.get(0), DefaultRunConfigurationProvider.DEFAULT_CONFIG_NAME);
    assertEquals(names.get(1), "a");
    assertEquals(names.get(2), "d");
    assertEquals(names.get(3), "f");
    assertEquals(names.get(4), "x");
    assertEquals(names.get(5), "z");
}
Also used : DefaultRunConfigurationProvider(org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfigurationProvider) SparkRunConfiguration(org.pentaho.di.engine.configuration.impl.spark.SparkRunConfiguration) ArrayList(java.util.ArrayList) MetastoreLocator(org.pentaho.osgi.metastore.locator.api.MetastoreLocator) MemoryMetaStore(org.pentaho.metastore.stores.memory.MemoryMetaStore) SparkRunConfigurationProvider(org.pentaho.di.engine.configuration.impl.spark.SparkRunConfigurationProvider) RunConfiguration(org.pentaho.di.engine.configuration.api.RunConfiguration) DefaultRunConfiguration(org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration) SparkRunConfiguration(org.pentaho.di.engine.configuration.impl.spark.SparkRunConfiguration) SparkRunConfigurationExecutor(org.pentaho.di.engine.configuration.impl.spark.SparkRunConfigurationExecutor) DefaultRunConfiguration(org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfiguration) SparkRunConfigurationProvider(org.pentaho.di.engine.configuration.impl.spark.SparkRunConfigurationProvider) RunConfigurationProvider(org.pentaho.di.engine.configuration.api.RunConfigurationProvider) DefaultRunConfigurationProvider(org.pentaho.di.engine.configuration.impl.pentaho.DefaultRunConfigurationProvider) 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