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