james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r895030 - in /james/mime4j/branches/cycleclean/core/src: main/java/org/apache/james/mime4j/field/ main/java/org/apache/james/mime4j/field/address/ main/java/org/apache/james/mime4j/field/address/parser/ test/java/org/apache/james/mime4j/fie...
Date Fri, 01 Jan 2010 16:03:06 GMT
Author: bago
Date: Fri Jan  1 16:03:04 2010
New Revision: 895030

URL: http://svn.apache.org/viewvc?rev=895030&view=rev
Log:
Group and Mailbox had "encoding" knowledge. This was the last bit making the dom depending
on encoding/decoding utils. Now the whole "dom" depends only on MimeException and ByteSequence
(maybe this can be removed, too) (MIME4J-156)

Added:
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/GroupImpl.java
  (with props)
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/MailboxImpl.java
  (with props)
Modified:
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/AddressListField.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/DateTimeField.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/MailboxField.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/MailboxListField.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Group.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Mailbox.java
    james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/Builder.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/FieldsTest.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java
    james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageTest.java

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/AddressListField.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/AddressListField.java?rev=895030&r1=895029&r2=895030&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/AddressListField.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/AddressListField.java
Fri Jan  1 16:03:04 2010
@@ -20,7 +20,6 @@
 package org.apache.james.mime4j.field;
 
 import org.apache.james.mime4j.field.address.AddressList;
