[jboss-svn-commits] JBL Code SVN: r15087 - in labs/jbossesb/trunk/product/rosetta: tests/src/org/jboss/soa/esb/notification and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Sep 13 09:13:48 EDT 2007
Author: kevin.conner at jboss.com
Date: 2007-09-13 09:13:48 -0400 (Thu, 13 Sep 2007)
New Revision: 15087
Modified:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyEmail.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyEmailUnitTest.java
Log:
Tidied up email notification: JBESB-1022
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyEmail.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyEmail.java 2007-09-13 12:04:29 UTC (rev 15086)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyEmail.java 2007-09-13 13:13:48 UTC (rev 15087)
@@ -98,7 +98,7 @@
}
ConfigTree oP = m_oParms.cloneObj();
String sMsg = oP.getAttribute(Email.MESSAGE);
- sMsg = ((null == sMsg) ? content : sMsg + "\n") + content;
+ sMsg = ((null == sMsg) ? content : (sMsg + "\n" + content));
oP.setAttribute(Email.MESSAGE, sMsg);
sendEmailNotification(oP);
}
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyEmailUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyEmailUnitTest.java 2007-09-13 12:04:29 UTC (rev 15086)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/notification/NotifyEmailUnitTest.java 2007-09-13 13:13:48 UTC (rev 15087)
@@ -47,18 +47,33 @@
emailMessageEl.setAttribute(Email.COPYTO, "g.h at i.com");
emailMessageEl.setAttribute(Email.MESSAGE, "Hi there!!!");
- NotifyEmail ne = new TestNotifyEmail(emailMessageEl);
+ NotifyEmail ne = new TestNotifyEmail(emailMessageEl, "Hi there!!!\nHello");
Message message = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
message.getBody().add(BytesBody.BYTES_LOCATION, "Hello".getBytes());
ne.sendNotification(message);
}
+
+ public void test_NotifyEmailNoMessage() throws Exception {
+ ConfigTree emailMessageEl = new ConfigTree("email");
+
+ emailMessageEl.setAttribute(Email.FROM, "a.b at c.com");
+ emailMessageEl.setAttribute(Email.SENDTO, "d.e at f.com");
+ emailMessageEl.setAttribute(Email.COPYTO, "g.h at i.com");
+
+ NotifyEmail ne = new TestNotifyEmail(emailMessageEl, "Hello");
+ Message message = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
+ message.getBody().add(BytesBody.BYTES_LOCATION, "Hello".getBytes());
+ ne.sendNotification(message);
+ }
private class TestNotifyEmail extends NotifyEmail {
- public TestNotifyEmail(ConfigTree p_oP) throws Exception {
+ private final String message ;
+ public TestNotifyEmail(ConfigTree p_oP, final String message) throws Exception {
super(p_oP);
+ this.message = message ;
}
protected void sendEmailNotification(ConfigTree messageParams) throws AddressException, MessagingException {
- assertEquals("Hi there!!!\nHello", messageParams.getAttribute(Email.MESSAGE));
+ assertEquals(message, messageParams.getAttribute(Email.MESSAGE));
}
}
}
More information about the jboss-svn-commits
mailing list