Author: rdonkin
Date: Mon May 28 11:47:08 2007
New Revision: 542292

URL: http://svn.apache.org/viewvc?view=rev&rev=542292
Log:
Inject UserRepository dependency to break coupling between UserRepository and 
ImapSession.

Added:
    
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/StandardFactory.java
Modified:
    
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapHandler.java
    
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapRequestHandler.java
    
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSession.java
    
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSessionImpl.java
    
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/Imap4Rev1ProcessorFactory.java
    
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/LoginProcessor.java
    
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/main/DefaultImapProcessorFactory.java
    
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/handler/commands/AbstractCommandTest.java
    
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/handler/commands/LoginTest.java
    
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/handler/session/AbstractSessionTest.java

Modified: 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapHandler.java
URL: 
http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapHandler.java?view=diff&rev=542292&r1=542291&r2=542292
==============================================================================
--- 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapHandler.java
 (original)
+++ 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapHandler.java
 Mon May 28 11:47:08 2007
@@ -30,6 +30,8 @@
 import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.core.AbstractJamesHandler;
 import 
org.apache.james.experimental.imapserver.encode.OutputStreamImapResponseWriter;
+import 
org.apache.james.experimental.imapserver.processor.main.DefaultImapProcessorFactory;
+import org.apache.james.services.UsersRepository;
 
 /**
  * The handler class for IMAP connections.
@@ -41,8 +43,9 @@
         implements ImapHandlerInterface, ConnectionHandler, Poolable, 
ImapConstants
 {
 
+    // TODO: inject dependency
     private String softwaretype = "JAMES "+VERSION+" Server " + 
Constants.SOFTWARE_VERSION;
-    private final ImapRequestHandler requestHandler = new ImapRequestHandler();
+    private ImapRequestHandler requestHandler;
     private ImapSession session;
 
     /**
@@ -66,6 +69,9 @@
     {
         if (theData instanceof ImapHandlerConfigurationData) {
             theConfigData = (ImapHandlerConfigurationData) theData;
+            final UsersRepository usersRepository = 
theConfigData.getUsersRepository();
+//          TODO: inject dependency
+            requestHandler = new 
ImapRequestHandler(StandardFactory.createDecoder(), 
DefaultImapProcessorFactory.createDefaultProcessor(usersRepository));
         } else {
             throw new IllegalArgumentException("Configuration object does not 
implement POP3HandlerConfigurationData");
         }
@@ -140,7 +146,6 @@
 
             sessionEnded = false;
             session = new ImapSessionImpl( 
theConfigData.getMailboxManagerProvider(),
-                                           theConfigData.getUsersRepository(),
                                            this,
                                            
socket.getInetAddress().getHostName(),
                                            
socket.getInetAddress().getHostAddress());

Modified: 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapRequestHandler.java
URL: 
http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapRequestHandler.java?view=diff&rev=542292&r1=542291&r2=542292
==============================================================================
--- 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapRequestHandler.java
 (original)
+++ 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapRequestHandler.java
 Mon May 28 11:47:08 2007
@@ -26,37 +26,24 @@
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.james.api.imap.ImapMessage;
 import org.apache.james.api.imap.ProtocolException;
-import org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory;
-import org.apache.james.api.imap.imap4rev1.Imap4Rev1MessageFactory;
 import 
org.apache.james.experimental.imapserver.encode.OutputStreamImapResponseWriter;
-import 
org.apache.james.experimental.imapserver.message.request.imap4rev1.BaseImap4Rev1MessageFactory;
 import 
org.apache.james.experimental.imapserver.message.response.ImapResponseMessage;
 import org.apache.james.experimental.imapserver.processor.ImapProcessor;
-import 
org.apache.james.experimental.imapserver.processor.main.DefaultImapProcessorFactory;
-import org.apache.james.imap.command.imap4rev1.StandardImap4Rev1CommandFactory;
-import org.apache.james.imapserver.codec.decode.ImapCommandParserFactory;
 import org.apache.james.imapserver.codec.decode.ImapDecoder;
 import org.apache.james.imapserver.codec.decode.ImapRequestLineReader;
-import 
org.apache.james.imapserver.codec.decode.imap4rev1.Imap4Rev1CommandParserFactory;
-import org.apache.james.imapserver.codec.decode.main.DefaultImapDecoder;
 
 /**
  * @version $Revision: 109034 $
  */
 public final class ImapRequestHandler extends AbstractLogEnabled {
 
-    // TODO: inject dependency
-    private static final ImapDecoder createDecoder() {
-        final Imap4Rev1MessageFactory messageFactory = new 
BaseImap4Rev1MessageFactory();
-        final Imap4Rev1CommandFactory commandFactory = new 
StandardImap4Rev1CommandFactory();
-        final ImapCommandParserFactory imapCommands = new 
Imap4Rev1CommandParserFactory(messageFactory, commandFactory);
-        final ImapDecoder result = new DefaultImapDecoder(messageFactory, 
imapCommands);
-        return result;
-    }
+    private final ImapDecoder decoder;
+    private final ImapProcessor processor;
     
-    // TODO: inject depedency
-    private final ImapDecoder decoder = createDecoder();
-    private final ImapProcessor processor = 
DefaultImapProcessorFactory.createDefaultProcessor();
+    public ImapRequestHandler(final ImapDecoder decoder, final ImapProcessor 
processor) {
+        this.decoder = decoder;
+        this.processor = processor;
+    }
     
     /**
      * @see 
org.apache.avalon.framework.logger.AbstractLogEnabled#enableLogging(org.apache.avalon.framework.logger.Logger)

Modified: 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSession.java
URL: 
http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSession.java?view=diff&rev=542292&r1=542291&r2=542292
==============================================================================
--- 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSession.java
 (original)
+++ 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSession.java
 Mon May 28 11:47:08 2007
@@ -25,7 +25,6 @@
 import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
 import org.apache.james.mailboxmanager.manager.MailboxManager;
 import org.apache.james.services.User;
-import org.apache.james.services.UsersRepository;
 
 
 /**
@@ -51,15 +50,6 @@
     void closeConnection();
 
     void closeConnection(String byeMessage);
-
-
-    /**
-     * Provides the UsersRepository for this session, to allow session
-     * to validate logins.
-     *
-     * @return The UsersRepository for this session.
-     */
-    UsersRepository getUsers();
 
     /**
      * @return The hostname of the connected client.

Modified: 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSessionImpl.java
URL: 
http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSessionImpl.java?view=diff&rev=542292&r1=542291&r2=542292
==============================================================================
--- 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSessionImpl.java
 (original)
+++ 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/ImapSessionImpl.java
 Mon May 28 11:47:08 2007
@@ -25,15 +25,14 @@
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.james.api.imap.ImapConstants;
 import org.apache.james.api.imap.ImapSessionState;
-import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.api.imap.message.MessageFlags;
+import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.MailboxManagerException;
 import org.apache.james.mailboxmanager.MessageResult;
 import org.apache.james.mailboxmanager.mailbox.ImapMailboxSession;
 import org.apache.james.mailboxmanager.manager.MailboxManager;
 import org.apache.james.mailboxmanager.manager.MailboxManagerProvider;
 import org.apache.james.services.User;
-import org.apache.james.services.UsersRepository;
 
 /**
  * @version $Revision: 109034 $
@@ -44,37 +43,27 @@
     private User user = null;
     private SelectedMailboxSession selectedMailbox = null;
 
-    private String clientHostName;
-    private String clientAddress;
+    private final String clientHostName;
+    private final String clientAddress;
 
     // TODO these shouldn't be in here - they can be provided directly to 
command components.
     private ImapHandlerInterface handler;
     private MailboxManagerProvider mailboxManagerProvider;
-    private UsersRepository users;
     
     private MailboxManager mailboxManager = null;
     private User mailboxManagerUser = null;
     
     public ImapSessionImpl( MailboxManagerProvider mailboxManagerProvider,
-                            UsersRepository users,
                             ImapHandlerInterface handler,
                             String clientHostName,
                             String clientAddress )
     {
         this.mailboxManagerProvider = mailboxManagerProvider;
-        this.users = users;
         this.handler = handler;
         this.clientHostName = clientHostName;
         this.clientAddress = clientAddress;
     }
 
-
-
-    private MailboxManagerProvider getMailboxManagerProvider()
-    {
-        return mailboxManagerProvider;
-    }
-
     public void unsolicitedResponses( ImapResponse request, boolean useUid ) 
throws MailboxException {
         unsolicitedResponses(request, false, useUid);
     }
@@ -132,11 +121,6 @@
     {
         closeMailbox();
         handler.resetHandler();
-    }
-
-    public UsersRepository getUsers()
-    {
-        return users;
     }
 
     public String getClientHostname()

Added: 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/StandardFactory.java
URL: 
http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/StandardFactory.java?view=auto&rev=542292
==============================================================================
--- 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/StandardFactory.java
 (added)
+++ 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/StandardFactory.java
 Mon May 28 11:47:08 2007
@@ -0,0 +1,45 @@
+/****************************************************************
+ * 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.experimental.imapserver;
+
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1CommandFactory;
+import org.apache.james.api.imap.imap4rev1.Imap4Rev1MessageFactory;
+import 
org.apache.james.experimental.imapserver.message.request.imap4rev1.BaseImap4Rev1MessageFactory;
+import org.apache.james.imap.command.imap4rev1.StandardImap4Rev1CommandFactory;
+import org.apache.james.imapserver.codec.decode.ImapCommandParserFactory;
+import org.apache.james.imapserver.codec.decode.ImapDecoder;
+import 
org.apache.james.imapserver.codec.decode.imap4rev1.Imap4Rev1CommandParserFactory;
+import org.apache.james.imapserver.codec.decode.main.DefaultImapDecoder;
+
+/**
+ * TODO: this is temporary: should let the container do the coupling.
+ */
+public class StandardFactory {
+    
+    public static final ImapDecoder createDecoder() {
+        final Imap4Rev1MessageFactory messageFactory = new 
BaseImap4Rev1MessageFactory();
+        final Imap4Rev1CommandFactory commandFactory = new 
StandardImap4Rev1CommandFactory();
+        final ImapCommandParserFactory imapCommands = new 
Imap4Rev1CommandParserFactory(
+                messageFactory, commandFactory);
+        final ImapDecoder result = new DefaultImapDecoder(messageFactory,
+                imapCommands);
+        return result;
+    }
+}

Modified: 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/Imap4Rev1ProcessorFactory.java
URL: 
http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/Imap4Rev1ProcessorFactory.java?view=diff&rev=542292&r1=542291&r2=542292
==============================================================================
--- 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/Imap4Rev1ProcessorFactory.java
 (original)
+++ 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/Imap4Rev1ProcessorFactory.java
 Mon May 28 11:47:08 2007
@@ -1,17 +1,18 @@
 package org.apache.james.experimental.imapserver.processor.imap4rev1;
 
 import org.apache.james.experimental.imapserver.processor.ImapProcessor;
+import org.apache.james.services.UsersRepository;
 
 /**
  * TODO: perhaps this should be a POJO
  */
 public class Imap4Rev1ProcessorFactory {
 
-    public static final ImapProcessor createDefaultChain(final ImapProcessor 
chainEndProcessor) {
+    public static final ImapProcessor createDefaultChain(final ImapProcessor 
chainEndProcessor, final UsersRepository users) {
         final LogoutProcessor logoutProcessor = new 
LogoutProcessor(chainEndProcessor);
         final CapabilityProcessor capabilityProcessor = new 
CapabilityProcessor(logoutProcessor);
         final CheckProcessor checkProcessor = new 
CheckProcessor(capabilityProcessor);
-        final LoginProcessor loginProcessor = new 
LoginProcessor(checkProcessor);
+        final LoginProcessor loginProcessor = new 
LoginProcessor(checkProcessor, users);
         final RenameProcessor renameProcessor = new 
RenameProcessor(loginProcessor);
         final DeleteProcessor deleteProcessor = new 
DeleteProcessor(renameProcessor);
         final CreateProcessor createProcessor = new 
CreateProcessor(deleteProcessor);

Modified: 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/LoginProcessor.java
URL: 
http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/LoginProcessor.java?view=diff&rev=542292&r1=542291&r2=542292
==============================================================================
--- 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/LoginProcessor.java
 (original)
+++ 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/imap4rev1/LoginProcessor.java
 Mon May 28 11:47:08 2007
@@ -33,12 +33,16 @@
 import 
org.apache.james.experimental.imapserver.processor.base.AbstractImapRequestProcessor;
 import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.services.User;
+import org.apache.james.services.UsersRepository;
 
 
 public class LoginProcessor extends AbstractImapRequestProcessor {
        
-       public LoginProcessor(final ImapProcessor next) {
+    private final UsersRepository users;
+    
+       public LoginProcessor(final ImapProcessor next, final UsersRepository 
users) {
         super(next);
+        this.users = users;
     }
 
     protected boolean isAcceptable(ImapMessage message) {
@@ -60,9 +64,9 @@
        
        private ImapResponseMessage doProcess(final String userid, final String 
password, 
                        ImapSession session, String tag, ImapCommand command) 
throws MailboxException, AuthorizationException, ProtocolException {
-        ImapResponseMessage result;
-        if ( session.getUsers().test( userid, password ) ) {
-            User user = session.getUsers().getUserByName( userid );
+        final ImapResponseMessage result;
+        if ( users.test( userid, password ) ) {
+            User user = users.getUserByName( userid );
             session.setAuthenticated( user );
             result = 
CommandCompleteResponse.createWithNoUnsolictedResponses(command, tag);
         }

Modified: 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/main/DefaultImapProcessorFactory.java
URL: 
http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/main/DefaultImapProcessorFactory.java?view=diff&rev=542292&r1=542291&r2=542292
==============================================================================
--- 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/main/DefaultImapProcessorFactory.java
 (original)
+++ 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/main/java/org/apache/james/experimental/imapserver/processor/main/DefaultImapProcessorFactory.java
 Mon May 28 11:47:08 2007
@@ -23,6 +23,7 @@
 import 
org.apache.james.experimental.imapserver.processor.base.ImapResponseMessageProcessor;
 import 
org.apache.james.experimental.imapserver.processor.base.UnknownRequestImapProcessor;
 import 
org.apache.james.experimental.imapserver.processor.imap4rev1.Imap4Rev1ProcessorFactory;
+import org.apache.james.services.UsersRepository;
 
 
 /**
@@ -30,9 +31,9 @@
  */
 public class DefaultImapProcessorFactory {
 
-    public static final ImapProcessor createDefaultProcessor() {
+    public static final ImapProcessor createDefaultProcessor(final 
UsersRepository usersRepository) {
         final UnknownRequestImapProcessor unknownRequestImapProcessor = new 
UnknownRequestImapProcessor();
-        final ImapProcessor imap4rev1Chain = 
Imap4Rev1ProcessorFactory.createDefaultChain(unknownRequestImapProcessor);
+        final ImapProcessor imap4rev1Chain = 
Imap4Rev1ProcessorFactory.createDefaultChain(unknownRequestImapProcessor, 
usersRepository);
         final ImapProcessor result = new 
ImapResponseMessageProcessor(imap4rev1Chain);
         return result;
     }

Modified: 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/handler/commands/AbstractCommandTest.java
URL: 
http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/handler/commands/AbstractCommandTest.java?view=diff&rev=542292&r1=542291&r2=542292
==============================================================================
--- 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/handler/commands/AbstractCommandTest.java
 (original)
+++ 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/handler/commands/AbstractCommandTest.java
 Mon May 28 11:47:08 2007
@@ -26,6 +26,8 @@
 import org.apache.james.api.imap.ProtocolException;
 import org.apache.james.experimental.imapserver.ImapRequestHandler;
 import org.apache.james.experimental.imapserver.ImapSession;
+import org.apache.james.experimental.imapserver.StandardFactory;
+import 
org.apache.james.experimental.imapserver.processor.main.DefaultImapProcessorFactory;
 import org.apache.james.mailboxmanager.manager.MailboxManager;
 import org.apache.james.services.User;
 import org.apache.james.services.UsersRepository;
@@ -35,7 +37,7 @@
 
 public abstract class AbstractCommandTest extends MockObjectTestCase
 {
-
+  
     ImapRequestHandler handler;
     Mock mockSession;
     Mock mockUsersRepository;
@@ -43,10 +45,10 @@
     Mock mockMailboxManager;
 
     public void setUp() {
-        handler=new ImapRequestHandler();
+        mockUsersRepository = mock ( UsersRepository.class );
+        handler=new ImapRequestHandler(StandardFactory.createDecoder(),  
DefaultImapProcessorFactory.createDefaultProcessor((UsersRepository)mockUsersRepository.proxy()));
         handler.enableLogging(new MockLogger());
         mockSession = mock ( ImapSession.class);
-        mockUsersRepository = mock ( UsersRepository.class );
         mockUser = mock (User.class );
         mockMailboxManager = mock (MailboxManager.class);
     }

Modified: 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/handler/commands/LoginTest.java
URL: 
http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/handler/commands/LoginTest.java?view=diff&rev=542292&r1=542291&r2=542292
==============================================================================
--- 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/handler/commands/LoginTest.java
 (original)
+++ 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/handler/commands/LoginTest.java
 Mon May 28 11:47:08 2007
@@ -10,7 +10,6 @@
 
     public void testValidUserStateNonAuth() throws ProtocolException {
         
mockSession.expects(atLeastOnce()).method("getState").will(returnValue(ImapSessionState.NON_AUTHENTICATED));
-        
mockSession.expects(atLeastOnce()).method("getUsers").will(returnValue(mockUsersRepository.proxy()));
         
         mockUsersRepository.expects(once()).method("test").with( 
eq("joachim2"),eq("abc")).will(returnValue(true));
         mockUsersRepository.expects(once()).method("getUserByName").with( 
eq("joachim2")).will(returnValue(mockUser.proxy()));
@@ -23,7 +22,6 @@
     }
     public void testInvalidUserStateNonAuth() throws ProtocolException {
         
mockSession.expects(atLeastOnce()).method("getState").will(returnValue(ImapSessionState.NON_AUTHENTICATED));
-        
mockSession.expects(atLeastOnce()).method("getUsers").will(returnValue(mockUsersRepository.proxy()));
         
         mockUsersRepository.expects(once()).method("test").with( 
eq("joachim2"),eq("abc")).will(returnValue(false));
 

Modified: 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/handler/session/AbstractSessionTest.java
URL: 
http://svn.apache.org/viewvc/james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/handler/session/AbstractSessionTest.java?view=diff&rev=542292&r1=542291&r2=542292
==============================================================================
--- 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/handler/session/AbstractSessionTest.java
 (original)
+++ 
james/server/sandbox/seda-imap-modular/experimental-seda-imap-function/src/test/java/org/apache/james/experimental/imapserver/handler/session/AbstractSessionTest.java
 Mon May 28 11:47:08 2007
@@ -43,11 +43,13 @@
 import org.apache.james.experimental.imapserver.ImapRequestHandler;
 import org.apache.james.experimental.imapserver.ImapSession;
 import org.apache.james.experimental.imapserver.ImapSessionImpl;
+import org.apache.james.experimental.imapserver.StandardFactory;
 import org.apache.james.experimental.imapserver.TestConstants;
 import org.apache.james.experimental.imapserver.client.Command;
 import org.apache.james.experimental.imapserver.mock.MockImapHandler;
 import 
org.apache.james.experimental.imapserver.mock.MockImapHandlerConfigurationData;
 import org.apache.james.experimental.imapserver.mock.MockUser;
+import 
org.apache.james.experimental.imapserver.processor.main.DefaultImapProcessorFactory;
 import org.apache.james.imapserver.store.MailboxException;
 import org.apache.james.mailboxmanager.GeneralMessageSet;
 import org.apache.james.mailboxmanager.ListResult;
@@ -78,10 +80,10 @@
         MockImapHandlerConfigurationData theConfigData = new 
MockImapHandlerConfigurationData();
         theConfigData.getMailboxManagerProvider().deleteEverything();
         session = new 
ImapSessionImpl(theConfigData.getMailboxManagerProvider(),
-                theConfigData.getUsersRepository(), new MockImapHandler(),
+                new MockImapHandler(),
                 HOST_NAME, HOST_ADDRESS);
         ((LogEnabled)session).enableLogging(new MockLogger());
-        handler = new ImapRequestHandler();
+        handler = new ImapRequestHandler(StandardFactory.createDecoder(),  
DefaultImapProcessorFactory.createDefaultProcessor(theConfigData.getUsersRepository()));
         handler.enableLogging(new MockLogger());
         
mailboxManager=theConfigData.getMailboxManagerProvider().getMailboxManagerInstance(new
 MockUser());
 



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

Reply via email to