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);
}
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());
}
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);
}
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());
}
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();
}
Aggregations