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);
}
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);
}
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");
}
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());
}
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));
}
Aggregations