use of org.ow2.proactive.resourcemanager.db.RMNodeData 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.RMNodeData in project scheduling by ow2-proactive.
the class RMDBManagerTest method testAddRMNodeData.
@Test
public void testAddRMNodeData() {
RMNodeData d = addRMNodeData(NODE_NAME_BASE, NODE_STATE_BASE);
Collection<RMNodeData> allNodes = dbManager.getAllNodes();
assertThat(allNodes).hasSize(1);
for (RMNodeData node : allNodes) {
assertThat(node.getName()).isEqualTo(NODE_NAME_BASE);
assertThat(node.getNodeUrl()).isEqualTo(NODE_URL);
assertThat(node.getState()).isEqualTo(NODE_STATE_BASE);
assertThat(node.getStateChangeTime()).isEqualTo(STATE_CHANGE_TIME_BASE);
assertThat(node.getOwner().getId()).isEqualTo(OWNER_ID);
assertThat(node.getProvider().getId()).isEqualTo(PROVIDER_ID);
assertThat(node.getUserPermission().getName()).isEqualTo(PERMISSION_NAME);
assertThat(node.getHostname()).isEqualTo(HOSTNAME);
assertThat(node.getJmxUrls()[0]).isEqualTo(JMX_URLS[0]);
assertThat(node.getJmxUrls()[1]).isEqualTo(JMX_URLS[1]);
assertThat(node.getJvmName()).isEqualTo(JVM_NAME);
}
}
use of org.ow2.proactive.resourcemanager.db.RMNodeData in project scheduling by ow2-proactive.
the class RMDBManagerTest method testRemoveRMNodeData.
@Test
public void testRemoveRMNodeData() {
RMNodeData rmNodeData = addRMNodeData(NODE_NAME_BASE, NODE_STATE_BASE);
dbManager.removeNode(rmNodeData, NODE_SOURCE_NAME_BASE);
Collection<RMNodeData> allNodes = dbManager.getAllNodes();
assertThat(allNodes).hasSize(0);
}
use of org.ow2.proactive.resourcemanager.db.RMNodeData in project scheduling by ow2-proactive.
the class RMDBManagerTest method testRemoveDeployingNode.
@Test
public void testRemoveDeployingNode() {
addRMNodeData(NODE_NAME_BASE + "1", NODE_STATE_BASE);
RMNodeData rmNodeData = addRMNodeData(NODE_NAME_BASE + "2", NodeState.DEPLOYING);
addRMNodeData(NODE_NAME_BASE + "3", NODE_STATE_BASE);
dbManager.removeNode(rmNodeData, NODE_SOURCE_NAME_BASE);
Collection<RMNodeData> allNodes = dbManager.getAllNodes();
assertThat(allNodes).hasSize(2);
for (RMNodeData node : allNodes) {
assertThat(node.getName()).startsWith(NODE_NAME_BASE);
assertThat(node.getNodeUrl()).isEqualTo(NODE_URL);
// no more deploying nodes should be returned
assertThat(node.getState()).isNotEqualTo(NodeState.DEPLOYING);
assertThat(node.getStateChangeTime()).isEqualTo(STATE_CHANGE_TIME_BASE);
assertThat(node.getOwner().getId()).isEqualTo(OWNER_ID);
assertThat(node.getProvider().getId()).isEqualTo(PROVIDER_ID);
assertThat(node.getUserPermission().getName()).isEqualTo(PERMISSION_NAME);
assertThat(node.getHostname()).isEqualTo(HOSTNAME);
assertThat(node.getJmxUrls()[0]).isEqualTo(JMX_URLS[0]);
assertThat(node.getJmxUrls()[1]).isEqualTo(JMX_URLS[1]);
assertThat(node.getJvmName()).isEqualTo(JVM_NAME);
}
}
use of org.ow2.proactive.resourcemanager.db.RMNodeData in project scheduling by ow2-proactive.
the class RMDBManagerTest method testUpdateRMNodeData.
@Test
public void testUpdateRMNodeData() {
RMNodeData rmNodeData = addRMNodeData(NODE_NAME_BASE, NODE_STATE_BASE);
rmNodeData.setState(NodeState.BUSY);
rmNodeData.setStateChangeTime(5678);
dbManager.updateNode(rmNodeData, NODE_SOURCE_NAME_BASE);
Collection<RMNodeData> allNodes = dbManager.getAllNodes();
assertThat(allNodes).hasSize(1);
for (RMNodeData node : allNodes) {
assertThat(node.getName()).startsWith(NODE_NAME_BASE);
assertThat(node.getName()).isEqualTo(NODE_NAME_BASE);
assertThat(node.getNodeUrl()).isEqualTo(NODE_URL);
assertThat(node.getState()).isEqualTo(NodeState.BUSY);
assertThat(node.getStateChangeTime()).isEqualTo(5678);
assertThat(node.getOwner().getId()).isEqualTo(OWNER_ID);
assertThat(node.getProvider().getId()).isEqualTo(PROVIDER_ID);
assertThat(node.getUserPermission().getName()).isEqualTo(PERMISSION_NAME);
assertThat(node.getHostname()).isEqualTo(HOSTNAME);
assertThat(node.getJmxUrls()[0]).isEqualTo(JMX_URLS[0]);
assertThat(node.getJmxUrls()[1]).isEqualTo(JMX_URLS[1]);
assertThat(node.getJvmName()).isEqualTo(JVM_NAME);
}
}
Aggregations