use of org.ow2.proactive.scheduler.common.job.JobState in project scheduling by ow2-proactive.
the class DozerMappingTest method jobStateTasks_Key_AreMappedToString.
@Test
public void jobStateTasks_Key_AreMappedToString() throws Exception {
JobState jobState = createJobState();
JobStateData jobStateData = mapper.map(jobState, JobStateData.class);
assertFalse(jobStateData.getTasks().isEmpty());
for (String s : jobStateData.getTasks().keySet()) {
assertEquals("1", s);
}
}
use of org.ow2.proactive.scheduler.common.job.JobState in project scheduling by ow2-proactive.
the class RestTestUtils method newMockedJob.
protected static JobState newMockedJob(final String jobIdStr, final String tag, final int nbTasks) {
JobState mockedJob = mock(JobState.class);
JobId mockedJobId = mock(JobId.class);
JobInfo mockedJobInfo = mock(JobInfo.class);
List<TaskState> dumbList = new ArrayList<TaskState>(nbTasks);
for (int i = 0; i < nbTasks; i++) {
dumbList.add(newTaskState(jobIdStr, null, i, nbTasks));
}
when(mockedJobId.value()).thenReturn(jobIdStr);
when(mockedJobInfo.getJobId()).thenReturn(mockedJobId);
when(mockedJobInfo.getStatus()).thenReturn(JobStatus.PENDING);
when(mockedJob.getId()).thenReturn(mockedJobId);
when(mockedJob.getTasksPaginated(0, 50)).thenReturn(new TaskStatesPage(dumbList, nbTasks));
when(mockedJob.getTaskByTagPaginated("", 0, 50)).thenReturn(new TaskStatesPage(dumbList, nbTasks));
when(mockedJob.getJobInfo()).thenReturn(mockedJobInfo);
return mockedJob;
}
use of org.ow2.proactive.scheduler.common.job.JobState in project scheduling by ow2-proactive.
the class SchedulerStateRestJobLogsTest method job_full_logs_not_finished.
@Test
public void job_full_logs_not_finished() throws Exception {
InternalTaskFlowJob jobState = new InternalTaskFlowJob();
jobState.addTask(new InternalScriptTask(jobState));
when(mockScheduler.getJobState("123")).thenReturn(jobState);
InputStream fullLogs = restScheduler.jobFullLogs(validSessionId, "123", validSessionId);
assertNull(fullLogs);
}
use of org.ow2.proactive.scheduler.common.job.JobState in project scheduling by ow2-proactive.
the class SchedulerStateRestPaginationTest method newMockedJob.
private JobState newMockedJob(final String jobIdStr, final int nbTasks) {
JobState mockedJob = mock(JobState.class);
JobId mockedJobId = mock(JobId.class);
List<TaskState> dumbList = new ArrayList<TaskState>(nbTasks);
for (int i = 0; i < nbTasks; i++) {
TaskState mockedTask = mock(TaskState.class);
TaskId mockedTaskId = mock(TaskId.class);
when(mockedTaskId.getReadableName()).thenReturn(generateReadableName(jobIdStr, i, nbTasks));
when(mockedTask.getId()).thenReturn(mockedTaskId);
dumbList.add(mockedTask);
}
when(mockedJobId.value()).thenReturn(jobIdStr);
when(mockedJob.getId()).thenReturn(mockedJobId);
when(mockedJob.getTasksPaginated(0, 50)).thenReturn(new TaskStatesPage(dumbList, nbTasks));
when(mockedJob.getTaskByTagPaginated("", 0, 50)).thenReturn(new TaskStatesPage(dumbList, nbTasks));
return mockedJob;
}
use of org.ow2.proactive.scheduler.common.job.JobState in project scheduling by ow2-proactive.
the class SchedulerStateRestPaginationTest method testGetJobTasksIdsByTagPaginated.
@Test
public void testGetJobTasksIdsByTagPaginated() throws Throwable {
JobState job = newMockedJob(jobIdStr, nbTasks);
when(mockOfScheduler.getJobState(jobIdStr)).thenReturn(job);
RestPage<String> page = restInterface.getTasksNamesPaginated(sessionId, jobIdStr, 0, nbTasks);
assertTasks(nbTasks, jobIdStr, page);
}
Aggregations