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 no...@apache.org on 2009/10/24 18:30:50 UTC

svn commit: r829401 - in /james/server/trunk: smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/ smtpserver-function/src/test/java/org/apache/james/smtpserver/

Author: norman
Date: Sat Oct 24 16:30:50 2009
New Revision: 829401

URL: http://svn.apache.org/viewvc?rev=829401&view=rev
Log:
Move one more test to smtp-protocol-library
Remove some not needed depedencies

Added:
    james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/MaxRcptHandlerTest.java
      - copied, changed from r829399, james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/MaxRcptHandlerTest.java
Removed:
    james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/MaxRcptHandlerTest.java
Modified:
    james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java

Copied: james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/MaxRcptHandlerTest.java (from r829399, james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/MaxRcptHandlerTest.java)
URL: http://svn.apache.org/viewvc/james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/MaxRcptHandlerTest.java?p2=james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/MaxRcptHandlerTest.java&p1=james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/MaxRcptHandlerTest.java&r1=829399&r2=829401&rev=829401&view=diff
==============================================================================
--- james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/MaxRcptHandlerTest.java (original)
+++ james/server/trunk/smtp-protocol-library/src/test/java/org/apache/james/smtpserver/protocol/core/fastfail/MaxRcptHandlerTest.java Sat Oct 24 16:30:50 2009
@@ -20,7 +20,7 @@
 
 
 
-package org.apache.james.smtpserver;
+package org.apache.james.smtpserver.protocol.core.fastfail;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -29,13 +29,10 @@
 
 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;
-import org.apache.james.smtpserver.protocol.hook.RcptHook;
-import org.apache.james.test.mock.avalon.MockLogger;
 import org.apache.mailet.MailAddress;
 
 
@@ -44,9 +41,9 @@
     
     private SMTPSession setupMockedSession(final int rcptCount) {
         SMTPSession session = new BaseFakeSMTPSession() {
-            HashMap state = new HashMap();
+            HashMap<String,Object> state = new HashMap<String,Object>();
 
-            public Map getState() {
+            public Map<String,Object> getState() {
                 return state;
             }
             
@@ -65,10 +62,7 @@
     public void testRejectMaxRcpt() throws ParseException {
         SMTPSession session = setupMockedSession(3);
         MaxRcptHandler handler = new MaxRcptHandler();
-    
-        ContainerUtil.enableLogging(handler,new MockLogger());
-    
-        //handler.setAction("reject");
+        
         handler.setMaxRcpt(2);
         int resp = handler.doRcpt(session,null,new MailAddress("test@test")).getResult();
     
@@ -78,10 +72,7 @@
     
     public void testNotRejectMaxRcpt() throws ParseException {
         SMTPSession session = setupMockedSession(3);
-        MaxRcptHandler handler = new MaxRcptHandler();
-    
-        ContainerUtil.enableLogging(handler,new MockLogger());
-    
+        MaxRcptHandler handler = new MaxRcptHandler();    
 
         handler.setMaxRcpt(4);
         int resp = handler.doRcpt(session,null,new MailAddress("test@test")).getResult();

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=829401&r1=829400&r2=829401&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:30:50 2009
@@ -29,7 +29,6 @@
 
 import junit.framework.TestCase;
 
-import org.apache.avalon.framework.container.ContainerUtil;
 import org.apache.james.api.user.UsersRepository;
 import org.apache.james.api.vut.ErrorMappingException;
 import org.apache.james.api.vut.VirtualUserTable;
@@ -39,7 +38,6 @@
 import org.apache.james.smtpserver.protocol.SMTPConfiguration;
 import org.apache.james.smtpserver.protocol.SMTPSession;
 import org.apache.james.smtpserver.protocol.hook.HookReturnCode;
-import org.apache.james.test.mock.avalon.MockLogger;
 import org.apache.james.test.mock.james.MockVirtualUserTableStore;
 import org.apache.james.userrepository.MockUsersRepository;
 import org.apache.mailet.MailAddress;
@@ -66,13 +64,13 @@
 
     private SMTPSession setupMockedSMTPSession(final SMTPConfiguration conf, final MailAddress rcpt, final boolean relayingAllowed) {
         SMTPSession session = new BaseFakeSMTPSession() {
-            HashMap state = new HashMap();
+            HashMap<String,Object> state = new HashMap<String,Object>();
 
             public boolean isRelayingAllowed() {
                 return relayingAllowed;
             }
         
-            public Map getState() {
+            public Map<String,Object> getState() {
                 return state;
             }
         };
@@ -146,7 +144,6 @@
     public void testRejectInvalidUser() throws Exception {
         MailAddress mailAddress = new MailAddress(INVALID_USER + "@localhost");
         SMTPSession session = setupMockedSMTPSession(setupMockedSMTPConfiguration(),mailAddress,false);
-        ContainerUtil.enableLogging(handler,new MockLogger());
     
         int rCode = handler.doRcpt(session, null, mailAddress).getResult();
     
@@ -156,7 +153,6 @@
     public void testNotRejectInvalidUserRelay() throws Exception {
         MailAddress mailAddress = new MailAddress(INVALID_USER + "@localhost");
         SMTPSession session = setupMockedSMTPSession(setupMockedSMTPConfiguration(),mailAddress,true);
-        ContainerUtil.enableLogging(handler,new MockLogger());
 
         int rCode = handler.doRcpt(session, null, mailAddress).getResult();
         
@@ -166,7 +162,6 @@
     public void testNotRejectValidUser() throws Exception {
         MailAddress mailAddress = new MailAddress(VALID_USER + "@localhost");
         SMTPSession session = setupMockedSMTPSession(setupMockedSMTPConfiguration(),mailAddress,false);
-        ContainerUtil.enableLogging(handler,new MockLogger());
     
         int rCode = handler.doRcpt(session, null, mailAddress).getResult();
         
@@ -179,7 +174,6 @@
         list.add(recipient);
         MailAddress mailAddress = new MailAddress(recipient);
         SMTPSession session = setupMockedSMTPSession(setupMockedSMTPConfiguration(),mailAddress,false);
-        ContainerUtil.enableLogging(handler,new MockLogger());
     
         handler.setValidRecipients(list);
 
@@ -195,7 +189,6 @@
         list.add(domain);
         MailAddress mailAddress = new MailAddress(recipient);
         SMTPSession session = setupMockedSMTPSession(setupMockedSMTPConfiguration(),mailAddress,false);
-        ContainerUtil.enableLogging(handler,new MockLogger());
     
         handler.setValidDomains(list);
 
@@ -211,7 +204,6 @@
         list.add("reci.*");
         MailAddress mailAddress = new MailAddress(recipient);
         SMTPSession session = setupMockedSMTPSession(setupMockedSMTPConfiguration(),mailAddress,false);
-        ContainerUtil.enableLogging(handler,new MockLogger());
     
         handler.setValidRegex(list);
 



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