Search in sources :

Example 1 with RMInitialState

use of org.ow2.proactive.resourcemanager.common.event.RMInitialState in project scheduling by ow2-proactive.

the class RMInitialStateTest method testCloneAndFilter0.

@Test
public void testCloneAndFilter0() {
    final RMStateDelta rmInitialState = this.rmInitialState.cloneAndFilter(1);
    assertEquals(4, rmInitialState.getNodesEvents().size());
    assertEquals(1, rmInitialState.getNodeSource().size());
}
Also used : RMStateDelta(org.ow2.proactive.resourcemanager.common.event.dto.RMStateDelta) Test(org.junit.Test)

Example 2 with RMInitialState

use of org.ow2.proactive.resourcemanager.common.event.RMInitialState in project scheduling by ow2-proactive.

the class TestExecRemote method action.

@Test
public void action() throws Exception {
    final String miscDir = System.getProperty("pa.rm.home") + File.separator + "samples" + File.separator + "scripts" + File.separator + "misc" + File.separator;
    boolean isLinux = OperatingSystem.getOperatingSystem().equals(OperatingSystem.unix);
    final String valueToEcho = "111";
    String nsName = "TestExecRemote";
    rmHelper.createNodeSource(nsName);
    RMInitialState state = ((RMMonitorEventReceiver) rmHelper.getResourceManager()).getInitialState();
    String hostname = state.getNodeEvents().get(0).getHostName();
    HashSet<String> nodesUrls = new HashSet<>();
    for (RMNodeEvent ne : state.getNodeEvents()) {
        nodesUrls.add(ne.getNodeUrl());
    }
    simpleScript(nodesUrls);
    selectionScript(nodesUrls);
    processBuilderScript(miscDir, isLinux, valueToEcho, nodesUrls);
    processBuilderWithDSScript(miscDir, isLinux, valueToEcho, nodesUrls);
    scriptOnNodeSource(nsName, nodesUrls);
    scriptOnHost(hostname);
}
Also used : RMInitialState(org.ow2.proactive.resourcemanager.common.event.RMInitialState) RMNodeEvent(org.ow2.proactive.resourcemanager.common.event.RMNodeEvent) RMMonitorEventReceiver(functionaltests.monitor.RMMonitorEventReceiver) HashSet(java.util.HashSet) Test(org.junit.Test) RMFunctionalTest(functionaltests.utils.RMFunctionalTest)

Example 3 with RMInitialState

use of org.ow2.proactive.resourcemanager.common.event.RMInitialState in project scheduling by ow2-proactive.

the class TestRMNodeMonitoring method prepareEnvAndGetRMNodeJmxUrl.

private String prepareEnvAndGetRMNodeJmxUrl() throws Exception {
    rmHelper.createNodeSource("TestRMNodeMonitoring");
    log("Checking existence of Sigar MBeans...");
    String jmxurl = null;
    RMInitialState state = ((RMMonitorEventReceiver) rmHelper.getResourceManager()).getInitialState();
    jmxurl = state.getNodeEvents().get(0).getDefaultJMXUrl();
    assertNotNull("The JMX URL of a node could not be obtained.", jmxurl);
    log("JMX URL obtained: " + jmxurl);
    return jmxurl;
}
Also used : RMInitialState(org.ow2.proactive.resourcemanager.common.event.RMInitialState)

Example 4 with RMInitialState

use of org.ow2.proactive.resourcemanager.common.event.RMInitialState in project scheduling by ow2-proactive.

the class RMProxyUserInterfaceTest method testGetNodeMBeanInfo_DisconnectionOfRemovedNodeSource.

