commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1429506 - in /commons/proper/email/trunk/src/test/java/org/apache/commons/mail: BaseEmailTestCase.java EmailTest.java HtmlEmailTest.java MultiPartEmailTest.java SendWithAttachmentsTest.java SimpleEmailTest.java
Date Sun, 06 Jan 2013 12:33:56 GMT
Author: tn
Date: Sun Jan  6 12:33:56 2013
New Revision: 1429506

URL: http://svn.apache.org/viewvc?rev=1429506&view=rev
Log:
Replace deprecated constants, generify test classes.

Modified:
    commons/proper/email/trunk/src/test/java/org/apache/commons/mail/BaseEmailTestCase.java
    commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailTest.java
    commons/proper/email/trunk/src/test/java/org/apache/commons/mail/HtmlEmailTest.java
    commons/proper/email/trunk/src/test/java/org/apache/commons/mail/MultiPartEmailTest.java
    commons/proper/email/trunk/src/test/java/org/apache/commons/mail/SendWithAttachmentsTest.java
    commons/proper/email/trunk/src/test/java/org/apache/commons/mail/SimpleEmailTest.java

Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/BaseEmailTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/BaseEmailTestCase.java?rev=1429506&r1=1429505&r2=1429506&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/BaseEmailTestCase.java
(original)
+++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/BaseEmailTestCase.java
Sun Jan  6 12:33:56 2013
@@ -236,9 +236,9 @@ public abstract class BaseEmailTestCase 
         Wiser mailServer,
         String strSubject,
         InternetAddress fromAdd,
