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();
}
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);
}
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));
}
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);
}
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);
}
Aggregations