Search in sources :

Example 96 with Client

use of org.ow2.proactive.resourcemanager.authentication.Client in project scheduling by ow2-proactive.

the class RMCoreTest method configureRMNode.

private void configureRMNode(MockedRMNodeParameters param) {
    RMNode rmNode = param.getRmNode();
    Node mockedNode = Mockito.mock(Node.class);
    NodeInformation mockedNodeInformation = Mockito.mock(NodeInformation.class);
    when(mockedNode.getNodeInformation()).thenReturn(mockedNodeInformation);
    when(rmNode.getNode()).thenReturn(mockedNode);
    when(rmNode.getNodeName()).thenReturn(param.getUrl());
    when(rmNode.getNodeURL()).thenReturn(param.getUrl());
    when(rmNode.isDown()).thenReturn(param.isDown());
    when(rmNode.isFree()).thenReturn(param.isFree());
    when(rmNode.isLocked()).thenReturn(param.isLocked());
    when(mockedNodeInformation.getURL()).thenReturn(param.getUrl());
    when(mockedNodeInformation.getName()).thenReturn(param.getUrl());
    when(rmNode.getNodeSource()).thenReturn(param.getNodeSource());
    when(rmNode.getNodeSourceName()).thenReturn(param.getNodeSourceName());
    when(rmNode.getAdminPermission()).thenReturn(null);
    when(rmNode.getProvider()).thenReturn(new Client());
    Client client = Mockito.mock(Client.class);
    when(rmNode.getOwner()).thenReturn(client);
    when(client.getName()).thenReturn("test");
    when(rmNode.getNodeURL()).thenReturn(param.getUrl());
    try {
        when(mockedNode.getThreadDump()).thenReturn("threadDumpExample");
    } catch (ProActiveException e) {
        e.printStackTrace();
    }
}
Also used : RMNode(org.ow2.proactive.resourcemanager.rmnode.RMNode) NodeInformation(org.objectweb.proactive.core.node.NodeInformation) RMNode(org.ow2.proactive.resourcemanager.rmnode.RMNode) RMDeployingNode(org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode) Node(org.objectweb.proactive.core.node.Node) ProActiveException(org.objectweb.proactive.core.ProActiveException) Client(org.ow2.proactive.resourcemanager.authentication.Client)

Example 97 with Client

use of org.ow2.proactive.resourcemanager.authentication.Client in project scheduling by ow2-proactive.

the class RMCoreTest method testGetNodeByUrlIncludingDeployingNodesUnknownNodeUrl.

@Test
public void testGetNodeByUrlIncludingDeployingNodesUnknownNodeUrl() {
    RMDeployingNode rmNode = new RMDeployingNode("node", mockedNodeSource, "command", new Client());
    doReturn(rmNode).when(mockedNodeSource).getNodeInDeployingOrLostNodes(rmNode.getNodeURL());
    RMNode rmNodeFound = rmCore.getNodeByUrlIncludingDeployingNodes(rmNode.getNodeURL());
    assertThat(rmNodeFound).isSameAs(rmNode);
}
Also used : RMNode(org.ow2.proactive.resourcemanager.rmnode.RMNode) RMDeployingNode(org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode) Client(org.ow2.proactive.resourcemanager.authentication.Client) Test(org.junit.Test)

Example 98 with Client

use of org.ow2.proactive.resourcemanager.authentication.Client 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 99 with Client

use of org.ow2.proactive.resourcemanager.authentication.Client in project scheduling by ow2-proactive.

the class NodeSourceTest method testSetNodeAvailableKnownNode.

@Test
public void testSetNodeAvailableKnownNode() throws RMException {
    Node node = createNode(PROACTIVE_PROGRAMMING_NODE_URL);
    RMNode rmNode = new RMNodeImpl(node, nodeSource, client, mock(Permission.class));
    nodeSource.internalAddNode(node);
    nodeSource.detectedPingedDownNode(node.getNodeInformation().getName(), node.getNodeInformation().getURL());
    assertThat(nodeSource.getDownNodes()).hasSize(1);
    boolean result = nodeSource.setNodeAvailable(rmNode);
    assertThat(result).isTrue();
    assertThat(nodeSource.getDownNodes()).hasSize(0);
}
Also used : RMNode(org.ow2.proactive.resourcemanager.rmnode.RMNode) RMNode(org.ow2.proactive.resourcemanager.rmnode.RMNode) Node(org.objectweb.proactive.core.node.Node) Permission(java.security.Permission) RMNodeImpl(org.ow2.proactive.resourcemanager.rmnode.RMNodeImpl) Test(org.junit.Test)

Example 100 with Client

use of org.ow2.proactive.resourcemanager.authentication.Client in project scheduling by ow2-proactive.

the class NodeSourceTest method testSetNodeAvailableUnknownNode.

@Test
public void testSetNodeAvailableUnknownNode() throws RMException {
    Node node = createNode(PROACTIVE_PROGRAMMING_NODE_URL);
    RMNode rmNode = new RMNodeImpl(node, nodeSource, client, mock(Permission.class));
    nodeSource.internalAddNode(node);
    assertThat(nodeSource.getDownNodes()).hasSize(0);
    boolean result = nodeSource.setNodeAvailable(rmNode);
    assertThat(result).isFalse();
    assertThat(nodeSource.getDownNodes()).hasSize(0);
}
Also used : RMNode(org.ow2.proactive.resourcemanager.rmnode.RMNode) RMNode(org.ow2.proactive.resourcemanager.rmnode.RMNode) Node(org.objectweb.proactive.core.node.Node) Permission(java.security.Permission) RMNodeImpl(org.ow2.proactive.resourcemanager.rmnode.RMNodeImpl) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)69 ISchedulerClient (org.ow2.proactive.scheduler.rest.ISchedulerClient)36 Client (org.ow2.proactive.resourcemanager.authentication.Client)31 JobId (org.ow2.proactive.scheduler.common.job.JobId)30 TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)28 NonTerminatingJob (functionaltests.jobs.NonTerminatingJob)25 SimpleJob (functionaltests.jobs.SimpleJob)25 Job (org.ow2.proactive.scheduler.common.job.Job)25 ResteasyClient (org.jboss.resteasy.client.jaxrs.ResteasyClient)18 ResteasyWebTarget (org.jboss.resteasy.client.jaxrs.ResteasyWebTarget)18 ListFile (org.ow2.proactive_grid_cloud_portal.dataspace.dto.ListFile)18 File (java.io.File)17 RMNode (org.ow2.proactive.resourcemanager.rmnode.RMNode)13 TaskResult (org.ow2.proactive.scheduler.common.task.TaskResult)13 NotConnectedRestException (org.ow2.proactive_grid_cloud_portal.scheduler.exception.NotConnectedRestException)11 Node (org.objectweb.proactive.core.node.Node)9 IOException (java.io.IOException)8 NotConnectedException (org.ow2.proactive.scheduler.common.exception.NotConnectedException)8 JobInfo (org.ow2.proactive.scheduler.common.job.JobInfo)8 NodeSet (org.ow2.proactive.utils.NodeSet)7