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 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 RMCore method defineNodeSource.
/**
* {@inheritDoc}
*/
@Override
public BooleanWrapper defineNodeSource(String nodeSourceName, String infrastructureType, Object[] infraParams, String policyType, Object[] policyParams, boolean nodesRecoverable) {
logger.info("Define node source " + nodeSourceName + REQUESTED_BY_STRING + this.caller.getName());
this.validateNodeSourceNameOrFail(nodeSourceName);
nodeSourceName = nodeSourceName.trim();
NodeSourceData nodeSourceData = this.getNodeSourceToPersist(nodeSourceName, infrastructureType, infraParams, policyType, policyParams, nodesRecoverable);
this.dbManager.addNodeSource(nodeSourceData);
NodeSourceDescriptor nodeSourceDescriptor = nodeSourceData.toNodeSourceDescriptor();
NodeSource nodeSource = this.createNodeSourceInstance(nodeSourceDescriptor);
this.definedNodeSources.put(nodeSourceName, nodeSource);
this.emitNodeSourceEvent(nodeSource, RMEventType.NODESOURCE_DEFINED);
logger.info(NODE_SOURCE_STRING + nodeSourceName + HAS_BEEN_SUCCESSFULLY + "defined");
return new BooleanWrapper(true);
}
use of org.ow2.proactive.resourcemanager.db.NodeSourceData in project scheduling by ow2-proactive.
the class RMCore method persistNodeSourceWithNewDescriptor.
private void persistNodeSourceWithNewDescriptor(NodeSourceDescriptor updatedDescriptor) {
NodeSourceData nodeSourceData = NodeSourceData.fromNodeSourceDescriptor(updatedDescriptor);
this.dbManager.updateNodeSource(nodeSourceData);
}
Aggregations