Search in sources :

Example 31 with RMNode

use of org.ow2.proactive.resourcemanager.rmnode.RMNode in project scheduling by ow2-proactive.

the class NodeSourceTest method testSetNodeAvailableKnownNode.

@Test
public void testSetNodeAvailableKnownNode() throws RMException {
    Node node = createNode(PROACTIVE_PROGRAMMING_NODE_URL);
    RMNode rmNode = new RMNodeImpl(node, nodeSource, client, mock(Permission.class));
    nodeSource.internalAddNode(node);
    nodeSource.detectedPingedDownNode(node.getNodeInformation().getName(), node.getNodeInformation().getURL());
    assertThat(nodeSource.getDownNodes()).hasSize(1);
    boolean result = nodeSource.setNodeAvailable(rmNode);
    assertThat(result).isTrue();
    assertThat(nodeSource.getDownNodes()).hasSize(0);
}
Also used : RMNode(org.ow2.proactive.resourcemanager.rmnode.RMNode) RMNode(org.ow2.proactive.resourcemanager.rmnode.RMNode) Node(org.objectweb.proactive.core.node.Node) Permission(java.security.Permission) RMNodeImpl(org.ow2.proactive.resourcemanager.rmnode.RMNodeImpl) Test(org.junit.Test)

Example 32 with RMNode

use of org.ow2.proactive.resourcemanager.rmnode.RMNode in project scheduling by ow2-proactive.

the class NodeSourceTest method testSetNodeAvailableUnknownNode.

@Test
public void testSetNodeAvailableUnknownNode() throws RMException {
    Node node = createNode(PROACTIVE_PROGRAMMING_NODE_URL);
    RMNode rmNode = new RMNodeImpl(node, nodeSource, client, mock(Permission.class));
    nodeSource.internalAddNode(node);
    assertThat(nodeSource.getDownNodes()).hasSize(0);
    boolean result = nodeSource.setNodeAvailable(rmNode);
    assertThat(result).isFalse();
    assertThat(nodeSource.getDownNodes()).hasSize(0);
}
Also used : RMNode(org.ow2.proactive.resourcemanager.rmnode.RMNode) RMNode(org.ow2.proactive.resourcemanager.rmnode.RMNode) Node(org.objectweb.proactive.core.node.Node) Permission(java.security.Permission) RMNodeImpl(org.ow2.proactive.resourcemanager.rmnode.RMNodeImpl) Test(org.junit.Test)

Example 33 with RMNode

use of org.ow2.proactive.resourcemanager.rmnode.RMNode in project scheduling by ow2-proactive.

the class InfrastructureManagerTest method testUpdateDeployingNodeKnown.

@Test
public void testUpdateDeployingNodeKnown() {
    RMDeployingNode rmNode = new RMDeployingNode("deploying", nodeSource, "command", null);
    infrastructureManager.addDeployingNodeWithLockAndPersist(rmNode.getNodeURL(), rmNode);
    assertThat(infrastructureManager.getDeployingNodesWithLock()).hasSize(1);
    assertThat(infrastructureManager.getPersistedDeployingNodesUrl()).hasSize(1);
    assertThat(infrastructureManager.getLostNodesWithLock()).hasSize(0);
    assertThat(infrastructureManager.getPersistedLostNodesUrl()).hasSize(0);
    RMDeployingNode rmNode2 = new RMDeployingNode("deploying", nodeSource, "command2", null);
    RMDeployingNode oldRmNode = infrastructureManager.update(rmNode2);
    assertThat(oldRmNode).isSameAs(rmNode);
    assertThat(infrastructureManager.getDeployingNodesWithLock()).hasSize(1);
    assertThat(infrastructureManager.getPersistedDeployingNodesUrl()).hasSize(1);
    assertThat(infrastructureManager.getLostNodesWithLock()).hasSize(0);
    assertThat(infrastructureManager.getPersistedLostNodesUrl()).hasSize(0);
    assertThat(infrastructureManager.getDeployingNodesWithLock()).contains(rmNode2);
}
Also used : RMDeployingNode(org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode) Test(org.junit.Test)

