Search in sources :

Example 16 with NodeSourceData

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

Example 17 with 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);
    }
}
Also used : RMNodeData(org.ow2.proactive.resourcemanager.db.RMNodeData) NodeSourceData(org.ow2.proactive.resourcemanager.db.NodeSourceData) Test(org.junit.Test)

Example 18 with NodeSourceData

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);
}
Also used : NodeSource(org.ow2.proactive.resourcemanager.nodesource.NodeSource) BooleanWrapper(org.objectweb.proactive.core.util.wrapper.BooleanWrapper) NodeSourceDescriptor(org.ow2.proactive.resourcemanager.nodesource.NodeSourceDescriptor) NodeSourceData(org.ow2.proactive.resourcemanager.db.NodeSourceData)

Example 19 with NodeSourceData

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

Aggregations

NodeSourceData (org.ow2.proactive.resourcemanager.db.NodeSourceData)17 Test (org.junit.Test)6 Serializable (java.io.Serializable)4 RMNodeData (org.ow2.proactive.resourcemanager.db.RMNodeData)4 ProActiveTest (org.ow2.tests.ProActiveTest)4 BooleanWrapper (org.objectweb.proactive.core.util.wrapper.BooleanWrapper)2 NodeSource (org.ow2.proactive.resourcemanager.nodesource.NodeSource)2 DefaultInfrastructureManager (org.ow2.proactive.resourcemanager.nodesource.infrastructure.DefaultInfrastructureManager)2 StaticPolicy (org.ow2.proactive.resourcemanager.nodesource.policy.StaticPolicy)2 URISyntaxException (java.net.URISyntaxException)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 ActiveObjectCreationException (org.objectweb.proactive.ActiveObjectCreationException)1 ProActiveException (org.objectweb.proactive.core.ProActiveException)1 NodeException (org.objectweb.proactive.core.node.NodeException)1 Client (org.ow2.proactive.resourcemanager.authentication.Client)1 RMCore (org.ow2.proactive.resourcemanager.core.RMCore)1 AddingNodesException (org.ow2.proactive.resourcemanager.exception.AddingNodesException)1 NotConnectedException (org.ow2.proactive.resourcemanager.exception.NotConnectedException)1 RMException (org.ow2.proactive.resourcemanager.exception.RMException)1 RMMonitoringImpl (org.ow2.proactive.resourcemanager.frontend.RMMonitoringImpl)1