Search in sources :

Example 1 with NodeInformation

use of org.objectweb.proactive.core.node.NodeInformation in project scheduling by ow2-proactive.

the class RMNodeHelper method createNode.

private static Node createNode(String name, String hostname, String nodeUrl, String proActiveRuntimeUrl) {
    VMInformation vmInformation = Mockito.mock(VMInformation.class);
    when(vmInformation.getHostName()).thenReturn(hostname);
    NodeInformation nodeInformation = Mockito.mock(NodeInformation.class);
    when(nodeInformation.getName()).thenReturn(name);
    when(nodeInformation.getURL()).thenReturn(nodeUrl);
    when(nodeInformation.getVMInformation()).thenReturn(vmInformation);
    ProActiveRuntime proActiveRuntime = Mockito.mock(ProActiveRuntime.class);
    when(proActiveRuntime.getURL()).thenReturn(proActiveRuntimeUrl);
    Node node = Mockito.mock(Node.class);
    when(node.getNodeInformation()).thenReturn(nodeInformation);
    when(node.getProActiveRuntime()).thenReturn(proActiveRuntime);
    return node;
}
Also used : NodeInformation(org.objectweb.proactive.core.node.NodeInformation) VMInformation(org.objectweb.proactive.core.runtime.VMInformation) Node(org.objectweb.proactive.core.node.Node) ProActiveRuntime(org.objectweb.proactive.core.runtime.ProActiveRuntime)

Example 2 with NodeInformation

use of org.objectweb.proactive.core.node.NodeInformation in project scheduling by ow2-proactive.

the class SelectionManagerTest method createMockeNode.

public static RMNode createMockeNode(String nodeUser, String nodeName, String nodeUrl) {
    RMNode rmNode = mock(RMNode.class);
    NodeInformation mockedNodeInformation = mock(NodeInformation.class);
    Node node = mock(Node.class);
    when(mockedNodeInformation.getURL()).thenReturn(nodeUrl);
    when(mockedNodeInformation.getName()).thenReturn(nodeName);
    when(node.getNodeInformation()).thenReturn(mockedNodeInformation);
    when(rmNode.getNodeName()).thenReturn(nodeName);
    when(rmNode.getNodeSource()).thenReturn(new NodeSource());
    when(rmNode.getNode()).thenReturn(node);
    when(rmNode.getNodeURL()).thenReturn(nodeUrl);
    when(rmNode.getUserPermission()).thenReturn(new PrincipalPermission("permissions", singleton(new UserNamePrincipal(nodeUser))));
    return rmNode;
}
Also used : UserNamePrincipal(org.ow2.proactive.authentication.principals.UserNamePrincipal) NodeSource(org.ow2.proactive.resourcemanager.nodesource.NodeSource) RMNode(org.ow2.proactive.resourcemanager.rmnode.RMNode) NodeInformation(org.objectweb.proactive.core.node.NodeInformation) RMNode(org.ow2.proactive.resourcemanager.rmnode.RMNode) Node(org.objectweb.proactive.core.node.Node) PrincipalPermission(org.ow2.proactive.permissions.PrincipalPermission)

Example 3 with NodeInformation

use of org.objectweb.proactive.core.node.NodeInformation in project scheduling by ow2-proactive.

the class LiveJobsTest method testFinishInErrorTask.

