Search in sources :

Example 46 with SlaveServer

use of org.pentaho.di.cluster.SlaveServer in project pentaho-kettle by pentaho.

the class SharedObjectSyncUtilTest method synchronizeSlaveServers_use_case_sensitive_name.

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

Example 47 with SlaveServer

use of org.pentaho.di.cluster.SlaveServer 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 48 with SlaveServer

use of org.pentaho.di.cluster.SlaveServer in project pentaho-kettle by pentaho.

the class SharedObjectSyncUtilTest method createSlaveServer.

private static SlaveServer createSlaveServer(String name, boolean shared) {
    SlaveServer slaveServer = new SlaveServer();
    slaveServer.setHostname(BEFORE_SYNC_VALUE);
    slaveServer.setName(name);
    slaveServer.setShared(shared);
    return slaveServer;
}
Also used : SlaveServer(org.pentaho.di.cluster.SlaveServer)

Example 49 with SlaveServer

use of org.pentaho.di.cluster.SlaveServer 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 50 with SlaveServer

use of org.pentaho.di.cluster.SlaveServer in project pentaho-kettle by pentaho.

the class Spoon method doubleClickedInTree.

/**
 * Reaction to double click
 */
private void doubleClickedInTree(Tree tree, boolean shift) {
    TreeSelection[] objects = getTreeObjects(tree);
    if (objects.length != 1) {
        // not yet supported, we can do this later when the OSX bug
        return;
    // goes away
    }
    TreeSelection object = objects[0];
    final Object selection = object.getSelection();
    final Object parent = object.getParent();
    if (selection instanceof Class<?>) {
        if (selection.equals(TransMeta.class)) {
            newTransFile();
        }
        if (selection.equals(JobMeta.class)) {
            newJobFile();
        }
        if (selection.equals(TransHopMeta.class)) {
            newHop((TransMeta) parent);
        }
        if (selection.equals(DatabaseMeta.class)) {
            delegates.db.newConnection();
        }
        if (selection.equals(PartitionSchema.class)) {
            newPartitioningSchema((TransMeta) parent);
        }
        if (selection.equals(ClusterSchema.class)) {
            newClusteringSchema((TransMeta) parent);
        }
        if (selection.equals(SlaveServer.class)) {
            newSlaveServer((HasSlaveServersInterface) parent);
        }
    } else {
        if (selection instanceof TransMeta) {
            TransGraph.editProperties((TransMeta) selection, this, rep, true);
        }
        if (selection instanceof JobMeta) {
            JobGraph.editProperties((JobMeta) selection, this, rep, true);
        }
        if (selection instanceof PluginInterface) {
            PluginInterface plugin = (PluginInterface) selection;
            if (plugin.getPluginType().equals(StepPluginType.class)) {
                TransGraph transGraph = getActiveTransGraph();
                if (transGraph != null) {
                    transGraph.addStepToChain(plugin, shift);
                }
            }
            if (plugin.getPluginType().equals(JobEntryPluginType.class)) {
                JobGraph jobGraph = getActiveJobGraph();
                if (jobGraph != null) {
                    jobGraph.addJobEntryToChain(object.getItemText(), shift);
                }
            }
        }
        if (selection instanceof DatabaseMeta) {
            DatabaseMeta database = (DatabaseMeta) selection;
            delegates.db.editConnection(database);
        }
        if (selection instanceof StepMeta) {
            StepMeta step = (StepMeta) selection;
            delegates.steps.editStep((TransMeta) parent, step);
            sharedObjectSyncUtil.synchronizeSteps(step);
        }
        if (selection instanceof JobEntryCopy) {
            editJobEntry((JobMeta) parent, (JobEntryCopy) selection);
        }
        if (selection instanceof TransHopMeta) {
            editHop((TransMeta) parent, (TransHopMeta) selection);
        }
        if (selection instanceof PartitionSchema) {
            editPartitionSchema((TransMeta) parent, (PartitionSchema) selection);
        }
        if (selection instanceof ClusterSchema) {
            delegates.clusters.editClusterSchema((TransMeta) parent, (ClusterSchema) selection);
        }
        if (selection instanceof SlaveServer) {
            editSlaveServer((SlaveServer) selection);
        }
        editSelectionTreeExtension(selection);
    }
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) PartitionSchema(org.pentaho.di.partition.PartitionSchema) PluginInterface(org.pentaho.di.core.plugins.PluginInterface) TransMeta(org.pentaho.di.trans.TransMeta) TransGraph(org.pentaho.di.ui.spoon.trans.TransGraph) SlaveServer(org.pentaho.di.cluster.SlaveServer) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) StepMeta(org.pentaho.di.trans.step.StepMeta) JobGraph(org.pentaho.di.ui.spoon.job.JobGraph) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) RepositoryObject(org.pentaho.di.repository.RepositoryObject) SimpleLoggingObject(org.pentaho.di.core.logging.SimpleLoggingObject) FileObject(org.apache.commons.vfs2.FileObject) TransHopMeta(org.pentaho.di.trans.TransHopMeta) ClusterSchema(org.pentaho.di.cluster.ClusterSchema)

Aggregations

SlaveServer (org.pentaho.di.cluster.SlaveServer)110 KettleException (org.pentaho.di.core.exception.KettleException)35 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)32 Test (org.junit.Test)22 ClusterSchema (org.pentaho.di.cluster.ClusterSchema)22 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)18 PartitionSchema (org.pentaho.di.partition.PartitionSchema)18 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)17 JobMeta (org.pentaho.di.job.JobMeta)16 ObjectId (org.pentaho.di.repository.ObjectId)16 StepMeta (org.pentaho.di.trans.step.StepMeta)14 ArrayList (java.util.ArrayList)13 TransMeta (org.pentaho.di.trans.TransMeta)11 Result (org.pentaho.di.core.Result)10 KettleFileException (org.pentaho.di.core.exception.KettleFileException)10 UnknownParamException (org.pentaho.di.core.parameters.UnknownParamException)10 NotePadMeta (org.pentaho.di.core.NotePadMeta)9 Point (org.pentaho.di.core.gui.Point)8 List (java.util.List)7 KettleXMLException (org.pentaho.di.core.exception.KettleXMLException)7