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