[jboss-svn-commits] JBL Code SVN: r5507 - in labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb: helpers notification
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sun Aug 6 08:09:31 EDT 2006
Author: arvinder
Date: 2006-08-06 08:09:27 -0400 (Sun, 06 Aug 2006)
New Revision: 5507
Added:
labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/helpers/EmailUnitTest.java
Removed:
labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/helpers/EsbEmailUnitTest.java
Modified:
labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/notification/NotifyEmailUnitTest.java
Log:
renamed EsbEmail to Email / Merge with trunk
Copied: labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/helpers/EmailUnitTest.java (from rev 5506, labs/jbossesb/trunk/product/core/common/tests/src/org/jboss/soa/esb/helpers/EmailUnitTest.java)
Deleted: labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/helpers/EsbEmailUnitTest.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/helpers/EsbEmailUnitTest.java 2006-08-06 12:00:09 UTC (rev 5506)
+++ labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/helpers/EsbEmailUnitTest.java 2006-08-06 12:09:27 UTC (rev 5507)
@@ -1,87 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.soa.esb.helpers;
-
-import java.io.IOException;
-
-import javax.mail.Address;
-import javax.mail.MessagingException;
-import javax.mail.internet.AddressException;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
-
-import junit.framework.TestCase;
-
-/**
- * Tests for the EsbEmail class.
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class EsbEmailUnitTest extends TestCase {
-
- private DomElement mailParams;
-
- @Override
- protected void setUp() throws Exception {
- mailParams = DomElement.fromInputStream(getClass().getResourceAsStream("testfile4.xml"));
- }
-
- public void test_EsbEmail() throws AddressException, MessagingException, IOException {
- // Look at the source message in testfile4.xml before reading this test.
-
- EsbEmail esbMail = new EsbEmail(mailParams);
- MimeMessage message = esbMail.getMailMessage();
- Address[] addresses;
-
- // Check the "from" address details...
- addresses = message.getFrom();
- assertEquals(1, addresses.length);
- assertEquals("x.x at x.com", addresses[0].toString());
-
- // Check the "to" address details...
- addresses = message.getRecipients(MimeMessage.RecipientType.TO);
- assertEquals(2, addresses.length);
- assertEquals("b.b at b.com", addresses[0].toString());
- assertEquals("c.c at c.com", addresses[1].toString());
-
- // Check the "cc" address details...
- addresses = message.getRecipients(MimeMessage.RecipientType.CC);
- assertEquals(2, addresses.length);
- assertEquals("d.d at c.com", addresses[0].toString());
- assertEquals("e.e at e.com", addresses[1].toString());
-
- // Check the "subject"...
- assertEquals("Unit Test - Subject", message.getSubject());
-
- // Check the message body, including attachments...
- MimeMultipart content = (MimeMultipart) message.getContent(); // expect a cast exception if it's not the expected type!
- assertEquals(3, content.getCount()); // the message and the 2 attachments - see testfile4.xml
- MimeBodyPart part = (MimeBodyPart) content.getBodyPart(0); // the message
- assertEquals("Unit Test - Message", ((String)part.getContent()).trim());
- part = (MimeBodyPart) content.getBodyPart(1); // attachement 1
- assertEquals("attachment1.txt", ((String)part.getFileName()).trim());
- part = (MimeBodyPart) content.getBodyPart(2); // attachement 2
- assertEquals("attachment2.txt", ((String)part.getFileName()).trim());
- }
-
- // TODO: Add some negative tests!!!
-}
Modified: labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/notification/NotifyEmailUnitTest.java
===================================================================
--- labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/notification/NotifyEmailUnitTest.java 2006-08-06 12:00:09 UTC (rev 5506)
+++ labs/jbossesb/branches/refactor/product/core/common/tests/src/org/jboss/soa/esb/notification/NotifyEmailUnitTest.java 2006-08-06 12:09:27 UTC (rev 5507)
@@ -25,7 +25,7 @@
import javax.mail.internet.AddressException;
import org.jboss.soa.esb.helpers.DomElement;
-import org.jboss.soa.esb.helpers.EsbEmail;
+import org.jboss.soa.esb.helpers.Email;
import junit.framework.TestCase;
@@ -38,10 +38,10 @@
public void test_NotifyEmail() throws Exception {
DomElement emailMessageEl = new DomElement("email");
- emailMessageEl.setAttr(EsbEmail.FROM, "a.b at c.com");
- emailMessageEl.setAttr(EsbEmail.SENDTO, "d.e at f.com");
- emailMessageEl.setAttr(EsbEmail.COPYTO, "g.h at i.com");
- emailMessageEl.setAttr(EsbEmail.MESSAGE, "Hi there!!!");
+ emailMessageEl.setAttr(Email.FROM, "a.b at c.com");
+ emailMessageEl.setAttr(Email.SENDTO, "d.e at f.com");
+ emailMessageEl.setAttr(Email.COPYTO, "g.h at i.com");
+ emailMessageEl.setAttr(Email.MESSAGE, "Hi there!!!");
NotifyEmail ne = new TestNotifyEmail(emailMessageEl);
ne.sendNotification("Hello");
@@ -52,7 +52,7 @@
super(p_oP);
}
protected void sendEmailNotification(DomElement messageParams) throws AddressException, MessagingException {
- assertEquals("Hi there!!!\nHello", messageParams.getAttr(EsbEmail.MESSAGE));
+ assertEquals("Hi there!!!\nHello", messageParams.getAttr(Email.MESSAGE));
}
}
}
More information about the jboss-svn-commits
mailing list