Search in sources :

Example 1 with StatHistory

use of org.ow2.proactive_grid_cloud_portal.webapp.StatHistory in project scheduling by ow2-proactive.

the class RMRestTest method callGetStatHistory.

private JSONObject callGetStatHistory() throws Exception {
    RMProxyUserInterface rmMock = mock(RMProxyUserInterface.class);
    String sessionId = SharedSessionStoreTestUtils.createValidSession(rmMock);
    AttributeList value = new AttributeList(Collections.singletonList(new Attribute("test", createRrdDb().getBytes())));
    when(rmMock.getMBeanAttributes(Matchers.<ObjectName>any(), Matchers.<String[]>any())).thenReturn(value);
    RMRestInterface client = ProxyFactory.create(RMRestInterface.class, "http://localhost:" + port + "/");
    String statHistory = client.getStatHistory(sessionId, "hhhhh");
    return (JSONObject) new JSONParser().parse(statHistory);
}
Also used : JSONObject(org.json.simple.JSONObject) Attribute(javax.management.Attribute) AttributeList(javax.management.AttributeList) RMProxyUserInterface(org.ow2.proactive.resourcemanager.common.util.RMProxyUserInterface) JSONParser(org.json.simple.parser.JSONParser) Matchers.anyString(org.mockito.Matchers.anyString)

Example 2 with StatHistory

use of org.ow2.proactive_grid_cloud_portal.webapp.StatHistory in project scheduling by ow2-proactive.

the class RMRestTest method callGetStatHistory.

private JSONObject callGetStatHistory(byte[] rrdb, ConsolFun function) throws Exception {
    RMProxyUserInterface rmMock = mock(RMProxyUserInterface.class);
    String sessionId = SharedSessionStoreTestUtils.createValidSession(rmMock);
    AttributeList value = new AttributeList(Collections.singletonList(new Attribute("test", rrdb)));
    when(rmMock.getMBeanAttributes(Matchers.<ObjectName>any(), Matchers.<String[]>any())).thenReturn(value);
    RMRestInterface client = ProxyFactory.create(RMRestInterface.class, "http://localhost:" + port + "/");
    String statHistory = client.getStatHistory(sessionId, "hhhhh", function.name());
    return (JSONObject) new JSONParser().parse(statHistory);
}
Also used : JSONObject(org.json.simple.JSONObject) Attribute(javax.management.Attribute) AttributeList(javax.management.AttributeList) RMProxyUserInterface(org.ow2.proactive.resourcemanager.common.util.RMProxyUserInterface) JSONParser(org.json.simple.parser.JSONParser) Matchers.anyString(org.mockito.Matchers.anyString) RMRestInterface(org.ow2.proactive_grid_cloud_portal.common.RMRestInterface)

Aggregations

Attribute (javax.management.Attribute)2 AttributeList (javax.management.AttributeList)2 JSONObject (org.json.simple.JSONObject)2 JSONParser (org.json.simple.parser.JSONParser)2 Matchers.anyString (org.mockito.Matchers.anyString)2 RMProxyUserInterface (org.ow2.proactive.resourcemanager.common.util.RMProxyUserInterface)2 RMRestInterface (org.ow2.proactive_grid_cloud_portal.common.RMRestInterface)1