agave-jobs/jobs-core/src/test/java/org/iplantc/service/notification/events/JobNotificationEventTest.java
/**
	 * Test that job status events on software resources properly process their notification template
	 * variables .
	 * 
	 * @throws Exception
	 */
Test that job status events on software resources properly process their notification template
variables .

@throws Exception
Test that job status events on software resources properly process their notification template variables . @throws Exception
@Test(dataProvider="processJobAssociationEventsProvider")
	public void processJobSoftwareEvents(JobStatusType status) 
	throws Exception 
	{
		Software software = createSoftware();
		Job job = createJob(status, software);
		Notification notification = createJobSoftwareNotification(job, software);
		SoftwareNotificationEvent event = (SoftwareNotificationEvent) EventFilterFactory.getInstance(new AgaveUUID(notification.getAssociatedUuid()), notification, notification.getEvent(), job.getOwner());
		ObjectMapper mapper = new ObjectMapper();
		ObjectNode jsonContent = mapper.createObjectNode();
		jsonContent.put("software", mapper.readTree(software.toJSON()));
		jsonContent.put("job", mapper.readTree(job.toJSON()));
		event.setCustomNotificationMessageContextData(jsonContent.toString());
		String resolvedTemplate = event.getEmailBody();
		Assert.assertFalse(resolvedTemplate.contains("${"), "No template variables should be found in the plain text email template body");
		resolvedTemplate = event.getHtmlEmailBody();
		Assert.assertFalse(resolvedTemplate.contains("${"), "No template variables should be found in the html email template body");
		resolvedTemplate = event.getEmailSubject();
	}
@ Test ( dataProvider = "processJobAssociationEventsProvider" ) public void processJobSoftwareEvents ( JobStatusType status ) throws Exception { Software software = createSoftware ( ) ; Job job = createJob ( status , software ) ; Notification notification = createJobSoftwareNotification ( job , software ) ; SoftwareNotificationEvent event = ( SoftwareNotificationEvent ) EventFilterFactory . getInstance ( new AgaveUUID ( notification . getAssociatedUuid ( ) ) , notification , notification . getEvent ( ) , job . getOwner ( ) ) ; ObjectMapper mapper = new ObjectMapper ( ) ; ObjectNode jsonContent = mapper . createObjectNode ( ) ; jsonContent . put ( "software" , mapper . readTree ( software . toJSON ( ) ) ) ; jsonContent . put ( "job" , mapper . readTree ( job . toJSON ( ) ) ) ; event . setCustomNotificationMessageContextData ( jsonContent . toString ( ) ) ; String resolvedTemplate = event . getEmailBody ( ) ; Assert . assertFalse ( resolvedTemplate . contains ( "${" ) , "No template variables should be found in the plain text email template body" ) ; resolvedTemplate = event . getHtmlEmailBody ( ) ; Assert . assertFalse ( resolvedTemplate . contains ( "${" ) , "No template variables should be found in the html email template body" ) ; resolvedTemplate = event . getEmailSubject ( ) ; }
Test that job status events on software resources properly process their notification template
 variables .
Test that job status events on software resources properly process their notification template variables .
//		Assert.assertTrue(resolvedTemplate.contains("Execution System: " + job.getSystem()), "Execution system should be resolved in email body."); //		System.out.println(resolvedTemplate); //		Assert.assertTrue(resolvedTemplate.contains("<strong>Execution System:</strong> " + job.getSystem()), "Execution system should be resolved in email body."); //		System.out.println(resolvedTemplate); //		Assert.assertFalse(resolvedTemplate.contains("${"), "No template variables should be found in the email subject"); //		System.out.println(resolvedTemplate);