Author: bago
Date: Thu Aug 21 12:35:14 2008
New Revision: 687837

URL: http://svn.apache.org/viewvc?rev=687837&view=rev
Log:
Avoid use of "*" in HostAddress strings (geronimo is more strict than sun 
implementation in accepting hostname content) (related to JAMES-850)

Modified:
    
james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/remotedeliverytester/AbstractRemoteDeliveryTest.java
    
james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/remotedeliverytester/Tester.java
    
james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/remotedeliverytester/TransportRule.java

Modified: 
james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/remotedeliverytester/AbstractRemoteDeliveryTest.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/remotedeliverytester/AbstractRemoteDeliveryTest.java?rev=687837&r1=687836&r2=687837&view=diff
==============================================================================
--- 
james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/remotedeliverytester/AbstractRemoteDeliveryTest.java
 (original)
+++ 
james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/remotedeliverytester/AbstractRemoteDeliveryTest.java
 Thu Aug 21 12:35:14 2008
@@ -309,7 +309,7 @@
             tester.init(serviceManager, params);
             
             String[][] servers = addServers(tester, new String[][] {
-                    { "test.it", "smtp://mail-me-1-ok.*-me-1-ok.test.it:25" }
+                    { "test.it", "smtp://mail-me-1-ok.ANY-me-1-ok.test.it:25" }
             }, true);
             
     
@@ -346,7 +346,7 @@
             tester.init(serviceManager, params);
             
             String[][] servers = addServers(tester, new String[][] {
-                    { "test.it", "smtp://s1-ok.a*-smtpafe400.test.it:25" }
+                    { "test.it", "smtp://s1-ok.aANY-smtpafe400.test.it:25" }
             }, true);
             
             ProcMail.Listing mails = tester.service("mail", "[EMAIL 
PROTECTED]", new String[] {"[EMAIL PROTECTED]", "[EMAIL PROTECTED]"}, "Subject: 
test\r\nContent-Transfer-Encoding: plain\r\n\r\nbody");
@@ -383,7 +383,7 @@
             tester.init(serviceManager, params);
             
             String[][] servers = addServers(tester, new String[][] {
-                    { "test.it", "smtp://s1-ok.a*-smtpafe400V.test.it:25" }
+                    { "test.it", "smtp://s1-ok.aANY-smtpafe400V.test.it:25" }
             }, true);
             
             ProcMail.Listing mails = tester.service("mail", "[EMAIL 
PROTECTED]", new String[] {"[EMAIL PROTECTED]", "[EMAIL PROTECTED]"}, "Subject: 
test\r\nContent-Transfer-Encoding: plain\r\n\r\nbody");
@@ -419,7 +419,7 @@
             tester.init(serviceManager, params);
             
             String[][] servers = addServers(tester, new String[][] {
-                    { "test.it", 
"smtp://s1-ok.a*-smtpafe411V.b*-smtpafe500.test.it:25" }
+                    { "test.it", 
"smtp://s1-ok.aANY-smtpafe411V.bANY-smtpafe500.test.it:25" }
             }, true);
             
             ProcMail.Listing mails = tester.service("mail", "[EMAIL 
PROTECTED]", new String[] {"[EMAIL PROTECTED]", "[EMAIL PROTECTED]"}, "Subject: 
test\r\nContent-Transfer-Encoding: plain\r\n\r\nbody");
@@ -477,8 +477,8 @@
             tester.init(serviceManager, params);
             
             String[][] servers = addServers(tester, new String[][] {
-                    { "test.it", 
"smtp://s1-ok.a*-smtpafe400V.b*-smtpafe500.test.it:25" },
-                    { "test2.it", 
"smtp://s1-ok.a*-smtpafe400V.b*-smtpafe500.test2.it:25" }
+                    { "test.it", 
"smtp://s1-ok.aANY-smtpafe400V.bANY-smtpafe500.test.it:25" },
+                    { "test2.it", 
"smtp://s1-ok.aANY-smtpafe400V.bANY-smtpafe500.test2.it:25" }
             }, true);
             
             ProcMail.Listing mails1 = tester.service("mail1", "[EMAIL 
PROTECTED]", new String[] {"[EMAIL PROTECTED]", "[EMAIL PROTECTED]"}, "Subject: 
test1\r\nContent-Transfer-Encoding: plain\r\n\r\nbody");
@@ -524,7 +524,7 @@
             tester.init(serviceManager, params);
             
             String[][] servers = addServers(tester, new String[][] {
-                    { "test.it", "smtp://s1-ok.a*-null.test.it:25" },
+                    { "test.it", "smtp://s1-ok.aANY-null.test.it:25" },
             }, true);
             
             ProcMail.Listing mails1 = tester.service("M0", "[EMAIL 
PROTECTED]", new String[] {"[EMAIL PROTECTED]", "[EMAIL PROTECTED]"}, "Subject: 
test1\r\nContent-Transfer-Encoding: plain\r\n\r\nbody");
@@ -555,7 +555,7 @@
             tester.init(serviceManager, params);
             
             String[][] servers = addServers(tester, new String[][] {
-                    { "test.it", "smtp://s1-null.**-ok.test.it:25" },
+                    { "test.it", "smtp://s1-null.ANYANY-ok.test.it:25" },
             }, true);
             
             ProcMail.Listing mails1 = tester.service("M0", "[EMAIL 
PROTECTED]", new String[] {"[EMAIL PROTECTED]", "[EMAIL PROTECTED]"}, "Subject: 
test1\r\nContent-Transfer-Encoding: plain\r\n\r\nbody");
@@ -595,7 +595,7 @@
                 { "a.it", "smtp://s1-ok.a.it:25", "smtp://s2-ok.a.it:25" },
                 
                 // b.it: one server always reply smtpafe400V, the other works.