// SCHEDULING-1850
@Test
public void testGetNodeMBeanInfo_DisconnectionOfRemovedNodeSource() throws Exception {
    proxyUserInterface = createRMCachingProxyUserInterface();
    rmHelper.createNodeSource("NodeSource1", 1);
    RMInitialState state = ((RMMonitorEventReceiver) rmHelper.getResourceManager()).getInitialState();
    String nodeSource1_NodeJmxUrl = state.getNodeEvents().get(0).getDefaultJMXUrl();
    Object mBeanFromNodeSource1 = proxyUserInterface.getNodeMBeanInfo(nodeSource1_NodeJmxUrl, EXISTING_OBJECT_NAME, Collections.<String>emptyList());
    assertNotNull(mBeanFromNodeSource1);
    // remove nodesource and try another jmx connection
    rmHelper.getResourceManager().removeNodeSource("NodeSource1", true);
    rmHelper.createNodeSource("NodeSource2", 1);
    state = ((RMMonitorEventReceiver) rmHelper.getResourceManager()).getInitialState();
    String nodeSource2_NodeJmxUrl = state.getNodeEvents().get(0).getDefaultJMXUrl();
    Object mBeanFromNodeSource2 = proxyUserInterface.getNodeMBeanInfo(nodeSource2_NodeJmxUrl, EXISTING_OBJECT_NAME, Collections.<String>emptyList());
    assertNotNull(mBeanFromNodeSource2);
    // cleanup
    rmHelper.getResourceManager().removeNodeSource("NodeSource2", true);
}
Also used : RMInitialState(org.ow2.proactive.resourcemanager.common.event.RMInitialState) PAActiveObject(org.objectweb.proactive.api.PAActiveObject) RMMonitorEventReceiver(functionaltests.monitor.RMMonitorEventReceiver) Test(org.junit.Test) RMFunctionalTest(functionaltests.utils.RMFunctionalTest)

Example 5 with RMInitialState

use of org.ow2.proactive.resourcemanager.common.event.RMInitialState in project scheduling by ow2-proactive.

the class RMFunctionalTest method cleanState.

/**
 * Remove all node sources and nodes in the RM
 *
 * @throws Exception
 */
private void cleanState() throws Exception {
    if (rmHelper.isRMStarted()) {
        // force reconnection
        rmHelper.disconnect();
        ResourceManager rm = rmHelper.getResourceManager();
        int nodeNumber = rm.getState().getTotalNodesNumber();
        RMInitialState state = ((RMMonitorEventReceiver) rmHelper.getResourceManager()).getInitialState();
        for (RMNodeSourceEvent sourceEvent : state.getNodeSourceEvents()) {
            String nodeSource = sourceEvent.getSourceName();
            rm.removeNodeSource(nodeSource, true);
            rmHelper.waitForNodeSourceEvent(RMEventType.NODESOURCE_REMOVED, nodeSource);
        }
        for (int i = 0; i < nodeNumber; i++) {
            rmHelper.waitForAnyNodeEvent(RMEventType.NODE_REMOVED);
        }
    }
}
Also used : RMNodeSourceEvent(org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent) RMInitialState(org.ow2.proactive.resourcemanager.common.event.RMInitialState) ResourceManager(org.ow2.proactive.resourcemanager.frontend.ResourceManager) RMMonitorEventReceiver(functionaltests.monitor.RMMonitorEventReceiver)

Aggregations

Test (org.junit.Test)5 RMInitialState (org.ow2.proactive.resourcemanager.common.event.RMInitialState)5 RMStateDelta (org.ow2.proactive.resourcemanager.common.event.dto.RMStateDelta)4 RMMonitorEventReceiver (functionaltests.monitor.RMMonitorEventReceiver)3 RMFunctionalTest (functionaltests.utils.RMFunctionalTest)2 HashSet (java.util.HashSet)2 PAActiveObject (org.objectweb.proactive.api.PAActiveObject)2 UniqueID (org.objectweb.proactive.core.UniqueID)2 Client (org.ow2.proactive.resourcemanager.authentication.Client)2 RMNodeSourceEvent (org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent)2 ResourceManager (org.ow2.proactive.resourcemanager.frontend.ResourceManager)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Function (com.google.common.base.Function)1 Predicate (com.google.common.base.Predicate)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Serializable (java.io.Serializable)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 Permission (java.security.Permission)1 ArrayList (java.util.ArrayList)1