use of org.ow2.proactive.scheduler.common.job.Job in project scheduling by ow2-proactive.
the class SchedulerRestWorkflowFromCatalogExecutionTest method testWhenSubmittingAValidTemplateWithoutVariablesThenTheDefaultJobVariableIsUsed.
@Test
public void testWhenSubmittingAValidTemplateWithoutVariablesThenTheDefaultJobVariableIsUsed() throws Exception {
when(scheduler.submit(Matchers.<Job>any())).thenReturn(new JobIdImpl(88L, "job"));
ArgumentCaptor<Job> argumentCaptor = ArgumentCaptor.forClass(Job.class);
String workflowUrl = getBaseUriTestWorkflowsServer() + "/workflow";
JobIdData response = schedulerRest.submitFromUrl(sessionId, workflowUrl, getEmptyPathSegment());
verify(scheduler).submit(argumentCaptor.capture());
Job interceptedJob = argumentCaptor.getValue();
Assert.assertEquals(1, interceptedJob.getVariables().size());
Assert.assertEquals("defaultvalue", interceptedJob.getVariables().get("var1").getValue());
Assert.assertEquals(88L, response.getId());
Assert.assertEquals("job", response.getReadableName());
}
use of org.ow2.proactive.scheduler.common.job.Job 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.common.job.Job in project scheduling by ow2-proactive.
the class SchedulerStateRestPaginationTest method testGetJobTasksIdsPaginated.
@Test
public void testGetJobTasksIdsPaginated() 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);
}
use of org.ow2.proactive.scheduler.common.job.Job in project scheduling by ow2-proactive.
the class SchedulerStateRestPaginationTest method testGetJobTaskStatesByTagPaginated.
@Test
public void testGetJobTaskStatesByTagPaginated() throws Throwable {
JobState job = newMockedJob(jobIdStr, nbTasks);
when(mockOfScheduler.getJobState(jobIdStr)).thenReturn(job);
List<TaskStateData> res = restInterface.getJobTaskStatesByTagPaginated(sessionId, jobIdStr, "", 0, nbTasks).getList();
assertEquals("Number of tasks is incorrect", nbTasks, res.size());
}
use of org.ow2.proactive.scheduler.common.job.Job in project scheduling by ow2-proactive.
the class SchedulerStateRestPaginationTest method testGetJobTaskStatesPaginated.
@Test
public void testGetJobTaskStatesPaginated() throws Throwable {
JobState job = newMockedJob(jobIdStr, nbTasks);
when(mockOfScheduler.getJobState(jobIdStr)).thenReturn(job);
List<TaskStateData> res = restInterface.getJobTaskStatesPaginated(sessionId, jobIdStr, 0, nbTasks).getList();
assertEquals("Number of tasks is incorrect", nbTasks, res.size());
}
Aggregations