コード例 #1
0
  @Test
  public void testCreateNotificationEmail() throws Exception {

    String expectedEmailBody =
        "Booking Name: Simpson, Homer<br/>Name in Parole case information: offenderName<br/>\n"
            + "SID: A9999999<br/>\n"
            + "DATE/TIME OF BOOKING: 2013-09-06<br/>\n"
            + "ARRESTING AGENCY: Honolulu PD<br/>ATTORNEY GENERAL CASE: false<br/>\n"
            + "ARREST CHARGES:<br/>\n"
            + "Description: Assault Severity: very severe, ARN: I-04679<br/>\n"
            + "<br/><br/>Positively identified by fingerprint.";

    EmailNotification email = new EmailNotification();
    email.addToAddressee("po1@localhost");
    email.setSubjectName("offenderName");
    email.setSubscribingSystemIdentifier("{http://demostate.gov/SystemNames/1.0}SystemA");
    email.setSubscriptionCategoryCode("default");
    email.setNotificationRequest(new ArrestNotificationRequest(getNotificationMessage()));

    Exchange e = new DefaultExchange((CamelContext) null);
    Message inMessage = e.getIn();
    inMessage.setHeader("notificationTopic", "arrest");
    inMessage.setBody(email);

    arrestNotificationProcessor.createNotificationEmail(e);

    Object receivedEmailBody = e.getOut().getBody();
    assertEquals(expectedEmailBody, receivedEmailBody);
    assertEquals("po1@localhost", e.getOut().getHeader(NotificationConstants.HEADER_TO));
  }
コード例 #2
0
  @Test
  public void testCreateNotificationWithSpecifiedEmailTemplate() throws Exception {

    String expectedEmailBody =
        "An event occurred for [Subject offenderName]. Contact their employer.";

    EmailNotification email = new EmailNotification();
    email.addToAddressee("po1@localhost");
    email.setSubjectName("offenderName");
    email.setSubscribingSystemIdentifier("{http://demostate.gov/SystemNames/1.0}SystemA");
    email.setSubscriptionCategoryCode("I");
    email.setNotificationRequest(new ArrestNotificationRequest(getNotificationMessage()));

    Exchange e = new DefaultExchange((CamelContext) null);
    Message inMessage = e.getIn();
    inMessage.setHeader("notificationTopic", "arrest");
    inMessage.setBody(email);

    arrestNotificationProcessor.createNotificationEmail(e);

    Object receivedEmailBody = e.getOut().getBody();
    assertEquals(expectedEmailBody, receivedEmailBody);
    assertEquals("po1@localhost", e.getOut().getHeader(NotificationConstants.HEADER_TO));
  }