-import org.apache.james.mime4j.field.ParseException;
 
 public interface AddressListField extends ParsedField {
 

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java?rev=895030&r1=895029&r2=895030&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java
Fri Jan  1 16:03:04 2010
@@ -21,8 +21,6 @@
 
 import java.util.Map;
 
-import org.apache.james.mime4j.field.ParseException;
-
 public interface ContentTypeField extends ParsedField {
 
     /** The prefix of all <code>multipart</code> MIME types. */

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/DateTimeField.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/DateTimeField.java?rev=895030&r1=895029&r2=895030&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/DateTimeField.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/DateTimeField.java
Fri Jan  1 16:03:04 2010
@@ -2,8 +2,6 @@
 
 import java.util.Date;
 
-import org.apache.james.mime4j.field.ParseException;
-
 public interface DateTimeField extends ParsedField {
 
     public abstract Date getDate();

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/MailboxField.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/MailboxField.java?rev=895030&r1=895029&r2=895030&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/MailboxField.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/MailboxField.java
Fri Jan  1 16:03:04 2010
@@ -20,7 +20,6 @@
 package org.apache.james.mime4j.field;
 
 import org.apache.james.mime4j.field.address.Mailbox;
-import org.apache.james.mime4j.field.ParseException;
 
 public interface MailboxField extends ParsedField {
 

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/MailboxListField.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/MailboxListField.java?rev=895030&r1=895029&r2=895030&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/MailboxListField.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/MailboxListField.java
Fri Jan  1 16:03:04 2010
@@ -20,7 +20,6 @@
 package org.apache.james.mime4j.field;
 
 import org.apache.james.mime4j.field.address.MailboxList;
-import org.apache.james.mime4j.field.ParseException;
 
 public interface MailboxListField extends ParsedField {
 

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Group.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Group.java?rev=895030&r1=895029&r2=895030&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Group.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Group.java
Fri Jan  1 16:03:04 2010
@@ -19,17 +19,12 @@
 
 package org.apache.james.mime4j.field.address;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
 import java.util.List;
 
-import org.apache.james.mime4j.codec.EncoderUtil;
-
 /**
  * A named group of zero or more mailboxes.
  */
-public class Group extends Address {
+public abstract class Group extends Address {
 
     private static final long serialVersionUID = 1L;
 
@@ -42,26 +37,6 @@
      * @param mailboxes
      *            The mailboxes in this group.
      */
-    public Group(String name, Mailbox... mailboxes) {
-        this(name, new MailboxList(Arrays.asList(mailboxes), true));
-    }
-
-    /**
-     * @param name
-     *            The group name.
-     * @param mailboxes
-     *            The mailboxes in this group.
-     */
-    public Group(String name, Collection<Mailbox> mailboxes) {
-        this(name, new MailboxList(new ArrayList<Mailbox>(mailboxes), true));
-    }
-
-    /**
-     * @param name
-     *            The group name.
-     * @param mailboxes
-     *            The mailboxes in this group.
-     */
     public Group(String name, MailboxList mailboxes) {
         if (name == null)
             throw new IllegalArgumentException();
@@ -111,30 +86,6 @@
     }
 
     @Override
-    public String getEncodedString() {
-        StringBuilder sb = new StringBuilder();
-
-        sb.append(EncoderUtil.encodeAddressDisplayName(name));
-        sb.append(':');
-
-        boolean first = true;
-        for (Mailbox mailbox : mailboxList) {
-            if (first) {
-                first = false;
-            } else {
-                sb.append(',');
-            }
-
-            sb.append(' ');
-            sb.append(mailbox.getEncodedString());
-        }
-
-        sb.append(';');
-
-        return sb.toString();
-    }
-
-    @Override
     protected void doAddMailboxesTo(List<Mailbox> results) {
         for (Mailbox mailbox : mailboxList) {
             results.add(mailbox);

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Mailbox.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Mailbox.java?rev=895030&r1=895029&r2=895030&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Mailbox.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/Mailbox.java
Fri Jan  1 16:03:04 2010
@@ -23,12 +23,10 @@
 import java.util.List;
 import java.util.Locale;
 
-import org.apache.james.mime4j.codec.EncoderUtil;
-
 /**
  * Represents a single e-mail address.
  */
-public class Mailbox extends Address {
+public abstract class Mailbox extends Address {
 
     private static final long serialVersionUID = 1L;
 
@@ -41,47 +39,6 @@
     private final String domain;
 
     /**
-     * Creates an unnamed mailbox without a route. Routes are obsolete.
-     * 
-     * @param localPart
-     *            The part of the e-mail address to the left of the "@".
-     * @param domain
-     *            The part of the e-mail address to the right of the "@".
-     */
-    public Mailbox(String localPart, String domain) {
-        this(null, null, localPart, domain);
-    }
-
-    /**
-     * Creates an unnamed mailbox with a route. Routes are obsolete.
-     * 
-     * @param route
-     *            The zero or more domains that make up the route. May be
-     *            <code>null</code>.
-     * @param localPart
-     *            The part of the e-mail address to the left of the "@".
-     * @param domain
-     *            The part of the e-mail address to the right of the "@".
-     */
-    public Mailbox(DomainList route, String localPart, String domain) {
-        this(null, route, localPart, domain);
-    }
-
-    /**
-     * Creates a named mailbox without a route. Routes are obsolete.
-     * 
-     * @param name
-     *            the name of the e-mail address. May be <code>null</code>.
-     * @param localPart
-     *            The part of the e-mail address to the left of the "@".
-     * @param domain
-     *            The part of the e-mail address to the right of the "@".
-     */
-    public Mailbox(String name, String localPart, String domain) {
-        this(name, null, localPart, domain);
-    }
-
-    /**
      * Creates a named mailbox with a route. Routes are obsolete.
      * 
      * @param name
@@ -193,32 +150,6 @@
     }
 
     @Override
-    public String getEncodedString() {
-        StringBuilder sb = new StringBuilder();
-
-        if (name != null) {
-            sb.append(EncoderUtil.encodeAddressDisplayName(name));
-            sb.append(" <");
-        }
-
-        sb.append(EncoderUtil.encodeAddressLocalPart(localPart));
-
-        // domain = dot-atom / domain-literal
-        // domain-literal = [CFWS] "[" *([FWS] dtext) [FWS] "]" [CFWS]
-        // dtext = %d33-90 / %d94-126
-        if (domain != null) {
-            sb.append('@');
-            sb.append(domain);
-        }
-
-        if (name != null) {
-            sb.append('>');
-        }
-
-        return sb.toString();
-    }
-
-    @Override
     public int hashCode() {
         return getCanonicalizedAddress().hashCode();
     }

Modified: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/Builder.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/Builder.java?rev=895030&r1=895029&r2=895030&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/Builder.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/Builder.java
Fri Jan  1 16:03:04 2010
@@ -23,7 +23,6 @@
 import org.apache.james.mime4j.field.address.Address;
 import org.apache.james.mime4j.field.address.AddressList;
 import org.apache.james.mime4j.field.address.DomainList;
-import org.apache.james.mime4j.field.address.Group;
 import org.apache.james.mime4j.field.address.Mailbox;
 import org.apache.james.mime4j.field.address.MailboxList;
 import org.apache.james.mime4j.field.address.parser.ASTaddr_spec;
@@ -78,11 +77,11 @@
             String name = buildString((ASTphrase) n, false);
             Node n2 = it.next();
             if (n2 instanceof ASTgroup_body) {
-                return new Group(name, buildGroupBody((ASTgroup_body) n2));
+                return new GroupImpl(name, buildGroupBody((ASTgroup_body) n2));
             } else if (n2 instanceof ASTangle_addr) {
                 name = DecoderUtil.decodeEncodedWords(name);
                 Mailbox mb = buildAngleAddr((ASTangle_addr) n2);
-                return new Mailbox(name, mb.getRoute(), mb.getLocalPart(),
+                return new MailboxImpl(name, mb.getRoute(), mb.getLocalPart(),
                         mb.getDomain());
             } else {
                 throw new IllegalStateException();
@@ -133,7 +132,7 @@
         if (n instanceof ASTangle_addr) {
             name = DecoderUtil.decodeEncodedWords(name);
             Mailbox mb = buildAngleAddr((ASTangle_addr) n);
-            return new Mailbox(name, mb.getRoute(), mb.getLocalPart(),
+            return new MailboxImpl(name, mb.getRoute(), mb.getLocalPart(),
                     mb.getDomain());
         } else {
             throw new IllegalStateException();
@@ -180,7 +179,7 @@
         ChildNodeIterator it = new ChildNodeIterator(node);
         String localPart = buildString((ASTlocal_part) it.next(), true);
         String domain = buildString((ASTdomain) it.next(), true);
-        return new Mailbox(route, localPart, domain);
+        return new MailboxImpl(route, localPart, domain);
     }
 
     private String buildString(SimpleNode node, boolean stripSpaces) {

Added: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/GroupImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/GroupImpl.java?rev=895030&view=auto
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/GroupImpl.java
(added)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/GroupImpl.java
Fri Jan  1 16:03:04 2010
@@ -0,0 +1,65 @@
+package org.apache.james.mime4j.field.address.parser;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.apache.james.mime4j.codec.EncoderUtil;
+import org.apache.james.mime4j.field.address.Group;
+import org.apache.james.mime4j.field.address.Mailbox;
+import org.apache.james.mime4j.field.address.MailboxList;
+
+public class GroupImpl extends Group {
+
+    private static final long serialVersionUID = 3689132038741323839L;
+
+
+    /**
+     * @param name
+     *            The group name.
+     * @param mailboxes
+     *            The mailboxes in this group.
+     */
+    public GroupImpl(String name, Mailbox... mailboxes) {
+        this(name, new MailboxList(Arrays.asList(mailboxes), true));
+    }
+
+    /**
+     * @param name
+     *            The group name.
+     * @param mailboxes
+     *            The mailboxes in this group.
+     */
+    public GroupImpl(String name, Collection<Mailbox> mailboxes) {
+        this(name, new MailboxList(new ArrayList<Mailbox>(mailboxes), true));
+    }
+
+    public GroupImpl(String name, MailboxList mailboxes) {
+        super(name, mailboxes);
+    }
+    
+    @Override
+    public String getEncodedString() {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append(EncoderUtil.encodeAddressDisplayName(getName()));
+        sb.append(':');
+
+        boolean first = true;
+        for (Mailbox mailbox : getMailboxes()) {
+            if (first) {
+                first = false;
+            } else {
+                sb.append(',');
+            }
+
+            sb.append(' ');
+            sb.append(mailbox.getEncodedString());
+        }
+
+        sb.append(';');
+
+        return sb.toString();
+    }
+
+}

Propchange: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/GroupImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/GroupImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/MailboxImpl.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/MailboxImpl.java?rev=895030&view=auto
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/MailboxImpl.java
(added)
+++ james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/MailboxImpl.java
Fri Jan  1 16:03:04 2010
@@ -0,0 +1,84 @@
+package org.apache.james.mime4j.field.address.parser;
+
+import org.apache.james.mime4j.codec.EncoderUtil;
+import org.apache.james.mime4j.field.address.DomainList;
+import org.apache.james.mime4j.field.address.Mailbox;
+
+public class MailboxImpl extends Mailbox {
+
+    private static final long serialVersionUID = 2836627303544263659L;
+
+    public MailboxImpl(String name, DomainList route, String localPart,
+            String domain) {
+        super(name, route, localPart, domain);
+    }
+
+
+    /**
+     * Creates an unnamed mailbox without a route. Routes are obsolete.
+     * 
+     * @param localPart
+     *            The part of the e-mail address to the left of the "@".
+     * @param domain
+     *            The part of the e-mail address to the right of the "@".
+     */
+    public MailboxImpl(String localPart, String domain) {
+        this(null, null, localPart, domain);
+    }
+
+    /**
+     * Creates an unnamed mailbox with a route. Routes are obsolete.
+     * 
+     * @param route
+     *            The zero or more domains that make up the route. May be
+     *            <code>null</code>.
+     * @param localPart
+     *            The part of the e-mail address to the left of the "@".
+     * @param domain
+     *            The part of the e-mail address to the right of the "@".
+     */
+    public MailboxImpl(DomainList route, String localPart, String domain) {
+        this(null, route, localPart, domain);
+    }
+
+    /**
+     * Creates a named mailbox without a route. Routes are obsolete.
+     * 
+     * @param name
+     *            the name of the e-mail address. May be <code>null</code>.
+     * @param localPart
+     *            The part of the e-mail address to the left of the "@".
+     * @param domain
+     *            The part of the e-mail address to the right of the "@".
+     */
+    public MailboxImpl(String name, String localPart, String domain) {
+        this(name, null, localPart, domain);
+    }
+
+    @Override
+    public String getEncodedString() {
+        StringBuilder sb = new StringBuilder();
+
+        if (getName() != null) {
+            sb.append(EncoderUtil.encodeAddressDisplayName(getName()));
+            sb.append(" <");
+        }
+
+        sb.append(EncoderUtil.encodeAddressLocalPart(getLocalPart()));
+
+        // domain = dot-atom / domain-literal
+        // domain-literal = [CFWS] "[" *([FWS] dtext) [FWS] "]" [CFWS]
+        // dtext = %d33-90 / %d94-126
+        if (getDomain() != null) {
+            sb.append('@');
+            sb.append(getDomain());
+        }
+
+        if (getName() != null) {
+            sb.append('>');
+        }
+
+        return sb.toString();
+    }
+
+}

Propchange: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/MailboxImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: james/mime4j/branches/cycleclean/core/src/main/java/org/apache/james/mime4j/field/address/parser/MailboxImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/FieldsTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/FieldsTest.java?rev=895030&r1=895029&r2=895030&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/FieldsTest.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/FieldsTest.java
Fri Jan  1 16:03:04 2010
@@ -30,6 +30,7 @@
 import org.apache.james.mime4j.field.address.Group;
 import org.apache.james.mime4j.field.address.Mailbox;
 import org.apache.james.mime4j.field.address.parser.AddressBuilder;
+import org.apache.james.mime4j.field.address.parser.GroupImpl;
 import org.apache.james.mime4j.field.impl.Fields;
 import org.apache.james.mime4j.util.ByteSequence;
 import org.apache.james.mime4j.util.ContentUtil;
@@ -257,7 +258,7 @@
         Mailbox mailbox1 = AddressBuilder.parseMailbox("JD <john.doe@acme.org>");
         Mailbox mailbox2 = AddressBuilder.parseMailbox("jane.doe@example.org");
         Mailbox mailbox3 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
-        Group group = new Group("The Does", mailbox1, mailbox2);
+        Group group = new GroupImpl("The Does", mailbox1, mailbox2);
 
         AddressListField field = Fields.to(group);
         assertEquals("To: The Does: JD <john.doe@acme.org>, "
@@ -278,7 +279,7 @@
         Mailbox mailbox1 = AddressBuilder.parseMailbox("JD <john.doe@acme.org>");
         Mailbox mailbox2 = AddressBuilder.parseMailbox("jane.doe@example.org");
         Mailbox mailbox3 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
-        Group group = new Group("The Does", mailbox1, mailbox2);
+        Group group = new GroupImpl("The Does", mailbox1, mailbox2);
 
         AddressListField field = Fields.cc(group);
         assertEquals("Cc: The Does: JD <john.doe@acme.org>, "
@@ -299,7 +300,7 @@
         Mailbox mailbox1 = AddressBuilder.parseMailbox("JD <john.doe@acme.org>");
         Mailbox mailbox2 = AddressBuilder.parseMailbox("jane.doe@example.org");
         Mailbox mailbox3 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
-        Group group = new Group("The Does", mailbox1, mailbox2);
+        Group group = new GroupImpl("The Does", mailbox1, mailbox2);
 
         AddressListField field = Fields.bcc(group);
         assertEquals("Bcc: The Does: JD <john.doe@acme.org>, "
@@ -320,7 +321,7 @@
         Mailbox mailbox1 = AddressBuilder.parseMailbox("JD <john.doe@acme.org>");
         Mailbox mailbox2 = AddressBuilder.parseMailbox("jane.doe@example.org");
         Mailbox mailbox3 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
-        Group group = new Group("The Does", mailbox1, mailbox2);
+        Group group = new GroupImpl("The Does", mailbox1, mailbox2);
 
         AddressListField field = Fields.replyTo(group);
         assertEquals("Reply-To: The Does: JD <john.doe@acme.org>, "
@@ -358,7 +359,7 @@
         Mailbox mailbox1 = AddressBuilder.parseMailbox("JD <john.doe@acme.org>");
         Mailbox mailbox2 = AddressBuilder.parseMailbox("jane.doe@example.org");
         Mailbox mailbox3 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
-        Group group = new Group("The Does", mailbox1, mailbox2);
+        Group group = new GroupImpl("The Does", mailbox1, mailbox2);
 
         AddressListField field = Fields.addressList("Resent-To", Arrays.asList(
                 group, mailbox3));

Modified: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java?rev=895030&r1=895029&r2=895030&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/field/address/AddressTest.java
Fri Jan  1 16:03:04 2010
@@ -21,6 +21,8 @@
 
 import org.apache.james.mime4j.MimeException;
 import org.apache.james.mime4j.field.address.parser.AddressBuilder;
+import org.apache.james.mime4j.field.address.parser.GroupImpl;
+import org.apache.james.mime4j.field.address.parser.MailboxImpl;
 import org.apache.james.mime4j.field.address.parser.ParseException;
 
 import java.io.BufferedReader;
@@ -333,18 +335,18 @@
 
     public void testMailboxList() {
         List<Mailbox> al = new ArrayList<Mailbox>();
-        al.add(new Mailbox("local","example.com"));
+        al.add(new MailboxImpl("local","example.com"));
 
         // shared arraylist
         MailboxList ml = new MailboxList(al, true);
         assertEquals(1, ml.size());
-        al.add(new Mailbox("local2", "foo.example.com"));
+        al.add(new MailboxImpl("local2", "foo.example.com"));
         assertEquals(2, ml.size());
         
         // cloned arraylist
         MailboxList mlcopy = new MailboxList(al, false);
         assertEquals(2, mlcopy.size());
-        al.add(new Mailbox("local3", "bar.example.com"));
+        al.add(new MailboxImpl("local3", "bar.example.com"));
         assertEquals(2, mlcopy.size());
         
         mlcopy.print();
@@ -352,13 +354,13 @@
     
     public void testGroupSerialization() {
         List<Mailbox> al = new ArrayList<Mailbox>();
-        al.add(new Mailbox("test", "example.com"));
-        al.add(new Mailbox("Foo!", "foo", "example.com"));
+        al.add(new MailboxImpl("test", "example.com"));
+        al.add(new MailboxImpl("Foo!", "foo", "example.com"));
         DomainList dl = new DomainList(new ArrayList<String>(Arrays.asList(new String[]
{"foo.example.com"})), true);
-        Mailbox mailbox = new Mailbox("Foo Bar", dl, "foo2", "example.com");
+        Mailbox mailbox = new MailboxImpl("Foo Bar", dl, "foo2", "example.com");
         assertSame(dl, mailbox.getRoute());
         al.add(mailbox);
-        Group g = new Group("group", new MailboxList(al, false));
+        Group g = new GroupImpl("group", new MailboxList(al, false));
         assertEquals("group: test@example.com, Foo! <foo@example.com>, Foo Bar <foo2@example.com>;",
g.getDisplayString());
     }
     
@@ -375,25 +377,25 @@
     }
     
     public void testMailboxGetEncodedString() throws Exception {
-        assertEquals("john.doe@acme.org", new Mailbox("john.doe", "acme.org")
+        assertEquals("john.doe@acme.org", new MailboxImpl("john.doe", "acme.org")
                 .getEncodedString());
-        assertEquals("\"john doe\"@acme.org", new Mailbox("john doe",
+        assertEquals("\"john doe\"@acme.org", new MailboxImpl("john doe",
                 "acme.org").getEncodedString());
-        assertEquals("John Doe <john.doe@acme.org>", new Mailbox("John Doe",
+        assertEquals("John Doe <john.doe@acme.org>", new MailboxImpl("John Doe",
                 "john.doe", "acme.org").getEncodedString());
-        assertEquals("\"John Doe @Home\" <john.doe@acme.org>", new Mailbox(
+        assertEquals("\"John Doe @Home\" <john.doe@acme.org>", new MailboxImpl(
                 "John Doe @Home", "john.doe", "acme.org").getEncodedString());
         assertEquals("=?ISO-8859-1?Q?Hans_M=FCller?= <hans.mueller@acme.org>",
-                new Mailbox("Hans M\374ller", "hans.mueller", "acme.org")
+                new MailboxImpl("Hans M\374ller", "hans.mueller", "acme.org")
                         .getEncodedString());
     }
 
     public void testGroupGetEncodedString() throws Exception {
         List<Mailbox> al = new ArrayList<Mailbox>();
-        al.add(new Mailbox("test", "example.com"));
-        al.add(new Mailbox("Foo!", "foo", "example.com"));
-        al.add(new Mailbox("Hans M\374ller", "hans.mueller", "acme.org"));
-        Group g = new Group("group @work", new MailboxList(al, false));
+        al.add(new MailboxImpl("test", "example.com"));
+        al.add(new MailboxImpl("Foo!", "foo", "example.com"));
+        al.add(new MailboxImpl("Hans M\374ller", "hans.mueller", "acme.org"));
+        Group g = new GroupImpl("group @work", new MailboxList(al, false));
         assertEquals("\"group @work\": test@example.com, "
                 + "Foo! <foo@example.com>, =?ISO-8859-1?Q?Hans_M=FCller?="
                 + " <hans.mueller@acme.org>;", g.getEncodedString());
@@ -401,7 +403,7 @@
 
     public void testEmptyGroupGetEncodedString() throws Exception {
         MailboxList emptyMailboxes = new MailboxList(null, true);
-        Group g = new Group("Undisclosed recipients", emptyMailboxes);
+        Group g = new GroupImpl("Undisclosed recipients", emptyMailboxes);
         assertEquals("Undisclosed recipients:;", g.getEncodedString());
     }
 

Modified: james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageTest.java
URL: http://svn.apache.org/viewvc/james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageTest.java?rev=895030&r1=895029&r2=895030&view=diff
==============================================================================
--- james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageTest.java
(original)
+++ james/mime4j/branches/cycleclean/core/src/test/java/org/apache/james/mime4j/message/MessageTest.java
Fri Jan  1 16:03:04 2010
@@ -36,6 +36,7 @@
 import org.apache.james.mime4j.field.address.Group;
 import org.apache.james.mime4j.field.address.Mailbox;
 import org.apache.james.mime4j.field.address.parser.AddressBuilder;
+import org.apache.james.mime4j.field.address.parser.GroupImpl;
 import org.apache.james.mime4j.field.impl.DefaultFieldParser;
 import org.apache.james.mime4j.message.impl.BodyPart;
 import org.apache.james.mime4j.message.impl.MessageImpl;
@@ -306,7 +307,7 @@
 
         Mailbox mailbox1 = AddressBuilder.parseMailbox("john.doe@example.net");
         Mailbox mailbox2 = AddressBuilder.parseMailbox("jane.doe@example.net");
-        Group group = new Group("Does", mailbox1, mailbox2);
+        Group group = new GroupImpl("Does", mailbox1, mailbox2);
         Mailbox mailbox3 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
 
         m.setTo(group);
@@ -344,7 +345,7 @@
 
         Mailbox mailbox1 = AddressBuilder.parseMailbox("john.doe@example.net");
         Mailbox mailbox2 = AddressBuilder.parseMailbox("jane.doe@example.net");
-        Group group = new Group("Does", mailbox1, mailbox2);
+        Group group = new GroupImpl("Does", mailbox1, mailbox2);
         Mailbox mailbox3 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
 
         m.setCc(group);
@@ -382,7 +383,7 @@
 
         Mailbox mailbox1 = AddressBuilder.parseMailbox("john.doe@example.net");
         Mailbox mailbox2 = AddressBuilder.parseMailbox("jane.doe@example.net");
-        Group group = new Group("Does", mailbox1, mailbox2);
+        Group group = new GroupImpl("Does", mailbox1, mailbox2);
         Mailbox mailbox3 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
 
         m.setBcc(group);
@@ -420,7 +421,7 @@
 
         Mailbox mailbox1 = AddressBuilder.parseMailbox("john.doe@example.net");
         Mailbox mailbox2 = AddressBuilder.parseMailbox("jane.doe@example.net");
-        Group group = new Group("Does", mailbox1, mailbox2);
+        Group group = new GroupImpl("Does", mailbox1, mailbox2);
         Mailbox mailbox3 = AddressBuilder.parseMailbox("Mary Smith <mary@example.net>");
 
         m.setReplyTo(group);



Mime
View raw message