use of org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobValidationData in project scheduling by ow2-proactive.
the class SchedulerRestWorkflowFromCatalogExecutionTest method testWhenValidatingUsingANullWorkflowUrlThenValidationContainsException.
@Test
public void testWhenValidatingUsingANullWorkflowUrlThenValidationContainsException() throws Exception {
String workflowUrl = null;
JobValidationData response = schedulerRest.validateFromUrl(sessionId, workflowUrl, getEmptyPathSegment());
checkInvalidResponse(response);
}
use of org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobValidationData in project scheduling by ow2-proactive.
the class ValidationUtil method validateJob.
public JobValidationData validateJob(String jobFilePath, Map<String, String> jobVariables) {
JobValidationData data = new JobValidationData();
try {
JobFactory factory = JobFactory.getFactory();
Job job = factory.createJob(jobFilePath, jobVariables);
if (job instanceof TaskFlowJob) {
validateJob((TaskFlowJob) job, data);
fillUpdatedVariables((TaskFlowJob) job, data);
} else {
data.setValid(true);
}
} catch (JobCreationException e) {
data.setTaskName(e.getTaskName());
data.setErrorMessage(e.getMessage());
data.setStackTrace(getStackTrace(e));
}
return data;
}
use of org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobValidationData in project scheduling by ow2-proactive.
the class ValidationUtil method validateJob.
private void validateJob(TaskFlowJob job, JobValidationData data) {
ArrayList<Task> tasks = job.getTasks();
if (tasks.isEmpty()) {
data.setErrorMessage(String.format("%s must contain at least one task.", job.getName()));
return;
}
FlowError error = FlowChecker.validate(job);
if (error != null) {
data.setTaskName(error.getTask());
data.setErrorMessage(error.getMessage());
return;
}
data.setValid(true);
}
use of org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobValidationData in project scheduling by ow2-proactive.
the class SchedulerRestWorkflowFromCatalogExecutionTest method testWhenValidatingAValidTemplateWithVariablesThenTheProvidedJobVariableIsUsed.
@Test
public void testWhenValidatingAValidTemplateWithVariablesThenTheProvidedJobVariableIsUsed() throws Exception {
String workflowUrl = getBaseUriTestWorkflowsServer() + "/workflow";
JobValidationData response = schedulerRest.validateFromUrl(sessionId, workflowUrl, getOneVariablePathSegment("var1", "value1"));
Assert.assertEquals(1, response.getUpdatedVariables().size());
Assert.assertEquals("value1", response.getUpdatedVariables().get("var1"));
}
use of org.ow2.proactive_grid_cloud_portal.scheduler.dto.JobValidationData in project scheduling by ow2-proactive.
the class SchedulerRestWorkflowFromCatalogExecutionTest method testWhenValidatingAValidTemplateWithoutVariablesThenTheDefaultJobVariableIsUsed.
@Test
public void testWhenValidatingAValidTemplateWithoutVariablesThenTheDefaultJobVariableIsUsed() throws Exception {
String workflowUrl = getBaseUriTestWorkflowsServer() + "/workflow";
JobValidationData response = schedulerRest.validateFromUrl(sessionId, workflowUrl, getEmptyPathSegment());
Assert.assertEquals(1, response.getUpdatedVariables().size());
Assert.assertEquals("defaultvalue", response.getUpdatedVariables().get("var1"));
}
Aggregations