Search in sources :

Example 21 with SlaveServer

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;
}
Also used : SlaveServer(org.pentaho.di.cluster.SlaveServer) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta)

Example 22 with SlaveServer

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));
    }
}
Also used : RepositoryElementInterface(org.pentaho.di.repository.RepositoryElementInterface) PartitionSchema(org.pentaho.di.partition.PartitionSchema) RepositoryObjectType(org.pentaho.di.repository.RepositoryObjectType) List(java.util.List) SharedObjectInterface(org.pentaho.di.shared.SharedObjectInterface) SlaveServer(org.pentaho.di.cluster.SlaveServer) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) ClusterSchema(org.pentaho.di.cluster.ClusterSchema) Test(org.junit.Test)

Example 23 with SlaveServer

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;
}
Also used : SlaveServer(org.pentaho.di.cluster.SlaveServer)

Example 24 with 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());
}
Also used : SlaveServer(org.pentaho.di.cluster.SlaveServer) Test(org.junit.Test)

Example 25 with SlaveServer

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());
    }
}
Also used : RepositoryElementInterface(org.pentaho.di.repository.RepositoryElementInterface) SlaveServer(org.pentaho.di.cluster.SlaveServer) MetaStoreException(org.pentaho.metastore.api.exceptions.MetaStoreException) BeansException(org.springframework.beans.BeansException) MetaStoreNamespaceExistsException(org.pentaho.metastore.api.exceptions.MetaStoreNamespaceExistsException) MetaStoreDependenciesExistsException(org.pentaho.metastore.api.exceptions.MetaStoreDependenciesExistsException) SAXException(org.xml.sax.SAXException) KettleException(org.pentaho.di.core.exception.KettleException) SAXParseException(org.xml.sax.SAXParseException) Test(org.junit.Test)

Aggregations

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