Search in sources :

Example 36 with NodeSource

use of org.ow2.proactive.resourcemanager.nodesource.NodeSource in project scheduling by ow2-proactive.

the class InfrastructureManagerTest method testGetDeployingNodeUnknownNode.

@Test
public void testGetDeployingNodeUnknownNode() {
    RMDeployingNode rmNode = new RMDeployingNode("deploying", nodeSource, "command", null);
    assertThat(infrastructureManager.getDeployingNodesWithLock()).hasSize(0);
    assertThat(infrastructureManager.getPersistedDeployingNodesUrl()).hasSize(0);
    assertThat(infrastructureManager.getLostNodesWithLock()).hasSize(0);
    assertThat(infrastructureManager.getPersistedLostNodesUrl()).hasSize(0);
    RMDeployingNode rmNodeFound = infrastructureManager.getDeployingOrLostNode(rmNode.getNodeURL());
    assertThat(rmNodeFound).isNull();
}
Also used : RMDeployingNode(org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode) Test(org.junit.Test)

Example 37 with NodeSource

use of org.ow2.proactive.resourcemanager.nodesource.NodeSource in project scheduling by ow2-proactive.

the class RMNodeHelper method basicWithMockedInternals.

public static Pair<RMNodeImpl, Node> basicWithMockedInternals(String nodeSourceName, Node node) {
    NodeSource nodeSource = Mockito.mock(NodeSource.class);
    Set<Principal> principals = new HashSet<>();
    principals.add(new UserNamePrincipal("provider"));
    Client provider = new Client(new Subject(false, principals, emptySet(), emptySet()), false);
    Permission permission = Mockito.mock(Permission.class);
    when(nodeSource.getName()).thenReturn(nodeSourceName);
    return new ImmutablePair<>(new RMNodeImpl(node, nodeSource, provider, permission), node);
}
Also used : UserNamePrincipal(org.ow2.proactive.authentication.principals.UserNamePrincipal) NodeSource(org.ow2.proactive.resourcemanager.nodesource.NodeSource) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) Permission(java.security.Permission) Client(org.ow2.proactive.resourcemanager.authentication.Client) UserNamePrincipal(org.ow2.proactive.authentication.principals.UserNamePrincipal) Principal(java.security.Principal) Subject(javax.security.auth.Subject) HashSet(java.util.HashSet)

Example 38 with NodeSource

use of org.ow2.proactive.resourcemanager.nodesource.NodeSource 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)

Example 39 with NodeSource

use of org.ow2.proactive.resourcemanager.nodesource.NodeSource in project scheduling by ow2-proactive.

the class RMDBManagerTest method testCreateLockEntryOrUpdateEnabled.

@Test
public void testCreateLockEntryOrUpdateEnabled() {
    int nbEntries = 42;
    Map<String, Integer> entries = insertEntries(nbEntries);
    List<LockHistory> lockHistories = dbManager.getLockHistories();
    assertThat(lockHistories).hasSize(nbEntries);
    for (int i = 0; i < nbEntries; i++) {
        Integer found = entries.remove("nodeSource" + i);
        assertThat(found).isNotNull();
        assertThat(found).isEqualTo(i);
    }
    assertThat(entries).hasSize(0);
}
Also used : MutableInteger(org.objectweb.proactive.core.util.MutableInteger) LockHistory(org.ow2.proactive.resourcemanager.core.history.LockHistory) Test(org.junit.Test)

Example 40 with NodeSource

use of org.ow2.proactive.resourcemanager.nodesource.NodeSource in project scheduling by ow2-proactive.

the class RMProxyUserInterfaceTest method testGetNodeMBeanInfo_DisconnectionOfRemovedNodeSource.

// SCHEDULING-1850
@Test
public void testGetNodeMBeanInfo_DisconnectionOfRemovedNodeSource() throws Exception {
    proxyUserInterface = createRMCachingProxyUserInterface();
    rmHelper.createNodeSource("NodeSource1", 1);
    RMInitialState state = ((RMMonitorEventReceiver) rmHelper.getResourceManager()).getInitialState();
    String nodeSource1_NodeJmxUrl = state.getNodeEvents().get(0).getDefaultJMXUrl();
    Object mBeanFromNodeSource1 = proxyUserInterface.getNodeMBeanInfo(nodeSource1_NodeJmxUrl, EXISTING_OBJECT_NAME, Collections.<String>emptyList());
    assertNotNull(mBeanFromNodeSource1);
    // remove nodesource and try another jmx connection
    rmHelper.getResourceManager().removeNodeSource("NodeSource1", true);
    rmHelper.createNodeSource("NodeSource2", 1);
    state = ((RMMonitorEventReceiver) rmHelper.getResourceManager()).getInitialState();
    String nodeSource2_NodeJmxUrl = state.getNodeEvents().get(0).getDefaultJMXUrl();
    Object mBeanFromNodeSource2 = proxyUserInterface.getNodeMBeanInfo(nodeSource2_NodeJmxUrl, EXISTING_OBJECT_NAME, Collections.<String>emptyList());
    assertNotNull(mBeanFromNodeSource2);
    // cleanup
    rmHelper.getResourceManager().removeNodeSource("NodeSource2", true);
}
Also used : RMInitialState(org.ow2.proactive.resourcemanager.common.event.RMInitialState) PAActiveObject(org.objectweb.proactive.api.PAActiveObject) RMMonitorEventReceiver(functionaltests.monitor.RMMonitorEventReceiver) Test(org.junit.Test) RMFunctionalTest(functionaltests.utils.RMFunctionalTest)

Aggregations

NodeSource (org.ow2.proactive.resourcemanager.nodesource.NodeSource)21 Test (org.junit.Test)17 RMNode (org.ow2.proactive.resourcemanager.rmnode.RMNode)13 BooleanWrapper (org.objectweb.proactive.core.util.wrapper.BooleanWrapper)11 RMDeployingNode (org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode)11 Client (org.ow2.proactive.resourcemanager.authentication.Client)9 Node (org.objectweb.proactive.core.node.Node)8 ResourceManager (org.ow2.proactive.resourcemanager.frontend.ResourceManager)7 ArrayList (java.util.ArrayList)6 RMNodeSourceEvent (org.ow2.proactive.resourcemanager.common.event.RMNodeSourceEvent)6 Permission (java.security.Permission)5 NodeSourceData (org.ow2.proactive.resourcemanager.db.NodeSourceData)5 RMException (org.ow2.proactive.resourcemanager.exception.RMException)5 Throwables.getStackTraceAsString (com.google.common.base.Throwables.getStackTraceAsString)4 IOException (java.io.IOException)4 HashMap (java.util.HashMap)4 HashSet (java.util.HashSet)4 Path (javax.ws.rs.Path)4 Produces (javax.ws.rs.Produces)4 Matchers.anyString (org.mockito.Matchers.anyString)4