use of org.pentaho.di.cluster.SlaveServer in project pentaho-kettle by pentaho.
the class AbstractMeta method loadSharedObject.
protected boolean loadSharedObject(SharedObjectInterface object) {
if (object instanceof DatabaseMeta) {
DatabaseMeta databaseMeta = (DatabaseMeta) object;
databaseMeta.shareVariablesWith(this);
addOrReplaceDatabase(databaseMeta);
} else if (object instanceof SlaveServer) {
SlaveServer slaveServer = (SlaveServer) object;
slaveServer.shareVariablesWith(this);
addOrReplaceSlaveServer(slaveServer);
} else {
return false;
}
return true;
}
use of org.pentaho.di.cluster.SlaveServer in project pentaho-kettle by pentaho.
the class PurRepository_SharedObjects_IT method loadAllShared.
@Test
public void loadAllShared() throws Exception {
ClusterSchema cluster = cluster();
DatabaseMeta database = database();
SlaveServer slaveServer = slaveServer();
PartitionSchema partition = partition();
purRepository.save(cluster, null, null);
purRepository.save(database, null, null);
purRepository.save(slaveServer, null, null);
purRepository.save(partition, null, null);
Map<RepositoryObjectType, List<? extends SharedObjectInterface>> map = map();
purRepository.readSharedObjects(map, RepositoryObjectType.CLUSTER_SCHEMA, RepositoryObjectType.DATABASE, RepositoryObjectType.SLAVE_SERVER, RepositoryObjectType.PARTITION_SCHEMA);
RepositoryElementInterface[] saved = new RepositoryElementInterface[] { cluster, database, slaveServer, partition };
assertEquals(saved.length, map.size());
for (RepositoryElementInterface sharedObject : saved) {
List<? extends SharedObjectInterface> list = map.get(sharedObject.getRepositoryElementType());
assertEquals(1, list.size());
assertEquals(sharedObject, list.get(0));
}
}
use of org.pentaho.di.cluster.SlaveServer in project pentaho-kettle by pentaho.
the class RepositoryTestBase method createSlaveServer.
protected SlaveServer createSlaveServer(String slaveName) throws Exception {
SlaveServer slaveServer = new SlaveServer();
slaveServer.setName(EXP_SLAVE_NAME.concat(slaveName));
slaveServer.setHostname(EXP_SLAVE_HOSTNAME);
slaveServer.setPort(EXP_SLAVE_PORT);
slaveServer.setUsername(EXP_SLAVE_USERNAME);
slaveServer.setPassword(EXP_SLAVE_PASSWORD);
slaveServer.setProxyHostname(EXP_SLAVE_PROXY_HOSTNAME);
slaveServer.setProxyPort(EXP_SLAVE_PROXY_PORT);
slaveServer.setNonProxyHosts(EXP_SLAVE_NON_PROXY_HOSTS);
slaveServer.setMaster(EXP_SLAVE_MASTER);
return slaveServer;
}
use of org.pentaho.di.cluster.SlaveServer in project pentaho-kettle by pentaho.
the class RepositoryTestBase method testSlaves.
/**
* save(slave) loadSlaveServer() exists() deleteSlave() getSlaveID() getSlaveIDs() getSlaveNames() getSlaveServers()
*/
@Test
public void testSlaves() throws Exception {
SlaveServer slave = createSlaveServer("");
repository.save(slave, VERSION_COMMENT_V1, null);
assertNotNull(slave.getObjectId());
ObjectRevision version = slave.getObjectRevision();
assertNotNull(version);
assertTrue(hasVersionWithComment(slave, VERSION_COMMENT_V1));
// setting repository directory on slave is not supported; use null parent directory
assertTrue(repository.exists(EXP_SLAVE_NAME, null, RepositoryObjectType.SLAVE_SERVER));
SlaveServer fetchedSlave = repository.loadSlaveServer(slave.getObjectId(), null);
assertEquals(EXP_SLAVE_NAME, fetchedSlave.getName());
assertEquals(EXP_SLAVE_HOSTNAME, fetchedSlave.getHostname());
assertEquals(EXP_SLAVE_PORT, fetchedSlave.getPort());
assertEquals(EXP_SLAVE_USERNAME, fetchedSlave.getUsername());
assertEquals(EXP_SLAVE_PASSWORD, fetchedSlave.getPassword());
assertEquals(EXP_SLAVE_PROXY_HOSTNAME, fetchedSlave.getProxyHostname());
assertEquals(EXP_SLAVE_PROXY_PORT, fetchedSlave.getProxyPort());
assertEquals(EXP_SLAVE_NON_PROXY_HOSTS, fetchedSlave.getNonProxyHosts());
assertEquals(EXP_SLAVE_MASTER, fetchedSlave.isMaster());
slave.setHostname(EXP_SLAVE_HOSTNAME_V2);
repository.save(slave, VERSION_COMMENT_V2, null);
assertEquals(VERSION_COMMENT_V2, slave.getObjectRevision().getComment());
fetchedSlave = repository.loadSlaveServer(slave.getObjectId(), null);
assertEquals(EXP_SLAVE_HOSTNAME_V2, fetchedSlave.getHostname());
fetchedSlave = repository.loadSlaveServer(slave.getObjectId(), VERSION_LABEL_V1);
assertEquals(EXP_SLAVE_HOSTNAME, fetchedSlave.getHostname());
assertEquals(slave.getObjectId(), repository.getSlaveID(EXP_SLAVE_NAME));
assertEquals(1, repository.getSlaveIDs(false).length);
assertEquals(1, repository.getSlaveIDs(true).length);
assertEquals(slave.getObjectId(), repository.getSlaveIDs(false)[0]);
assertEquals(1, repository.getSlaveNames(false).length);
assertEquals(1, repository.getSlaveNames(true).length);
assertEquals(EXP_SLAVE_NAME, repository.getSlaveNames(false)[0]);
assertEquals(1, repository.getSlaveServers().size());
assertEquals(EXP_SLAVE_NAME, repository.getSlaveServers().get(0).getName());
repository.deleteSlave(slave.getObjectId());
assertFalse(repository.exists(EXP_SLAVE_NAME, null, RepositoryObjectType.SLAVE_SERVER));
assertEquals(0, repository.getSlaveIDs(false).length);
// shared object deletion is permanent by default
assertEquals(0, repository.getSlaveIDs(true).length);
assertEquals(0, repository.getSlaveNames(false).length);
// shared object deletion is permanent by default
assertEquals(0, repository.getSlaveNames(true).length);
assertEquals(0, repository.getSlaveServers().size());
}
use of org.pentaho.di.cluster.SlaveServer in project pentaho-kettle by pentaho.
the class PurRepositoryIT method doesNotChangeFileWhenFailsToRename_slaves.
@Test
public void doesNotChangeFileWhenFailsToRename_slaves() throws Exception {
final SlaveServer server1 = new SlaveServer();
final SlaveServer server2 = new SlaveServer();
try {
testDoesNotChangeFileWhenFailsToRename(server1, server2, new Callable<RepositoryElementInterface>() {
@Override
public RepositoryElementInterface call() throws Exception {
return repository.loadSlaveServer(server2.getObjectId(), null);
}
});
} finally {
repository.deleteSlave(server1.getObjectId());
repository.deleteSlave(server2.getObjectId());
}
}
Aggregations