james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r760821 - in /james/imap/trunk: decode/src/main/java/org/apache/james/imap/decode/parser/ message/src/main/java/org/apache/james/imap/encode/ message/src/main/java/org/apache/james/imap/encode/main/ message/src/test/java/org/apache/james/im...
Date Wed, 01 Apr 2009 09:06:11 GMT
Author: rdonkin
Date: Wed Apr  1 09:06:06 2009
New Revision: 760821

URL: http://svn.apache.org/viewvc?rev=760821&view=rev
Log:
Hook up codec and processor. Add integration tests. IMAP Namespaces IMAP-76  https://issues.apache.org/jira/browse/IMAP-76

Added:
    james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/Namespace.test
Modified:
    james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/Imap4Rev1CommandParserFactory.java
    james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/NamespaceResponseEncoder.java
    james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/main/DefaultImapEncoderFactory.java
    james/imap/trunk/message/src/test/java/org/apache/james/imap/encode/NamespaceResponseEncoderTest.java
    james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/Imap4Rev1ProcessorFactory.java
    james/imap/trunk/seda/src/test/java/org/apache/james/imap/functional/suite/AuthenticatedState.java
    james/imap/trunk/seda/src/test/java/org/apache/james/imap/functional/suite/SelectedState.java

Modified: james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/Imap4Rev1CommandParserFactory.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/Imap4Rev1CommandParserFactory.java?rev=760821&r1=760820&r2=760821&view=diff
==============================================================================
--- james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/Imap4Rev1CommandParserFactory.java
(original)
+++ james/imap/trunk/decode/src/main/java/org/apache/james/imap/decode/parser/Imap4Rev1CommandParserFactory.java
Wed Apr  1 09:06:06 2009
@@ -94,8 +94,8 @@
         _imapCommands.put(ImapConstants.APPEND_COMMAND_NAME,
                 AppendCommandParser.class);
 
-        // // RFC2342 NAMESPACE
-        // _imapCommands.put( "NAMESPACE", NamespaceCommand.class );
+        // RFC2342 NAMESPACE
+        _imapCommands.put( ImapConstants.NAMESPACE_COMMAND_NAME, NamespaceCommandParser.class
);
 
         // RFC2086 GETACL, SETACL, DELETEACL, LISTRIGHTS, MYRIGHTS
         // _imapCommands.put( "GETACL", GetAclCommand.class );

Modified: james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/NamespaceResponseEncoder.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/NamespaceResponseEncoder.java?rev=760821&r1=760820&r2=760821&view=diff
==============================================================================
--- james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/NamespaceResponseEncoder.java
(original)
+++ james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/NamespaceResponseEncoder.java
Wed Apr  1 09:06:06 2009
@@ -21,6 +21,7 @@
 import java.io.IOException;
 import java.util.List;
 
+import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapMessage;
 import org.apache.james.imap.api.process.ImapSession;
 import org.apache.james.imap.encode.base.AbstractChainedImapEncoder;
