Author: norman
Date: Sat Oct 24 16:26:08 2009
New Revision: 829399

URL: http://svn.apache.org/viewvc?rev=829399&view=rev
Log:
Move some tests and mocked classes to the smtp-protocol-library

Added:
    james/server/trunk/smtp-protocol-library/src/test/java/org/
    james/server/trunk/smtp-protocol-library/src/test/java/org/apache/
    james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/
    
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/
    
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/
    
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/BaseFakeDNSService.java
    
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/BaseFakeSMTPSession.java
      - copied, changed from r829385, 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/BaseFakeSMTPSession.java
    
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/
    
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/
    
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/DNSRBLHandlerTest.java
      - copied, changed from r829385, 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/DNSRBLHandlerTest.java
    
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/MockLog.java
    
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/ResolvableEhloHeloHandlerTest.java
      - copied, changed from r829385, 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ResolvableEhloHeloHandlerTest.java
    
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/TarpitHandlerTest.java
      - copied, changed from r829385, 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/TarpitHandlerTest.java
    
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/ValidSenderDomainHandlerTest.java
      - copied, changed from r829385, 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ValidSenderDomainHandlerTest.java
Removed:
    
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/BaseFakeSMTPSession.java
    
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/DNSRBLHandlerTest.java
    
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ResolvableEhloHeloHandlerTest.java
    
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/TarpitHandlerTest.java
    
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ValidSenderDomainHandlerTest.java
Modified:
    
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/MaxRcptHandlerTest.java
    
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/POP3BeforeSMTPHandlerTest.java
    
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SPFHandlerTest.java
    
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SetMimeHeaderHandlerTest.java
    
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SpamAssassinHandlerTest.java
    
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SpamTrapHandlerTest.java
    
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/URIRBLHandlerTest.java
    
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java
    
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ValidRcptMXTest.java

Added: 
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/BaseFakeDNSService.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/BaseFakeDNSService.java?rev=829399&view=auto
==============================================================================
--- 
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/BaseFakeDNSService.java
 (added)
+++ 
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/BaseFakeDNSService.java
 Sat Oct 24 16:26:08 2009
@@ -0,0 +1,65 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.smtpserver.protocol;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.mailet.HostAddress;
+
+public class BaseFakeDNSService implements DNSService{
+
+    public Collection<String> findMXRecords(String hostname) throws 
TemporaryResolutionException {
+        throw new UnsupportedOperationException("Unimplemented in mock");
+
+    }
+
+    public Collection<String> findTXTRecords(String hostname) {
+        throw new UnsupportedOperationException("Unimplemented in mock");
+
+    }
+
+    public InetAddress[] getAllByName(String host) throws UnknownHostException 
{
+        throw new UnsupportedOperationException("Unimplemented in mock");
+
+    }
+
+    public InetAddress getByName(String host) throws UnknownHostException {
+        throw new UnsupportedOperationException("Unimplemented in mock");
+
+    }
+
+    public String getHostName(InetAddress addr) {
+        throw new UnsupportedOperationException("Unimplemented in mock");
+
+    }
+
+    public InetAddress getLocalHost() throws UnknownHostException {
+        throw new UnsupportedOperationException("Unimplemented in mock");
+
+    }
+
+    public Iterator<HostAddress> getSMTPHostAddresses(String domainName) 
throws TemporaryResolutionException {
+        throw new UnsupportedOperationException("Unimplemented in mock");
+
+    }
+
+}

Copied: 
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/BaseFakeSMTPSession.java
 (from r829385, 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/BaseFakeSMTPSession.java)
URL: 
http://svn.apache.org/viewvc/james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/BaseFakeSMTPSession.java?p2=james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/BaseFakeSMTPSession.java&p1=james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/BaseFakeSMTPSession.java&r1=829385&r2=829399&rev=829399&view=diff
==============================================================================
--- 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/BaseFakeSMTPSession.java
 (original)
+++ 
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/BaseFakeSMTPSession.java
 Sat Oct 24 16:26:08 2009
@@ -18,7 +18,7 @@
  ****************************************************************/
 
 
