use of org.ow2.proactive.resourcemanager.db.NodeSourceData in project scheduling by ow2-proactive.
the class RMDBManagerTest method testGetRMNodeDataByNodeSource.
@Test
public void testGetRMNodeDataByNodeSource() {
RMNodeData rmNodeData1 = addRMNodeData(NODE_NAME_BASE + "1", NODE_STATE_BASE);
// Add another RMNodeData with another NodeSourceData
RMNodeData rmNodeData2 = new RMNodeData(NODE_NAME_BASE + "2", NODE_URL, null, null, null, NODE_STATE_BASE, STATE_CHANGE_TIME_BASE, HOSTNAME, JMX_URLS, JVM_NAME);
NodeSourceData newNodeSourceData = new NodeSourceData();
newNodeSourceData.setName("anotherNodeSourceName");
newNodeSourceData.setPolicyType("aPolicyType");
dbManager.addNodeSource(newNodeSourceData);
rmNodeData2.setNodeSource(newNodeSourceData);
dbManager.addNode(rmNodeData2, newNodeSourceData.getName());
Collection<RMNodeData> nodes = dbManager.getNodesByNodeSource(nodeSourceData.getName());
assertThat(nodes).hasSize(1);
for (RMNodeData node : nodes) {
assertThat(node).isEqualTo(rmNodeData1);
}
}
use of org.ow2.proactive.resourcemanager.db.NodeSourceData in project scheduling by ow2-proactive.
the class RMDBManagerTest method testGetSeveralRMNodeDataByNodeSource.
@Test
public void testGetSeveralRMNodeDataByNodeSource() {
RMNodeData rmNodeData1 = addRMNodeData(NODE_NAME_BASE + "1", NODE_STATE_BASE);
// Add another RMNodeData with another NodeSourceData
RMNodeData rmNodeData2 = new RMNodeData(NODE_NAME_BASE + "2", NODE_URL, null, null, null, NODE_STATE_BASE, STATE_CHANGE_TIME_BASE, HOSTNAME, JMX_URLS, JVM_NAME);
NodeSourceData newNodeSourceData = new NodeSourceData();
newNodeSourceData.setName("anotherNodeSourceName");
newNodeSourceData.setPolicyType("aPolicyType");
dbManager.addNodeSource(newNodeSourceData);
rmNodeData2.setNodeSource(newNodeSourceData);
dbManager.addNode(rmNodeData2, newNodeSourceData.getName());
RMNodeData rmNodeData3 = addRMNodeData(NODE_NAME_BASE + "3", NODE_STATE_BASE);
Collection<RMNodeData> nodes = dbManager.getNodesByNodeSource(nodeSourceData.getName());
assertThat(nodes).hasSize(2);
for (RMNodeData node : nodes) {
assertThat(node).isAnyOf(rmNodeData1, rmNodeData3);
}
}
use of org.ow2.proactive.resourcemanager.db.NodeSourceData in project scheduling by ow2-proactive.
the class RMDBManagerTest method addNodeSourceData.
private void addNodeSourceData() {
nodeSourceData = new NodeSourceData();
nodeSourceData.setName(NODE_SOURCE_NAME_BASE);
nodeSourceData.setPolicyType(NODE_SOURCE_POLICY);
dbManager.addNodeSource(nodeSourceData);
}
use of org.ow2.proactive.resourcemanager.db.NodeSourceData in project scheduling by ow2-proactive.
the class RMDBManagerTest method addRMNodeData.
private RMNodeData addRMNodeData(String nodeName, NodeState state) {
RMNodeData rmNodeData = new RMNodeData(nodeName, NODE_URL, owner, provider, permission, state, STATE_CHANGE_TIME_BASE, HOSTNAME, JMX_URLS, JVM_NAME);
rmNodeData.setNodeSource(nodeSourceData);
dbManager.addNode(rmNodeData, NODE_SOURCE_NAME_BASE);
return rmNodeData;
}
use of org.ow2.proactive.resourcemanager.db.NodeSourceData in project scheduling by ow2-proactive.
the class NodesRecoveryManager method recoverNodeSourcesAndNodes.
protected void recoverNodeSourcesAndNodes() {
Collection<NodeSourceData> nodeSources = this.rmCore.getDbManager().getNodeSources();
this.logPersistedNodeSourceInfo(nodeSources);
for (NodeSourceData nodeSourceData : nodeSources) {
String nodeSourceName = nodeSourceData.getName();
if (NodeSource.DEFAULT_LOCAL_NODES_NODE_SOURCE_NAME.equals(nodeSourceName)) {
// will be recreated by SchedulerStarter
this.rmCore.getDbManager().removeNodeSource(nodeSourceName);
} else {
this.recoverNodeSourceSuccessfullyOrRemove(nodeSourceData, nodeSourceName);
}
}
}
Aggregations