-                { "b.it", "smtp://s1-ok.**-smtpafe400V.b.it:25", 
"smtp://s2-ok.b.it:25" },
+                { "b.it", "smtp://s1-ok.ANYANY-smtpafe400V.b.it:25", 
"smtp://s2-ok.b.it:25" },
             }, true);
             
             ProcMail.Listing mails = tester.service("M0", "[EMAIL PROTECTED]", 
new String[] {"[EMAIL PROTECTED]", "[EMAIL PROTECTED]"}, "Subject: 
test0\r\nContent-Transfer-Encoding: plain\r\n\r\nbody");
@@ -670,7 +670,7 @@
             
             String[][] servers = addServers(tester, new String[][] {
                 // i.it: ioexception (during connect or send for "a", 
depending on the server) 
-                { "i.it", "smtp://s1-io.i.it:25",  
"smtp://s2-ok.a*-io.i.it:25"},
+                { "i.it", "smtp://s1-io.i.it:25",  
"smtp://s2-ok.aANY-io.i.it:25"},
             }, true);
             
             //ProcMail.Listing mails = tester.service("M0", "[EMAIL 
PROTECTED]", new String[] {"[EMAIL PROTECTED]", "[EMAIL PROTECTED]"}, "Subject: 
test0\r\nContent-Transfer-Encoding: plain\r\n\r\nbody");
@@ -701,27 +701,27 @@
             { "a.it", "smtp://s1-ok.a.it:25", "smtp://s2-ok.a.it:25" },
             
             // b.it: one server throws ME on every call, the other works.
-            //{ "b.it", "smtp://s1-ok.**-smtpafe400V.b.it:25", 
"smtp://s2-ok.b.it:25" },  <- Questo su MailSender non lo puo' fare
+            //{ "b.it", "smtp://s1-ok.ANYANY-smtpafe400V.b.it:25", 
"smtp://s2-ok.b.it:25" },  <- Questo su MailSender non lo puo' fare
             { "b.it", "smtp://s1-me.b.it:25", "smtp://s2-ok.b.it:25" },
             
             // c.it: both servers replies smtpafe400V.
-            { "c.it", "smtp://s1-ok.**-smtpafe400V.c.it:25", 
"smtp://s2-ok.**-smtpafe400V.c.it:25" },
+            { "c.it", "smtp://s1-ok.ANYANY-smtpafe400V.c.it:25", 
"smtp://s2-ok.ANYANY-smtpafe400V.c.it:25" },
 
             // d.it: Messaging exception once every 2 attempts.
-            { "d.it", "smtp://s1-me-1-ok-1-rpt.*-me-1-ok-1-rpt.d.it:25" }, 
+            { "d.it", "smtp://s1-me-1-ok-1-rpt.ANY-me-1-ok-1-rpt.d.it:25" }, 
             
             // e.it: addresses starting with "a" are rejected with a smtpafe400
-            { "e.it", "smtp://s1-ok.a*-smtpafe400.e.it:25" },
+            { "e.it", "smtp://s1-ok.aANY-smtpafe400.e.it:25" },
             
             // f.it: addresses starting with "a" are rejected with a 
smtpafe400V from the first server
             //       the second server do the same with "b" addresses.
-            { "f.it", "smtp://s1-ok.a*-smtpafe400V.f.it:25", 
"smtp://s2-ok.b*-smtpafe400V.f.it:25" },
+            { "f.it", "smtp://s1-ok.aANY-smtpafe400V.f.it:25", 
"smtp://s2-ok.bANY-smtpafe400V.f.it:25" },
             
             // g.it: "a" not accepted (temporary), "b" not accepted 
(permanent), "c" half temporary exceptions
-            { "g.it", 
"smtp://s1-ok.a*-smtpafe411V.b*-smtpafe500.test.c*-smtpafe411V-1-ok-1-rpt.g.it:25"
 },
+            { "g.it", 
"smtp://s1-ok.aANY-smtpafe411V.bANY-smtpafe500.test.cANY-smtpafe411V-1-ok-1-rpt.g.it:25"
 },
             
             // h.it: null pointer exception (during connect for one server and 