Example 34 with RMNode

use of org.ow2.proactive.resourcemanager.rmnode.RMNode in project scheduling by ow2-proactive.

the class InfrastructureManagerTest method testUpdateUnknownNode.

@Test
public void testUpdateUnknownNode() {
    RMDeployingNode rmNode = new RMDeployingNode("deploying", nodeSource, "command", null);
    assertThat(infrastructureManager.getDeployingNodesWithLock()).hasSize(0);
    assertThat(infrastructureManager.getPersistedDeployingNodesUrl()).hasSize(0);
    assertThat(infrastructureManager.getLostNodesWithLock()).hasSize(0);
    assertThat(infrastructureManager.getPersistedLostNodesUrl()).hasSize(0);
    RMDeployingNode oldRmNode = infrastructureManager.update(rmNode);
    assertThat(infrastructureManager.getDeployingNodesWithLock()).hasSize(0);
    assertThat(infrastructureManager.getPersistedDeployingNodesUrl()).hasSize(0);
    assertThat(infrastructureManager.getLostNodesWithLock()).hasSize(0);
    assertThat(infrastructureManager.getPersistedLostNodesUrl()).hasSize(0);
    assertThat(oldRmNode).isNull();
}
Also used : RMDeployingNode(org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode) Test(org.junit.Test)

Example 35 with RMNode

use of org.ow2.proactive.resourcemanager.rmnode.RMNode in project scheduling by ow2-proactive.

the class InfrastructureManagerTest method testGetDeployingNodeUnknownNode.

@Test
public void testGetDeployingNodeUnknownNode() {
    RMDeployingNode rmNode = new RMDeployingNode("deploying", nodeSource, "command", null);
    assertThat(infrastructureManager.getDeployingNodesWithLock()).hasSize(0);
    assertThat(infrastructureManager.getPersistedDeployingNodesUrl()).hasSize(0);
    assertThat(infrastructureManager.getLostNodesWithLock()).hasSize(0);
    assertThat(infrastructureManager.getPersistedLostNodesUrl()).hasSize(0);
    RMDeployingNode rmNodeFound = infrastructureManager.getDeployingOrLostNode(rmNode.getNodeURL());
    assertThat(rmNodeFound).isNull();
}
Also used : RMDeployingNode(org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode) Test(org.junit.Test)

Aggregations

RMNode (org.ow2.proactive.resourcemanager.rmnode.RMNode)55 Test (org.junit.Test)27 Node (org.objectweb.proactive.core.node.Node)12 BooleanWrapper (org.objectweb.proactive.core.util.wrapper.BooleanWrapper)12 Client (org.ow2.proactive.resourcemanager.authentication.Client)12 SelectionScript (org.ow2.proactive.scripting.SelectionScript)12 ArrayList (java.util.ArrayList)11 RMDeployingNode (org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode)11 LinkedList (java.util.LinkedList)10 RMNodeImpl (org.ow2.proactive.resourcemanager.rmnode.RMNodeImpl)10 SelectionManager (org.ow2.proactive.resourcemanager.selection.SelectionManager)8 NodeState (org.ow2.proactive.resourcemanager.common.NodeState)7 NodeSource (org.ow2.proactive.resourcemanager.nodesource.NodeSource)7 Permission (java.security.Permission)6 SelectionManagerTest (org.ow2.proactive.resourcemanager.selection.SelectionManagerTest)6 NodeSet (org.ow2.proactive.utils.NodeSet)6 HashMap (java.util.HashMap)5 HashSet (java.util.HashSet)5 MutableInteger (org.objectweb.proactive.core.util.MutableInteger)5 PrincipalPermission (org.ow2.proactive.permissions.PrincipalPermission)5