Search in sources :

Example 21 with ResourceManager

use of org.ow2.proactive.resourcemanager.frontend.ResourceManager in project scheduling by ow2-proactive.

the class TestRMProxy method requestWithExtraNodes.

private void requestWithExtraNodes(RMProxy proxy, ResourceManager rm) throws Exception {
    log("Request NodeSet with extra nodes");
    TopologyDescriptor topology = TopologyDescriptor.SINGLE_HOST_EXCLUSIVE;
    Criteria criteria = new Criteria(1);
    criteria.setTopology(topology);
    NodeSet nodeSet = proxy.getNodes(criteria);
    PAFuture.waitFor(nodeSet);
    assertEquals(1, nodeSet.size());
    Assert.assertNotNull("Extra nodes are expected", nodeSet.getExtraNodes());
    assertEquals(NODES_NUMBER - 1, nodeSet.getExtraNodes().size());
    assertEquals(0, rm.getState().getFreeNodesNumber());
    proxy.releaseNodes(nodeSet);
    waitWhenNodesAreReleased(NODES_NUMBER);
    assertEquals(NODES_NUMBER, rm.getState().getFreeNodesNumber());
}
Also used : NodeSet(org.ow2.proactive.utils.NodeSet) Criteria(org.ow2.proactive.utils.Criteria) TopologyDescriptor(org.ow2.proactive.topology.descriptor.TopologyDescriptor)

Example 22 with ResourceManager

use of org.ow2.proactive.resourcemanager.frontend.ResourceManager in project scheduling by ow2-proactive.

the class TestRMProxy method requestReleaseAllNodes.

private void requestReleaseAllNodes(RMProxy proxy, ResourceManager rm) throws Exception {
    log("Request and release all nodes");
    List<NodeSet> nodeSets = new ArrayList<>();
    for (int i = 0; i < NODES_NUMBER; i++) {
        nodeSets.add(proxy.getNodes(new Criteria(1)));
    }
    for (NodeSet nodeSet : nodeSets) {
        waitWhenNodeSetAcquired(nodeSet, 1);
        proxy.releaseNodes(nodeSet);
    }
    waitWhenNodesAreReleased(NODES_NUMBER);
    assertEquals(NODES_NUMBER, rm.getState().getFreeNodesNumber());
}
Also used : NodeSet(org.ow2.proactive.utils.NodeSet) ArrayList(java.util.ArrayList) Criteria(org.ow2.proactive.utils.Criteria)

Example 23 with ResourceManager

use of org.ow2.proactive.resourcemanager.frontend.ResourceManager in project scheduling by ow2-proactive.

the class TestRMProxy method testSplitNodeSet.

private void testSplitNodeSet(RMProxy proxy, ResourceManager rm) throws Exception {
    log("Request as single NodeSet, release it as two NodeSets");
    NodeSet nodeSet = proxy.getNodes(new Criteria(3));
    waitWhenNodeSetAcquired(nodeSet, 3);
    assertEquals(NODES_NUMBER - 3, rm.getState().getFreeNodesNumber());
    NodeSet nodeSet1 = new NodeSet();
    nodeSet1.add(nodeSet.remove(0));
    NodeSet nodeSet2 = new NodeSet();
    nodeSet2.add(nodeSet.remove(0));
    nodeSet2.add(nodeSet.remove(0));
    proxy.releaseNodes(nodeSet1);
    waitWhenNodesAreReleased(1);
    assertEquals(NODES_NUMBER - 2, rm.getState().getFreeNodesNumber());
    proxy.releaseNodes(nodeSet2);
    waitWhenNodesAreReleased(2);
    assertEquals(NODES_NUMBER, rm.getState().getFreeNodesNumber());
}
Also used : NodeSet(org.ow2.proactive.utils.NodeSet) Criteria(org.ow2.proactive.utils.Criteria)

Example 24 with ResourceManager

use of org.ow2.proactive.resourcemanager.frontend.ResourceManager in project scheduling by ow2-proactive.

the class NodeRecoveryTest method startKillStartRM.

/**
 * This method tests performance of node recovery using local infrastructure.
 *
 * @throws Exception
 */
public void startKillStartRM() throws Exception {
    ProActiveConfiguration.load();
    rmHelper = new RMTHelper();
    rmHelper.startRM(RM_CONFIGURATION_START);
    assertTrue(PAResourceManagerProperties.RM_PRESERVE_NODES_ON_SHUTDOWN.getValueAsBoolean());
    assertTrue(rmHelper.isRMStarted());
    ResourceManager resourceManager = rmHelper.getResourceManager();
    assertEquals(0, resourceManager.getState().getAllNodes().size());
    rmHelper.createNodeSourceWithInfiniteTimeout(RMConstants.DEFAULT_STATIC_SOURCE_NAME, nodesNumber);
    assertEquals(nodesNumber, resourceManager.getState().getAllNodes().size());
    RecoverInfrastructureTestHelper.killRmWithStrongSigKill();
    rmHelper.startRM(RM_CONFIGURATION_RESTART);
    resourceManager = rmHelper.getResourceManager();
    assertEquals(nodesNumber, resourceManager.getState().getAllNodes().size());
}
Also used : ResourceManager(org.ow2.proactive.resourcemanager.frontend.ResourceManager)

Example 25 with ResourceManager

use of org.ow2.proactive.resourcemanager.frontend.ResourceManager in project scheduling by ow2-proactive.

the class AuthenticationTest method loginAsUser.

private void loginAsUser(RMAuthentication auth) throws LoginException, KeyException {
    log("Test 2");
    log("Trying to authorized with correct user name and password");
    Credentials cred = Credentials.createCredentials(new CredData(TestUsers.USER.username, TestUsers.USER.password), auth.getPublicKey());
    ResourceManager user = auth.login(cred);
    user.disconnect().getBooleanValue();
    log("Passed: successful authentication");
}
Also used : CredData(org.ow2.proactive.authentication.crypto.CredData) ResourceManager(org.ow2.proactive.resourcemanager.frontend.ResourceManager) Credentials(org.ow2.proactive.authentication.crypto.Credentials)

Aggregations

ResourceManager (org.ow2.proactive.resourcemanager.frontend.ResourceManager)45 NodeSet (org.ow2.proactive.utils.NodeSet)26 RMFunctionalTest (functionaltests.utils.RMFunctionalTest)25 Test (org.junit.Test)25 Node (org.objectweb.proactive.core.node.Node)16 File (java.io.File)14 Credentials (org.ow2.proactive.authentication.crypto.Credentials)14 Criteria (org.ow2.proactive.utils.Criteria)13 HashMap (java.util.HashMap)11 CredData (org.ow2.proactive.authentication.crypto.CredData)11 StaticPolicy (org.ow2.proactive.resourcemanager.nodesource.policy.StaticPolicy)11 RMAuthentication (org.ow2.proactive.resourcemanager.authentication.RMAuthentication)10 RMNodeEvent (org.ow2.proactive.resourcemanager.common.event.RMNodeEvent)10 TestNode (functionaltests.utils.TestNode)9 SelectionScript (org.ow2.proactive.scripting.SelectionScript)9 RMMonitorEventReceiver (functionaltests.monitor.RMMonitorEventReceiver)5 Path (javax.ws.rs.Path)5 Produces (javax.ws.rs.Produces)5 BooleanWrapper (org.objectweb.proactive.core.util.wrapper.BooleanWrapper)5 PublicKey (java.security.PublicKey)4