during send for the other) 
-            { "h.it", "smtp://s1-null.h.it:25",  
"smtp://s2-ok.**-null.h.it:25"},
+            { "h.it", "smtp://s1-null.h.it:25",  
"smtp://s2-ok.ANYANY-null.h.it:25"},
 
             // i.it: ioexception during connect on one server, the other 
works. 
             { "i.it", "smtp://s1-io.i.it:25",  "smtp://s2-ok.i.it:25"},

Modified: 
james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/remotedeliverytester/Tester.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/remotedeliverytester/Tester.java?rev=687837&r1=687836&r2=687837&view=diff
==============================================================================
--- 
james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/remotedeliverytester/Tester.java
 (original)
+++ 
james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/remotedeliverytester/Tester.java
 Thu Aug 21 12:35:14 2008
@@ -163,13 +163,14 @@
             if (!((s.getTransport("smtp")) instanceof SMTPTransport))
                 s.setProvider(new Provider(Type.TRANSPORT, "smtp", 
SMTPTransport.class.getName(), "test", "0"));
         } catch (NoSuchProviderException e) {
-          // Let's do it twice, don't remember why.
-          try {
-                        s.setProvider(new Provider(Type.TRANSPORT, "smtp", 
SMTPTransport.class.getName(), "test", "0"));
-                    } catch (NoSuchProviderException e1) {
-                        e1.printStackTrace();
-                    }
-            e.printStackTrace();
+            // Let's do it twice, don't remember why.
+            System.out.println("WARN: "+e.getMessage());
+            try {
+                s.setProvider(new Provider(Type.TRANSPORT, "smtp", 
SMTPTransport.class.getName(), "test", "0"));
+            } catch (NoSuchProviderException e1) {
+                System.out.println("ERROR: "+e.getMessage());
+                e1.printStackTrace();
+            }
         }
         return s;
     }
@@ -278,7 +279,8 @@
     }
 
     public Iterator onMailetContextGetSMTPHostAddresses(String domainName) {
-        return ((List)hostAddresses.get(domainName)).iterator();
+        List list = (List)hostAddresses.get(domainName);
+        return (list).iterator();
     }
     
     public synchronized void onTransportConnect(SMTPTransport tester) throws 
MessagingException {

Modified: 
james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/remotedeliverytester/TransportRule.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/remotedeliverytester/TransportRule.java?rev=687837&r1=687836&r2=687837&view=diff
==============================================================================
--- 
james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/remotedeliverytester/TransportRule.java
 (original)
+++ 
james/server/trunk/mailets-function/src/test/java/org/apache/james/transport/remotedeliverytester/TransportRule.java
 Thu Aug 21 12:35:14 2008
@@ -75,6 +75,8 @@
      */
     public class NameExpression extends Default {
         
+        private static final String STAR_MATCHER = "ANY";
+        
         // Se false ai recipient validi non vengono effettivamente fatti invii 
         private boolean propSendValid = true;
         
@@ -89,7 +91,7 @@
          * @return
          */
         private String[] getRules(String data) {
-            String[] pieces = data.toLowerCase().split("-");
+            String[] pieces = data.split("-");
             Vector actions = new Vector();
             actions.add(pieces[0]);
             for (int i = 1; i < pieces.length; i += 2) {
@@ -298,9 +300,13 @@
             
             for (int i = 1; i < serverPieces.length - 1; i++) {
                 String[] actions = getRules(serverPieces[i]);
-                if (actions[0].endsWith("*") && actions[0].length() > 1) {
-                    String match = actions[0].substring(0, actions[0].length() 
- 1);
-                    for (int j = 0; j < pmails.size(); j++) if 
(pmails.get(j).getRecipient().toString().startsWith(match) || 
match.equals("*")) {
+                System.out.println("Actions1!");
+                for (int k = 0; k < actions.length; k++) 
System.out.println(actions[k]);
+                if (actions[0].endsWith(STAR_MATCHER) && actions[0].length() > 
1) {
+                    String match = actions[0].substring(0, actions[0].length() 
- STAR_MATCHER.length());
+                    System.out.println("Match!");
+                    System.out.println(match);
+                    for (int j = 0; j < pmails.size(); j++) if 
(pmails.get(j).getRecipient().toString().startsWith(match) || 
match.equals(STAR_MATCHER)) {
                         MessagingException ex = getException(actions, idx, 
pmails.get(j), server);
                         addException(exceptionMap, ex, 
pmails.get(j).getRecipient().toInternetAddress());
                     } else addException(exceptionMap, null, 
pmails.get(j).getRecipient().toInternetAddress());
@@ -309,7 +315,9 @@
             
             for (int i = 1; i < serverPieces.length - 1; i++) {
                 String[] actions = getRules(serverPieces[i]);
-                if (actions[0].equals("*")) {
+                System.out.println("Actions2!");
+                for (int k = 0; k < actions.length; k++) 
System.out.println(actions[k]);
+                if (actions[0].equals(STAR_MATCHER)) {
                     MessagingException ex = getException(actions, idx, null, 
server);
                     addException(exceptionMap, ex, null);
                 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to