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);
}
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) {
}
}
}
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);
}
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);
}
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);
}
Aggregations