-        List toAdd,
-        List ccAdd,
-        List bccAdd,
+        List<InternetAddress> toAdd,
+        List<InternetAddress> ccAdd,
+        List<InternetAddress> bccAdd,
         boolean boolSaveToFile)
         throws IOException
     {
@@ -322,9 +322,9 @@ public abstract class BaseEmailTestCase 
         String strSubject,
         Multipart content,
         InternetAddress fromAdd,
-        List toAdd,
-        List ccAdd,
-        List bccAdd,
+        List<InternetAddress> toAdd,
+        List<InternetAddress> ccAdd,
+        List<InternetAddress> bccAdd,
         boolean boolSaveToFile)
         throws IOException
     {
@@ -371,9 +371,9 @@ public abstract class BaseEmailTestCase 
         String strSubject,
         String strMessage,
         InternetAddress fromAdd,
-        List toAdd,
-        List ccAdd,
-        List bccAdd,
+        List<InternetAddress> toAdd,
+        List<InternetAddress> ccAdd,
+        List<InternetAddress> bccAdd,
         boolean boolSaveToFile)
         throws IOException
     {

Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailTest.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailTest.java?rev=1429506&r1=1429505&r2=1429506&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailTest.java (original)
+++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/EmailTest.java Sun Jan
 6 12:33:56 2013
@@ -95,13 +95,13 @@ public class EmailTest extends BaseEmail
     {
 
         Properties properties = new Properties(System.getProperties());
-        properties.setProperty(Email.MAIL_TRANSPORT_PROTOCOL, Email.SMTP);
+        properties.setProperty(EmailConstants.MAIL_TRANSPORT_PROTOCOL, EmailConstants.SMTP);
 
         properties.setProperty(
-            Email.MAIL_PORT,
+            EmailConstants.MAIL_PORT,
             String.valueOf(this.getMailServerPort()));
-        properties.setProperty(Email.MAIL_HOST, this.strTestMailServer);
-        properties.setProperty(Email.MAIL_DEBUG, String.valueOf(false));
+        properties.setProperty(EmailConstants.MAIL_HOST, this.strTestMailServer);
+        properties.setProperty(EmailConstants.MAIL_DEBUG, String.valueOf(false));
 
         Session mySession = Session.getInstance(properties, null);
 
@@ -197,7 +197,7 @@ public class EmailTest extends BaseEmail
         // ====================================================================
         // test (string object and valid content type)
         testObject = "test string object";
-        testContentType = " ; charset=" + Email.US_ASCII;
+        testContentType = " ; charset=" + EmailConstants.US_ASCII;
 
         this.email.setContent(testObject, testContentType);
         assertEquals(testObject, this.email.getContentObject());
@@ -206,7 +206,7 @@ public class EmailTest extends BaseEmail
         // ====================================================================
         // test (null string object and valid content type)
         testObject = null;
-        testContentType = " ; charset=" + Email.US_ASCII + " some more here";
+        testContentType = " ; charset=" + EmailConstants.US_ASCII + " some more here";
 
         this.email.setContent(testObject, testContentType);
         assertEquals(testObject, this.email.getContentObject());
@@ -322,10 +322,10 @@ public class EmailTest extends BaseEmail
         String testValidEmail = "me@home.com";
 
         InternetAddress inetExpected =
-            new InternetAddress("me@home.com", "me@home.com", Email.ISO_8859_1);
+            new InternetAddress("me@home.com", "me@home.com", EmailConstants.ISO_8859_1);
 
         // set from
-        this.email.setFrom(testValidEmail, testValidEmail, Email.ISO_8859_1);
+        this.email.setFrom(testValidEmail, testValidEmail, EmailConstants.ISO_8859_1);
 
         // retrieve and verify
         assertEquals(inetExpected, this.email.getFromAddress());
@@ -446,7 +446,7 @@ public class EmailTest extends BaseEmail
         // ====================================================================
         // Test Success
         // ====================================================================
-        String testCharset = Email.ISO_8859_1;
+        String testCharset = EmailConstants.ISO_8859_1;
         String[] testEmailNames = {"Name1", "", null};
 
         List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
@@ -628,7 +628,7 @@ public class EmailTest extends BaseEmail
         // ====================================================================
         // Test Success
         // ====================================================================
-        String testCharset = Email.ISO_8859_1;
+        String testCharset = EmailConstants.ISO_8859_1;
         String[] testEmailNames = {"Name1", "", null};
 
         List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
@@ -800,7 +800,7 @@ public class EmailTest extends BaseEmail
         // ====================================================================
         // Test Success
         // ====================================================================
-        String testCharset = Email.ISO_8859_1;
+        String testCharset = EmailConstants.ISO_8859_1;
         String[] testEmailNames = {"Name1", "", null};
 
         List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
@@ -957,7 +957,7 @@ public class EmailTest extends BaseEmail
         // ====================================================================
         // Test Success
         // ====================================================================
-        String testCharset = Email.ISO_8859_1;
+        String testCharset = EmailConstants.ISO_8859_1;
         String[] testEmailNames = {"Name1", "", null};
 
         List<InternetAddress> arrExpected = new ArrayList<InternetAddress>();
@@ -1201,7 +1201,7 @@ public class EmailTest extends BaseEmail
 
             this.email.setContent(
                 "test string object",
-                " ; charset=" + Email.US_ASCII);
+                " ; charset=" + EmailConstants.US_ASCII);
 
             this.email.send();
             fail("Should have thrown an exception");
@@ -1280,7 +1280,7 @@ public class EmailTest extends BaseEmail
 
             this.email = new MockEmailConcrete();
             this.email.setHostName("bad.host.com");
-            this.email.setSSL(true);
+            this.email.setSSLOnConnect(true);
             this.email.setFrom(this.strTestMailFrom);
             this.email.addTo(this.strTestMailTo);
             this.email.setAuthentication(null, null);

Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/HtmlEmailTest.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/HtmlEmailTest.java?rev=1429506&r1=1429505&r2=1429506&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/HtmlEmailTest.java (original)
+++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/HtmlEmailTest.java Sun
Jan  6 12:33:56 2013
@@ -319,7 +319,7 @@ public class HtmlEmailTest extends BaseE
 
         this.email.setAuthentication(this.strTestUser, this.strTestPasswd);
 
-        this.email.setCharset(Email.ISO_8859_1);
+        this.email.setCharset(EmailConstants.ISO_8859_1);
         this.email.setSubject(strSubject);
 
         URL url = new URL(EmailConfiguration.TEST_URL);
@@ -465,7 +465,7 @@ public class HtmlEmailTest extends BaseE
         }
 
         strSubject = "Test HTML Send #2 Subject (w charset)";
