use of org.ow2.proactive.scheduler.job.InternalJob in project scheduling by ow2-proactive.
the class JobEmailNotificationTest method createJob.
private InternalJob createJob(String userEmail) throws Exception {
TaskFlowJob job = new TaskFlowJob();
job.setName(JOB_NAME);
if (userEmail != null) {
job.addGenericInformation(JobEmailNotification.GENERIC_INFORMATION_KEY_EMAIL, userEmail);
}
JavaTask javaTask = new JavaTask();
javaTask.setExecutableClassName(TestJavaTask.class.getName());
javaTask.setName(TASK_NAME);
job.addTask(javaTask);
InternalJob internalJob = InternalJobFactory.createJob(job, null);
internalJob.setOwner(DEFAULT_USER_NAME);
return internalJob;
}
use of org.ow2.proactive.scheduler.job.InternalJob in project scheduling by ow2-proactive.
the class JobEmailNotificationTest method testJobRestartedFromError.
@Test
public void testJobRestartedFromError() throws Exception {
InternalJob job = createJob(USER_EMAIL);
job.setId(new JobIdImpl(123890, job.getName()));
job.setStatus(JobStatus.RUNNING);
Map<String, String> genericInfo = job.getGenericInformation();
genericInfo.put("NOTIFICATION_EVENTS", "Job restarted from error");
job.setGenericInformation(genericInfo);
boolean sent = sendNotification(job, SchedulerEvent.JOB_RESTARTED_FROM_ERROR, stubbedSender);
assertTrue(sent);
verify(stubbedSender).sender(eq(USER_EMAIL), contains("ProActive Job 123890 : Job restarted from error"), contains("Status: Running"));
verifyNoMoreInteractions(stubbedSender);
}
use of org.ow2.proactive.scheduler.job.InternalJob in project scheduling by ow2-proactive.
the class JobEmailNotificationTest method testDisabled.
@Test
public void testDisabled() throws Exception {
disableEmailNotifications();
InternalJob job = createJob(USER_EMAIL);
boolean sent = sendNotification(job, SchedulerEvent.JOB_RUNNING_TO_FINISHED, stubbedSender);
assertFalse(sent);
verifyNoMoreInteractions(stubbedSender);
}
use of org.ow2.proactive.scheduler.job.InternalJob in project scheduling by ow2-proactive.
the class JobEmailNotificationTest method testFinished.
@Test
public void testFinished() throws Exception {
InternalJob job = createJob(USER_EMAIL);
job.setId(new JobIdImpl(123890, job.getName()));
job.setStatus(JobStatus.FINISHED);
Map<String, String> genericInfo = job.getGenericInformation();
genericInfo.put("NOTIFICATION_EVENTS", "Job running to finished");
job.setGenericInformation(genericInfo);
boolean sent = sendNotification(job, SchedulerEvent.JOB_RUNNING_TO_FINISHED, stubbedSender);
assertTrue(sent);
verify(stubbedSender).sender(eq(USER_EMAIL), contains("ProActive Job 123890 : Job running to finished"), contains("Status: Finished"));
verifyNoMoreInteractions(stubbedSender);
}
use of org.ow2.proactive.scheduler.job.InternalJob in project scheduling by ow2-proactive.
the class JobEmailNotificationTest method testJobSubmitted.
@Test
public void testJobSubmitted() throws Exception {
InternalJob job = createJob(USER_EMAIL);
job.setId(new JobIdImpl(123890, job.getName()));
job.setStatus(JobStatus.PENDING);
Map<String, String> genericInfo = job.getGenericInformation();
genericInfo.put("NOTIFICATION_EVENTS", "Job submitted");
job.setGenericInformation(genericInfo);
boolean sent = sendNotification(job, SchedulerEvent.JOB_SUBMITTED, stubbedSender);
assertTrue(sent);
verify(stubbedSender).sender(eq(USER_EMAIL), contains("ProActive Job 123890 : Job submitted"), contains("Status: Pending"));
verifyNoMoreInteractions(stubbedSender);
}
Aggregations