Search in sources :

Example 11 with NodeSourceData

use of org.ow2.proactive.resourcemanager.db.NodeSourceData in project scheduling by ow2-proactive.

the class RMDBManagerTest method testGetRMNodeDataByNodeSource.

@Test
public void testGetRMNodeDataByNodeSource() {
    RMNodeData rmNodeData1 = addRMNodeData(NODE_NAME_BASE + "1", NODE_STATE_BASE);
    // Add another RMNodeData with another NodeSourceData
    RMNodeData rmNodeData2 = new RMNodeData(NODE_NAME_BASE + "2", NODE_URL, null, null, null, NODE_STATE_BASE, STATE_CHANGE_TIME_BASE, HOSTNAME, JMX_URLS, JVM_NAME);
    NodeSourceData newNodeSourceData = new NodeSourceData();
    newNodeSourceData.setName("anotherNodeSourceName");
    newNodeSourceData.setPolicyType("aPolicyType");
    dbManager.addNodeSource(newNodeSourceData);
    rmNodeData2.setNodeSource(newNodeSourceData);
    dbManager.addNode(rmNodeData2, newNodeSourceData.getName());
    Collection<RMNodeData> nodes = dbManager.getNodesByNodeSource(nodeSourceData.getName());
    assertThat(nodes).hasSize(1);
    for (RMNodeData node : nodes) {
        assertThat(node).isEqualTo(rmNodeData1);
    }
}
Also used : RMNodeData(org.ow2.proactive.resourcemanager.db.RMNodeData) NodeSourceData(org.ow2.proactive.resourcemanager.db.NodeSourceData) Test(org.junit.Test)

Example 12 with NodeSourceData

use of org.ow2.proactive.resourcemanager.db.NodeSourceData in project scheduling by ow2-proactive.

the class RMDBManagerTest method testGetSeveralRMNodeDataByNodeSource.

@Test
public void testGetSeveralRMNodeDataByNodeSource() {
    RMNodeData rmNodeData1 = addRMNodeData(NODE_NAME_BASE + "1", NODE_STATE_BASE);
    // Add another RMNodeData with another NodeSourceData
    RMNodeData rmNodeData2 = new RMNodeData(NODE_NAME_BASE + "2", NODE_URL, null, null, null, NODE_STATE_BASE, STATE_CHANGE_TIME_BASE, HOSTNAME, JMX_URLS, JVM_NAME);
    NodeSourceData newNodeSourceData = new NodeSourceData();
    newNodeSourceData.setName("anotherNodeSourceName");
    newNodeSourceData.setPolicyType("aPolicyType");
    dbManager.addNodeSource(newNodeSourceData);
    rmNodeData2.setNodeSource(newNodeSourceData);
    dbManager.addNode(rmNodeData2, newNodeSourceData.getName());
    RMNodeData rmNodeData3 = addRMNodeData(NODE_NAME_BASE + "3", NODE_STATE_BASE);
    Collection<RMNodeData> nodes = dbManager.getNodesByNodeSource(nodeSourceData.getName());
    assertThat(nodes).hasSize(2);
    for (RMNodeData node : nodes) {
        assertThat(node).isAnyOf(rmNodeData1, rmNodeData3);
    }
}
Also used : RMNodeData(org.ow2.proactive.resourcemanager.db.RMNodeData) NodeSourceData(org.ow2.proactive.resourcemanager.db.NodeSourceData) Test(org.junit.Test)

Example 13 with NodeSourceData

use of org.ow2.proactive.resourcemanager.db.NodeSourceData in project scheduling by ow2-proactive.

the class RMDBManagerTest method addNodeSourceData.

private void addNodeSourceData() {
    nodeSourceData = new NodeSourceData();
    nodeSourceData.setName(NODE_SOURCE_NAME_BASE);
    nodeSourceData.setPolicyType(NODE_SOURCE_POLICY);
    dbManager.addNodeSource(nodeSourceData);
}
Also used : NodeSourceData(org.ow2.proactive.resourcemanager.db.NodeSourceData)

Example 14 with NodeSourceData

use of org.ow2.proactive.resourcemanager.db.NodeSourceData in project scheduling by ow2-proactive.

the class RMDBManagerTest method addRMNodeData.

private RMNodeData addRMNodeData(String nodeName, NodeState state) {
    RMNodeData rmNodeData = new RMNodeData(nodeName, NODE_URL, owner, provider, permission, state, STATE_CHANGE_TIME_BASE, HOSTNAME, JMX_URLS, JVM_NAME);
    rmNodeData.setNodeSource(nodeSourceData);
    dbManager.addNode(rmNodeData, NODE_SOURCE_NAME_BASE);
    return rmNodeData;
}
Also used : RMNodeData(org.ow2.proactive.resourcemanager.db.RMNodeData)

Example 15 with NodeSourceData

use of org.ow2.proactive.resourcemanager.db.NodeSourceData in project scheduling by ow2-proactive.

the class NodesRecoveryManager method recoverNodeSourcesAndNodes.

protected void recoverNodeSourcesAndNodes() {
    Collection<NodeSourceData> nodeSources = this.rmCore.getDbManager().getNodeSources();
    this.logPersistedNodeSourceInfo(nodeSources);
    for (NodeSourceData nodeSourceData : nodeSources) {
        String nodeSourceName = nodeSourceData.getName();
        if (NodeSource.DEFAULT_LOCAL_NODES_NODE_SOURCE_NAME.equals(nodeSourceName)) {
            // will be recreated by SchedulerStarter
            this.rmCore.getDbManager().removeNodeSource(nodeSourceName);
        } else {
            this.recoverNodeSourceSuccessfullyOrRemove(nodeSourceData, nodeSourceName);
        }
    }
}
Also used : NodeSourceData(org.ow2.proactive.resourcemanager.db.NodeSourceData)

Aggregations

NodeSourceData (org.ow2.proactive.resourcemanager.db.NodeSourceData)13 Test (org.junit.Test)6 Serializable (java.io.Serializable)4 RMNodeData (org.ow2.proactive.resourcemanager.db.RMNodeData)4 ProActiveTest (org.ow2.tests.ProActiveTest)4 DefaultInfrastructureManager (org.ow2.proactive.resourcemanager.nodesource.infrastructure.DefaultInfrastructureManager)2 StaticPolicy (org.ow2.proactive.resourcemanager.nodesource.policy.StaticPolicy)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 Client (org.ow2.proactive.resourcemanager.authentication.Client)1 RMCore (org.ow2.proactive.resourcemanager.core.RMCore)1 RMMonitoringImpl (org.ow2.proactive.resourcemanager.frontend.RMMonitoringImpl)1