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/07/26 22:14:18 UTC

svn commit: r425831 - in /james/server/trunk/src/test/org/apache/james/smtpserver: AbstractSMTPSession.java DNSRBLHandlerTest.java POP3BeforeSMTPHandlerTest.java SPFHandlerTest.java SetMimeHeaderHandlerTest.java SpamAssassinHandlerTest.java

Author: bago
Date: Wed Jul 26 13:14:18 2006
New Revision: 425831

URL: http://svn.apache.org/viewvc?rev=425831&view=rev
Log:
Created AbstractSMTPSession to be used as a stub for HandlerTests (remove code duplication)

Added:
    james/server/trunk/src/test/org/apache/james/smtpserver/AbstractSMTPSession.java   (with props)
Modified:
    james/server/trunk/src/test/org/apache/james/smtpserver/DNSRBLHandlerTest.java
    james/server/trunk/src/test/org/apache/james/smtpserver/POP3BeforeSMTPHandlerTest.java
    james/server/trunk/src/test/org/apache/james/smtpserver/SPFHandlerTest.java
    james/server/trunk/src/test/org/apache/james/smtpserver/SetMimeHeaderHandlerTest.java
    james/server/trunk/src/test/org/apache/james/smtpserver/SpamAssassinHandlerTest.java

Added: james/server/trunk/src/test/org/apache/james/smtpserver/AbstractSMTPSession.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/smtpserver/AbstractSMTPSession.java?rev=425831&view=auto
==============================================================================
--- james/server/trunk/src/test/org/apache/james/smtpserver/AbstractSMTPSession.java (added)
+++ james/server/trunk/src/test/org/apache/james/smtpserver/AbstractSMTPSession.java Wed Jul 26 13:14:18 2006
@@ -0,0 +1,242 @@
+/***********************************************************************
+ * Copyright (c) 2006-2006 The Apache Software Foundation.             *
+ * All rights reserved.                                                *
+ * ------------------------------------------------------------------- *
+ * Licensed 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;
+
+import org.apache.james.util.watchdog.Watchdog;
+import org.apache.mailet.Mail;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+
+/**
+ * Abstract class to simplify the mocks
+ */
+public class AbstractSMTPSession implements SMTPSession {
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#abortMessage()
+     */
+    public void abortMessage() {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#clearResponseBuffer()
+     */
+    public String clearResponseBuffer() {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#endSession()
+     */
+    public void endSession() {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#getCommandArgument()
+     */
+    public String getCommandArgument() {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#getCommandName()
+     */
+    public String getCommandName() {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#getConfigurationData()
+     */
+    public SMTPHandlerConfigurationData getConfigurationData() {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#getConnectionState()
+     */
+    public HashMap getConnectionState() {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#getInputStream()
+     */
+    public InputStream getInputStream() {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#getMail()
+     */
+    public Mail getMail() {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#getRcptCount()
+     */
+    public int getRcptCount() {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#getRemoteHost()
+     */
+    public String getRemoteHost() {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#getRemoteIPAddress()
+     */
+    public String getRemoteIPAddress() {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#getResponseBuffer()
+     */
+    public StringBuffer getResponseBuffer() {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#getSessionID()
+     */
+    public String getSessionID() {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#getState()
+     */
+    public HashMap getState() {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#getStopHandlerProcessing()
+     */
+    public boolean getStopHandlerProcessing() {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#getUser()
+     */
+    public String getUser() {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#getWatchdog()
+     */
+    public Watchdog getWatchdog() {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#isAuthRequired()
+     */
+    public boolean isAuthRequired() {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#isRelayingAllowed()
+     */
+    public boolean isRelayingAllowed() {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#isSessionEnded()
+     */
+    public boolean isSessionEnded() {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#readCommandLine()
+     */
+    public String readCommandLine() throws IOException {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#resetConnectionState()
+     */
+    public void resetConnectionState() {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#resetState()
+     */
+    public void resetState() {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#setMail(org.apache.mailet.Mail)
+     */
+    public void setMail(Mail mail) {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#setRelayingAllowed(boolean)
+     */
+    public void setRelayingAllowed(boolean relayingAllowed) {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#setStopHandlerProcessing(boolean)
+     */
+    public void setStopHandlerProcessing(boolean b) {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#setUser(java.lang.String)
+     */
+    public void setUser(String user) {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#useHeloEhloEnforcement()
+     */
+    public boolean useHeloEhloEnforcement() {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+    /**
+     * @see org.apache.james.smtpserver.SMTPSession#writeResponse(java.lang.String)
+     */
+    public void writeResponse(String respString) {
+        throw new UnsupportedOperationException("Unimplemented Stub Method");
+    }
+
+}

Propchange: james/server/trunk/src/test/org/apache/james/smtpserver/AbstractSMTPSession.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/server/trunk/src/test/org/apache/james/smtpserver/DNSRBLHandlerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/smtpserver/DNSRBLHandlerTest.java?rev=425831&r1=425830&r2=425831&view=diff
==============================================================================
--- james/server/trunk/src/test/org/apache/james/smtpserver/DNSRBLHandlerTest.java (original)
+++ james/server/trunk/src/test/org/apache/james/smtpserver/DNSRBLHandlerTest.java Wed Jul 26 13:14:18 2006
@@ -17,8 +17,6 @@
 
 package org.apache.james.smtpserver;
 
-import java.io.IOException;
-import java.io.InputStream;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.ArrayList;
@@ -31,8 +29,6 @@
 import org.apache.james.services.DNSServer;
 import org.apache.james.smtpserver.core.filter.fastfail.DNSRBLHandler;
 import org.apache.james.test.mock.avalon.MockLogger;
-import org.apache.james.util.watchdog.Watchdog;
-import org.apache.mailet.Mail;
 
 import junit.framework.TestCase;
 
@@ -124,94 +120,19 @@
      * Setup mocked smtpsession
      */
     private void setupMockedSMTPSession() {
-        mockedSMTPSession = new SMTPSession() {
+        mockedSMTPSession = new AbstractSMTPSession() {
             HashMap state = new HashMap();
             HashMap connectionState = new HashMap();
             boolean stopHandler = false;
             
-            public void writeResponse(String respString) {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String readCommandLine() throws IOException {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public StringBuffer getResponseBuffer() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String clearResponseBuffer() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public InputStream getInputStream() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String getCommandName() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String getCommandArgument() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public Mail getMail() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public void setMail(Mail mail) {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String getRemoteHost() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
             public String getRemoteIPAddress() {
                 return remoteIp;
             }
 
-            public void abortMessage() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public void endSession() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public boolean isSessionEnded() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
             public HashMap getState() {
                 return state;
             }
 
-            public void resetState() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public SMTPHandlerConfigurationData getConfigurationData() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
             public boolean isRelayingAllowed() {
                 return relaying;
             }
@@ -220,31 +141,6 @@
                 return false;
             }
 
-            public boolean useHeloEhloEnforcement() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String getUser() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public void setUser(String user) {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public Watchdog getWatchdog() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String getSessionID() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
             public int getRcptCount() {
                 return 0;
             }
@@ -263,11 +159,6 @@
 
             public void resetConnectionState() {
                 connectionState.clear();
-            }
-
-            public void setRelayingAllowed(boolean relayingAllowed) {
-                throw new UnsupportedOperationException(
-                "Unimplemented mock service");
             }
 
         };

Modified: james/server/trunk/src/test/org/apache/james/smtpserver/POP3BeforeSMTPHandlerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/smtpserver/POP3BeforeSMTPHandlerTest.java?rev=425831&r1=425830&r2=425831&view=diff
==============================================================================
--- james/server/trunk/src/test/org/apache/james/smtpserver/POP3BeforeSMTPHandlerTest.java (original)
+++ james/server/trunk/src/test/org/apache/james/smtpserver/POP3BeforeSMTPHandlerTest.java Wed Jul 26 13:14:18 2006
@@ -17,16 +17,10 @@
 
 package org.apache.james.smtpserver;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
-
 import org.apache.avalon.framework.container.ContainerUtil;
 import org.apache.james.smtpserver.core.POP3BeforeSMTPHandler;
 import org.apache.james.test.mock.avalon.MockLogger;
 import org.apache.james.util.POP3BeforeSMTPHelper;
-import org.apache.james.util.watchdog.Watchdog;
-import org.apache.mailet.Mail;
 
 import junit.framework.TestCase;
 
@@ -35,154 +29,19 @@
     private SMTPSession mockedSession;
 
     private void setupMockedSMTPSession() {
-        mockedSession = new SMTPSession() {
+        mockedSession = new AbstractSMTPSession() {
             private boolean relayingAllowed = false;
 
-            public void abortMessage() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String clearResponseBuffer() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public void endSession() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String getCommandArgument() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String getCommandName() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public SMTPHandlerConfigurationData getConfigurationData() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public HashMap getConnectionState() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public InputStream getInputStream() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public Mail getMail() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public int getRcptCount() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String getRemoteHost() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
             public String getRemoteIPAddress() {
                 return "192.168.200.1";
             }
 
-            public StringBuffer getResponseBuffer() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String getSessionID() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public HashMap getState() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public boolean getStopHandlerProcessing() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String getUser() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public Watchdog getWatchdog() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public boolean isAuthRequired() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
             public boolean isRelayingAllowed() {
                 return relayingAllowed;
             }
 
-            public boolean isSessionEnded() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String readCommandLine() throws IOException {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public void resetConnectionState() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public void resetState() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public void setMail(Mail mail) {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
             public void setRelayingAllowed(boolean relayingAllowed) {
                 this.relayingAllowed = relayingAllowed;
-            }
-
-            public void setStopHandlerProcessing(boolean b) {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public void setUser(String user) {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public boolean useHeloEhloEnforcement() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public void writeResponse(String respString) {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
             }
 
         };

Modified: james/server/trunk/src/test/org/apache/james/smtpserver/SPFHandlerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/smtpserver/SPFHandlerTest.java?rev=425831&r1=425830&r2=425831&view=diff
==============================================================================
--- james/server/trunk/src/test/org/apache/james/smtpserver/SPFHandlerTest.java (original)
+++ james/server/trunk/src/test/org/apache/james/smtpserver/SPFHandlerTest.java Wed Jul 26 13:14:18 2006
@@ -17,9 +17,6 @@
 
 package org.apache.james.smtpserver;
 
-import java.io.IOException;
-import java.io.InputStream;
-
 import java.util.HashMap;
 
 import java.util.List;
@@ -32,7 +29,6 @@
 import org.apache.james.smtpserver.core.filter.fastfail.SPFHandler;
 import org.apache.james.test.mock.avalon.MockLogger;
 import org.apache.james.test.mock.mailet.MockMail;
-import org.apache.james.util.watchdog.Watchdog;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
 
@@ -147,7 +143,7 @@
      */
     private void setupMockedSMTPSession(final String ip, final String helo,
             final MailAddress sender, final MailAddress recipient) {
-        mockedSMTPSession = new SMTPSession() {
+        mockedSMTPSession = new AbstractSMTPSession() {
             HashMap state = new HashMap();
 
             HashMap connectionState = new HashMap();
@@ -160,68 +156,18 @@
                 // Do nothing
             }
 
-            public String readCommandLine() throws IOException {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public StringBuffer getResponseBuffer() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String clearResponseBuffer() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public InputStream getInputStream() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
             public String getCommandName() {
                 return command;
             }
 
-            public String getCommandArgument() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
             public Mail getMail() {
                 return mail;
             }
 
-            public void setMail(Mail mail) {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String getRemoteHost() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
             public String getRemoteIPAddress() {
                 return ip;
             }
 
-            public void abortMessage() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public void endSession() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public boolean isSessionEnded() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
             public HashMap getState() {
                 state.put(SMTPSession.CURRENT_HELO_NAME, helo);
                 state.put(SMTPSession.SENDER, sender);
@@ -229,16 +175,6 @@
                 return state;
             }
 
-            public void resetState() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public SMTPHandlerConfigurationData getConfigurationData() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
             public boolean isRelayingAllowed() {
                 return relaying;
             }
@@ -247,31 +183,6 @@
                 return false;
             }
 
-            public boolean useHeloEhloEnforcement() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String getUser() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public void setUser(String user) {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public Watchdog getWatchdog() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String getSessionID() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
             public int getRcptCount() {
                 return 0;
             }
@@ -290,11 +201,6 @@
 
             public void resetConnectionState() {
                 connectionState.clear();
-            }
-
-            public void setRelayingAllowed(boolean relayingAllowed) {
-                throw new UnsupportedOperationException(
-                "Unimplemented mock service");
             }
 
         };

Modified: james/server/trunk/src/test/org/apache/james/smtpserver/SetMimeHeaderHandlerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/smtpserver/SetMimeHeaderHandlerTest.java?rev=425831&r1=425830&r2=425831&view=diff
==============================================================================
--- james/server/trunk/src/test/org/apache/james/smtpserver/SetMimeHeaderHandlerTest.java (original)
+++ james/server/trunk/src/test/org/apache/james/smtpserver/SetMimeHeaderHandlerTest.java Wed Jul 26 13:14:18 2006
@@ -22,14 +22,10 @@
 import org.apache.james.smtpserver.core.SetMimeHeaderHandler;
 import org.apache.james.test.mock.avalon.MockLogger;
 import org.apache.james.test.util.Util;
-import org.apache.james.util.watchdog.Watchdog;
 import org.apache.mailet.Mail;
 
 import javax.mail.MessagingException;
 import javax.mail.internet.MimeMessage;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashMap;
 
 public class SetMimeHeaderHandlerTest extends TestCase {
 
@@ -65,156 +61,16 @@
     }
 
     private void setupMockedSMTPSession() {
-        mockedSMTPSession = new SMTPSession() {
-
-            public void writeResponse(String respString) {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String readCommandLine() throws IOException {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public StringBuffer getResponseBuffer() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String clearResponseBuffer() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public InputStream getInputStream() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String getCommandName() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String getCommandArgument() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
+        mockedSMTPSession = new AbstractSMTPSession() {
 
             public Mail getMail() {
                 return mockedMail;
             }
 
-            public void setMail(Mail mail) {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String getRemoteHost() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String getRemoteIPAddress() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public void abortMessage() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public void endSession() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public boolean isSessionEnded() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public HashMap getState() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public void resetState() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public SMTPHandlerConfigurationData getConfigurationData() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public boolean isRelayingAllowed() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public boolean isAuthRequired() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public boolean useHeloEhloEnforcement() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String getUser() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public void setUser(String user) {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public Watchdog getWatchdog() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String getSessionID() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
             public int getRcptCount() {
-                // TODO Auto-generated method stub
                 return 0;
             }
 
-            public void setStopHandlerProcessing(boolean b) {
-                throw new UnsupportedOperationException(
-                "Unimplemented mock service");     
-            }
-
-            public boolean getStopHandlerProcessing() {
-                throw new UnsupportedOperationException(
-                "Unimplemented mock service");
-            }
-
-            public HashMap getConnectionState() {
-                throw new UnsupportedOperationException(
-                "Unimplemented mock service");
-            }
-
-            public void resetConnectionState() {
-                throw new UnsupportedOperationException(
-                "Unimplemented mock service");
-            }
-
-            public void setRelayingAllowed(boolean relayingAllowed) {
-                throw new UnsupportedOperationException(
-                "Unimplemented mock service");
-            }
         };
     }
 

Modified: james/server/trunk/src/test/org/apache/james/smtpserver/SpamAssassinHandlerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/smtpserver/SpamAssassinHandlerTest.java?rev=425831&r1=425830&r2=425831&view=diff
==============================================================================
--- james/server/trunk/src/test/org/apache/james/smtpserver/SpamAssassinHandlerTest.java (original)
+++ james/server/trunk/src/test/org/apache/james/smtpserver/SpamAssassinHandlerTest.java Wed Jul 26 13:14:18 2006
@@ -18,7 +18,6 @@
 package org.apache.james.smtpserver;
 
 import java.io.IOException;
-import java.io.InputStream;
 import java.util.HashMap;
 
 import javax.mail.MessagingException;
@@ -34,7 +33,6 @@
 import org.apache.james.test.mock.util.MockSpamd;
 import org.apache.james.test.util.Util;
 import org.apache.james.util.SpamAssassinInvoker;
-import org.apache.james.util.watchdog.Watchdog;
 import org.apache.mailet.Mail;
 
 public class SpamAssassinHandlerTest extends TestCase {
@@ -50,7 +48,7 @@
     }
 
     private SMTPSession setupMockedSMTPSession(final Mail mail) {
-        mockedSMTPSession = new SMTPSession() {
+        mockedSMTPSession = new AbstractSMTPSession() {
 
             private HashMap state = new HashMap();
 
@@ -63,50 +61,10 @@
             public void abortMessage() {
             }
 
-            public String clearResponseBuffer() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public void endSession() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String getCommandArgument() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String getCommandName() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public SMTPHandlerConfigurationData getConfigurationData() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public HashMap getConnectionState() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public InputStream getInputStream() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
             public Mail getMail() {
                 return mail;
             }
 
-            public int getRcptCount() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
             public String getRemoteHost() {
                 return host;
             }
@@ -115,87 +73,17 @@
                 return ipAddress;
             }
 
-            public StringBuffer getResponseBuffer() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String getSessionID() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
             public HashMap getState() {
                 state.put(SMTPSession.SENDER, "sender@james.apache.org");
                 return state;
             }
 
-            public boolean getStopHandlerProcessing() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String getUser() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public Watchdog getWatchdog() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public boolean isAuthRequired() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
             public boolean isRelayingAllowed() {
                 return relayingAllowed;
             }
 
-            public boolean isSessionEnded() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public String readCommandLine() throws IOException {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public void resetConnectionState() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public void resetState() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public void setMail(Mail mail) {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
             public void setRelayingAllowed(boolean relayingAllowed) {
                 this.relayingAllowed = relayingAllowed;
-            }
-
-            public void setStopHandlerProcessing(boolean b) {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public void setUser(String user) {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
-            }
-
-            public boolean useHeloEhloEnforcement() {
-                throw new UnsupportedOperationException(
-                        "Unimplemented mock service");
             }
 
             public void writeResponse(String respString) {



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