Search in sources :

Example 11 with RMNodeImpl

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();
}
Also used : RMDBManager(org.ow2.proactive.resourcemanager.db.RMDBManager) SelectionManager(org.ow2.proactive.resourcemanager.selection.SelectionManager) HashMap(java.util.HashMap) RMMonitoringImpl(org.ow2.proactive.resourcemanager.frontend.RMMonitoringImpl) Matchers.anyString(org.mockito.Matchers.anyString) NodeSource(org.ow2.proactive.resourcemanager.nodesource.NodeSource) BooleanWrapper(org.objectweb.proactive.core.util.wrapper.BooleanWrapper) RMNode(org.ow2.proactive.resourcemanager.rmnode.RMNode) RMNodeImpl(org.ow2.proactive.resourcemanager.rmnode.RMNodeImpl) Client(org.ow2.proactive.resourcemanager.authentication.Client)

Aggregations

RMNodeImpl (org.ow2.proactive.resourcemanager.rmnode.RMNodeImpl)10 Test (org.junit.Test)7 MutableInteger (org.objectweb.proactive.core.util.MutableInteger)5 Permission (java.security.Permission)3 Client (org.ow2.proactive.resourcemanager.authentication.Client)3 RMNode (org.ow2.proactive.resourcemanager.rmnode.RMNode)3 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 Principal (java.security.Principal)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 Subject (javax.security.auth.Subject)1 ImmutablePair (org.apache.commons.lang3.tuple.ImmutablePair)1 Matchers.anyString (org.mockito.Matchers.anyString)1 IdentityPrincipal (org.ow2.proactive.authentication.principals.IdentityPrincipal)1 TokenPrincipal (org.ow2.proactive.authentication.principals.TokenPrincipal)1 UserNamePrincipal (org.ow2.proactive.authentication.principals.UserNamePrincipal)1 PrincipalPermission (org.ow2.proactive.permissions.PrincipalPermission)1