james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From darr...@apache.org
Subject cvs commit: james-server/proposals/imap2/test/org/apache/james/test AbstractProtocolTest.java ProtocolSession.java
Date Mon, 29 Dec 2003 06:54:48 GMT
darrell     2003/12/28 22:54:48

  Modified:    proposals/imap2/java/org/apache/james/imapserver/commands
                        CommandParser.java CommandTemplate.java
                        CreateCommand.java DeleteCommand.java
                        ListCommand.java LogoutCommand.java
                        RenameCommand.java SearchCommand.java
                        SelectCommand.java StoreCommand.java
               proposals/imap2/java/org/apache/james/imapserver/store
                        ImapMailbox.java ImapMessage.java
                        InMemoryStore.java MailboxListener.java
                        SimpleImapMessage.java SimpleMessageAttributes.java
               proposals/imap2/java/org/apache/james/imapserver
                        ImapHandler.java ImapHost.java
                        ImapRequestHandler.java ImapResponse.java
                        ImapSession.java ImapSessionImpl.java
                        ImapSessionMailbox.java JamesImapHost.java
               proposals/imap2/java/org/apache/james JamesImap.java
               proposals/imap2/test/org/apache/james/imapserver/concurrent
                        Concurrent.todo.txt ExistsResponse.test
               proposals/imap2/test/org/apache/james/imapserver
                        CommandParserTest.java ImapHostTest.java
                        ImapStoreTest.java ImapTest.java
                        TestCommandsInAuthenticatedState.java
                        TestCommandsInNonAuthenticatedState.java
                        TestConcurrentSessions.java
               proposals/imap2/test/org/apache/james/remotemanager
                        TestRemoteManager.java
               proposals/imap2/test/org/apache/james/smtpserver
                        TestSMTP.java
               proposals/imap2/test/org/apache/james/test
                        AbstractProtocolTest.java ProtocolSession.java
  Added:       proposals/imap2/test/org/apache/james/imapserver/concurrent
                        DeleteSelected.test RenameSelected.test
  Log:
  Imap2 proposal mods:
  - Handle deletion/rename of concurrently accessed mailboxes
  
  Revision  Changes    Path
  1.11      +7 -8      james-server/proposals/imap2/java/org/apache/james/imapserver/commands/CommandParser.java
  
  Index: CommandParser.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/imapserver/commands/CommandParser.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- CommandParser.java	23 Oct 2003 01:55:12 -0000	1.10
  +++ CommandParser.java	29 Dec 2003 06:54:47 -0000	1.11
  @@ -58,18 +58,17 @@
   
   package org.apache.james.imapserver.commands;
   
  +import org.apache.james.imapserver.ImapConstants;
  +import org.apache.james.imapserver.ImapRequestLineReader;
  +import org.apache.james.imapserver.ProtocolException;
  +import org.apache.james.imapserver.store.MessageFlags;
  +
  +import javax.mail.Flags;
   import java.text.DateFormat;
   import java.text.ParseException;
   import java.text.SimpleDateFormat;
   import java.util.ArrayList;
   import java.util.Date;
  -
  -import javax.mail.Flags;
  -
  -import org.apache.james.imapserver.ImapConstants;
  -import org.apache.james.imapserver.ImapRequestLineReader;
  -import org.apache.james.imapserver.ProtocolException;
  -import org.apache.james.imapserver.store.MessageFlags;
   
   /**
    *
  
  
  
  1.7       +3 -3      james-server/proposals/imap2/java/org/apache/james/imapserver/commands/CommandTemplate.java
  
  Index: CommandTemplate.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/imapserver/commands/CommandTemplate.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- CommandTemplate.java	8 Mar 2003 21:13:55 -0000	1.6
  +++ CommandTemplate.java	29 Dec 2003 06:54:47 -0000	1.7
  @@ -61,13 +61,13 @@
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.james.imapserver.AuthorizationException;
   import org.apache.james.imapserver.ImapConstants;
  -import org.apache.james.imapserver.store.ImapMailbox;
   import org.apache.james.imapserver.ImapRequestLineReader;
   import org.apache.james.imapserver.ImapResponse;
   import org.apache.james.imapserver.ImapSession;
   import org.apache.james.imapserver.ImapSessionState;
  -import org.apache.james.imapserver.store.MailboxException;
   import org.apache.james.imapserver.ProtocolException;
  +import org.apache.james.imapserver.store.ImapMailbox;
  +import org.apache.james.imapserver.store.MailboxException;
   
   /**
    * Base class for all command implementations. This class provides common
  
  
  
  1.6       +2 -2      james-server/proposals/imap2/java/org/apache/james/imapserver/commands/CreateCommand.java
  
  Index: CreateCommand.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/imapserver/commands/CreateCommand.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CreateCommand.java	8 Mar 2003 21:13:55 -0000	1.5
  +++ CreateCommand.java	29 Dec 2003 06:54:47 -0000	1.6
  @@ -62,8 +62,8 @@
   import org.apache.james.imapserver.ImapRequestLineReader;
   import org.apache.james.imapserver.ImapResponse;
   import org.apache.james.imapserver.ImapSession;
  -import org.apache.james.imapserver.store.MailboxException;
   import org.apache.james.imapserver.ProtocolException;
  +import org.apache.james.imapserver.store.MailboxException;
   
   /**
    * Handles processeing for the CREATE imap command.
  
  
  
  1.6       +9 -3      james-server/proposals/imap2/java/org/apache/james/imapserver/commands/DeleteCommand.java
  
  Index: DeleteCommand.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/imapserver/commands/DeleteCommand.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DeleteCommand.java	8 Mar 2003 21:13:55 -0000	1.5
  +++ DeleteCommand.java	29 Dec 2003 06:54:47 -0000	1.6
  @@ -62,8 +62,9 @@
   import org.apache.james.imapserver.ImapRequestLineReader;
   import org.apache.james.imapserver.ImapResponse;
   import org.apache.james.imapserver.ImapSession;
  -import org.apache.james.imapserver.store.MailboxException;
   import org.apache.james.imapserver.ProtocolException;
  +import org.apache.james.imapserver.store.ImapMailbox;
  +import org.apache.james.imapserver.store.MailboxException;
   
   /**
    * Handles processeing for the DELETE imap command.
  @@ -86,7 +87,12 @@
   
           String mailboxName = parser.mailbox( request );
           parser.endLine( request );
  -
  +        
  +        ImapMailbox mailbox = getMailbox(mailboxName, session, true);
  +        if (session.getSelected() != null &&
  +                mailbox.getFullName().equals(session.getSelected().getFullName())) {
  +            session.deselect();
  +        }
           session.getHost().deleteMailbox( session.getUser(), mailboxName );
   
           session.unsolicitedResponses( response );
  
  
  
  1.6       +3 -3      james-server/proposals/imap2/java/org/apache/james/imapserver/commands/ListCommand.java
  
  Index: ListCommand.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/imapserver/commands/ListCommand.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ListCommand.java	8 Mar 2003 21:13:55 -0000	1.5
  +++ ListCommand.java	29 Dec 2003 06:54:47 -0000	1.6
  @@ -58,12 +58,12 @@
   
   package org.apache.james.imapserver.commands;
   
  -import org.apache.james.imapserver.store.ImapMailbox;
   import org.apache.james.imapserver.ImapRequestLineReader;
   import org.apache.james.imapserver.ImapResponse;
   import org.apache.james.imapserver.ImapSession;
  -import org.apache.james.imapserver.store.MailboxException;
   import org.apache.james.imapserver.ProtocolException;
  +import org.apache.james.imapserver.store.ImapMailbox;
  +import org.apache.james.imapserver.store.MailboxException;
   import org.apache.james.util.Assert;
   
   import java.util.ArrayList;
  
  
  
  1.5       +3 -5      james-server/proposals/imap2/java/org/apache/james/imapserver/commands/LogoutCommand.java
  
  Index: LogoutCommand.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/imapserver/commands/LogoutCommand.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- LogoutCommand.java	8 Mar 2003 21:13:55 -0000	1.4
  +++ LogoutCommand.java	29 Dec 2003 06:54:47 -0000	1.5
  @@ -74,8 +74,7 @@
   {
       public static final String NAME = "LOGOUT";
       public static final String ARGS = null;
  -    public static final String BYE_MESSAGE = BYE + SP + VERSION + SP +
  -            "Server logging out";
  +    public static final String BYE_MESSAGE = VERSION + SP + "Server logging out";
   
       /** @see CommandTemplate#doProcess */
       protected void doProcess( ImapRequestLineReader request,
  @@ -84,9 +83,8 @@
       {
           parser.endLine( request );
   
  -        response.untaggedResponse( BYE_MESSAGE );
  +        response.byeResponse( BYE_MESSAGE );
           response.commandComplete( this );
  -
           session.closeConnection();
       }
   
  
  
  
  1.6       +2 -2      james-server/proposals/imap2/java/org/apache/james/imapserver/commands/RenameCommand.java
  
  Index: RenameCommand.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/imapserver/commands/RenameCommand.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- RenameCommand.java	8 Mar 2003 21:13:55 -0000	1.5
  +++ RenameCommand.java	29 Dec 2003 06:54:47 -0000	1.6
  @@ -62,8 +62,8 @@
   import org.apache.james.imapserver.ImapRequestLineReader;
   import org.apache.james.imapserver.ImapResponse;
   import org.apache.james.imapserver.ImapSession;
  -import org.apache.james.imapserver.store.MailboxException;
   import org.apache.james.imapserver.ProtocolException;
  +import org.apache.james.imapserver.store.MailboxException;
   
   /**
    * Handles processeing for the RENAME imap command.
  
  
  
  1.6       +2 -2      james-server/proposals/imap2/java/org/apache/james/imapserver/commands/SearchCommand.java
  
  Index: SearchCommand.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/imapserver/commands/SearchCommand.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SearchCommand.java	21 Jul 2003 23:31:05 -0000	1.5
  +++ SearchCommand.java	29 Dec 2003 06:54:47 -0000	1.6
  @@ -65,8 +65,8 @@
   import org.apache.james.imapserver.store.ImapMailbox;
   import org.apache.james.imapserver.store.MailboxException;
   
  -import javax.mail.search.SearchTerm;
   import javax.mail.Message;
  +import javax.mail.search.SearchTerm;
   
   /**
    * Handles processeing for the SEARCH imap command.
  
  
  
  1.10      +4 -4      james-server/proposals/imap2/java/org/apache/james/imapserver/commands/SelectCommand.java
  
  Index: SelectCommand.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/imapserver/commands/SelectCommand.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SelectCommand.java	30 Nov 2003 07:03:48 -0000	1.9
  +++ SelectCommand.java	29 Dec 2003 06:54:47 -0000	1.10
  @@ -58,13 +58,13 @@
   
   package org.apache.james.imapserver.commands;
   
  -import org.apache.james.imapserver.store.ImapMailbox;
   import org.apache.james.imapserver.ImapRequestLineReader;
   import org.apache.james.imapserver.ImapResponse;
   import org.apache.james.imapserver.ImapSession;
  -import org.apache.james.imapserver.store.MailboxException;
  -import org.apache.james.imapserver.ProtocolException;
   import org.apache.james.imapserver.ImapSessionMailbox;
  +import org.apache.james.imapserver.ProtocolException;
  +import org.apache.james.imapserver.store.ImapMailbox;
  +import org.apache.james.imapserver.store.MailboxException;
   
   /**
    * Handles processeing for the SELECT imap command.
  
  
  
  1.8       +4 -4      james-server/proposals/imap2/java/org/apache/james/imapserver/commands/StoreCommand.java
  
  Index: StoreCommand.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/imapserver/commands/StoreCommand.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- StoreCommand.java	30 Nov 2003 07:03:48 -0000	1.7
  +++ StoreCommand.java	29 Dec 2003 06:54:47 -0000	1.8
  @@ -58,17 +58,17 @@
   
   package org.apache.james.imapserver.commands;
   
  -import javax.mail.Flags;
  -
   import org.apache.james.imapserver.ImapRequestLineReader;
   import org.apache.james.imapserver.ImapResponse;
   import org.apache.james.imapserver.ImapSession;
   import org.apache.james.imapserver.ImapSessionMailbox;
   import org.apache.james.imapserver.ProtocolException;
   import org.apache.james.imapserver.store.MailboxException;
  +import org.apache.james.imapserver.store.MailboxListener;
   import org.apache.james.imapserver.store.MessageFlags;
   import org.apache.james.imapserver.store.SimpleImapMessage;
  -import org.apache.james.imapserver.store.MailboxListener;
  +
  +import javax.mail.Flags;
   
   /**
    * Handles processeing for the STORE imap command.
  
  
  
  1.13      +5 -4      james-server/proposals/imap2/java/org/apache/james/imapserver/store/ImapMailbox.java
  
  Index: ImapMailbox.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/imapserver/store/ImapMailbox.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ImapMailbox.java	30 Nov 2003 07:03:48 -0000	1.12
  +++ ImapMailbox.java	29 Dec 2003 06:54:47 -0000	1.13
  @@ -58,13 +58,12 @@
   
   package org.apache.james.imapserver.store;
   
  -import java.util.Date;
  +import org.apache.james.core.MailImpl;
   
   import javax.mail.Flags;
   import javax.mail.internet.MimeMessage;
   import javax.mail.search.SearchTerm;
  -
  -import org.apache.james.core.MailImpl;
  +import java.util.Date;
   
   /**
    * Represents a mailbox within an {@link org.apache.james.imapserver.store.ImapStore}.
  @@ -125,5 +124,7 @@
       void replaceFlags(Flags flags, long uid, MailboxListener silentListener, boolean addUid) throws MailboxException;
   
       int getMsn( long uid ) throws MailboxException;
  +
  +    void signalDeletion();
   
   }
  
  
  
  1.7       +2 -2      james-server/proposals/imap2/java/org/apache/james/imapserver/store/ImapMessage.java
  
  Index: ImapMessage.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/imapserver/store/ImapMessage.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ImapMessage.java	13 Jul 2003 12:04:29 -0000	1.6
  +++ ImapMessage.java	29 Dec 2003 06:54:47 -0000	1.7
  @@ -58,8 +58,8 @@
   
   package org.apache.james.imapserver.store;
   
  -import javax.mail.internet.MimeMessage;
   import javax.mail.Flags;
  +import javax.mail.internet.MimeMessage;
   import java.util.Date;
   
   /**
  
  
  
  1.12      +20 -10    james-server/proposals/imap2/java/org/apache/james/imapserver/store/InMemoryStore.java
  
  Index: InMemoryStore.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/imapserver/store/InMemoryStore.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- InMemoryStore.java	30 Nov 2003 07:03:48 -0000	1.11
  +++ InMemoryStore.java	29 Dec 2003 06:54:47 -0000	1.12
  @@ -58,6 +58,14 @@
   
   package org.apache.james.imapserver.store;
   
  +import org.apache.avalon.framework.logger.AbstractLogEnabled;
  +import org.apache.james.core.MailImpl;
  +import org.apache.james.imapserver.ImapConstants;
  +
  +import javax.mail.Flags;
  +import javax.mail.MessagingException;
  +import javax.mail.internet.MimeMessage;
  +import javax.mail.search.SearchTerm;
   import java.util.ArrayList;
   import java.util.Collection;
   import java.util.Collections;
  @@ -67,15 +75,6 @@
   import java.util.List;
   import java.util.StringTokenizer;
   
  -import javax.mail.Flags;
  -import javax.mail.MessagingException;
  -import javax.mail.internet.MimeMessage;
  -import javax.mail.search.SearchTerm;
  -
  -import org.apache.avalon.framework.logger.AbstractLogEnabled;
  -import org.apache.james.core.MailImpl;
  -import org.apache.james.imapserver.ImapConstants;
  -
   /**
    * A simple in-memory implementation of {@link ImapStore}, used for testing
    * and development. Note: this implementation does not persist *anything* to disk.
  @@ -372,6 +371,17 @@
                   }
               }
               throw new MailboxException( "No such message." );
  +        }
  +
  +        public void signalDeletion() {
  +            // Notify all the listeners of the new message
  +            synchronized (_mailboxListeners) {
  +                for (int j = 0; j < _mailboxListeners.size(); j++) {
  +                    MailboxListener listener = (MailboxListener) _mailboxListeners.get(j);
  +                    listener.mailboxDeleted();
  +                }
  +            }
  +
           }
   
           public boolean isSelectable()
  
  
  
  1.4       +2 -1      james-server/proposals/imap2/java/org/apache/james/imapserver/store/MailboxListener.java
  
  Index: MailboxListener.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/imapserver/store/MailboxListener.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MailboxListener.java	30 Nov 2003 07:03:48 -0000	1.3
  +++ MailboxListener.java	29 Dec 2003 06:54:47 -0000	1.4
  @@ -60,10 +60,11 @@
   import javax.mail.Flags;
   
   public interface MailboxListener {
  -    // TODO shouldn't have exceptions here
       void expunged(int msn);
       
       void added(int msn);
   
       void flagsUpdated(int msn, Flags flags, Long uid);
  +    
  +    void mailboxDeleted();
   }
  
  
  
  1.7       +3 -3      james-server/proposals/imap2/java/org/apache/james/imapserver/store/SimpleImapMessage.java
  
  Index: SimpleImapMessage.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/imapserver/store/SimpleImapMessage.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SimpleImapMessage.java	21 Jul 2003 23:31:06 -0000	1.6
  +++ SimpleImapMessage.java	29 Dec 2003 06:54:47 -0000	1.7
  @@ -60,9 +60,9 @@
   
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   
  -import javax.mail.internet.MimeMessage;
  -import javax.mail.MessagingException;
   import javax.mail.Flags;
  +import javax.mail.MessagingException;
  +import javax.mail.internet.MimeMessage;
   import java.util.Date;
   
   /**
  
  
  
  1.5       +1 -1      james-server/proposals/imap2/java/org/apache/james/imapserver/store/SimpleMessageAttributes.java
  
  Index: SimpleMessageAttributes.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/imapserver/store/SimpleMessageAttributes.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SimpleMessageAttributes.java	8 Mar 2003 21:13:57 -0000	1.4
  +++ SimpleMessageAttributes.java	29 Dec 2003 06:54:47 -0000	1.5
  @@ -59,8 +59,8 @@
   package org.apache.james.imapserver.store;
   
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
  -import org.apache.mailet.dates.RFC822DateFormat;
   import org.apache.mailet.MailAddress;
  +import org.apache.mailet.dates.RFC822DateFormat;
   
   import javax.mail.BodyPart;
   import javax.mail.MessagingException;
  
  
  
  1.9       +19 -41    james-server/proposals/imap2/java/org/apache/james/imapserver/ImapHandler.java
  
  Index: ImapHandler.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/imapserver/ImapHandler.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ImapHandler.java	23 Oct 2003 01:55:12 -0000	1.8
  +++ ImapHandler.java	29 Dec 2003 06:54:47 -0000	1.9
  @@ -58,15 +58,6 @@
   
   package org.apache.james.imapserver;
   
  -import java.io.BufferedOutputStream;
  -import java.io.BufferedReader;
  -import java.io.IOException;
  -import java.io.InputStream;
  -import java.io.InputStreamReader;
  -import java.io.OutputStream;
  -import java.io.PrintWriter;
  -import java.net.Socket;
  -
   import org.apache.avalon.cornerstone.services.connection.ConnectionHandler;
   import org.apache.avalon.excalibur.pool.Poolable;
   import org.apache.avalon.framework.activity.Disposable;
  @@ -77,6 +68,15 @@
   import org.apache.james.util.watchdog.WatchdogTarget;
   import org.apache.mailet.MailRepository;
   
  +import java.io.BufferedOutputStream;
  +import java.io.BufferedReader;
  +import java.io.IOException;
  +import java.io.InputStream;
  +import java.io.InputStreamReader;
  +import java.io.OutputStream;
  +import java.io.PrintWriter;
  +import java.net.Socket;
  +
   /**
    * The handler class for IMAP connections.
    * TODO: This is a quick cut-and-paste hack from POP3Handler. This, and the ImapServer
  @@ -176,35 +176,10 @@
           return theWatchdogTarget;
       }
   
  -    /**
  -     * Idle out this connection
  -     */
  -    void idleClose()
  -    {
  -        // TODO: Send BYE message before closing.
  -        if ( getLogger() != null ) {
  -            getLogger().error( "IMAP Connection has idled out." );
  -        }
  -        try {
  -            if ( socket != null ) {
  -                socket.close();
  -            }
  -        }
  -        catch ( Exception e ) {
  -            // ignored
  -        }
  -        finally {
  -            socket = null;
  -        }
  -
  -        synchronized ( this ) {
  -            // Interrupt the thread to recover from internal hangs
  -            if ( handlerThread != null ) {
  -                handlerThread.interrupt();
  -                handlerThread = null;
  -            }
  -        }
  -
  +    public void forceConnectionClose(final String message) {
  +        ImapResponse response = new ImapResponse(outs);
  +        response.byeResponse(message);        
  +        resetHandler();
       }
   
       /**
  @@ -377,7 +352,11 @@
           }
   
           synchronized ( this ) {
  -            handlerThread = null;
  +            // Interrupt the thread to recover from internal hangs
  +            if ( handlerThread != null ) {
  +                handlerThread.interrupt();
  +                handlerThread = null;
  +            }
           }
   
           // Clear user data
  @@ -468,9 +447,8 @@
            */
           public void execute()
           {
  -            ImapHandler.this.idleClose();
  +            forceConnectionClose("IMAP Connection has idled out.");
           }
  -
       }
   
   }
  
  
  
  1.9       +3 -3      james-server/proposals/imap2/java/org/apache/james/imapserver/ImapHost.java
  
  Index: ImapHost.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/imapserver/ImapHost.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ImapHost.java	23 Oct 2003 01:55:12 -0000	1.8
  +++ ImapHost.java	29 Dec 2003 06:54:47 -0000	1.9
  @@ -58,11 +58,11 @@
   
   package org.apache.james.imapserver;
   
  -import java.util.Collection;
  -
   import org.apache.james.imapserver.store.ImapMailbox;
   import org.apache.james.imapserver.store.MailboxException;
   import org.apache.mailet.User;
  +
  +import java.util.Collection;
   
   /**
    * A host machine that has an IMAP4rev1 messaging server. There should be one
  
  
  
  1.5       +2 -2      james-server/proposals/imap2/java/org/apache/james/imapserver/ImapRequestHandler.java
  
  Index: ImapRequestHandler.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/imapserver/ImapRequestHandler.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ImapRequestHandler.java	8 Mar 2003 21:13:54 -0000	1.4
  +++ ImapRequestHandler.java	29 Dec 2003 06:54:47 -0000	1.5
  @@ -58,9 +58,9 @@
   
   package org.apache.james.imapserver;
   
  -import org.apache.james.imapserver.commands.ImapCommandFactory;
   import org.apache.james.imapserver.commands.CommandParser;
   import org.apache.james.imapserver.commands.ImapCommand;
  +import org.apache.james.imapserver.commands.ImapCommandFactory;
   
   import java.io.InputStream;
   import java.io.OutputStream;
  
  
  
  1.7       +5 -1      james-server/proposals/imap2/java/org/apache/james/imapserver/ImapResponse.java
  
  Index: ImapResponse.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/imapserver/ImapResponse.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ImapResponse.java	13 Jul 2003 12:04:29 -0000	1.6
  +++ ImapResponse.java	29 Dec 2003 06:54:47 -0000	1.7
  @@ -63,8 +63,8 @@
   import org.apache.james.util.InternetPrintWriter;
   
   import javax.mail.Flags;
  -import java.io.PrintWriter;
   import java.io.OutputStream;
  +import java.io.PrintWriter;
   
   /**
    * Class providing methods to send response messages from the server
  @@ -268,6 +268,10 @@
           untagged();
           message( message );
           end();
  +    }
  +    
  +    public void byeResponse( String message ) {
  +        untaggedResponse(BYE + SP + message);
       }
   
       private void untagged()
  
  
  
  1.9       +5 -3      james-server/proposals/imap2/java/org/apache/james/imapserver/ImapSession.java
  
  Index: ImapSession.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/imapserver/ImapSession.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ImapSession.java	23 Oct 2003 01:55:12 -0000	1.8
  +++ ImapSession.java	29 Dec 2003 06:54:47 -0000	1.9
  @@ -79,12 +79,14 @@
        * responses when the selected mailbox is modified by another user.
        * @param response The response to write to
        */
  -    public void unsolicitedResponses( ImapResponse response ) throws MailboxException;
  +    void unsolicitedResponses( ImapResponse response ) throws MailboxException;
   
       /**
        * Closes the connection for this session.
        */
  -    public void closeConnection();
  +    void closeConnection();
  +
  +    void closeConnection(String byeMessage);
   
       /**
        * Provides the Imap host for this server, which is used for all access to mail
  
  
  
  1.11      +16 -9     james-server/proposals/imap2/java/org/apache/james/imapserver/ImapSessionImpl.java
  
  Index: ImapSessionImpl.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/imapserver/ImapSessionImpl.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ImapSessionImpl.java	30 Nov 2003 10:48:47 -0000	1.10
  +++ ImapSessionImpl.java	29 Dec 2003 06:54:47 -0000	1.11
  @@ -110,13 +110,13 @@
           unsolicitedResponses(request, false);
       }
   
  -    public void unsolicitedResponses( ImapResponse request, boolean omitExpunged ) throws MailboxException {
  +    public void unsolicitedResponses( ImapResponse response, boolean omitExpunged ) throws MailboxException {
           ImapSessionMailbox selected = getSelected();
           if (selected != null) {
               // New message response
               if (selected.isSizeChanged()) {
  -                request.existsResponse(selected.getMessageCount());
  -                request.recentResponse(selected.getRecentCount(true));
  +                response.existsResponse(selected.getMessageCount());
  +                response.recentResponse(selected.getRecentCount(true));
                   selected.setSizeChanged(false);
               }
   
  @@ -134,7 +134,7 @@
                       out.append(" UID ");
                       out.append(entry.getUid());
                   }
  -                request.fetchResponse(msn, out.toString());
  +                response.fetchResponse(msn, out.toString());
   
               }
   
  @@ -143,11 +143,15 @@
                   int[] expunged = selected.getExpunged();
                   for (int i = 0; i < expunged.length; i++) {
                       int msn = expunged[i];
  -                    request.expungeResponse(msn);
  +                    response.expungeResponse(msn);
                   }
               }
           }
       }
  +    
  +    public void closeConnection(String byeMessage) {
  +        handler.forceConnectionClose(byeMessage);
  +    }
   
       public void closeConnection()
       {
  @@ -183,13 +187,16 @@
       public void deselect()
       {
           this.state = ImapSessionState.AUTHENTICATED;
  -        // TODO is there more to do here, to cleanup the mailbox.
  -        this.selectedMailbox = null;
  +        if (selectedMailbox != null) {
  +            // TODO is there more to do here, to cleanup the mailbox.
  +            selectedMailbox.removeListener(selectedMailbox);
  +            this.selectedMailbox = null;
  +        }
       }
   
       public void setSelected( ImapMailbox mailbox, boolean readOnly )
       {
  -        ImapSessionMailbox sessionMailbox = new ImapSessionMailbox(mailbox, readOnly);
  +        ImapSessionMailbox sessionMailbox = new ImapSessionMailbox(mailbox, this, readOnly);
           this.state = ImapSessionState.SELECTED;
           this.selectedMailbox = sessionMailbox;
       }
  
  
  
  1.6       +18 -2     james-server/proposals/imap2/java/org/apache/james/imapserver/ImapSessionMailbox.java
  
  Index: ImapSessionMailbox.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/imapserver/ImapSessionMailbox.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ImapSessionMailbox.java	30 Nov 2003 07:08:10 -0000	1.5
  +++ ImapSessionMailbox.java	29 Dec 2003 06:54:47 -0000	1.6
  @@ -67,17 +67,25 @@
   import javax.mail.Flags;
   import javax.mail.internet.MimeMessage;
   import javax.mail.search.SearchTerm;
  -import java.util.*;
  +import java.util.ArrayList;
  +import java.util.Collections;
  +import java.util.Date;
  +import java.util.LinkedList;
  +import java.util.List;
  +import java.util.Map;
  +import java.util.TreeMap;
   
   public class ImapSessionMailbox implements ImapMailbox, MailboxListener {
       private ImapMailbox _mailbox;
  +    private ImapSession _session;
       private boolean _readonly;
       private boolean _sizeChanged;
       private List _expungedMsns = Collections.synchronizedList(new LinkedList());
       private Map _modifiedFlags = Collections.synchronizedMap(new TreeMap());
   
  -    public ImapSessionMailbox(ImapMailbox mailbox, boolean readonly) {
  +    public ImapSessionMailbox(ImapMailbox mailbox, ImapSession session, boolean readonly) {
           _mailbox = mailbox;
  +        _session = session;
           _readonly = readonly;
           // TODO make this a weak reference (or make sure deselect() is *always* called).
           _mailbox.addListener(this);
  @@ -100,6 +108,10 @@
           throw new MailboxException( "No such message." );
       }
   
  +    public void signalDeletion() {
  +        _mailbox.signalDeletion();
  +    }
  +
       public boolean isReadonly() {
           return _readonly;
       }
  @@ -145,6 +157,10 @@
       public void flagsUpdated(int msn, Flags flags, Long uid) {
           // This will overwrite any earlier changes
           _modifiedFlags.put(new Integer(msn), new FlagUpdate(msn, uid, flags));
  +    }
  +
  +    public void mailboxDeleted() {
  +        _session.closeConnection("Mailbox " + _mailbox.getName() + " has been deleted");
       }
   
       public String getName() {
  
  
  
  1.13      +9 -10     james-server/proposals/imap2/java/org/apache/james/imapserver/JamesImapHost.java
  
  Index: JamesImapHost.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/imapserver/JamesImapHost.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- JamesImapHost.java	30 Nov 2003 07:03:48 -0000	1.12
  +++ JamesImapHost.java	29 Dec 2003 06:54:47 -0000	1.13
  @@ -58,13 +58,6 @@
   
   package org.apache.james.imapserver;
   
  -import java.util.ArrayList;
  -import java.util.Collection;
  -import java.util.HashMap;
  -import java.util.Iterator;
  -import java.util.Map;
  -import java.util.StringTokenizer;
  -
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.logger.ConsoleLogger;
   import org.apache.james.imapserver.store.ImapMailbox;
  @@ -73,6 +66,13 @@
   import org.apache.james.imapserver.store.MailboxException;
   import org.apache.mailet.User;
   
  +import java.util.ArrayList;
  +import java.util.Collection;
  +import java.util.HashMap;
  +import java.util.Iterator;
  +import java.util.Map;
  +import java.util.StringTokenizer;
  +
   /**
    * An initial implementation of an ImapHost. By default, uses,
    * the {@link org.apache.james.imapserver.store.InMemoryStore} implementation of {@link org.apache.james.imapserver.store.ImapStore}.
  @@ -194,14 +194,13 @@
               throws MailboxException, AuthorizationException
       {
           ImapMailbox toDelete = getMailbox( user, mailboxName, true );
  -
           if ( store.getChildren( toDelete ).isEmpty() ) {
               toDelete.deleteAllMessages();
  +            toDelete.signalDeletion();
               store.deleteMailbox( toDelete );
           }
           else {
               if ( toDelete.isSelectable() ) {
  -                // TODO delete all messages.
                   toDelete.deleteAllMessages();
                   store.setSelectable( toDelete, false );
               }
  
  
  
  1.5       +3 -3      james-server/proposals/imap2/java/org/apache/james/JamesImap.java
  
  Index: JamesImap.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/java/org/apache/james/JamesImap.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JamesImap.java	8 Mar 2003 21:13:54 -0000	1.4
  +++ JamesImap.java	29 Dec 2003 06:54:47 -0000	1.5
  @@ -58,6 +58,8 @@
   
   package org.apache.james;
   
  +import org.apache.avalon.framework.configuration.Configuration;
  +import org.apache.avalon.framework.service.ServiceManager;
   import org.apache.james.core.MailImpl;
   import org.apache.james.imapserver.ImapHost;
   import org.apache.james.imapserver.store.ImapMailbox;
  @@ -65,8 +67,6 @@
   import org.apache.james.services.JamesUser;
   import org.apache.james.userrepository.DefaultJamesUser;
   import org.apache.mailet.MailAddress;
  -import org.apache.avalon.framework.configuration.Configuration;
  -import org.apache.avalon.framework.service.ServiceManager;
   
   import javax.mail.MessagingException;
   import javax.mail.internet.MimeMessage;
  
  
  
  1.3       +0 -17     james-server/proposals/imap2/test/org/apache/james/imapserver/concurrent/Concurrent.todo.txt
  
  Index: Concurrent.todo.txt
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/test/org/apache/james/imapserver/concurrent/Concurrent.todo.txt,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Concurrent.todo.txt	30 Nov 2003 10:48:47 -0000	1.2
  +++ Concurrent.todo.txt	29 Dec 2003 06:54:47 -0000	1.3
  @@ -1,22 +1,5 @@
   Simple tests:
  -1 Send FETCH response when another session performs a STORE against a message
  -    (concurrent/FetchResponse.test)
  -2 Send EXISTS and RECENT responses when a message is added
  -    (concurrent/ExistsResponse.test) - still need RECENT
  -3 Expunge response when another session performs a EXPUNGE against the mailbox
  -
   FETCH should set the /SEEN flag, and this should be propogated to other sessions.
  -
  -
  -From RFC2180
  -3. Deletion/Renaming of a multi-accessed mailbox
  -### Need to pick one of these 3...
  -3.1. The server MAY fail the DELETE/RENAME command of a multi-accessed
  -     mailbox
  -
  -3.3. The server MAY allow the DELETE/RENAME of a multi-accessed
  -     mailbox, but disconnect all other clients who have the mailbox
  -     accessed by sending a untagged BYE response.
   
   3.4. The server MAY allow the RENAME of a multi-accessed mailbox by
        simply changing the name attribute on the mailbox.
  
  
  
  1.3       +2 -2      james-server/proposals/imap2/test/org/apache/james/imapserver/concurrent/ExistsResponse.test
  
  Index: ExistsResponse.test
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/test/org/apache/james/imapserver/concurrent/ExistsResponse.test,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ExistsResponse.test	30 Nov 2003 07:03:49 -0000	1.2
  +++ ExistsResponse.test	29 Dec 2003 06:54:47 -0000	1.3
  @@ -1,4 +1,4 @@
  -# Tests that appending a message from one session triggers an EXISTS response
  +# Tests that appending a message from one session triggers an EXISTS and RECENT response
   # in a concurrent session on the same mailbox
   SESSION: 1
   C: 1a CREATE existsresponse
  @@ -66,7 +66,7 @@
   C: 2c CLOSE
   S: 2c OK CLOSE completed
   
  -# EXISTS response on STORE
  +# EXISTS response on STORE (recent is no longer set)
   SESSION: 3
   C: 3b STORE 1 +FLAGS.SILENT (\Flagged)
   S: \* 1 EXISTS
  
  
  
  1.1                  james-server/proposals/imap2/test/org/apache/james/imapserver/concurrent/DeleteSelected.test
  
  Index: DeleteSelected.test
  ===================================================================
  #From RFC2180
  #3. Deletion/Renaming of a multi-accessed mailbox
  #3.3. The server MAY allow the DELETE/RENAME of a multi-accessed
  #     mailbox, but disconnect all other clients who have the mailbox
  #     accessed by sending a untagged BYE response.
  
  SESSION: 1
  C: 1a CREATE deleteconcurrent
  S: 1a OK CREATE completed
  
  C: 1b APPEND deleteconcurrent (\Deleted) {254+}
  C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
  C: From: Fred Foobar <foobar@Blurdybloop.COM>
  C: Subject: Test 03
  C: To: mooch@owatagu.siam.edu
  C: Message-Id: <B27397-0100000@Blurdybloop.COM>
  C: MIME-Version: 1.0
  C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
  C:
  C: Test 03
  C:
  S: 1b OK APPEND completed
  
  C: 1c SELECT deleteconcurrent
  S: \* FLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)
  S: \* 1 EXISTS
  S: \* 1 RECENT
  S: \* OK \[UIDVALIDITY \d+\]
  S: \* OK \[UNSEEN 1\] Message 1 is the first unseen
  S: \* OK \[PERMANENTFLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)\]
  S: 1c OK \[READ-WRITE\] SELECT completed
  
  
  # Client #1 has mailbox "deleteconcurrent" selected. Client #2 DELETEs the mailbox.
  SESSION: 2
  C: 2a DELETE deleteconcurrent
  S: 2a OK DELETE completed
  
  # Forced disconnect of selected sessions
  SESSION: 1
  S: \* BYE Mailbox deleteconcurrent has been deleted
  
  
  
  1.1                  james-server/proposals/imap2/test/org/apache/james/imapserver/concurrent/RenameSelected.test
  
  Index: RenameSelected.test
  ===================================================================
  #From RFC2180
  #3. Deletion/Renaming of a multi-accessed mailbox
  #3.4. The server MAY allow the RENAME of a multi-accessed mailbox by
  #     simply changing the name attribute on the mailbox.
  
  SESSION: 1
  C: 1a CREATE renameconcurrent
  S: 1a OK CREATE completed
  
  C: 1b APPEND renameconcurrent (\Deleted) {254+}
  C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
  C: From: Fred Foobar <foobar@Blurdybloop.COM>
  C: Subject: Test 03
  C: To: mooch@owatagu.siam.edu
  C: Message-Id: <B27397-0100000@Blurdybloop.COM>
  C: MIME-Version: 1.0
  C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
  C:
  C: Test 03
  C:
  S: 1b OK APPEND completed
  
  C: 1c SELECT renameconcurrent
  S: \* FLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)
  S: \* 1 EXISTS
  S: \* 1 RECENT
  S: \* OK \[UIDVALIDITY \d+\]
  S: \* OK \[UNSEEN 1\] Message 1 is the first unseen
  S: \* OK \[PERMANENTFLAGS \(\\Answered \\Deleted \\Draft \\Flagged \\Seen\)\]
  S: 1c OK \[READ-WRITE\] SELECT completed
  
  
  # Client #1 has mailbox "renameconcurrent" selected. Client #2 RENAMEs the mailbox.
  SESSION: 2
  C: 2a RENAME renameconcurrent renamed
  S: 2a OK RENAME completed
  
  # Client #1 is still able to do operations that do not reference the mailbox name.
  SESSION: 1
  C: 1d FETCH 1:* (FLAGS)
  S: \* 1 FETCH \(FLAGS \(\\Deleted\)\)
  S: 1d OK FETCH completed
  
  # Client #1 is not able to do operations that reference the mailbox name.
  C: 1e APPEND renameconcurrent (\Deleted) {254+}
  C: Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
  C: From: Fred Foobar <foobar@Blurdybloop.COM>
  C: Subject: Test 03
  C: To: mooch@owatagu.siam.edu
  C: Message-Id: <B27397-0100000@Blurdybloop.COM>
  C: MIME-Version: 1.0
  C: Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
  C:
  C: Test 03
  C:
  S: 1e NO \[TRYCREATE\] APPEND failed. No such mailbox.
  
  
  
  1.10      +5 -6      james-server/proposals/imap2/test/org/apache/james/imapserver/CommandParserTest.java
  
  Index: CommandParserTest.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/test/org/apache/james/imapserver/CommandParserTest.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- CommandParserTest.java	23 Oct 2003 01:55:13 -0000	1.9
  +++ CommandParserTest.java	29 Dec 2003 06:54:47 -0000	1.10
  @@ -58,17 +58,16 @@
   
   package org.apache.james.imapserver;
   
  +import junit.framework.TestCase;
  +import org.apache.james.imapserver.commands.CommandParser;
  +import org.apache.james.imapserver.commands.IdRange;
  +
   import java.io.ByteArrayInputStream;
   import java.io.ByteArrayOutputStream;
   import java.io.InputStream;
   import java.io.UnsupportedEncodingException;
   import java.text.SimpleDateFormat;
   import java.util.TimeZone;
  -
  -import junit.framework.TestCase;
  -
  -import org.apache.james.imapserver.commands.CommandParser;
  -import org.apache.james.imapserver.commands.IdRange;
   
   /**
    * Tests for the {@link ImapRequestLineReader}.
  
  
  
  1.8       +2 -3      james-server/proposals/imap2/test/org/apache/james/imapserver/ImapHostTest.java
  
  Index: ImapHostTest.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/test/org/apache/james/imapserver/ImapHostTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ImapHostTest.java	8 Mar 2003 21:13:57 -0000	1.7
  +++ ImapHostTest.java	29 Dec 2003 06:54:47 -0000	1.8
  @@ -58,13 +58,12 @@
   
   package org.apache.james.imapserver;
   
  +import junit.framework.TestCase;
   import org.apache.james.imapserver.store.ImapMailbox;
   import org.apache.james.imapserver.store.InMemoryStore;
   import org.apache.james.imapserver.store.MailboxException;
   import org.apache.james.userrepository.DefaultUser;
   import org.apache.mailet.User;
  -
  -import junit.framework.TestCase;
   
   /**
    * A test for implementations of the {@link ImapHost} interface.
  
  
  
  1.6       +2 -3      james-server/proposals/imap2/test/org/apache/james/imapserver/ImapStoreTest.java
  
  Index: ImapStoreTest.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/test/org/apache/james/imapserver/ImapStoreTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ImapStoreTest.java	8 Mar 2003 21:13:57 -0000	1.5
  +++ ImapStoreTest.java	29 Dec 2003 06:54:47 -0000	1.6
  @@ -58,12 +58,11 @@
   
   package org.apache.james.imapserver;
   
  +import junit.framework.TestCase;
   import org.apache.james.imapserver.store.ImapMailbox;
   import org.apache.james.imapserver.store.ImapStore;
   import org.apache.james.imapserver.store.InMemoryStore;
   import org.apache.james.imapserver.store.MailboxException;
  -
  -import junit.framework.TestCase;
   
   import java.util.Collection;
   
  
  
  
  1.4       +1 -1      james-server/proposals/imap2/test/org/apache/james/imapserver/ImapTest.java
  
  Index: ImapTest.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/test/org/apache/james/imapserver/ImapTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ImapTest.java	8 Mar 2003 21:13:57 -0000	1.3
  +++ ImapTest.java	29 Dec 2003 06:54:48 -0000	1.4
  @@ -71,5 +71,5 @@
       String FROM_ADDRESS = "sender@localhost";
       String TO_ADDRESS = USER + "@" + HOST;
   
  -    int TIMEOUT = 30000;
  +    int TIMEOUT = 10000;
   }
  
  
  
  1.5       +16 -17    james-server/proposals/imap2/test/org/apache/james/imapserver/TestCommandsInAuthenticatedState.java
  
  Index: TestCommandsInAuthenticatedState.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/test/org/apache/james/imapserver/TestCommandsInAuthenticatedState.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestCommandsInAuthenticatedState.java	30 Nov 2003 07:03:48 -0000	1.4
  +++ TestCommandsInAuthenticatedState.java	29 Dec 2003 06:54:48 -0000	1.5
  @@ -58,10 +58,9 @@
   
   package org.apache.james.imapserver;
   
  -import org.apache.james.test.SimpleFileProtocolTest;
  -
   import junit.framework.Test;
   import junit.framework.TestSuite;
  +import org.apache.james.test.SimpleFileProtocolTest;
   
   /**
    * Runs tests for commands valid in the AUTHENTICATED state. A login session precedes
  @@ -100,26 +99,26 @@
       {
           TestSuite suite = new TestSuite();
           // Not valid in this state
  -        suite.addTest( new TestCommandsInAuthenticatedState( "ValidSelected" ) );
  -        suite.addTest( new TestCommandsInAuthenticatedState( "ValidNonAuthenticated" ) );
  +//        suite.addTest( new TestCommandsInAuthenticatedState( "ValidSelected" ) );
  +//        suite.addTest( new TestCommandsInAuthenticatedState( "ValidNonAuthenticated" ) );
   
           // Valid in all states
  -        suite.addTest( new TestCommandsInAuthenticatedState( "Capability" ) );
  -        suite.addTest( new TestCommandsInAuthenticatedState( "Noop" ) );
  -        suite.addTest( new TestCommandsInAuthenticatedState( "Logout" ) );
  +//        suite.addTest( new TestCommandsInAuthenticatedState( "Capability" ) );
  +//        suite.addTest( new TestCommandsInAuthenticatedState( "Noop" ) );
  +//        suite.addTest( new TestCommandsInAuthenticatedState( "Logout" ) );
   
           // Valid in authenticated state
  -        suite.addTest( new TestCommandsInAuthenticatedState( "AppendExamineInbox" ) );
  -        suite.addTest( new TestCommandsInAuthenticatedState( "AppendSelectInbox" ) );
  -        suite.addTest( new TestCommandsInAuthenticatedState( "Create" ) );
  +//        suite.addTest( new TestCommandsInAuthenticatedState( "AppendExamineInbox" ) );
  +//        suite.addTest( new TestCommandsInAuthenticatedState( "AppendSelectInbox" ) );
  +//        suite.addTest( new TestCommandsInAuthenticatedState( "Create" ) );
           suite.addTest( new TestCommandsInAuthenticatedState( "ExamineEmpty" ) );
  -        suite.addTest( new TestCommandsInAuthenticatedState( "SelectEmpty" ) );
  -        suite.addTest( new TestCommandsInAuthenticatedState( "ListNamespace" ) );
  -        suite.addTest( new TestCommandsInAuthenticatedState( "ListMailboxes" ) );
  -        suite.addTest( new TestCommandsInAuthenticatedState( "Status" ) );
  -        suite.addTest( new TestCommandsInAuthenticatedState( "Subscribe" ) );
  -        suite.addTest( new TestCommandsInAuthenticatedState( "Delete" ) );
  -        suite.addTest( new TestCommandsInAuthenticatedState( "Append" ) );
  +//        suite.addTest( new TestCommandsInAuthenticatedState( "SelectEmpty" ) );
  +//        suite.addTest( new TestCommandsInAuthenticatedState( "ListNamespace" ) );
  +//        suite.addTest( new TestCommandsInAuthenticatedState( "ListMailboxes" ) );
  +//        suite.addTest( new TestCommandsInAuthenticatedState( "Status" ) );
  +//        suite.addTest( new TestCommandsInAuthenticatedState( "Subscribe" ) );
  +//        suite.addTest( new TestCommandsInAuthenticatedState( "Delete" ) );
  +//        suite.addTest( new TestCommandsInAuthenticatedState( "Append" ) );
   
           return suite;
       }
  
  
  
  1.4       +1 -2      james-server/proposals/imap2/test/org/apache/james/imapserver/TestCommandsInNonAuthenticatedState.java
  
  Index: TestCommandsInNonAuthenticatedState.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/test/org/apache/james/imapserver/TestCommandsInNonAuthenticatedState.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestCommandsInNonAuthenticatedState.java	8 Mar 2003 21:13:57 -0000	1.3
  +++ TestCommandsInNonAuthenticatedState.java	29 Dec 2003 06:54:48 -0000	1.4
  @@ -58,10 +58,9 @@
   
   package org.apache.james.imapserver;
   
  -import org.apache.james.test.SimpleFileProtocolTest;
  -
   import junit.framework.Test;
   import junit.framework.TestSuite;
  +import org.apache.james.test.SimpleFileProtocolTest;
   
   /**
    * Runs tests for commands valid in the NON_AUTHENTICATED state.
  
  
  
  1.3       +6 -5      james-server/proposals/imap2/test/org/apache/james/imapserver/TestConcurrentSessions.java
  
  Index: TestConcurrentSessions.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/test/org/apache/james/imapserver/TestConcurrentSessions.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestConcurrentSessions.java	30 Nov 2003 07:03:48 -0000	1.2
  +++ TestConcurrentSessions.java	29 Dec 2003 06:54:48 -0000	1.3
  @@ -9,7 +9,6 @@
   ////////////////////////////////////////////////////////////////////////////////
   package org.apache.james.imapserver;
   
  -import org.apache.james.imapserver.TestCommandsInAuthenticatedState;
   import junit.framework.Test;
   import junit.framework.TestSuite;
   
  @@ -29,9 +28,11 @@
       {
           TestSuite suite = new TestSuite();
           // Not valid in this state
  -        suite.addTest( new TestConcurrentSessions( "concurrent/FetchResponse" ) );
  -        suite.addTest( new TestConcurrentSessions( "concurrent/ExistsResponse" ) );
  -        suite.addTest( new TestConcurrentSessions( "concurrent/ExpungeResponse" ) );
  +//        suite.addTest( new TestConcurrentSessions( "concurrent/FetchResponse" ) );
  +//        suite.addTest( new TestConcurrentSessions( "concurrent/ExistsResponse" ) );
  +//        suite.addTest( new TestConcurrentSessions( "concurrent/ExpungeResponse" ) );
  +//        suite.addTest( new TestConcurrentSessions( "concurrent/RenameSelected" ) );
  +        suite.addTest( new TestConcurrentSessions( "concurrent/DeleteSelected" ) );
   
           return suite;
       }
  
  
  
  1.5       +1 -2      james-server/proposals/imap2/test/org/apache/james/remotemanager/TestRemoteManager.java
  
  Index: TestRemoteManager.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/test/org/apache/james/remotemanager/TestRemoteManager.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestRemoteManager.java	8 Mar 2003 21:13:57 -0000	1.4
  +++ TestRemoteManager.java	29 Dec 2003 06:54:48 -0000	1.5
  @@ -58,10 +58,9 @@
   
   package org.apache.james.remotemanager;
   
  -import org.apache.james.test.SimpleFileProtocolTest;
  -
   import junit.framework.Test;
   import junit.framework.TestSuite;
  +import org.apache.james.test.SimpleFileProtocolTest;
   
   public class TestRemoteManager
           extends SimpleFileProtocolTest
  
  
  
  1.5       +1 -2      james-server/proposals/imap2/test/org/apache/james/smtpserver/TestSMTP.java
  
  Index: TestSMTP.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/test/org/apache/james/smtpserver/TestSMTP.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestSMTP.java	8 Mar 2003 21:13:58 -0000	1.4
  +++ TestSMTP.java	29 Dec 2003 06:54:48 -0000	1.5
  @@ -58,10 +58,9 @@
   
   package org.apache.james.smtpserver;
   
  -import org.apache.james.test.SimpleFileProtocolTest;
  -
   import junit.framework.Test;
   import junit.framework.TestSuite;
  +import org.apache.james.test.SimpleFileProtocolTest;
   
   
   public class TestSMTP
  
  
  
  1.10      +25 -23    james-server/proposals/imap2/test/org/apache/james/test/AbstractProtocolTest.java
  
  Index: AbstractProtocolTest.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/test/org/apache/james/test/AbstractProtocolTest.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- AbstractProtocolTest.java	30 Nov 2003 07:03:49 -0000	1.9
  +++ AbstractProtocolTest.java	29 Dec 2003 06:54:48 -0000	1.10
  @@ -58,9 +58,11 @@
   
   package org.apache.james.test;
   
  +import junit.framework.TestCase;
   import org.apache.james.imapserver.ImapHandler;
   import org.apache.james.imapserver.ImapHost;
   import org.apache.james.imapserver.ImapRequestHandler;
  +import org.apache.james.imapserver.ImapResponse;
   import org.apache.james.imapserver.ImapSession;
   import org.apache.james.imapserver.ImapSessionImpl;
   import org.apache.james.imapserver.ImapTest;
  @@ -72,18 +74,12 @@
   import org.apache.mailet.User;
   import org.apache.mailet.UsersRepository;
   
  -import junit.framework.TestCase;
  -
   import java.io.BufferedReader;
  -import java.io.ByteArrayInputStream;
  -import java.io.ByteArrayOutputStream;
  -import java.io.InputStream;
  -import java.io.InputStreamReader;
  -import java.io.PrintWriter;
   import java.io.IOException;
  +import java.io.InputStreamReader;
   import java.io.PipedInputStream;
   import java.io.PipedOutputStream;
  -import java.io.OutputStream;
  +import java.io.PrintWriter;
   import java.net.Socket;
   import java.util.HashMap;
   import java.util.Iterator;
  @@ -203,7 +199,7 @@
        * Instead of sending requests to a socket connected to a running instance of James,
        * this method uses the {@link MockImapServer} to simplify testing. One mock instance
        * is required per protocol session/connection. These share the same underlying 
  -     * Mailboxes, because of the way {@link #getImapSession()} works.
  +     * Mailboxes, because of the way {@link MockImapServer#getImapSession()} works.
        */
       private void runLocalProtocolSessions() throws Exception
       {
  @@ -212,7 +208,7 @@
           BufferedReader[] in = new BufferedReader[socket.length];
   
           for (int i = 0; i < socket.length; i++) {
  -            socket[i] = new MockImapServer(getImapSession());
  +            socket[i] = new MockImapServer();
               out[i] = socket[i].getWriter();
               in[i] = socket[i].getReader();
               socket[i].start();
  @@ -256,16 +252,6 @@
       }
   
       /**
  -     * Provides an ImapSession to use for this test. An ImapSession is accosiated
  -     * with a single client connection.
  -     */
  -    private ImapSession getImapSession() throws MailboxException
  -    {
  -        ImapSession session = new ImapSessionImpl( imapHost, users, new ImapHandler(), null, null );
  -        return session;
  -    }
  -
  -    /**
        * Initialises the UsersRepository and ImapHost on first call.
        * TODO enable logging, set up components properly.
        */
  @@ -333,8 +319,8 @@
           /**
            * Creates a MockImapServer, with a handler for the session provided.
            */ 
  -        public MockImapServer(ImapSession session) throws IOException {
  -            this.session = session;
  +        public MockImapServer() throws IOException {
  +            this.session = getImapSession();
               requestOutputStream = new PipedOutputStream();
               requestInputStream = new PipedInputStream(requestOutputStream);
   
  @@ -364,7 +350,6 @@
                       break;
                   }
               }
  -
           }
   
           /** 
  @@ -384,6 +369,23 @@
           /** stop the running server thread.*/
           public void stopServer() {
               running = false;
  +        }
  +
  +        /**
  +         * Provides an ImapSession to use for this test. An ImapSession is accosiated
  +         * with a single client connection.
  +         */
  +        private ImapSession getImapSession()
  +        {
  +            ImapSession session = new ImapSessionImpl( imapHost, users, new MockImapHandler(), null, null );
  +            return session;
  +        }
  +
  +        private final class MockImapHandler extends ImapHandler {
  +            public void forceConnectionClose(String message) {
  +                ImapResponse response = new ImapResponse(responseOutputStream);
  +                response.byeResponse(message);        
  +            }
           }
       }
   }
  
  
  
  1.8       +2 -2      james-server/proposals/imap2/test/org/apache/james/test/ProtocolSession.java
  
  Index: ProtocolSession.java
  ===================================================================
  RCS file: /home/cvs/james-server/proposals/imap2/test/org/apache/james/test/ProtocolSession.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ProtocolSession.java	26 Nov 2003 14:18:38 -0000	1.7
  +++ ProtocolSession.java	29 Dec 2003 06:54:48 -0000	1.8
  @@ -61,8 +61,8 @@
   import org.apache.oro.text.perl.Perl5Util;
   
   import java.io.BufferedReader;
  -import java.io.PrintWriter;
   import java.io.IOException;
  +import java.io.PrintWriter;
   import java.util.ArrayList;
   import java.util.Iterator;
   import java.util.List;
  
  
  

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


Mime
View raw message