Search in sources :

Example 1 with RMStateNodeUrls

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

the class SessionSharingTest method sessions_are_shared_rm_login.

@Test
public void sessions_are_shared_rm_login() throws Exception {
    String sessionId = rmRest.rmConnect("login", "pw");
    assertTrue(studioRest.getWorkflows(sessionId).isEmpty());
    when(schedulerMock.freeze()).thenReturn(true);
    boolean frozen = schedulerRest.freezeScheduler(sessionId);
    assertTrue(frozen);
    when(rmMock.getState()).thenReturn(new RMState(new RMStateNodeUrls(new HashSet<String>(), new HashSet<String>(), new HashSet<String>()), Long.valueOf(-1)));
    RMState rmState = rmRest.getState(sessionId);
    assertNotNull(rmState);
    rmRest.rmDisconnect(sessionId);
    try {
        rmRest.getState(sessionId);
        fail();
    } catch (NotConnectedException expected) {
    // expected
    }
    try {
        schedulerRest.freezeScheduler(sessionId);
        fail();
    } catch (NotConnectedRestException expected) {
    // expected
    }
}
Also used : NotConnectedException(org.ow2.proactive.scheduler.common.exception.NotConnectedException) NotConnectedRestException(org.ow2.proactive_grid_cloud_portal.scheduler.exception.NotConnectedRestException) RMState(org.ow2.proactive.resourcemanager.common.RMState) RMStateNodeUrls(org.ow2.proactive.resourcemanager.common.RMStateNodeUrls) Test(org.junit.Test)

Example 2 with RMStateNodeUrls

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

the class SessionSharingTest method sessions_are_shared_scheduler_login.

@Test
public void sessions_are_shared_scheduler_login() throws Exception {
    String sessionId = schedulerRest.login("login", "pw");
    when(rmMock.getState()).thenReturn(new RMState(new RMStateNodeUrls(new HashSet<String>(), new HashSet<String>(), new HashSet<String>()), Long.valueOf(-1)));
    RMState rmState = rmRest.getState(sessionId);
    assertNotNull(rmState);
    when(schedulerMock.freeze()).thenReturn(true);
    boolean frozen = schedulerRest.freezeScheduler(sessionId);
    assertTrue(frozen);
    schedulerRest.disconnect(sessionId);
    try {
        rmRest.getState(sessionId);
        fail();
    } catch (NotConnectedException expected) {
    // expected
    }
    try {
        schedulerRest.freezeScheduler(sessionId);
        fail();
    } catch (NotConnectedRestException expected) {
    // expected
    }
}
Also used : NotConnectedException(org.ow2.proactive.scheduler.common.exception.NotConnectedException) NotConnectedRestException(org.ow2.proactive_grid_cloud_portal.scheduler.exception.NotConnectedRestException) RMState(org.ow2.proactive.resourcemanager.common.RMState) RMStateNodeUrls(org.ow2.proactive.resourcemanager.common.RMStateNodeUrls) Test(org.junit.Test)

Example 3 with RMStateNodeUrls

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

the class RMCore method getState.

/**
 * {@inheritDoc}
 */
public RMState getState() {
    RMStateNodeUrls rmStateNodeUrls = new RMStateNodeUrls(nodesListToUrlsSet(eligibleNodes), listAliveNodeUrls(), nodesListToUrlsSet(allNodes.values()));
    RMState state = new RMState(rmStateNodeUrls, maximumNumberOfNodes);
    return state;
}
Also used : RMState(org.ow2.proactive.resourcemanager.common.RMState) RMStateNodeUrls(org.ow2.proactive.resourcemanager.common.RMStateNodeUrls)

Aggregations

RMState (org.ow2.proactive.resourcemanager.common.RMState)3 RMStateNodeUrls (org.ow2.proactive.resourcemanager.common.RMStateNodeUrls)3 Test (org.junit.Test)2 NotConnectedException (org.ow2.proactive.scheduler.common.exception.NotConnectedException)2 NotConnectedRestException (org.ow2.proactive_grid_cloud_portal.scheduler.exception.NotConnectedRestException)2