Search in sources :

Example 21 with RMDeployingNode

use of org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode 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 22 with RMDeployingNode

use of org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode 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 23 with RMDeployingNode

use of org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode 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 24 with RMDeployingNode

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

the class RMCoreTest method testGetNodeByUrlIncludingDeployingNodesUnknownNodeUrl.

@Test
public void testGetNodeByUrlIncludingDeployingNodesUnknownNodeUrl() {
    RMDeployingNode rmNode = new RMDeployingNode("node", mockedNodeSource, "command", new Client());
    doReturn(rmNode).when(mockedNodeSource).getNodeInDeployingOrLostNodes(rmNode.getNodeURL());
    RMNode rmNodeFound = rmCore.getNodeByUrlIncludingDeployingNodes(rmNode.getNodeURL());
    assertThat(rmNodeFound).isSameAs(rmNode);
}
Also used : RMNode(org.ow2.proactive.resourcemanager.rmnode.RMNode) RMDeployingNode(org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode) Client(org.ow2.proactive.resourcemanager.authentication.Client) Test(org.junit.Test)

Aggregations

RMDeployingNode (org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode)23 Test (org.junit.Test)9 RMNodeEvent (org.ow2.proactive.resourcemanager.common.event.RMNodeEvent)6 RMException (org.ow2.proactive.resourcemanager.exception.RMException)4 Client (org.ow2.proactive.resourcemanager.authentication.Client)3 NodeState (org.ow2.proactive.resourcemanager.common.NodeState)3 RMNode (org.ow2.proactive.resourcemanager.rmnode.RMNode)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 Node (org.objectweb.proactive.core.node.Node)2 BooleanWrapper (org.objectweb.proactive.core.util.wrapper.BooleanWrapper)2 NodeSource (org.ow2.proactive.resourcemanager.nodesource.NodeSource)2 Function (com.google.common.base.Function)1 Predicate (com.google.common.base.Predicate)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 File (java.io.File)1 Serializable (java.io.Serializable)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 Files (java.nio.file.Files)1 Paths (java.nio.file.Paths)1