Search in sources :

Example 6 with JobMeta

use of org.pentaho.di.job.JobMeta in project pentaho-kettle by pentaho.

the class JobEntryDialog_ConnectionLine_Test method ignores_WhenNewNameIsUsed.

@Test
public void ignores_WhenNewNameIsUsed() throws Exception {
    JobMeta jobMeta = new JobMeta();
    jobMeta.addDatabase(createDefaultDatabase());
    invokeEditConnectionListener(jobMeta, null);
    assertOnlyDbExists(jobMeta, INITIAL_NAME, INITIAL_HOST);
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) Test(org.junit.Test)

Example 7 with JobMeta

use of org.pentaho.di.job.JobMeta in project pentaho-kettle by pentaho.

the class GraphTest method testDelJobNoSelections.

@Test
public void testDelJobNoSelections() {
    JobMeta jobMeta = mock(JobMeta.class);
    Spoon spoon = mock(Spoon.class);
    when(jobMeta.getSelectedEntries()).thenReturn(Collections.<JobEntryCopy>emptyList());
    JobEntryCopy je = mock(JobEntryCopy.class);
    JobGraph jobGraph = mock(JobGraph.class);
    doCallRealMethod().when(jobGraph).setJobMeta(any(JobMeta.class));
    doCallRealMethod().when(jobGraph).setSpoon(any(Spoon.class));
    doCallRealMethod().when(jobGraph).delSelected(any(JobEntryCopy.class));
    jobGraph.setJobMeta(jobMeta);
    jobGraph.setSpoon(spoon);
    jobGraph.delSelected(je);
    verify(spoon).deleteJobEntryCopies(jobMeta, je);
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) JobGraph(org.pentaho.di.ui.spoon.job.JobGraph) Test(org.junit.Test)

Example 8 with JobMeta

use of org.pentaho.di.job.JobMeta in project pentaho-kettle by pentaho.

the class JobFileListenerTest method testProcessLinkedJobsWithNoFilename.

@Test
public void testProcessLinkedJobsWithNoFilename() {
    JobEntryJob jobJobExecutor = spy(new JobEntryJob());
    jobJobExecutor.setFileName(null);
    jobJobExecutor.setDirectory("/path/to");
    jobJobExecutor.setJobName("Job1");
    jobJobExecutor.setSpecificationMethod(ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME);
    JobEntryCopy jobEntry = mock(JobEntryCopy.class);
    when(jobEntry.getEntry()).thenReturn(jobJobExecutor);
    JobMeta parent = mock(JobMeta.class);
    when(parent.nrJobEntries()).thenReturn(1);
    when(parent.getJobEntry(0)).thenReturn(jobEntry);
    JobMeta result = jobFileListener.processLinkedJobs(parent);
    JobEntryCopy meta = result.getJobEntry(0);
    assertNotNull(meta);
    JobEntryJob resultExecMeta = (JobEntryJob) meta.getEntry();
    assertEquals(ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME, resultExecMeta.getSpecificationMethod());
    assertEquals(resultExecMeta.getDirectory(), "/path/to");
    assertEquals(resultExecMeta.getJobName(), "Job1");
}
Also used : JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) JobMeta(org.pentaho.di.job.JobMeta) JobEntryJob(org.pentaho.di.job.entries.job.JobEntryJob) Test(org.junit.Test)

Example 9 with JobMeta

use of org.pentaho.di.job.JobMeta in project pentaho-kettle by pentaho.

the class SharedObjectSyncUtilTest method synchronizeSlaveServersRename.

@Test
public void synchronizeSlaveServersRename() throws Exception {
    final String originalName = "slave";
    SlaveServer slaveServer = createSlaveServer(originalName, true);
    saveSharedObjects(SHARED_OBJECTS_FILE, slaveServer);
    JobMeta job1 = createJobMeta();
    spoonDelegates.jobs.addJob(job1);
    JobMeta job2 = createJobMeta();
    spoonDelegates.jobs.addJob(job2);
    SlaveServer server1 = job1.getSlaveServers().get(0);
    SlaveServer server2 = job2.getSlaveServers().get(0);
    assertTrue(server1 != server2);
    final String newName = "spartacus";
    server1.setName(newName);
    sharedUtil.synchronizeSlaveServers(server1, originalName);
    assertEquals(1, job1.getSlaveServerNames().length);
    server2 = job2.getSlaveServers().get(0);
    assertEquals(newName, server2.getName());
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) SlaveServer(org.pentaho.di.cluster.SlaveServer) Test(org.junit.Test)

Example 10 with JobMeta

use of org.pentaho.di.job.JobMeta in project pentaho-kettle by pentaho.

the class SharedObjectSyncUtilTest method synchronizeConnections_should_not_sync_unshared.

@Test
public void synchronizeConnections_should_not_sync_unshared() throws Exception {
    final String databaseName = "DB";
    JobMeta job1 = createJobMeta();
    DatabaseMeta sharedDB1 = createDatabaseMeta(databaseName, true);
    job1.addDatabase(sharedDB1);
    spoonDelegates.jobs.addJob(job1);
    DatabaseMeta db2 = createDatabaseMeta(databaseName, false);
    JobMeta job2 = createJobMeta();
    spoonDelegates.jobs.addJob(job2);
    job2.addDatabase(db2);
    db2.setHostname(AFTER_SYNC_VALUE);
    sharedUtil.synchronizeConnections(db2, db2.getName());
    assertThat(sharedDB1.getHostname(), equalTo(BEFORE_SYNC_VALUE));
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) Test(org.junit.Test)

Aggregations

JobMeta (org.pentaho.di.job.JobMeta)254 Test (org.junit.Test)88 TransMeta (org.pentaho.di.trans.TransMeta)69 KettleException (org.pentaho.di.core.exception.KettleException)62 JobEntryCopy (org.pentaho.di.job.entry.JobEntryCopy)48 Job (org.pentaho.di.job.Job)45 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)27 Repository (org.pentaho.di.repository.Repository)25 RepositoryDirectoryInterface (org.pentaho.di.repository.RepositoryDirectoryInterface)25 Point (org.pentaho.di.core.gui.Point)24 ArrayList (java.util.ArrayList)23 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)22 SlaveServer (org.pentaho.di.cluster.SlaveServer)17 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)17 FileObject (org.apache.commons.vfs2.FileObject)16 KettleXMLException (org.pentaho.di.core.exception.KettleXMLException)16 LogChannelInterface (org.pentaho.di.core.logging.LogChannelInterface)15 SimpleLoggingObject (org.pentaho.di.core.logging.SimpleLoggingObject)15 PrintWriter (java.io.PrintWriter)12 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)12