Search in sources :

Example 6 with RMMonitorEventReceiver

use of functionaltests.monitor.RMMonitorEventReceiver in project scheduling by ow2-proactive.

the class RecoverLocalInfrastructureTest method defineNodeSourceAndCheckState.

private void defineNodeSourceAndCheckState() throws Exception {
    this.rmHelper.defineNodeSource(NODE_SOURCE_NAME, NODE_NUMBER);
    RMMonitorEventReceiver resourceManagerMonitor = (RMMonitorEventReceiver) this.resourceManager;
    List<RMNodeSourceEvent> nodeSourceEventPerNodeSource = resourceManagerMonitor.getInitialState().getNodeSourceEvents();
    assertThat(nodeSourceEventPerNodeSource.size()).isEqualTo(1);
    assertThat(nodeSourceEventPerNodeSource.get(0).getSourceName()).isEqualTo(NODE_SOURCE_NAME);
}
Also used : RMNodeSourceEvent(org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent) RMMonitorEventReceiver(functionaltests.monitor.RMMonitorEventReceiver)

Example 7 with RMMonitorEventReceiver

use of functionaltests.monitor.RMMonitorEventReceiver in project scheduling by ow2-proactive.

the class TestRMProxyRebind method stopRMs.

@After
public void stopRMs() throws Exception {
    if (rm1 != null) {
        PAFuture.waitFor(rm1.shutdown(true));
    }
    if (rm2 != null) {
        PAFuture.waitFor(rm2.shutdown(true));
    }
    helper1.kill();
    helper2.kill();
    for (TestNode node : testNodes) {
        try {
            node.kill();
        } catch (Exception ignored) {
        }
    }
    for (RMMonitorEventReceiver receiver : eventReceivers) {
        try {
            PAActiveObject.terminateActiveObject(receiver, true);
        } catch (Exception ignored) {
        }
    }
}
Also used : RMMonitorEventReceiver(functionaltests.monitor.RMMonitorEventReceiver) After(org.junit.After)

Example 8 with RMMonitorEventReceiver

use of functionaltests.monitor.RMMonitorEventReceiver in project scheduling by ow2-proactive.

the class TestRMProxyRebind method createRMs.

@Before
public void createRMs() throws Exception {
    schedulerProxyCredentials = Credentials.getCredentials(PASchedulerProperties.getAbsolutePath(PASchedulerProperties.RESOURCE_MANAGER_CREDS.getValueAsString()));
    helper1 = new TestRM();
    helper2 = new TestRM();
    pnpPort1 = CentralPAPropertyRepository.PA_RMI_PORT.getValue() + 1;
    jmxPort1 = PAResourceManagerProperties.RM_JMX_PORT.getValueAsInt() + 1;
    pnpPort2 = CentralPAPropertyRepository.PA_RMI_PORT.getValue() + 2;
    jmxPort2 = PAResourceManagerProperties.RM_JMX_PORT.getValueAsInt() + 2;
    helper1.start(config1.getAbsolutePath(), pnpPort1, RMTHelper.testClasspath(), PAResourceManagerProperties.RM_JMX_PORT.getCmdLine() + jmxPort1);
    Credentials connectedUserCreds = Credentials.createCredentials(new CredData(CredData.parseLogin(TestUsers.DEMO.username), CredData.parseDomain(TestUsers.DEMO.username), TestUsers.DEMO.password), helper1.getAuth().getPublicKey());
    Map.Entry<RMMonitorsHandler, RMMonitorEventReceiver> entry1 = connectToRM(helper1.getUrl(), connectedUserCreds);
    monitorsHandler1 = entry1.getKey();
    rm1 = entry1.getValue();
    testNodes.addAll(RMTHelper.addNodesToDefaultNodeSource(NODES_NUMBER, new ArrayList<String>(), rm1, monitorsHandler1));
    helper2.start(config2.getAbsolutePath(), pnpPort2, RMTHelper.testClasspath(), PAResourceManagerProperties.RM_JMX_PORT.getCmdLine() + jmxPort2);
    Map.Entry<RMMonitorsHandler, RMMonitorEventReceiver> entry2 = connectToRM(helper2.getUrl(), connectedUserCreds);
    monitorsHandler2 = entry2.getKey();
    rm2 = entry2.getValue();
    testNodes.addAll(RMTHelper.addNodesToDefaultNodeSource(NODES_NUMBER, new ArrayList<String>(), rm2, monitorsHandler2));
    checkFreeNodes(rm1, NODES_NUMBER);
    checkFreeNodes(rm2, NODES_NUMBER);
}
Also used : CredData(org.ow2.proactive.authentication.crypto.CredData) ArrayList(java.util.ArrayList) Map(java.util.Map) AbstractMap(java.util.AbstractMap) Credentials(org.ow2.proactive.authentication.crypto.Credentials) RMMonitorEventReceiver(functionaltests.monitor.RMMonitorEventReceiver) RMMonitorsHandler(functionaltests.monitor.RMMonitorsHandler) Before(org.junit.Before)

Example 9 with RMMonitorEventReceiver

use of functionaltests.monitor.RMMonitorEventReceiver in project scheduling by ow2-proactive.

the class TestRMProxyRebind method connectToRM.

private Map.Entry<RMMonitorsHandler, RMMonitorEventReceiver> connectToRM(String rmUrl, Credentials creds) throws Exception {
    RMMonitorsHandler monitorsHandler1 = new RMMonitorsHandler();
    /**
     * create event receiver then turnActive to avoid deepCopy of MonitorsHandler object
     * 	(shared instance between event receiver and static helpers).
     */
    RMMonitorEventReceiver passiveEventReceiver = new RMMonitorEventReceiver(monitorsHandler1);
    RMMonitorEventReceiver receiver = PAActiveObject.turnActive(passiveEventReceiver);
    eventReceivers.add(receiver);
    receiver.init(rmUrl, creds);
    return new AbstractMap.SimpleImmutableEntry<RMMonitorsHandler, RMMonitorEventReceiver>(monitorsHandler1, receiver);
}
Also used : RMMonitorEventReceiver(functionaltests.monitor.RMMonitorEventReceiver) RMMonitorsHandler(functionaltests.monitor.RMMonitorsHandler)

Example 10 with RMMonitorEventReceiver

use of functionaltests.monitor.RMMonitorEventReceiver 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)

Aggregations

RMMonitorEventReceiver (functionaltests.monitor.RMMonitorEventReceiver)15 RMNodeSourceEvent (org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent)8 HashSet (java.util.HashSet)4 RMMonitorsHandler (functionaltests.monitor.RMMonitorsHandler)3 RMTHelper (functionaltests.utils.RMTHelper)3 BooleanWrapper (org.objectweb.proactive.core.util.wrapper.BooleanWrapper)3 RMInitialState (org.ow2.proactive.resourcemanager.common.event.RMInitialState)3 RMFunctionalTest (functionaltests.utils.RMFunctionalTest)2 Test (org.junit.Test)2 CredData (org.ow2.proactive.authentication.crypto.CredData)2 TestSSHInfrastructureV2 (functionaltests.nodesource.TestSSHInfrastructureV2)1 AbstractMap (java.util.AbstractMap)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 After (org.junit.After)1 Before (org.junit.Before)1 PAActiveObject (org.objectweb.proactive.api.PAActiveObject)1 Credentials (org.ow2.proactive.authentication.crypto.Credentials)1 RMNodeEvent (org.ow2.proactive.resourcemanager.common.event.RMNodeEvent)1 ResourceManager (org.ow2.proactive.resourcemanager.frontend.ResourceManager)1