Search in sources :

Example 11 with JobMeta

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

the class SharedObjectSyncUtilTest method synchronizeConnectionsRename.

@Test
public void synchronizeConnectionsRename() throws Exception {
    final String databaseName = BEFORE_SYNC_VALUE;
    DatabaseMeta sharedDB0 = createDatabaseMeta(databaseName, true);
    saveSharedObjects(SHARED_OBJECTS_FILE, sharedDB0);
    JobMeta job1 = createJobMeta();
    spoonDelegates.jobs.addJob(job1);
    JobMeta job2 = createJobMeta();
    spoonDelegates.jobs.addJob(job2);
    DatabaseMeta sharedDB2 = job2.getDatabase(0);
    assertEquals(databaseName, sharedDB2.getName());
    DatabaseMeta sharedDB1 = job1.getDatabase(0);
    assertEquals(databaseName, sharedDB1.getName());
    assertTrue(sharedDB1 != sharedDB2);
    assertThat(sharedDB1.getName(), equalTo(BEFORE_SYNC_VALUE));
    sharedDB2.setName(AFTER_SYNC_VALUE);
    sharedUtil.synchronizeConnections(sharedDB2, BEFORE_SYNC_VALUE);
    assertThat(sharedDB1.getName(), equalTo(AFTER_SYNC_VALUE));
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) Test(org.junit.Test)

Example 12 with JobMeta

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

the class SharedObjectSyncUtilTest method synchronizeSlaveServers_sync_shared_only.

@Test
public void synchronizeSlaveServers_sync_shared_only() throws Exception {
    final String slaveServerName = "SlaveServer";
    JobMeta job1 = createJobMeta();
    SlaveServer slaveServer1 = createSlaveServer(slaveServerName, true);
    job1.setSlaveServers(Collections.singletonList(slaveServer1));
    spoonDelegates.jobs.addJob(job1);
    JobMeta job2 = createJobMeta();
    SlaveServer unsharedSlaveServer2 = createSlaveServer(slaveServerName, false);
    job2.setSlaveServers(Collections.singletonList(unsharedSlaveServer2));
    spoonDelegates.jobs.addJob(job2);
    JobMeta job3 = createJobMeta();
    SlaveServer slaveServer3 = createSlaveServer(slaveServerName, true);
    job3.setSlaveServers(Collections.singletonList(slaveServer3));
    spoonDelegates.jobs.addJob(job3);
    slaveServer3.setHostname(AFTER_SYNC_VALUE);
    sharedUtil.synchronizeSlaveServers(slaveServer3);
    assertThat(slaveServer1.getHostname(), equalTo(AFTER_SYNC_VALUE));
    assertThat(unsharedSlaveServer2.getHostname(), equalTo(BEFORE_SYNC_VALUE));
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) SlaveServer(org.pentaho.di.cluster.SlaveServer) Test(org.junit.Test)

Example 13 with JobMeta

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

the class SharedObjectSyncUtilTest method synchronizeConnectionsOpenNew.

@Test
public void synchronizeConnectionsOpenNew() throws Exception {
    final String databaseName = "SharedDB";
    DatabaseMeta sharedDB0 = createDatabaseMeta(databaseName, true);
    saveSharedObjects(SHARED_OBJECTS_FILE, sharedDB0);
    JobMeta job1 = createJobMeta();
    spoonDelegates.jobs.addJob(job1);
    DatabaseMeta sharedDB1 = job1.getDatabase(0);
    JobMeta job2 = createJobMeta();
    spoonDelegates.jobs.addJob(job2);
    DatabaseMeta sharedDB2 = job2.getDatabase(0);
    assertThat(sharedDB1.getHostname(), equalTo(BEFORE_SYNC_VALUE));
    sharedDB2.setHostname(AFTER_SYNC_VALUE);
    sharedUtil.synchronizeConnections(sharedDB2, sharedDB2.getName());
    assertThat(sharedDB1.getHostname(), equalTo(AFTER_SYNC_VALUE));
    JobMeta job3 = createJobMeta();
    spoonDelegates.jobs.addJob(job3);
    DatabaseMeta sharedDB3 = job3.getDatabase(0);
    assertThat(sharedDB3.getHostname(), equalTo(AFTER_SYNC_VALUE));
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) Test(org.junit.Test)

Example 14 with JobMeta

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

the class SharedObjectSyncUtilTest method synchronizeConnections.

@Test
public void synchronizeConnections() throws Exception {
    final String databaseName = "SharedDB";
    DatabaseMeta sharedDB0 = createDatabaseMeta(databaseName, true);
    saveSharedObjects(SHARED_OBJECTS_FILE, sharedDB0);
    JobMeta job1 = createJobMeta();
    spoonDelegates.jobs.addJob(job1);
    JobMeta job2 = createJobMeta();
    spoonDelegates.jobs.addJob(job2);
    DatabaseMeta sharedDB2 = job2.getDatabase(0);
    assertEquals(databaseName, sharedDB2.getName());
    DatabaseMeta sharedDB1 = job1.getDatabase(0);
    assertEquals(databaseName, sharedDB1.getName());
    assertTrue(sharedDB1 != sharedDB2);
    assertThat(sharedDB1.getHostname(), equalTo(BEFORE_SYNC_VALUE));
    sharedDB2.setHostname(AFTER_SYNC_VALUE);
    sharedUtil.synchronizeConnections(sharedDB2, sharedDB2.getName());
    assertThat(sharedDB1.getHostname(), equalTo(AFTER_SYNC_VALUE));
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) Test(org.junit.Test)

Example 15 with JobMeta

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

the class SharedObjectSyncUtilTest method synchronizeSlaveServerRenameBackAndForth.

@Test
public void synchronizeSlaveServerRenameBackAndForth() throws Exception {
    final String serverName = "SharedServer";
    SlaveServer server0 = createSlaveServer(serverName, true);
    saveSharedObjects(SHARED_OBJECTS_FILE, server0);
    JobMeta j1 = createJobMeta();
    spoonDelegates.jobs.addJob(j1);
    JobMeta j2 = createJobMeta();
    spoonDelegates.jobs.addJob(j2);
    final String name2 = "NAME 2";
    when(spoon.getActiveMeta()).thenReturn(j1);
    SlaveServer server1 = j1.getSlaveServers().get(0);
    server1.setName(name2);
    sharedUtil.synchronizeSlaveServers(server1, serverName);
    SlaveServer server2 = j2.getSlaveServers().get(0);
    assertTrue(server2.getName().equals(name2));
    when(spoon.getActiveMeta()).thenReturn(j2);
    server2.setName("name3");
    sharedUtil.synchronizeSlaveServers(server2, name2);
    assertTrue(server1.getName().equals(server2.getName()));
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) SlaveServer(org.pentaho.di.cluster.SlaveServer) 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