use of org.ow2.proactive.resourcemanager.common.util.RMProxyUserInterface in project scheduling by ow2-proactive.
the class RMRestTest method testAddNodeOverloading.
// PORTAL-326
@Test
public void testAddNodeOverloading() throws Exception {
RMProxyUserInterface rm = mock(RMProxyUserInterface.class);
String sessionId = SharedSessionStoreTestUtils.createValidSession(rm);
when(rm.addNode(anyString())).thenReturn(new BooleanWrapper(true));
List<NameValuePair> firstCall = Collections.<NameValuePair>singletonList(new BasicNameValuePair("nodeurl", "url"));
callHttpPostMethod("node", sessionId, firstCall);
verify(rm).addNode("url");
reset(rm);
when(rm.addNode(anyString(), anyString())).thenReturn(new BooleanWrapper(true));
List<NameValuePair> secondCall = new ArrayList<>();
secondCall.add(new BasicNameValuePair("nodeurl", "urlwithnsname"));
secondCall.add(new BasicNameValuePair("nodesource", "ns"));
callHttpPostMethod("node", sessionId, secondCall);
verify(rm).addNode("urlwithnsname", "ns");
}
use of org.ow2.proactive.resourcemanager.common.util.RMProxyUserInterface in project scheduling by ow2-proactive.
the class RMRestTest method testShutdown_NoPreemptParameter.
@Test
public void testShutdown_NoPreemptParameter() throws Exception {
RMProxyUserInterface rm = mock(RMProxyUserInterface.class);
when(rm.shutdown(false)).thenReturn(new BooleanWrapper(true));
String sessionId = SharedSessionStoreTestUtils.createValidSession(rm);
HttpResponse response = callHttpGetMethod("shutdown", sessionId);
assertEquals(HttpURLConnection.HTTP_OK, response.getStatusLine().getStatusCode());
verify(rm).shutdown(false);
}
use of org.ow2.proactive.resourcemanager.common.util.RMProxyUserInterface in project scheduling by ow2-proactive.
the class SchedulerRMProxyFactory method connectToRM.
public RMProxyUserInterface connectToRM(Credentials credentials) throws ActiveObjectCreationException, NodeException, RMException, KeyException, LoginException {
RMProxyUserInterface rm = PAActiveObject.newActive(RMProxyUserInterface.class, new Object[] {});
rm.init(PortalConfiguration.RM_URL.getValueAsString(), credentials);
return rm;
}
use of org.ow2.proactive.resourcemanager.common.util.RMProxyUserInterface in project scheduling by ow2-proactive.
the class SchedulerRMProxyFactory method connectToRM.
public RMProxyUserInterface connectToRM(CredData credData) throws ActiveObjectCreationException, NodeException, RMException, KeyException, LoginException {
RMProxyUserInterface rm = PAActiveObject.newActive(RMProxyUserInterface.class, new Object[] {});
rm.init(PortalConfiguration.RM_URL.getValueAsString(), credData);
return rm;
}
use of org.ow2.proactive.resourcemanager.common.util.RMProxyUserInterface in project scheduling by ow2-proactive.
the class RMRest method checkAccess.
private RMProxyUserInterface checkAccess(String sessionId) throws NotConnectedException {
Session session = sessionStore.get(sessionId);
if (session == null) {
throw new NotConnectedException("you are not connected to the scheduler, you should log on first");
}
RMProxyUserInterface s = session.getRM();
if (s == null) {
throw new NotConnectedException("you are not connected to the scheduler, you should log on first");
}
return session.getRM();
}
Aggregations