You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ba...@apache.org on 2006/03/30 16:09:54 UTC

svn commit: r390138 - /james/server/trunk/src/test/org/apache/james/smtpserver/SMTPTestConfiguration.java

Author: bago
Date: Thu Mar 30 06:09:53 2006
New Revision: 390138

URL: http://svn.apache.org/viewcvs?rev=390138&view=rev
Log:
Fix for the test of the previous patch [Check for valid domain in EHLO] (JAMES-451)

Modified:
    james/server/trunk/src/test/org/apache/james/smtpserver/SMTPTestConfiguration.java

Modified: james/server/trunk/src/test/org/apache/james/smtpserver/SMTPTestConfiguration.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/test/org/apache/james/smtpserver/SMTPTestConfiguration.java?rev=390138&r1=390137&r2=390138&view=diff
==============================================================================
--- james/server/trunk/src/test/org/apache/james/smtpserver/SMTPTestConfiguration.java (original)
+++ james/server/trunk/src/test/org/apache/james/smtpserver/SMTPTestConfiguration.java Thu Mar 30 06:09:53 2006
@@ -18,6 +18,8 @@
 
 package org.apache.james.smtpserver;
 
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.configuration.DefaultConfiguration;
 import org.apache.james.test.util.Util;
 
@@ -82,7 +84,7 @@
         m_ehloResolv = true; 
     }
 
-    public void init() {
+    public void init() throws ConfigurationException {
 
         setAttribute("enabled", true);
 
@@ -100,9 +102,17 @@
         handlerConfig.addChild(Util.createRemoteManagerHandlerChainConfiguration());
         
         // Add Configuration for Helo checks and Ehlo checks
-        DefaultConfiguration heloConfig = (DefaultConfiguration) handlerConfig.getChild("handlerchain").getChild("handler");
-        heloConfig.addChild(Util.getValuedConfiguration("checkValidHelo",m_heloResolv+""));     
-        heloConfig.addChild(Util.getValuedConfiguration("checkValidEhlo",m_ehloResolv+""));  
+        Configuration[] heloConfig = handlerConfig.getChild("handlerchain").getChildren("handler");
+        for (int i = 0; i < heloConfig.length; i++) {
+            if (heloConfig[i] instanceof DefaultConfiguration) {
+                String cmd = ((DefaultConfiguration) heloConfig[i]).getAttribute("command");
+                if ("HELO".equals(cmd)) {
+                    ((DefaultConfiguration) heloConfig[i]).addChild(Util.getValuedConfiguration("checkValidHelo",m_heloResolv+""));     
+                } else if ("EHLO".equals(cmd)) {
+                    ((DefaultConfiguration) heloConfig[i]).addChild(Util.getValuedConfiguration("checkValidEhlo",m_ehloResolv+""));
+                }
+            }
+        }
         
         addChild(handlerConfig);
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org