You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by sg...@apache.org on 2009/06/17 23:04:08 UTC

svn commit: r785799 - in /commons/proper/email/trunk/src: changes/ test/org/apache/commons/mail/

Author: sgoeschl
Date: Wed Jun 17 21:04:08 2009
New Revision: 785799

URL: http://svn.apache.org/viewvc?rev=785799&view=rev
Log:
Improving the regression tests so they will run successfully without internet access

Modified:
    commons/proper/email/trunk/src/changes/changes.xml
    commons/proper/email/trunk/src/test/org/apache/commons/mail/BaseEmailTestCase.java
    commons/proper/email/trunk/src/test/org/apache/commons/mail/EmailLiveTest.java
    commons/proper/email/trunk/src/test/org/apache/commons/mail/HtmlEmailTest.java
    commons/proper/email/trunk/src/test/org/apache/commons/mail/MultiPartEmailTest.java

Modified: commons/proper/email/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/changes/changes.xml?rev=785799&r1=785798&r2=785799&view=diff
==============================================================================
--- commons/proper/email/trunk/src/changes/changes.xml (original)
+++ commons/proper/email/trunk/src/changes/changes.xml Wed Jun 17 21:04:08 2009
@@ -23,7 +23,19 @@
 
   <body>
 
-    <release version="1.2" date="2009-06-12">
+    <release version="1.2" date="as in SVN">
+      <action dev="sgoeschl" type="fix" date="2009-06-16" due-to="sebb">
+        Using "http://example.invalid" for a bad url - ".invalid" is reserved
+        and not intended to be installed as a top-level domain in the global 
+        Domain Name System (DNS) of the Internet.
+      </action>    
+      <action dev="sgoeschl" type="fix" date="2009-06-16" due-to="sebb">
+        Made BaseEmailTestCase abstract and fixed a few coding issues.
+      </action>    
+      <action dev="sgoeschl" type="fix" issue="EMAIL-87" date="2009-06-16" due-to="sebb">
+        HtmlEmail invokes java.net.URL.equals(Object), which blocks to do domain name resolution. This
+        is avoided by using "url.toExternalForm().equals()" instead of "url.equals()".
+      </action>
       <action dev="sgoeschl" type="add" issue="EMAIL-75" date="2009-04-05" due-to="Yu Kobayashi">
         Email.setFrom and Email.addTo are using Email.charset to properly encode the name.
       </action>

Modified: commons/proper/email/trunk/src/test/org/apache/commons/mail/BaseEmailTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/org/apache/commons/mail/BaseEmailTestCase.java?rev=785799&r1=785798&r2=785799&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/org/apache/commons/mail/BaseEmailTestCase.java (original)
+++ commons/proper/email/trunk/src/test/org/apache/commons/mail/BaseEmailTestCase.java Wed Jun 17 21:04:08 2009
@@ -19,7 +19,6 @@
 import java.io.BufferedOutputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
-import java.io.FileWriter;
 import java.io.IOException;
 import java.util.Date;
 import java.util.Enumeration;
@@ -49,7 +48,7 @@
  * @version $Id$
  */
 
-public class BaseEmailTestCase extends TestCase
+public abstract class BaseEmailTestCase extends TestCase
 {
     /** Padding at end of body added by wiser/send */
     public static final int BODY_END_PAD = 3;
@@ -138,7 +137,8 @@
      * Safe a mail to a file using a more or less unique file name.
      *
      * @param email email
-     * @throws IOException Exception
+     * @throws IOException writing the email failed
+     * @throws MessagingException writing the email failed
      */
     protected void saveEmailToFile(WiserMessage email) throws IOException, MessagingException
     {

Modified: commons/proper/email/trunk/src/test/org/apache/commons/mail/EmailLiveTest.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/org/apache/commons/mail/EmailLiveTest.java?rev=785799&r1=785798&r2=785799&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/org/apache/commons/mail/EmailLiveTest.java (original)
+++ commons/proper/email/trunk/src/test/org/apache/commons/mail/EmailLiveTest.java Wed Jun 17 21:04:08 2009
@@ -73,7 +73,7 @@
         String cid;
 
         URL url = new URL(EmailConfiguration.TEST_URL);
-        URL imageUrl = new URL("http://www.apache.org/images/asf_logo_wide.gif");
+        File imageFile = new File("./src/test/images/asf_logo_wide.gif");
 
         EmailAttachment attachment = new EmailAttachment();
         File attachmentFile = new File("./src/test/attachments/logo.pdf");
@@ -140,7 +140,8 @@
 
         HtmlEmail htmlEmail3 = new HtmlEmail();
         textMsg = "Your email client does not support HTML messages";
-        cid = htmlEmail3.embed(imageUrl, "Apache Logo");
+        cid = htmlEmail3.embed(imageFile, "Apache Logo");
+
         htmlMsg = "<html><b>This is a HTML message with an inline image - <img src=\"cid:"
             + cid + "\"> and NO attachment</b><html>";
 
@@ -164,7 +165,7 @@
 
         HtmlEmail htmlEmail4 = new HtmlEmail();
         textMsg = "Your email client does not support HTML messages";
-        cid = htmlEmail4.embed(imageUrl, "Apache Logo");
+        cid = htmlEmail4.embed(imageFile, "Apache Logo");
         htmlMsg = "<html><b>This is a HTML message with an inline image - <img src=\"cid:" + cid + "\"> and attachment</b><html>";
 
         htmlEmail4.setSubject( "[email] 4.Test: text + html content + inline image + attachment");

Modified: commons/proper/email/trunk/src/test/org/apache/commons/mail/HtmlEmailTest.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/org/apache/commons/mail/HtmlEmailTest.java?rev=785799&r1=785798&r2=785799&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/org/apache/commons/mail/HtmlEmailTest.java (original)
+++ commons/proper/email/trunk/src/test/org/apache/commons/mail/HtmlEmailTest.java Wed Jun 17 21:04:08 2009
@@ -186,7 +186,7 @@
         // Does an invalid URL throw an exception?
         try
         {
-            this.email.embed(new URL("http://bad.url"), "Bad URL");
+            this.email.embed(new URL("http://example.invalid"), "Bad URL");
             fail("Should have thrown an exception");
         }
         catch (EmailException e)

Modified: commons/proper/email/trunk/src/test/org/apache/commons/mail/MultiPartEmailTest.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/org/apache/commons/mail/MultiPartEmailTest.java?rev=785799&r1=785798&r2=785799&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/org/apache/commons/mail/MultiPartEmailTest.java (original)
+++ commons/proper/email/trunk/src/test/org/apache/commons/mail/MultiPartEmailTest.java Wed Jun 17 21:04:08 2009
@@ -232,7 +232,7 @@
         attachment = new EmailAttachment();
         try
         {
-            attachment.setURL(new URL("http://bad.url"));
+            attachment.setURL(new URL("http://example.invalid"));
             this.email.attach(attachment);
             fail("Should have thrown an exception");
         }
@@ -308,7 +308,7 @@
         // invalid datasource
         try
         {
-            URLDataSource urlDs = new URLDataSource(new URL("http://bad.url/"));
+            URLDataSource urlDs = new URLDataSource(new URL("http://example.invalid/"));
             this.email.attach(urlDs, "Test Attachment", "Test Attachment Desc");
             fail("Should have thrown an exception");
         }