Search in sources :

Example 11 with RMNodeData

use of org.ow2.proactive.resourcemanager.db.RMNodeData 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 12 with RMNodeData

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

the class RMDBManagerTest method testAddRMNodeData.

@Test
public void testAddRMNodeData() {
    RMNodeData d = addRMNodeData(NODE_NAME_BASE, NODE_STATE_BASE);
    Collection<RMNodeData> allNodes = dbManager.getAllNodes();
    assertThat(allNodes).hasSize(1);
    for (RMNodeData node : allNodes) {
        assertThat(node.getName()).isEqualTo(NODE_NAME_BASE);
        assertThat(node.getNodeUrl()).isEqualTo(NODE_URL);
        assertThat(node.getState()).isEqualTo(NODE_STATE_BASE);
        assertThat(node.getStateChangeTime()).isEqualTo(STATE_CHANGE_TIME_BASE);
        assertThat(node.getOwner().getId()).isEqualTo(OWNER_ID);
        assertThat(node.getProvider().getId()).isEqualTo(PROVIDER_ID);
        assertThat(node.getUserPermission().getName()).isEqualTo(PERMISSION_NAME);
        assertThat(node.getHostname()).isEqualTo(HOSTNAME);
        assertThat(node.getJmxUrls()[0]).isEqualTo(JMX_URLS[0]);
        assertThat(node.getJmxUrls()[1]).isEqualTo(JMX_URLS[1]);
        assertThat(node.getJvmName()).isEqualTo(JVM_NAME);
    }
}
Also used : RMNodeData(org.ow2.proactive.resourcemanager.db.RMNodeData) Test(org.junit.Test)

Example 13 with RMNodeData

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

the class RMDBManagerTest method testRemoveRMNodeData.

@Test
public void testRemoveRMNodeData() {
    RMNodeData rmNodeData = addRMNodeData(NODE_NAME_BASE, NODE_STATE_BASE);
    dbManager.removeNode(rmNodeData, NODE_SOURCE_NAME_BASE);
    Collection<RMNodeData> allNodes = dbManager.getAllNodes();
    assertThat(allNodes).hasSize(0);
}
Also used : RMNodeData(org.ow2.proactive.resourcemanager.db.RMNodeData) Test(org.junit.Test)

Example 14 with RMNodeData

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

the class RMDBManagerTest method testRemoveDeployingNode.

@Test
public void testRemoveDeployingNode() {
    addRMNodeData(NODE_NAME_BASE + "1", NODE_STATE_BASE);
    RMNodeData rmNodeData = addRMNodeData(NODE_NAME_BASE + "2", NodeState.DEPLOYING);
    addRMNodeData(NODE_NAME_BASE + "3", NODE_STATE_BASE);
    dbManager.removeNode(rmNodeData, NODE_SOURCE_NAME_BASE);
    Collection<RMNodeData> allNodes = dbManager.getAllNodes();
    assertThat(allNodes).hasSize(2);
    for (RMNodeData node : allNodes) {
        assertThat(node.getName()).startsWith(NODE_NAME_BASE);
        assertThat(node.getNodeUrl()).isEqualTo(NODE_URL);
        // no more deploying nodes should be returned
        assertThat(node.getState()).isNotEqualTo(NodeState.DEPLOYING);
        assertThat(node.getStateChangeTime()).isEqualTo(STATE_CHANGE_TIME_BASE);
        assertThat(node.getOwner().getId()).isEqualTo(OWNER_ID);
        assertThat(node.getProvider().getId()).isEqualTo(PROVIDER_ID);
        assertThat(node.getUserPermission().getName()).isEqualTo(PERMISSION_NAME);
        assertThat(node.getHostname()).isEqualTo(HOSTNAME);
        assertThat(node.getJmxUrls()[0]).isEqualTo(JMX_URLS[0]);
        assertThat(node.getJmxUrls()[1]).isEqualTo(JMX_URLS[1]);
        assertThat(node.getJvmName()).isEqualTo(JVM_NAME);
    }
}
Also used : RMNodeData(org.ow2.proactive.resourcemanager.db.RMNodeData) Test(org.junit.Test)

Example 15 with RMNodeData

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

the class RMDBManagerTest method testUpdateRMNodeData.

@Test
public void testUpdateRMNodeData() {
    RMNodeData rmNodeData = addRMNodeData(NODE_NAME_BASE, NODE_STATE_BASE);
    rmNodeData.setState(NodeState.BUSY);
    rmNodeData.setStateChangeTime(5678);
    dbManager.updateNode(rmNodeData, NODE_SOURCE_NAME_BASE);
    Collection<RMNodeData> allNodes = dbManager.getAllNodes();
    assertThat(allNodes).hasSize(1);
    for (RMNodeData node : allNodes) {
        assertThat(node.getName()).startsWith(NODE_NAME_BASE);
        assertThat(node.getName()).isEqualTo(NODE_NAME_BASE);
        assertThat(node.getNodeUrl()).isEqualTo(NODE_URL);
        assertThat(node.getState()).isEqualTo(NodeState.BUSY);
        assertThat(node.getStateChangeTime()).isEqualTo(5678);
        assertThat(node.getOwner().getId()).isEqualTo(OWNER_ID);
        assertThat(node.getProvider().getId()).isEqualTo(PROVIDER_ID);
        assertThat(node.getUserPermission().getName()).isEqualTo(PERMISSION_NAME);
        assertThat(node.getHostname()).isEqualTo(HOSTNAME);
        assertThat(node.getJmxUrls()[0]).isEqualTo(JMX_URLS[0]);
        assertThat(node.getJmxUrls()[1]).isEqualTo(JMX_URLS[1]);
        assertThat(node.getJvmName()).isEqualTo(JVM_NAME);
    }
}
Also used : RMNodeData(org.ow2.proactive.resourcemanager.db.RMNodeData) Test(org.junit.Test)

Aggregations

RMNodeData (org.ow2.proactive.resourcemanager.db.RMNodeData)18 Test (org.junit.Test)12 RMNode (org.ow2.proactive.resourcemanager.rmnode.RMNode)4 HashMap (java.util.HashMap)2 NodeSourceData (org.ow2.proactive.resourcemanager.db.NodeSourceData)2 Node (org.objectweb.proactive.core.node.Node)1 NodeState (org.ow2.proactive.resourcemanager.common.NodeState)1 AbstractRMNode (org.ow2.proactive.resourcemanager.rmnode.AbstractRMNode)1 RMNodeImpl (org.ow2.proactive.resourcemanager.rmnode.RMNodeImpl)1