-        this.email.setCharset(Email.ISO_8859_1);
+        this.email.setCharset(EmailConstants.ISO_8859_1);
         this.email.setSubject(strSubject);
         this.email.setMsg("Test txt msg");
 
@@ -516,7 +516,7 @@ public class HtmlEmailTest extends BaseE
         this.email.setSmtpPort(this.getMailServerPort());
         this.email.setFrom(this.strTestMailFrom);
         this.email.addTo(this.strTestMailTo);
-        this.email.setCharset(Email.ISO_8859_1);
+        this.email.setCharset(EmailConstants.ISO_8859_1);
 
         if (this.strTestUser != null && this.strTestPasswd != null)
         {
@@ -562,7 +562,7 @@ public class HtmlEmailTest extends BaseE
         this.email.setSmtpPort(this.getMailServerPort());
         this.email.setFrom(this.strTestMailFrom);
         this.email.addTo(this.strTestMailTo);
-        this.email.setCharset(Email.ISO_8859_1);
+        this.email.setCharset(EmailConstants.ISO_8859_1);
 
         if (this.strTestUser != null && this.strTestPasswd != null)
         {
@@ -606,7 +606,7 @@ public class HtmlEmailTest extends BaseE
         this.email.setFrom(this.strTestMailFrom);
         this.email.addTo(this.strTestMailTo);
         this.email.setAuthentication(this.strTestUser, this.strTestPasswd);
-        this.email.setCharset(Email.ISO_8859_1);
+        this.email.setCharset(EmailConstants.ISO_8859_1);
         this.email.setSubject(strSubject);
         this.email.setMsg("This is a plain text content : <b><&npsb;></html></b>");
 

Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/MultiPartEmailTest.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/MultiPartEmailTest.java?rev=1429506&r1=1429505&r2=1429506&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/MultiPartEmailTest.java
(original)
+++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/MultiPartEmailTest.java
Sun Jan  6 12:33:56 2013
@@ -83,7 +83,7 @@ public class MultiPartEmailTest extends 
         }
 
         // with charset set
-        this.email.setCharset(Email.US_ASCII);
+        this.email.setCharset(EmailConstants.US_ASCII);
         for (int i = 0; i < testCharsValid.length; i++)
         {
             this.email.setMsg(testCharsValid[i]);

Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/SendWithAttachmentsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/SendWithAttachmentsTest.java?rev=1429506&r1=1429505&r2=1429506&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/SendWithAttachmentsTest.java
(original)
+++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/SendWithAttachmentsTest.java
Sun Jan  6 12:33:56 2013
@@ -71,7 +71,7 @@ public class SendWithAttachmentsTest ext
 
         this.email.setAuthentication(this.strTestUser, this.strTestPasswd);
 
-        this.email.setCharset(Email.ISO_8859_1);
+        this.email.setCharset(EmailConstants.ISO_8859_1);
         this.email.setSubject(strSubject);
 
         URL url = new URL(EmailConfiguration.TEST_URL);
@@ -143,7 +143,7 @@ public class SendWithAttachmentsTest ext
 
         this.email.setAuthentication(this.strTestUser, this.strTestPasswd);
 
-        this.email.setCharset(Email.ISO_8859_1);
+        this.email.setCharset(EmailConstants.ISO_8859_1);
         this.email.setSubject(strSubject);
 
         URL url = new URL(EmailConfiguration.TEST_URL);

Modified: commons/proper/email/trunk/src/test/java/org/apache/commons/mail/SimpleEmailTest.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/java/org/apache/commons/mail/SimpleEmailTest.java?rev=1429506&r1=1429505&r2=1429506&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/java/org/apache/commons/mail/SimpleEmailTest.java
(original)
+++ commons/proper/email/trunk/src/test/java/org/apache/commons/mail/SimpleEmailTest.java
Sun Jan  6 12:33:56 2013
@@ -107,7 +107,7 @@ public class SimpleEmailTest extends Bas
         String strSubject = "Test Msg Subject";
         String strMessage = "Test Msg Body";
 
-        this.email.setCharset(Email.ISO_8859_1);
+        this.email.setCharset(EmailConstants.ISO_8859_1);
         this.email.setSubject(strSubject);
 
         this.email.setMsg(strMessage);



Mime
View raw message