@@ -42,6 +43,7 @@
             throws IOException {
         final NamespaceResponse response = (NamespaceResponse) acceptableMessage;
         composer.untagged();
+        composer.commandName(ImapConstants.NAMESPACE_COMMAND_NAME);
 
         final List<NamespaceResponse.Namespace> personal = response
                 .getPersonal();
@@ -50,6 +52,8 @@
         encode(users, composer);
         final List<NamespaceResponse.Namespace> shared = response.getShared();
         encode(shared, composer);
+        
+        composer.end();
     }
 
     private void encode(List<Namespace> namespaces,

Modified: james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/main/DefaultImapEncoderFactory.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/main/DefaultImapEncoderFactory.java?rev=760821&r1=760820&r2=760821&view=diff
==============================================================================
--- james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/main/DefaultImapEncoderFactory.java
(original)
+++ james/imap/trunk/message/src/main/java/org/apache/james/imap/encode/main/DefaultImapEncoderFactory.java
Wed Apr  1 09:06:06 2009
@@ -28,6 +28,7 @@
 import org.apache.james.imap.encode.ImapEncoderFactory;
 import org.apache.james.imap.encode.LSubResponseEncoder;
 import org.apache.james.imap.encode.ListResponseEncoder;
+import org.apache.james.imap.encode.NamespaceResponseEncoder;
 import org.apache.james.imap.encode.RecentResponseEncoder;
 import org.apache.james.imap.encode.MailboxStatusResponseEncoder;
 import org.apache.james.imap.encode.SearchResponseEncoder;
@@ -41,8 +42,9 @@
 
     public static final ImapEncoder createDefaultEncoder() {
         final EndImapEncoder endImapEncoder = new EndImapEncoder();
+        final NamespaceResponseEncoder namespaceEncoder = new NamespaceResponseEncoder(endImapEncoder);
         final StatusResponseEncoder statusResponseEncoder = new StatusResponseEncoder(
-                endImapEncoder);
+                namespaceEncoder);
         final RecentResponseEncoder recentResponseEncoder = new RecentResponseEncoder(
                 statusResponseEncoder);
         final FetchResponseEncoder fetchResponseEncoder = new FetchResponseEncoder(

Modified: james/imap/trunk/message/src/test/java/org/apache/james/imap/encode/NamespaceResponseEncoderTest.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/message/src/test/java/org/apache/james/imap/encode/NamespaceResponseEncoderTest.java?rev=760821&r1=760820&r2=760821&view=diff
==============================================================================
--- james/imap/trunk/message/src/test/java/org/apache/james/imap/encode/NamespaceResponseEncoderTest.java
(original)
+++ james/imap/trunk/message/src/test/java/org/apache/james/imap/encode/NamespaceResponseEncoderTest.java
Wed Apr  1 09:06:06 2009
@@ -21,6 +21,7 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.james.imap.api.ImapConstants;
 import org.apache.james.imap.api.ImapMessage;
 import org.apache.james.imap.api.process.ImapSession;
 import org.apache.james.imap.message.response.NamespaceResponse;
@@ -55,24 +56,17 @@
         checking(new Expectations() {
             {
                 final Sequence sequence = sequence("Composition order");
-                oneOf(mockComposer).untagged();
-                inSequence(sequence);
-                oneOf(mockComposer).nil();
-                inSequence(sequence);
-                oneOf(mockComposer).nil();
-                inSequence(sequence);
-                oneOf(mockComposer).openParen();
-                inSequence(sequence);
-                oneOf(mockComposer).openParen();
-                inSequence(sequence);
-                oneOf(mockComposer).quote(aPrefix);
-                inSequence(sequence);
-                oneOf(mockComposer).quote(aDeliminator);
-                inSequence(sequence);
-                oneOf(mockComposer).closeParen();
-                inSequence(sequence);
-                oneOf(mockComposer).closeParen();
-                inSequence(sequence);
+                oneOf(mockComposer).untagged(); inSequence(sequence);
+                oneOf(mockComposer).commandName(ImapConstants.NAMESPACE_COMMAND_NAME);
+                oneOf(mockComposer).nil(); inSequence(sequence);
+                oneOf(mockComposer).nil(); inSequence(sequence);
+                oneOf(mockComposer).openParen();  inSequence(sequence);
+                oneOf(mockComposer).openParen(); inSequence(sequence);
+                oneOf(mockComposer).quote(aPrefix); inSequence(sequence);
+                oneOf(mockComposer).quote(aDeliminator); inSequence(sequence);
+                oneOf(mockComposer).closeParen(); inSequence(sequence);
+                oneOf(mockComposer).closeParen(); inSequence(sequence);
+                oneOf(mockComposer).end(); inSequence(sequence);
             }
         });
         List<NamespaceResponse.Namespace> namespaces = new ArrayList<NamespaceResponse.Namespace>();
@@ -89,24 +83,17 @@
         checking(new Expectations() {
             {
                 final Sequence sequence = sequence("Composition order");
-                oneOf(mockComposer).untagged();
-                inSequence(sequence);
-                oneOf(mockComposer).nil();
-                inSequence(sequence);
-                oneOf(mockComposer).openParen();
-                inSequence(sequence);
-                oneOf(mockComposer).openParen();
-                inSequence(sequence);
-                oneOf(mockComposer).quote(aPrefix);
-                inSequence(sequence);
-                oneOf(mockComposer).quote(aDeliminator);
-                inSequence(sequence);
-                oneOf(mockComposer).closeParen();
-                inSequence(sequence);
-                oneOf(mockComposer).closeParen();
-                inSequence(sequence);
-                oneOf(mockComposer).nil();
-                inSequence(sequence);
+                oneOf(mockComposer).untagged(); inSequence(sequence);
+                oneOf(mockComposer).commandName(ImapConstants.NAMESPACE_COMMAND_NAME);
+                oneOf(mockComposer).nil(); inSequence(sequence);
+                oneOf(mockComposer).openParen(); inSequence(sequence);
+                oneOf(mockComposer).openParen(); inSequence(sequence);
+                oneOf(mockComposer).quote(aPrefix); inSequence(sequence);
+                oneOf(mockComposer).quote(aDeliminator); inSequence(sequence);
+                oneOf(mockComposer).closeParen(); inSequence(sequence);
+                oneOf(mockComposer).closeParen(); inSequence(sequence);
+                oneOf(mockComposer).nil(); inSequence(sequence);
+                oneOf(mockComposer).end(); inSequence(sequence);
             }
         });
         List<NamespaceResponse.Namespace> namespaces = new ArrayList<NamespaceResponse.Namespace>();
@@ -123,24 +110,17 @@
         checking(new Expectations() {
             {
                 final Sequence sequence = sequence("Composition order");
-                oneOf(mockComposer).untagged();
-                inSequence(sequence);
-                oneOf(mockComposer).openParen();
-                inSequence(sequence);
-                oneOf(mockComposer).openParen();
-                inSequence(sequence);
-                oneOf(mockComposer).quote(aPrefix);
-                inSequence(sequence);
-                oneOf(mockComposer).quote(aDeliminator);
-                inSequence(sequence);
-                oneOf(mockComposer).closeParen();
-                inSequence(sequence);
-                oneOf(mockComposer).closeParen();
-                inSequence(sequence);
-                oneOf(mockComposer).nil();
-                inSequence(sequence);
-                oneOf(mockComposer).nil();
-                inSequence(sequence);
+                oneOf(mockComposer).untagged(); inSequence(sequence);
+                oneOf(mockComposer).commandName(ImapConstants.NAMESPACE_COMMAND_NAME);
+                oneOf(mockComposer).openParen(); inSequence(sequence);
+                oneOf(mockComposer).openParen(); inSequence(sequence);
+                oneOf(mockComposer).quote(aPrefix); inSequence(sequence);
+                oneOf(mockComposer).quote(aDeliminator); inSequence(sequence);
+                oneOf(mockComposer).closeParen(); inSequence(sequence);
+                oneOf(mockComposer).closeParen(); inSequence(sequence);
+                oneOf(mockComposer).nil(); inSequence(sequence);
+                oneOf(mockComposer).nil(); inSequence(sequence);
+                oneOf(mockComposer).end(); inSequence(sequence);
             }
         });
         List<NamespaceResponse.Namespace> namespaces = new ArrayList<NamespaceResponse.Namespace>();
@@ -159,32 +139,21 @@
         checking(new Expectations() {
             {
                 final Sequence sequence = sequence("Composition order");
-                oneOf(mockComposer).untagged();
-                inSequence(sequence);
-                oneOf(mockComposer).openParen();
-                inSequence(sequence);
-                oneOf(mockComposer).openParen();
-                inSequence(sequence);
-                oneOf(mockComposer).quote(aPrefix);
-                inSequence(sequence);
-                oneOf(mockComposer).quote(aDeliminator);
-                inSequence(sequence);
-                oneOf(mockComposer).closeParen();
-                inSequence(sequence);
-                oneOf(mockComposer).openParen();
-                inSequence(sequence);
-                oneOf(mockComposer).quote(anotherPrefix);
-                inSequence(sequence);
-                oneOf(mockComposer).quote(anotherDeliminator);
-                inSequence(sequence);
-                oneOf(mockComposer).closeParen();
-                inSequence(sequence);
-                oneOf(mockComposer).closeParen();
-                inSequence(sequence);
-                oneOf(mockComposer).nil();
-                inSequence(sequence);
-                oneOf(mockComposer).nil();
-                inSequence(sequence);
+                oneOf(mockComposer).untagged(); inSequence(sequence);
+                oneOf(mockComposer).commandName(ImapConstants.NAMESPACE_COMMAND_NAME);
+                oneOf(mockComposer).openParen(); inSequence(sequence);
+                oneOf(mockComposer).openParen(); inSequence(sequence);
+                oneOf(mockComposer).quote(aPrefix); inSequence(sequence);
+                oneOf(mockComposer).quote(aDeliminator); inSequence(sequence);
+                oneOf(mockComposer).closeParen(); inSequence(sequence);
+                oneOf(mockComposer).openParen(); inSequence(sequence);
+                oneOf(mockComposer).quote(anotherPrefix); inSequence(sequence);
+                oneOf(mockComposer).quote(anotherDeliminator); inSequence(sequence);
+                oneOf(mockComposer).closeParen(); inSequence(sequence);
+                oneOf(mockComposer).closeParen(); inSequence(sequence);
+                oneOf(mockComposer).nil(); inSequence(sequence);
+                oneOf(mockComposer).nil(); inSequence(sequence);
+                oneOf(mockComposer).end(); inSequence(sequence);
             }
         });
         List<NamespaceResponse.Namespace> namespaces = new ArrayList<NamespaceResponse.Namespace>();
@@ -200,14 +169,12 @@
         checking(new Expectations() {
             {
                 final Sequence sequence = sequence("Composition order");
-                oneOf(mockComposer).untagged();
-                inSequence(sequence);
-                oneOf(mockComposer).nil();
-                inSequence(sequence);
-                oneOf(mockComposer).nil();
-                inSequence(sequence);
-                oneOf(mockComposer).nil();
-                inSequence(sequence);
+                oneOf(mockComposer).untagged(); inSequence(sequence);
+                oneOf(mockComposer).commandName(ImapConstants.NAMESPACE_COMMAND_NAME);
+                oneOf(mockComposer).nil(); inSequence(sequence);
+                oneOf(mockComposer).nil(); inSequence(sequence);
+                oneOf(mockComposer).nil(); inSequence(sequence);
+                oneOf(mockComposer).end(); inSequence(sequence);
             }
         });
         subject.doEncode(new NamespaceResponse(null, null, null), mockComposer,

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/Imap4Rev1ProcessorFactory.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/Imap4Rev1ProcessorFactory.java?rev=760821&r1=760820&r2=760821&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/Imap4Rev1ProcessorFactory.java
(original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/Imap4Rev1ProcessorFactory.java
Wed Apr  1 09:06:06 2009
@@ -92,7 +92,9 @@
                 listProcessor, mailboxManagerProvider, statusResponseFactory);
         final SelectProcessor selectProcessor = new SelectProcessor(
                 searchProcessor, mailboxManagerProvider, statusResponseFactory);
-        final ImapProcessor result = new FetchProcessor(selectProcessor,
+        final NamespaceProcessor namespaceProcessor = new NamespaceProcessor(
+                selectProcessor, mailboxManagerProvider, statusResponseFactory);
+        final ImapProcessor result = new FetchProcessor(namespaceProcessor,
                 mailboxManagerProvider, statusResponseFactory);
         return result;
     }

Modified: james/imap/trunk/seda/src/test/java/org/apache/james/imap/functional/suite/AuthenticatedState.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/seda/src/test/java/org/apache/james/imap/functional/suite/AuthenticatedState.java?rev=760821&r1=760820&r2=760821&view=diff
==============================================================================
--- james/imap/trunk/seda/src/test/java/org/apache/james/imap/functional/suite/AuthenticatedState.java
(original)
+++ james/imap/trunk/seda/src/test/java/org/apache/james/imap/functional/suite/AuthenticatedState.java
Wed Apr  1 09:06:06 2009
@@ -247,4 +247,15 @@
         scriptTest("ValidNonAuthenticated", Locale.KOREA);
     }
 
+    public void testNamespaceUS() throws Exception {
+        scriptTest("Namespace", Locale.US);
+    }
+
+    public void testNamespaceITALY() throws Exception {
+        scriptTest("Namespace", Locale.ITALY);
+    }
+    
+    public void testNamespaceKOREA() throws Exception {
+        scriptTest("Namespace", Locale.KOREA);
+    }
 }

Modified: james/imap/trunk/seda/src/test/java/org/apache/james/imap/functional/suite/SelectedState.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/seda/src/test/java/org/apache/james/imap/functional/suite/SelectedState.java?rev=760821&r1=760820&r2=760821&view=diff
==============================================================================
--- james/imap/trunk/seda/src/test/java/org/apache/james/imap/functional/suite/SelectedState.java
(original)
+++ james/imap/trunk/seda/src/test/java/org/apache/james/imap/functional/suite/SelectedState.java
Wed Apr  1 09:06:06 2009
@@ -137,4 +137,16 @@
     public void testUidKOREA() throws Exception {
         scriptTest("Uid", Locale.KOREA);
     }
+    
+    public void testNamespaceUS() throws Exception {
+        scriptTest("Namespace", Locale.US);
+    }
+
+    public void testNamespaceITALY() throws Exception {
+        scriptTest("Namespace", Locale.ITALY);
+    }
+    
+    public void testNamespaceKOREA() throws Exception {
+        scriptTest("Namespace", Locale.KOREA);
+    }
 }

Added: james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/Namespace.test
URL: http://svn.apache.org/viewvc/james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/Namespace.test?rev=760821&view=auto
==============================================================================
--- james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/Namespace.test
(added)
+++ james/imap/trunk/seda/src/test/resources/org/apache/james/imap/scripts/Namespace.test
Wed Apr  1 09:06:06 2009
@@ -0,0 +1,22 @@
+################################################################
+# 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.                                           #
+################################################################
+C: A001 NAMESPACE
+S: \* NAMESPACE \(\(\"\" \".\"\)\) NIL NIL
+S: A001 OK NAMESPACE completed.
+



---------------------------------------------------------------------
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