-package org.apache.james.smtpserver;
+package org.apache.james.smtpserver.protocol;
 
 import java.io.IOException;
 import java.util.Map;

Copied: 
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/DNSRBLHandlerTest.java
 (from r829385, 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/DNSRBLHandlerTest.java)
URL: 
http://svn.apache.org/viewvc/james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/DNSRBLHandlerTest.java?p2=james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/DNSRBLHandlerTest.java&p1=james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/DNSRBLHandlerTest.java&r1=829385&r2=829399&rev=829399&view=diff
==============================================================================
--- 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/DNSRBLHandlerTest.java
 (original)
+++ 
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/DNSRBLHandlerTest.java
 Sat Oct 24 16:26:08 2009
@@ -18,7 +18,7 @@
  ****************************************************************/
 
 
-package org.apache.james.smtpserver;
+package org.apache.james.smtpserver.protocol.core.fastfail;
 
 import java.math.BigDecimal;
 import java.math.BigInteger;
@@ -36,19 +36,17 @@
 
 import junit.framework.TestCase;
 
-import org.apache.avalon.framework.container.ContainerUtil;
 import org.apache.commons.configuration.Configuration;
 import org.apache.commons.configuration.ConfigurationException;
-import org.apache.james.api.dnsservice.AbstractDNSServer;
-import org.apache.james.smtpserver.integration.SMTPServerDNSServiceAdapter;
+import org.apache.james.smtpserver.protocol.BaseFakeDNSService;
+import org.apache.james.smtpserver.protocol.BaseFakeSMTPSession;
+import org.apache.james.smtpserver.protocol.DNSService;
 import org.apache.james.smtpserver.protocol.SMTPSession;
