use of org.ow2.proactive.scheduler.task.TaskIdImpl.createTaskId in project scheduling by ow2-proactive.
the class DozerMappingTest method createJobState.
private JobState createJobState() {
return new ClientJobState(new JobState() {
@Override
public void update(TaskInfo taskInfo) {
}
@Override
public void update(JobInfo jobInfo) {
}
@Override
public JobInfo getJobInfo() {
return new JobInfoImpl();
}
@Override
public ArrayList<TaskState> getTasks() {
return new ArrayList<>(getHMTasks().values());
}
@Override
public Map<TaskId, TaskState> getHMTasks() {
TaskId taskId = TaskIdImpl.createTaskId(new JobIdImpl(42, "job"), "remoteVisuTask", 1);
TaskState value = new ClientTaskState(new TaskState() {
@Override
public void update(TaskInfo taskInfo) {
}
@Override
public List<TaskState> getDependences() {
return null;
}
@Override
public TaskInfo getTaskInfo() {
TaskInfoImpl taskInfo = new TaskInfoImpl();
taskInfo.setTaskId(TaskIdImpl.createTaskId(new JobIdImpl(42, "job"), "remoteVisuTask", 1));
return taskInfo;
}
@Override
public int getMaxNumberOfExecutionOnFailure() {
return 0;
}
@Override
public TaskState replicate() throws Exception {
return null;
}
@Override
public int getIterationIndex() {
return 0;
}
@Override
public int getReplicationIndex() {
return 0;
}
});
return Collections.singletonMap(taskId, value);
}
@Override
public String getOwner() {
return null;
}
@Override
public JobType getType() {
return null;
}
});
}
use of org.ow2.proactive.scheduler.task.TaskIdImpl.createTaskId in project scheduling by ow2-proactive.
the class SchedulerStateRestJobLogsTest method createJobResult.
private JobResultImpl createJobResult(String taskOutput, String taskErrput) {
JobResultImpl jobResult = new JobResultImpl();
jobResult.addTaskResult("OneTask", new TaskResultImpl(TaskIdImpl.createTaskId(JobIdImpl.makeJobId("123"), "OneTask", 1), "result", new SimpleTaskLogs(taskOutput, taskErrput), 100), false);
return jobResult;
}
use of org.ow2.proactive.scheduler.task.TaskIdImpl.createTaskId in project scheduling by ow2-proactive.
the class SchedulerStateRestJobLogsTest method addTask.
private static void addTask(InternalTaskFlowJob jobState, long finishedTime, long id) {
InternalScriptTask task = new InternalScriptTask(jobState);
task.setPreciousLogs(true);
task.setFinishedTime(finishedTime);
jobState.addTask(task);
task.setId(TaskIdImpl.createTaskId(new JobIdImpl(123, "job"), "task", id));
}
use of org.ow2.proactive.scheduler.task.TaskIdImpl.createTaskId in project scheduling by ow2-proactive.
the class SchedulerStateRestJobTaskResultTest method testValueOfTaskResult_ExceptionNoMessage.
@Test
public void testValueOfTaskResult_ExceptionNoMessage() throws Throwable {
TaskResultImpl taskResultWithException = new TaskResultImpl(TaskIdImpl.createTaskId(JobIdImpl.makeJobId("42"), "mytask", 1), null, new byte[0], null, false);
when(mockOfScheduler.getTaskResult("42", "mytask")).thenReturn(taskResultWithException);
String exceptionStackTrace = (String) restInterface.valueOfTaskResult(sessionId, "42", "mytask");
assertNotNull(exceptionStackTrace);
}
use of org.ow2.proactive.scheduler.task.TaskIdImpl.createTaskId in project scheduling by ow2-proactive.
the class NoVncSecuredTargetResolverTest method testMagicStringFoundInLogs_MagicStringOnSeveralLines.
@Test
public void testMagicStringFoundInLogs_MagicStringOnSeveralLines() 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\nPA_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());
}
Aggregations