Search in sources :

Example 1 with NodeHistory

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);
}
Also used : NodeHistory(org.ow2.proactive.resourcemanager.core.history.NodeHistory)

Example 2 with NodeHistory

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();
}
Also used : NodeHistory(org.ow2.proactive.resourcemanager.core.history.NodeHistory)

Example 3 with NodeHistory

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);
}
Also used : RMDBManager(org.ow2.proactive.resourcemanager.db.RMDBManager) NodeHistory(org.ow2.proactive.resourcemanager.core.history.NodeHistory) Configuration(org.hibernate.cfg.Configuration)

Example 4 with NodeHistory

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;
}
Also used : NodeHistory(org.ow2.proactive.resourcemanager.core.history.NodeHistory)

Aggregations

NodeHistory (org.ow2.proactive.resourcemanager.core.history.NodeHistory)4 Configuration (org.hibernate.cfg.Configuration)1 RMDBManager (org.ow2.proactive.resourcemanager.db.RMDBManager)1