-import org.apache.james.smtpserver.protocol.core.fastfail.DNSRBLHandler;
-import org.apache.james.test.mock.avalon.MockLogger;
 import org.apache.mailet.MailAddress;
 
 public class DNSRBLHandlerTest extends TestCase {
 
-    private SMTPServerDNSServiceAdapter mockedDnsServer;
+    private DNSService mockedDnsServer;
 
     private SMTPSession mockedSMTPSession;
 
@@ -89,14 +87,10 @@
      *
      */
     private void setupMockedDnsServer() {
-        org.apache.james.api.dnsservice.DNSService dns  = new 
AbstractDNSServer() {
+        mockedDnsServer  = new BaseFakeDNSService() {
 
-            public Collection findMXRecords(String hostname) {
-                throw new UnsupportedOperationException("Unimplemented in 
mock");
-            }
-
-            public Collection findTXTRecords(String hostname) {
-                List res = new ArrayList();
+            public Collection<String> findTXTRecords(String hostname) {
+                List<String> res = new ArrayList<String>();
                 if (hostname == null) {
                     return res;
                 }
@@ -120,8 +114,6 @@
             }
         };
         
-        mockedDnsServer = new SMTPServerDNSServiceAdapter();
-        mockedDnsServer.setDNSService(dns);
     }
 
     /**
@@ -162,9 +154,7 @@
     // ip is blacklisted and has txt details
     public void testBlackListedTextPresent() throws ParseException {
         DNSRBLHandler rbl = new DNSRBLHandler();
-
-        ContainerUtil.enableLogging(rbl, new MockLogger());
-
+       
         setupMockedSMTPSession(new MailAddress("a...@domain"));
         rbl.setDNSService(mockedDnsServer);
 
@@ -179,9 +169,6 @@
     // ip is blacklisted and has txt details but we don'T want to retrieve the 
txt record
     public void testGetNoDetail() throws ParseException {
         DNSRBLHandler rbl = new DNSRBLHandler();
-
-        ContainerUtil.enableLogging(rbl, new MockLogger());
-
         setupMockedSMTPSession(new MailAddress("a...@domain"));
         rbl.setDNSService(mockedDnsServer);
 
@@ -195,9 +182,6 @@
     // ip is allowed to relay
     public void testRelayAllowed() throws ParseException {
         DNSRBLHandler rbl = new DNSRBLHandler();
-
-        ContainerUtil.enableLogging(rbl, new MockLogger());
-
         setRelayingAllowed(true);
         setupMockedSMTPSession(new MailAddress("a...@domain"));
 
@@ -214,7 +198,6 @@
     public void testNotBlackListed() throws ParseException {
         DNSRBLHandler rbl = new DNSRBLHandler();
 
-        ContainerUtil.enableLogging(rbl, new MockLogger());
         setRemoteIp("192.168.0.1");
         setupMockedSMTPSession(new MailAddress("a...@domain"));
 
@@ -231,7 +214,6 @@
     public void testBlackListedNoTxt() throws ParseException {
         DNSRBLHandler rbl = new DNSRBLHandler();
 
-        ContainerUtil.enableLogging(rbl, new MockLogger());
         setRemoteIp("127.0.0.3");
         setupMockedSMTPSession(new MailAddress("a...@domain"));
 
@@ -248,7 +230,6 @@
     public void testWhiteListed() throws ParseException {
         DNSRBLHandler rbl = new DNSRBLHandler();
 
-        ContainerUtil.enableLogging(rbl, new MockLogger());
         setRemoteIp("127.0.0.2");
         setupMockedSMTPSession(new MailAddress("a...@domain"));
 

Added: 
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/MockLog.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/MockLog.java?rev=829399&view=auto
==============================================================================
--- 
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/MockLog.java
 (added)
+++ 
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/MockLog.java
 Sat Oct 24 16:26:08 2009
@@ -0,0 +1,118 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.smtpserver.protocol.core.fastfail;
+
+import org.apache.commons.logging.Log;
+
+public class MockLog implements Log{
+
+    public void debug(Object arg0) {
+        System.out.println(arg0);
+    }
+
+    public void debug(Object arg0, Throwable arg1) {
+        System.out.println(arg0);
+        arg1.printStackTrace();
+
+
+    }
+
+    public void error(Object arg0) {
+        System.out.println(arg0);
+        
+    }
+
+    public void error(Object arg0, Throwable arg1) {
+        System.out.println(arg0);
+        arg1.printStackTrace();
+
+        
+    }
+
+    public void fatal(Object arg0) {
+        System.out.println(arg0);
+        
+    }
+
+    public void fatal(Object arg0, Throwable arg1) {
+        System.out.println(arg0);
+        arg1.printStackTrace();
+
+        
+    }
+
+    public void info(Object arg0) {
+        System.out.println(arg0);
+        
+    }
+
+    public void info(Object arg0, Throwable arg1) {
+        System.out.println(arg0);
+        arg1.printStackTrace();
+
+        
+    }
+
+    public boolean isDebugEnabled() {
+        return true;
+    }
+
+    public boolean isErrorEnabled() {
+        return true;
+    }
+
+    public boolean isFatalEnabled() {
+        return true;
+    }
+
+    public boolean isInfoEnabled() {
+        return true;
+    }
+
+    public boolean isTraceEnabled() {
+        return true;
+    }
+
+    public boolean isWarnEnabled() {
+        return true;
+    }
+
+    public void trace(Object arg0) {
+        System.out.println(arg0);        
+    }
+
+    public void trace(Object arg0, Throwable arg1) {
+        System.out.println(arg0);  
+        arg1.printStackTrace();
+
+    }
+
+    public void warn(Object arg0) {
+        System.out.println(arg0);
+        
+    }
+
+    public void warn(Object arg0, Throwable arg1) {
+        System.out.println(arg0);
+        arg1.printStackTrace();
+        
+    }
+
+}

Copied: 
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/ResolvableEhloHeloHandlerTest.java
 (from r829385, 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ResolvableEhloHeloHandlerTest.java)
URL: 
http://svn.apache.org/viewvc/james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/ResolvableEhloHeloHandlerTest.java?p2=james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/ResolvableEhloHeloHandlerTest.java&p1=james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ResolvableEhloHeloHandlerTest.java&r1=829385&r2=829399&rev=829399&view=diff
==============================================================================
--- 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ResolvableEhloHeloHandlerTest.java
 (original)
+++ 
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/ResolvableEhloHeloHandlerTest.java
 Sat Oct 24 16:26:08 2009
@@ -19,7 +19,7 @@
 
 
 
-package org.apache.james.smtpserver;
+package org.apache.james.smtpserver.protocol.core.fastfail;
 
 import java.net.InetAddress;
 import java.net.UnknownHostException;
@@ -30,14 +30,12 @@
 
 import junit.framework.TestCase;
 
-import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.james.api.dnsservice.AbstractDNSServer;
-import org.apache.james.api.dnsservice.DNSService;
-import org.apache.james.smtpserver.integration.SMTPServerDNSServiceAdapter;
+import org.apache.james.smtpserver.protocol.BaseFakeDNSService;
+import org.apache.james.smtpserver.protocol.BaseFakeSMTPSession;
+import org.apache.james.smtpserver.protocol.DNSService;
 import org.apache.james.smtpserver.protocol.SMTPSession;
 import 
org.apache.james.smtpserver.protocol.core.fastfail.ResolvableEhloHeloHandler;
 import org.apache.james.smtpserver.protocol.hook.HookReturnCode;
-import org.apache.james.test.mock.avalon.MockLogger;
 import org.apache.mailet.MailAddress;
 
 public class ResolvableEhloHeloHandlerTest extends TestCase {
@@ -81,8 +79,8 @@
         return session;
     }
     
-    private SMTPServerDNSServiceAdapter setupMockDNSServer() {
-       DNSService dns = new AbstractDNSServer(){
+    private DNSService setupMockDNSServer() {
+       DNSService dns = new BaseFakeDNSService(){
             public InetAddress getByName(String host) throws 
UnknownHostException {
                 if (host.equals(INVALID_HOST)) 
                     throw new UnknownHostException();
@@ -90,18 +88,13 @@
             }
         };
         
-        SMTPServerDNSServiceAdapter adapter = new 
SMTPServerDNSServiceAdapter();
-        adapter.setDNSService(dns);
-        return adapter;
+        return dns;
     }
     
     public void testRejectInvalidHelo() throws ParseException {
         MailAddress mailAddress = new MailAddress("t...@localhost");
         SMTPSession session = 
setupMockSession(INVALID_HOST,false,false,null,mailAddress);
         ResolvableEhloHeloHandler handler = new ResolvableEhloHeloHandler();
-        
-        ContainerUtil.enableLogging(handler,new MockLogger());
-        
         handler.setDNSService(setupMockDNSServer());
         
         handler.doHelo(session, INVALID_HOST);
@@ -116,9 +109,7 @@
         MailAddress mailAddress = new MailAddress("t...@localhost");
         SMTPSession session = 
setupMockSession(VALID_HOST,false,false,null,mailAddress);
         ResolvableEhloHeloHandler handler = new ResolvableEhloHeloHandler();
-        
-        ContainerUtil.enableLogging(handler,new MockLogger());
-        
+                
         handler.setDNSService(setupMockDNSServer());
   
         handler.doHelo(session, VALID_HOST);
@@ -152,9 +143,7 @@
         MailAddress mailAddress = new MailAddress("t...@localhost");
         SMTPSession session = 
setupMockSession(INVALID_HOST,false,true,"va...@user",mailAddress);
         ResolvableEhloHeloHandler handler = new ResolvableEhloHeloHandler();
-        
-        ContainerUtil.enableLogging(handler,new MockLogger());
-        
+                
         handler.setDNSService(setupMockDNSServer());
 
         handler.doHelo(session, INVALID_HOST);
@@ -169,9 +158,7 @@
         MailAddress mailAddress = new MailAddress("t...@localhost");
         SMTPSession session = 
setupMockSession(INVALID_HOST,true,false,null,mailAddress);
         ResolvableEhloHeloHandler handler = new ResolvableEhloHeloHandler();
-        
-        ContainerUtil.enableLogging(handler,new MockLogger());
-        
+                
         handler.setDNSService(setupMockDNSServer());
         
 
@@ -187,7 +174,6 @@
         SMTPSession session = 
setupMockSession(INVALID_HOST,true,false,null,mailAddress);
         ResolvableEhloHeloHandler handler = new ResolvableEhloHeloHandler();
         
-        ContainerUtil.enableLogging(handler,new MockLogger());
         
         handler.setDNSService(setupMockDNSServer());
         handler.setCheckAuthNetworks(true);

Copied: 
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/TarpitHandlerTest.java
 (from r829385, 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/TarpitHandlerTest.java)
URL: 
http://svn.apache.org/viewvc/james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/TarpitHandlerTest.java?p2=james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/TarpitHandlerTest.java&p1=james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/TarpitHandlerTest.java&r1=829385&r2=829399&rev=829399&view=diff
==============================================================================
--- 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/TarpitHandlerTest.java
 (original)
+++ 
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/TarpitHandlerTest.java
 Sat Oct 24 16:26:08 2009
@@ -16,11 +16,12 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.smtpserver;
+package org.apache.james.smtpserver.protocol.core.fastfail;
 
 import javax.mail.internet.ParseException;
 
 import org.apache.avalon.framework.container.ContainerUtil;
+import org.apache.james.smtpserver.protocol.BaseFakeSMTPSession;
 import org.apache.james.smtpserver.protocol.SMTPSession;
 import org.apache.james.smtpserver.protocol.core.fastfail.TarpitHandler;
 import org.apache.james.test.mock.avalon.MockLogger;

Copied: 
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/ValidSenderDomainHandlerTest.java
 (from r829385, 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ValidSenderDomainHandlerTest.java)
URL: 
http://svn.apache.org/viewvc/james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/ValidSenderDomainHandlerTest.java?p2=james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/ValidSenderDomainHandlerTest.java&p1=james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ValidSenderDomainHandlerTest.java&r1=829385&r2=829399&rev=829399&view=diff
==============================================================================
--- 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ValidSenderDomainHandlerTest.java
 (original)
+++ 
james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/ValidSenderDomainHandlerTest.java
 Sat Oct 24 16:26:08 2009
@@ -17,7 +17,7 @@
  * under the License.                                           *
  ****************************************************************/
 
-package org.apache.james.smtpserver;
+package org.apache.james.smtpserver.protocol.core.fastfail;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -28,23 +28,21 @@
 
 import junit.framework.TestCase;
 
-import org.apache.avalon.framework.container.ContainerUtil;
-import org.apache.james.api.dnsservice.AbstractDNSServer;
-import org.apache.james.api.dnsservice.DNSService;
-import org.apache.james.smtpserver.integration.SMTPServerDNSServiceAdapter;
+import org.apache.james.smtpserver.protocol.BaseFakeDNSService;
+import org.apache.james.smtpserver.protocol.BaseFakeSMTPSession;
+import org.apache.james.smtpserver.protocol.DNSService;
 import org.apache.james.smtpserver.protocol.SMTPSession;
 import 
org.apache.james.smtpserver.protocol.core.fastfail.ValidSenderDomainHandler;
 import org.apache.james.smtpserver.protocol.hook.HookReturnCode;
-import org.apache.james.test.mock.avalon.MockLogger;
 import org.apache.mailet.MailAddress;
 
 public class ValidSenderDomainHandlerTest extends TestCase {
     
-    private SMTPServerDNSServiceAdapter setupDNSServer() {
-       DNSService dns = new AbstractDNSServer(){
+    private DNSService setupDNSServer() {
+       DNSService dns = new BaseFakeDNSService(){
 
-            public Collection findMXRecords(String hostname) {
-                Collection mx = new ArrayList();
+            public Collection<String> findMXRecords(String hostname) {
+                Collection<String> mx = new ArrayList<String>();
                 if (hostname.equals("test.james.apache.org")) {
                     mx.add("mail.james.apache.org");
                 }
@@ -52,16 +50,14 @@
             }
             
         };
-        SMTPServerDNSServiceAdapter adapter = new 
SMTPServerDNSServiceAdapter();
-        adapter.setDNSService(dns);
-        return adapter;
+        return dns;
     }
     
     private SMTPSession setupMockedSession(final MailAddress sender) {
         SMTPSession session = new BaseFakeSMTPSession() {
-            HashMap state = new HashMap();
+            HashMap<String,Object> state = new HashMap<String,Object>();
 
-            public Map getState() {
+            public Map<String,Object> getState() {
 
                 state.put(SMTPSession.SENDER, sender);
 
@@ -81,8 +77,6 @@
     // Test for JAMES-580
     public void testNullSenderNotReject() {
         ValidSenderDomainHandler handler = new ValidSenderDomainHandler();
-        ContainerUtil.enableLogging(handler, new MockLogger());
-        
         handler.setDNSService(setupDNSServer());
         int response = 
handler.doMail(setupMockedSession(null),null).getResult();
         
@@ -92,7 +86,6 @@
     public void testInvalidSenderDomainReject() throws ParseException {
         ValidSenderDomainHandler handler = new ValidSenderDomainHandler();
         SMTPSession session = setupMockedSession(new 
MailAddress("inva...@invalid"));
-        ContainerUtil.enableLogging(handler, new MockLogger());
         handler.setDNSService(setupDNSServer());
         int response = handler.doMail(session,(MailAddress) 
session.getState().get(SMTPSession.SENDER)).getResult();
         

Modified: 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/MaxRcptHandlerTest.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/MaxRcptHandlerTest.java?rev=829399&r1=829398&r2=829399&view=diff
==============================================================================
--- 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/MaxRcptHandlerTest.java
 (original)
+++ 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/MaxRcptHandlerTest.java
 Sat Oct 24 16:26:08 2009
@@ -30,6 +30,7 @@
 import junit.framework.TestCase;
 
 import org.apache.avalon.framework.container.ContainerUtil;
+import org.apache.james.smtpserver.protocol.BaseFakeSMTPSession;
 import org.apache.james.smtpserver.protocol.SMTPSession;
 import org.apache.james.smtpserver.protocol.core.fastfail.MaxRcptHandler;
 import org.apache.james.smtpserver.protocol.hook.HookReturnCode;

Modified: 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/POP3BeforeSMTPHandlerTest.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/POP3BeforeSMTPHandlerTest.java?rev=829399&r1=829398&r2=829399&view=diff
==============================================================================
--- 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/POP3BeforeSMTPHandlerTest.java
 (original)
+++ 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/POP3BeforeSMTPHandlerTest.java
 Sat Oct 24 16:26:08 2009
@@ -22,6 +22,7 @@
 
 import org.apache.avalon.framework.container.ContainerUtil;
 import org.apache.james.smtpserver.integration.POP3BeforeSMTPHandler;
+import org.apache.james.smtpserver.protocol.BaseFakeSMTPSession;
 import org.apache.james.smtpserver.protocol.SMTPSession;
 import org.apache.james.test.mock.avalon.MockLogger;
 import org.apache.james.util.POP3BeforeSMTPHelper;

Modified: 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SPFHandlerTest.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SPFHandlerTest.java?rev=829399&r1=829398&r2=829399&view=diff
==============================================================================
--- 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SPFHandlerTest.java
 (original)
+++ 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SPFHandlerTest.java
 Sat Oct 24 16:26:08 2009
@@ -29,6 +29,7 @@
 import org.apache.james.jspf.core.DNSRequest;
 import org.apache.james.jspf.core.DNSService;
 import org.apache.james.jspf.core.exceptions.TimeoutException;
+import org.apache.james.smtpserver.protocol.BaseFakeSMTPSession;
 import org.apache.james.smtpserver.protocol.SMTPSession;
 import org.apache.james.smtpserver.protocol.core.fastfail.SPFHandler;
 import org.apache.james.smtpserver.protocol.hook.HookReturnCode;

Modified: 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SetMimeHeaderHandlerTest.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SetMimeHeaderHandlerTest.java?rev=829399&r1=829398&r2=829399&view=diff
==============================================================================
--- 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SetMimeHeaderHandlerTest.java
 (original)
+++ 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SetMimeHeaderHandlerTest.java
 Sat Oct 24 16:26:08 2009
@@ -23,6 +23,7 @@
 import junit.framework.TestCase;
 import org.apache.avalon.framework.container.ContainerUtil;
 import org.apache.james.smtpserver.integration.SetMimeHeaderHandler;
+import org.apache.james.smtpserver.protocol.BaseFakeSMTPSession;
 import org.apache.james.smtpserver.protocol.SMTPSession;
 import org.apache.james.test.mock.avalon.MockLogger;
 import org.apache.mailet.Mail;

Modified: 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SpamAssassinHandlerTest.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SpamAssassinHandlerTest.java?rev=829399&r1=829398&r2=829399&view=diff
==============================================================================
--- 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SpamAssassinHandlerTest.java
 (original)
+++ 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SpamAssassinHandlerTest.java
 Sat Oct 24 16:26:08 2009
@@ -31,6 +31,7 @@
 
 import org.apache.avalon.framework.container.ContainerUtil;
 import org.apache.james.smtpserver.integration.SpamAssassinHandler;
+import org.apache.james.smtpserver.protocol.BaseFakeSMTPSession;
 import org.apache.james.smtpserver.protocol.SMTPSession;
 import org.apache.james.smtpserver.protocol.hook.HookResult;
 import org.apache.james.smtpserver.protocol.hook.HookReturnCode;

Modified: 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SpamTrapHandlerTest.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SpamTrapHandlerTest.java?rev=829399&r1=829398&r2=829399&view=diff
==============================================================================
--- 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SpamTrapHandlerTest.java
 (original)
+++ 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SpamTrapHandlerTest.java
 Sat Oct 24 16:26:08 2009
@@ -25,6 +25,7 @@
 import javax.mail.internet.ParseException;
 
 import org.apache.avalon.framework.container.ContainerUtil;
+import org.apache.james.smtpserver.protocol.BaseFakeSMTPSession;
 import org.apache.james.smtpserver.protocol.SMTPSession;
 import org.apache.james.smtpserver.protocol.core.fastfail.SpamTrapHandler;
 import org.apache.james.smtpserver.protocol.hook.HookReturnCode;

Modified: 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/URIRBLHandlerTest.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/URIRBLHandlerTest.java?rev=829399&r1=829398&r2=829399&view=diff
==============================================================================
--- 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/URIRBLHandlerTest.java
 (original)
+++ 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/URIRBLHandlerTest.java
 Sat Oct 24 16:26:08 2009
@@ -42,6 +42,7 @@
 import org.apache.james.api.dnsservice.AbstractDNSServer;
 import org.apache.james.api.dnsservice.DNSService;
 import org.apache.james.smtpserver.integration.URIRBLHandler;
+import org.apache.james.smtpserver.protocol.BaseFakeSMTPSession;
 import org.apache.james.smtpserver.protocol.SMTPSession;
 import org.apache.james.smtpserver.protocol.hook.HookResult;
 import org.apache.james.smtpserver.protocol.hook.HookReturnCode;

Modified: 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java?rev=829399&r1=829398&r2=829399&view=diff
==============================================================================
--- 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java
 (original)
+++ 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java
 Sat Oct 24 16:26:08 2009
@@ -35,6 +35,7 @@
 import org.apache.james.api.vut.VirtualUserTable;
 import org.apache.james.api.vut.VirtualUserTableStore;
 import org.apache.james.smtpserver.integration.ValidRcptHandler;
+import org.apache.james.smtpserver.protocol.BaseFakeSMTPSession;
 import org.apache.james.smtpserver.protocol.SMTPConfiguration;
 import org.apache.james.smtpserver.protocol.SMTPSession;
 import org.apache.james.smtpserver.protocol.hook.HookReturnCode;

Modified: 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ValidRcptMXTest.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ValidRcptMXTest.java?rev=829399&r1=829398&r2=829399&view=diff
==============================================================================
--- 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ValidRcptMXTest.java
 (original)
+++ 
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ValidRcptMXTest.java
 Sat Oct 24 16:26:08 2009
@@ -32,6 +32,7 @@
 import org.apache.james.api.dnsservice.AbstractDNSServer;
 import org.apache.james.api.dnsservice.DNSService;
 import org.apache.james.smtpserver.integration.ValidRcptMX;
+import org.apache.james.smtpserver.protocol.BaseFakeSMTPSession;
 import org.apache.james.smtpserver.protocol.SMTPSession;
 import org.apache.james.smtpserver.protocol.hook.HookReturnCode;
 import org.apache.james.test.mock.avalon.MockLogger;



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to