use of org.ow2.proactive.resourcemanager.rmnode.RMNodeImpl in project scheduling by ow2-proactive.
the class RMCoreTest method testLockNodeState.
private void testLockNodeState(NodeState nodeState) {
RMNodeImpl rmNode = spy(RMNodeHelper.basicWithMockedInternals().getLeft());
rmNode.setState(nodeState);
HashMap<String, RMNode> allNodes = new HashMap<>();
allNodes.put(rmNode.getNodeURL(), rmNode);
ArrayList<RMNode> freeNodes = Lists.newArrayList((RMNode) rmNode);
RMCore rmCore = new RMCore(new HashMap<String, NodeSource>(), allNodes, Mockito.mock(Client.class), Mockito.mock(RMMonitoringImpl.class), Mockito.mock(SelectionManager.class), freeNodes, Mockito.mock(RMDBManager.class));
rmCore.signalRMCoreIsInitialized();
BooleanWrapper lockResult = rmCore.lockNodes(ImmutableSet.of(rmNode.getNodeURL()));
assertThat(lockResult.getBooleanValue()).isTrue();
assertThat(rmNode.getState()).isEqualTo(nodeState);
assertThat(rmNode.isLocked()).isTrue();
assertThat(freeNodes).isEmpty();
}
Aggregations