Search in sources :

Example 31 with NodeSource

use of org.ow2.proactive.resourcemanager.nodesource.NodeSource 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 32 with NodeSource

use of org.ow2.proactive.resourcemanager.nodesource.NodeSource in project scheduling by ow2-proactive.

the class NodeSourceTest method createNodeSource.

private NodeSource createNodeSource(InfrastructureManager infrastructureManager, NodeSourcePolicy nodeSourcePolicy, Client client) {
    NodeSourceData nodeSourceData = new NodeSourceData();
    nodeSourceData.setProvider(client);
    nodeSourceData.setNodesRecoverable(NODES_NOT_RECOVERABLE);
    return new NodeSource("registrationURL", "name", infrastructureManager, nodeSourcePolicy, mock(RMCore.class), mock(RMMonitoringImpl.class), nodeSourceData.toNodeSourceDescriptor());
}
Also used : RMCore(org.ow2.proactive.resourcemanager.core.RMCore) RMMonitoringImpl(org.ow2.proactive.resourcemanager.frontend.RMMonitoringImpl) NodeSourceData(org.ow2.proactive.resourcemanager.db.NodeSourceData)

Example 33 with NodeSource

use of org.ow2.proactive.resourcemanager.nodesource.NodeSource 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 NodeSource

use of org.ow2.proactive.resourcemanager.nodesource.NodeSource in project scheduling by ow2-proactive.

the class InfrastructureManagerTest method testUpdateLostNodeKnown.

@Test
public void testUpdateLostNodeKnown() {
    RMDeployingNode deployingNode = new RMDeployingNode("deploying", nodeSource, "command", null);
    infrastructureManager.addDeployingNodeWithLockAndPersist(deployingNode.getNodeURL(), deployingNode);
    RMDeployingNode lostNode = new RMDeployingNode("lost", nodeSource, "command", null);
    lostNode.setLost();
    infrastructureManager.addLostNodeWithLockAndPersist(lostNode.getNodeURL(), lostNode);
    assertThat(infrastructureManager.getDeployingNodesWithLock()).hasSize(1);
    assertThat(infrastructureManager.getPersistedDeployingNodesUrl()).hasSize(1);
    assertThat(infrastructureManager.getLostNodesWithLock()).hasSize(1);
    assertThat(infrastructureManager.getPersistedLostNodesUrl()).hasSize(1);
    RMDeployingNode lostNode2 = new RMDeployingNode("lost", nodeSource, "command2", null);
    lostNode2.setLost();
    RMDeployingNode oldRmNode = infrastructureManager.update(lostNode2);
    assertThat(oldRmNode).isSameAs(lostNode);
    assertThat(infrastructureManager.getDeployingNodesWithLock()).hasSize(1);
    assertThat(infrastructureManager.getPersistedDeployingNodesUrl()).hasSize(1);
    assertThat(infrastructureManager.getLostNodesWithLock()).hasSize(1);
    assertThat(infrastructureManager.getPersistedLostNodesUrl()).hasSize(1);
    assertThat(infrastructureManager.getLostNodesWithLock()).contains(lostNode2);
    assertThat(infrastructureManager.getPersistedLostNodesUrl()).contains(lostNode.getNodeURL());
    assertThat(infrastructureManager.getPersistedLostNodesUrl()).contains(lostNode2.getNodeURL());
}
Also used : RMDeployingNode(org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode) Test(org.junit.Test)

Example 35 with NodeSource

use of org.ow2.proactive.resourcemanager.nodesource.NodeSource 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)

Aggregations

NodeSource (org.ow2.proactive.resourcemanager.nodesource.NodeSource)21 Test (org.junit.Test)17 RMNode (org.ow2.proactive.resourcemanager.rmnode.RMNode)13 BooleanWrapper (org.objectweb.proactive.core.util.wrapper.BooleanWrapper)11 RMDeployingNode (org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode)11 Client (org.ow2.proactive.resourcemanager.authentication.Client)9 Node (org.objectweb.proactive.core.node.Node)8 ResourceManager (org.ow2.proactive.resourcemanager.frontend.ResourceManager)7 ArrayList (java.util.ArrayList)6 RMNodeSourceEvent (org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent)6 Permission (java.security.Permission)5 NodeSourceData (org.ow2.proactive.resourcemanager.db.NodeSourceData)5 RMException (org.ow2.proactive.resourcemanager.exception.RMException)5 Throwables.getStackTraceAsString (com.google.common.base.Throwables.getStackTraceAsString)4 IOException (java.io.IOException)4 HashMap (java.util.HashMap)4 HashSet (java.util.HashSet)4 Path (javax.ws.rs.Path)4 Produces (javax.ws.rs.Produces)4 Matchers.anyString (org.mockito.Matchers.anyString)4