use of org.objectweb.proactive.core.runtime.VMInformation in project scheduling by ow2-proactive.
the class InProcessTaskExecutorTest method mockedNodeSet.
private NodeSet mockedNodeSet() {
NodeSet nodes = new NodeSet();
ProActiveRuntime proActiveRuntime = mock(ProActiveRuntime.class);
VMInformation vmInformation = mock(VMInformation.class);
when(vmInformation.getHostName()).thenReturn("dummyhost");
when(proActiveRuntime.getVMInformation()).thenReturn(vmInformation);
nodes.add(new NodeImpl(proActiveRuntime, "dummyhost"));
return nodes;
}
use of org.objectweb.proactive.core.runtime.VMInformation 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.runtime.VMInformation 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.runtime.VMInformation in project scheduling by ow2-proactive.
the class TopologyNodesTest method createMockeNode.
private Node createMockeNode(String hostName) {
Node node = mock(Node.class);
String nodeName = hostName + "_" + nodeNameIndex++;
VMInformation vmInformation = mock(VMInformation.class);
NodeInformation nodeInformation = mock(NodeInformation.class);
if (!mockedInetAddresses.containsKey(hostName)) {
mockedInetAddresses.put(hostName, mock(InetAddress.class));
}
InetAddress inetAddress = mockedInetAddresses.get(hostName);
when(node.getVMInformation()).thenReturn(vmInformation);
when(node.getNodeInformation()).thenReturn(nodeInformation);
when(nodeInformation.getVMInformation()).thenReturn(vmInformation);
when(nodeInformation.getName()).thenReturn(nodeName);
when(vmInformation.getHostName()).thenReturn(hostName);
when(vmInformation.getInetAddress()).thenReturn(inetAddress);
when(inetAddress.getHostName()).thenReturn(hostName);
when(node.toString()).thenReturn(nodeName);
return node;
}
Aggregations