use of org.ow2.proactive.resourcemanager.core.history.NodeHistory in project scheduling by ow2-proactive.
the class RMMonitoringImpl method nodeEvent.
/**
* @see org.ow2.proactive.resourcemanager.frontend.RMEventListener#nodeEvent(org.ow2.proactive.resourcemanager.common.event.RMNodeEvent)
*/
public void nodeEvent(RMNodeEvent event) {
RMMonitoringImpl.rmStatistics.nodeEvent(event);
RMDBManager.getInstance().saveNodeHistory(new NodeHistory(event));
queueEvent(event);
}
use of org.ow2.proactive.resourcemanager.core.history.NodeHistory in project scheduling by ow2-proactive.
the class NodeHistoryTest method testUpdateHistory.
public void testUpdateHistory() throws Exception {
NodeHistory expected1 = createNodeHistory(1);
expected1.setEndTime(2);
NodeHistory expected2 = createNodeHistory(2);
dbManager.saveNodeHistory(expected2);
List<?> rows = dbManager.executeSqlQuery("from NodeHistory");
Assert.assertEquals(2, rows.size());
assertEquals(expected1, (NodeHistory) rows.get(0));
assertEquals(expected2, (NodeHistory) rows.get(1));
dbManager.close();
}
use of org.ow2.proactive.resourcemanager.core.history.NodeHistory in project scheduling by ow2-proactive.
the class NodeHistoryTest method testSaveHistory.
public void testSaveHistory() throws Exception {
Configuration config = new Configuration().configure("/functionaltests/config/hibernate-unit.cfg.xml");
dbManager = new RMDBManager(config, true, true);
NodeHistory expected = createNodeHistory(1);
dbManager.saveNodeHistory(expected);
List<?> rows = dbManager.executeSqlQuery("from NodeHistory");
Assert.assertEquals(1, rows.size());
NodeHistory actual = (NodeHistory) rows.get(0);
assertEquals(expected, actual);
}
use of org.ow2.proactive.resourcemanager.core.history.NodeHistory in project scheduling by ow2-proactive.
the class NodeHistoryTest method createNodeHistory.
private NodeHistory createNodeHistory(long startTime) {
NodeHistory nodeHistory = new NodeHistory();
nodeHistory.setHost("host");
nodeHistory.setNodeSource("ns");
nodeHistory.setNodeState(NodeState.FREE);
nodeHistory.setNodeUrl("url");
nodeHistory.setProviderName("provider");
nodeHistory.setStartTime(startTime);
nodeHistory.setEndTime(0);
nodeHistory.setStoreInDataBase(true);
return nodeHistory;
}
Aggregations