use of org.ow2.proactive_grid_cloud_portal.scheduler.dto.TaskResultData in project scheduling by ow2-proactive.
the class SchedulerDBManager method loadTaskResult.
@SuppressWarnings("unchecked")
private TaskResult loadTaskResult(Session session, TaskId taskId, int resultIndex) {
DBTaskId dbTaskId = taskId(taskId);
TaskData task = session.load(TaskData.class, dbTaskId);
Query query = session.getNamedQuery("loadTasksResultByTask").setParameter("task", task);
query.setMaxResults(1);
query.setFirstResult(resultIndex);
List<TaskResultData> results = (List<TaskResultData>) query.list();
if (results.isEmpty()) {
return null;
} else {
return results.get(0).toTaskResult(taskId);
}
}
use of org.ow2.proactive_grid_cloud_portal.scheduler.dto.TaskResultData in project scheduling by ow2-proactive.
the class SchedulerStateRestJobTaskResultTest method testValueOfJobResult.
@Test
public void testValueOfJobResult() throws Throwable {
TaskResultImpl taskResult = new TaskResultImpl(TaskIdImpl.createTaskId(JobIdImpl.makeJobId("42"), "mytask", 1), ObjectToByteConverter.ObjectStream.convert("hello"), null, null, false);
JobResultImpl jobResultWithValue = new JobResultImpl();
JobInfoImpl jobInfo = new JobInfoImpl();
jobInfo.setJobId(new JobIdImpl(12, "myjob"));
jobResultWithValue.setJobInfo(jobInfo);
jobResultWithValue.addTaskResult("mytask", taskResult, false);
when(mockOfScheduler.getJobResult("42")).thenReturn(jobResultWithValue);
JobResultData jobResultData = restInterface.jobResult(sessionId, "42");
TaskResultData taskResultData = jobResultData.getAllResults().get("mytask");
assertNotNull(taskResultData);
assertNotNull(taskResultData.getValue());
assertEquals("hello", taskResultData.getValue());
Map<String, String> jobResult = restInterface.jobResultValue(sessionId, "42");
String result = jobResult.get("mytask");
assertNotNull(result);
assertEquals("hello", result);
}
Aggregations