@Test(timeout = 60000)
public void testFinishInErrorTask() throws UnknownTaskException, UnknownJobException {
    InternalJob job = new InternalTaskFlowJob("test-name", JobPriority.NORMAL, OnTaskError.CONTINUE_JOB_EXECUTION, "description");
    JobId id = new JobIdImpl(666L, "test-name");
    job.setId(id);
    List<InternalTask> tasksList = new ArrayList<>();
    InternalTask internalTask = new InternalScriptTask(job);
    internalTask.setName("task-name");
    internalTask.setStatus(TaskStatus.IN_ERROR);
    Node node = Mockito.mock(Node.class);
    Mockito.when(node.getVMInformation()).thenAnswer(new Answer<VMInformation>() {

        @Override
        public VMInformation answer(InvocationOnMock invocation) throws Throwable {
            return Mockito.mock(VMInformation.class);
        }
    });
    Mockito.when(node.getNodeInformation()).thenAnswer(new Answer<NodeInformation>() {

        @Override
        public NodeInformation answer(InvocationOnMock invocation) throws Throwable {
            return Mockito.mock(NodeInformation.class);
        }
    });
    TaskLauncher taskLauncher = Mockito.mock(TaskLauncher.class);
    internalTask.setExecuterInformation(new ExecuterInformation(taskLauncher, node));
    tasksList.add(internalTask);
    job.setTasks(tasksList);
    liveJobs.jobSubmitted(job);
    liveJobs.finishInErrorTask(job.getId(), "task-name");
    assertThat(internalTask.getStatus(), is(TaskStatus.FINISHED));
}
Also used : ExecuterInformation(org.ow2.proactive.scheduler.task.internal.ExecuterInformation) InternalJob(org.ow2.proactive.scheduler.job.InternalJob) NodeInformation(org.objectweb.proactive.core.node.NodeInformation) InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask) VMInformation(org.objectweb.proactive.core.runtime.VMInformation) TaskLauncher(org.ow2.proactive.scheduler.task.TaskLauncher) Node(org.objectweb.proactive.core.node.Node) ArrayList(java.util.ArrayList) InternalScriptTask(org.ow2.proactive.scheduler.task.internal.InternalScriptTask) InvocationOnMock(org.mockito.invocation.InvocationOnMock) JobIdImpl(org.ow2.proactive.scheduler.job.JobIdImpl) InternalTaskFlowJob(org.ow2.proactive.scheduler.job.InternalTaskFlowJob) JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Example 4 with NodeInformation

use of org.objectweb.proactive.core.node.NodeInformation in project scheduling by ow2-proactive.

the class NodeSourceTest method createNode.

private Node createNode(String nodeUrl) {
    Node node = mock(Node.class);
    NodeInformation nodeInformation = mock(NodeInformation.class);
    when(node.getNodeInformation()).thenReturn(nodeInformation);
    when(node.getProActiveRuntime()).thenReturn(mock(ProActiveRuntime.class));
    when(nodeInformation.getURL()).thenReturn(nodeUrl);
    when(nodeInformation.getVMInformation()).thenReturn(mock(VMInformation.class));
    return node;
}
Also used : NodeInformation(org.objectweb.proactive.core.node.NodeInformation) VMInformation(org.objectweb.proactive.core.runtime.VMInformation) RMNode(org.ow2.proactive.resourcemanager.rmnode.RMNode) Node(org.objectweb.proactive.core.node.Node) ProActiveRuntime(org.objectweb.proactive.core.runtime.ProActiveRuntime)

Example 5 with NodeInformation

use of org.objectweb.proactive.core.node.NodeInformation 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());
}
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) Client(org.ow2.proactive.resourcemanager.authentication.Client)

Aggregations

Node (org.objectweb.proactive.core.node.Node)5 NodeInformation (org.objectweb.proactive.core.node.NodeInformation)5 VMInformation (org.objectweb.proactive.core.runtime.VMInformation)3 RMNode (org.ow2.proactive.resourcemanager.rmnode.RMNode)3 ProActiveRuntime (org.objectweb.proactive.core.runtime.ProActiveRuntime)2 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 UserNamePrincipal (org.ow2.proactive.authentication.principals.UserNamePrincipal)1 PrincipalPermission (org.ow2.proactive.permissions.PrincipalPermission)1 Client (org.ow2.proactive.resourcemanager.authentication.Client)1 NodeSource (org.ow2.proactive.resourcemanager.nodesource.NodeSource)1 RMDeployingNode (org.ow2.proactive.resourcemanager.rmnode.RMDeployingNode)1 JobId (org.ow2.proactive.scheduler.common.job.JobId)1 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)1 InternalTaskFlowJob (org.ow2.proactive.scheduler.job.InternalTaskFlowJob)1 JobIdImpl (org.ow2.proactive.scheduler.job.JobIdImpl)1 TaskLauncher (org.ow2.proactive.scheduler.task.TaskLauncher)1 ExecuterInformation (org.ow2.proactive.scheduler.task.internal.ExecuterInformation)1 InternalScriptTask (org.ow2.proactive.scheduler.task.internal.InternalScriptTask)1