Search in sources :

Example 6 with NodeSourceData

use of org.ow2.proactive.resourcemanager.db.NodeSourceData in project scheduling by ow2-proactive.

the class RMDBManagerBufferTest 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 7 with NodeSourceData

use of org.ow2.proactive.resourcemanager.db.NodeSourceData in project scheduling by ow2-proactive.

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

Example 8 with NodeSourceData

use of org.ow2.proactive.resourcemanager.db.NodeSourceData in project scheduling by ow2-proactive.

the class NodeSourceTest method createNodeSource.

private NodeSource createNodeSource(InfrastructureManager infrastructureManager, NodeSourcePolicy nodeSourcePolicy, Client client) {
    NodeSourceData nodeSourceData = new NodeSourceData();
    nodeSourceData.setProvider(client);
    nodeSourceData.setNodesRecoverable(NODES_NOT_RECOVERABLE);
    return new NodeSource("registrationURL", "name", infrastructureManager, nodeSourcePolicy, mock(RMCore.class), mock(RMMonitoringImpl.class), nodeSourceData.toNodeSourceDescriptor());
}
Also used : RMCore(org.ow2.proactive.resourcemanager.core.RMCore) RMMonitoringImpl(org.ow2.proactive.resourcemanager.frontend.RMMonitoringImpl) NodeSourceData(org.ow2.proactive.resourcemanager.db.NodeSourceData)

Example 9 with NodeSourceData

use of org.ow2.proactive.resourcemanager.db.NodeSourceData in project scheduling by ow2-proactive.

the class NodeSourcesTest method emptyNodeSource.

@Test
public void emptyNodeSource() throws Exception {
    NodeSourceData nodeSourceData = new NodeSourceData();
    try {
        dbManager.addNodeSource(nodeSourceData);
        Assert.fail("Empty node source successfully added");
    } catch (RuntimeException e) {
    }
}
Also used : NodeSourceData(org.ow2.proactive.resourcemanager.db.NodeSourceData) Test(org.junit.Test) ProActiveTest(org.ow2.tests.ProActiveTest)

Example 10 with NodeSourceData

use of org.ow2.proactive.resourcemanager.db.NodeSourceData in project scheduling by ow2-proactive.

the class NodeSourcesTest method addNodeSource.

@Test
public void addNodeSource() throws Exception {
    NodeSourceData nodeSourceData = createNodeSource();
    nodeSourceData.setInfrastructureVariables(infrastructureVariables);
    assertThat(dbManager.getNodeSources()).isEmpty();
    dbManager.addNodeSource(nodeSourceData);
    Collection<NodeSourceData> nodeSources = dbManager.getNodeSources();
    assertThat(nodeSources).hasSize(1);
    NodeSourceData nodeSource = nodeSources.iterator().next();
    Assert.assertEquals("ns1", nodeSource.getName());
    Assert.assertEquals(DefaultInfrastructureManager.class.getName(), nodeSource.getInfrastructureType());
    Assert.assertEquals("infrastructure", nodeSource.getInfrastructureParameters().toArray()[0]);
    Assert.assertEquals(StaticPolicy.class.getName(), nodeSource.getPolicyType());
    Assert.assertEquals("policy", nodeSource.getPolicyParameters().toArray()[0]);
    assertThat(nodeSource.getInfrastructureVariables()).hasSize(1);
    Assert.assertEquals(INFRASTRUCTURE_VARIABLE_VALUE, nodeSource.getInfrastructureVariables().get(INFRASTRUCTURE_VARIABLE_KEY));
}
Also used : DefaultInfrastructureManager(org.ow2.proactive.resourcemanager.nodesource.infrastructure.DefaultInfrastructureManager) StaticPolicy(org.ow2.proactive.resourcemanager.nodesource.policy.StaticPolicy) NodeSourceData(org.ow2.proactive.resourcemanager.db.NodeSourceData) Test(org.junit.Test) ProActiveTest(org.ow2.tests.ProActiveTest)

Aggregations

NodeSourceData (org.ow2.proactive.resourcemanager.db.NodeSourceData)13 Test (org.junit.Test)6 Serializable (java.io.Serializable)4 RMNodeData (org.ow2.proactive.resourcemanager.db.RMNodeData)4 ProActiveTest (org.ow2.tests.ProActiveTest)4 DefaultInfrastructureManager (org.ow2.proactive.resourcemanager.nodesource.infrastructure.DefaultInfrastructureManager)2 StaticPolicy (org.ow2.proactive.resourcemanager.nodesource.policy.StaticPolicy)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 Client (org.ow2.proactive.resourcemanager.authentication.Client)1 RMCore (org.ow2.proactive.resourcemanager.core.RMCore)1 RMMonitoringImpl (org.ow2.proactive.resourcemanager.frontend.RMMonitoringImpl)1