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