use of org.ow2.proactive.scheduler.task.TaskIdImpl.createTaskId in project scheduling by ow2-proactive.
the class NoVncSecuredTargetResolverTest method testMagicStringFoundInLiveLogs.
@Test
public void testMagicStringFoundInLiveLogs() throws Exception {
String sessionId = SharedSessionStoreTestUtils.createValidSession(schedulerMock);
SharedSessionStore.getInstance().get(sessionId).getJobsOutputController().addJobOutputAppender("42", createLiveLogs("[Visualization_task@node2;10:38:06]PA_REMOTE_CONNECTION;42;1;vnc;node.grid.com:5900"));
when(schedulerMock.getTaskResult("42", "remoteVisuTask")).thenReturn(new TaskResultImpl(TaskIdImpl.createTaskId(new JobIdImpl(42, "job"), "remoteVisuTask", 1), new byte[0], new byte[0], new SimpleTaskLogs("", ""), true));
InetSocketAddress targetVncHost = new NoVncSecuredTargetResolver().doResolve(sessionId, "42", "remoteVisuTask");
assertEquals(5900, targetVncHost.getPort());
assertEquals("node.grid.com", targetVncHost.getHostName());
}
use of org.ow2.proactive.scheduler.task.TaskIdImpl.createTaskId in project scheduling by ow2-proactive.
the class NoVncSecuredTargetResolverTest method testMagicStringFoundInLogs.
@Test
public void testMagicStringFoundInLogs() throws Exception {
String sessionId = SharedSessionStoreTestUtils.createValidSession(schedulerMock);
when(schedulerMock.getTaskResult("42", "remoteVisuTask")).thenReturn(new TaskResultImpl(TaskIdImpl.createTaskId(new JobIdImpl(42, "job"), "remoteVisuTask", 1), new byte[0], new byte[0], new SimpleTaskLogs("PA_REMOTE_CONNECTION;42;1;vnc;node.grid.com:5900", ""), true));
InetSocketAddress targetVncHost = new NoVncSecuredTargetResolver().doResolve(sessionId, "42", "remoteVisuTask");
assertEquals(5900, targetVncHost.getPort());
assertEquals("node.grid.com", targetVncHost.getHostName());
}
use of org.ow2.proactive.scheduler.task.TaskIdImpl.createTaskId in project scheduling by ow2-proactive.
the class TerminationDataTest method testAddTaskData.
@Test
public void testAddTaskData() {
assertThat(terminationData.isEmpty(), is(true));
InternalJob job = new InternalTaskFlowJob("test-name", JobPriority.NORMAL, OnTaskError.CANCEL_JOB, "description");
JobId jobId = new JobIdImpl(666, "readableName");
InternalTask internalTask = new InternalScriptTask(job);
TaskId taskId = TaskIdImpl.createTaskId(jobId, "task-name", 777L);
internalTask.setId(taskId);
internalTask.setName("task-name");
internalTask.setStatus(TaskStatus.RUNNING);
internalTask.setExecuterInformation(Mockito.mock(ExecuterInformation.class));
RunningTaskData taskData = new RunningTaskData(internalTask, "user", null, null);
terminationData.addTaskData(null, taskData, TerminationData.TerminationStatus.NORMAL, null);
assertThat(terminationData.isEmpty(), is(false));
assertThat(terminationData.taskTerminated(jobId, "task-name"), is(true));
}
use of org.ow2.proactive.scheduler.task.TaskIdImpl.createTaskId in project scheduling by ow2-proactive.
the class TerminationDataTest method testAddRestartData.
@Test
public void testAddRestartData() {
assertThat(terminationData.isEmpty(), is(true));
JobId jobId = new JobIdImpl(666, "readableName");
TaskId taskId = TaskIdImpl.createTaskId(jobId, "task-name", 777L);
terminationData.addRestartData(taskId, 1000L);
assertThat(terminationData.isEmpty(), is(false));
}
use of org.ow2.proactive.scheduler.task.TaskIdImpl.createTaskId in project scheduling by ow2-proactive.
the class TerminationDataTest method testHandleTerminationForTaskToRestart.
@Test
public void testHandleTerminationForTaskToRestart() throws RMProxyCreationException, IOException, ClassNotFoundException {
JobId jobId = new JobIdImpl(666, "readableName");
TaskId taskId = TaskIdImpl.createTaskId(jobId, "task-name", 777L);
terminationData.addRestartData(taskId, 1000L);
terminationData.handleTermination(service);
Mockito.verify(schedulingInfrastructure, Mockito.times(1)).schedule(org.mockito.Matchers.any(Runnable.class), org.mockito.Matchers.anyLong());
}
Aggregations