james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r762739 - in /james/imap/trunk/processor/src: main/java/org/apache/james/imap/processor/ListProcessor.java test/java/org/apache/james/imap/processor/ListProcessorTest.java
Date Wed, 08 Apr 2009 04:10:31 GMT
Author: rdonkin
Date: Tue Apr  7 12:24:18 2009
New Revision: 762739

URL: http://svn.apache.org/viewvc?rev=762739&view=rev
Log:
Process HasChildren HasNoChildren meta data IMAP-73 https://issues.apache.org/jira/browse/IMAP-73

Modified:
    james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ListProcessor.java
    james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/ListProcessorTest.java

Modified: james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ListProcessor.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ListProcessor.java?rev=762739&r1=762738&r2=762739&view=diff
==============================================================================
--- james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ListProcessor.java
(original)
+++ james/imap/trunk/processor/src/main/java/org/apache/james/imap/processor/ListProcessor.java
Tue Apr  7 12:24:18 2009
@@ -35,6 +35,7 @@
 import org.apache.james.imap.mailbox.MailboxManagerProvider;
 import org.apache.james.imap.mailbox.MailboxMetaData;
 import org.apache.james.imap.mailbox.MailboxQuery;
+import org.apache.james.imap.mailbox.MailboxMetaData.Children;
 import org.apache.james.imap.mailbox.util.SimpleMailboxMetaData;
 import org.apache.james.imap.message.request.ListRequest;
 import org.apache.james.imap.message.response.ListResponse;
@@ -63,9 +64,9 @@
 
     protected ImapResponseMessage createResponse(boolean noInferior,
             boolean noSelect, boolean marked, boolean unmarked,
-            String hierarchyDelimiter, String mailboxName) {
+            boolean hasChildren, boolean hasNoChildren, String hierarchyDelimiter, String
mailboxName) {
         return new ListResponse(noInferior, noSelect, marked, unmarked,
-                false, false, hierarchyDelimiter, mailboxName);
+                hasChildren, hasNoChildren, hierarchyDelimiter, mailboxName);
     }
 
     protected final void doProcess(final String baseReferenceName,
@@ -151,7 +152,10 @@
         final String mailboxName = mailboxName(removeUserPrefix, prefixLength,
                 listResult);
 
-        final boolean noInferior = MailboxMetaData.Children.NO_INFERIORS.equals(listResult.inferiors());
+        final Children inferiors = listResult.inferiors();
+        final boolean noInferior = MailboxMetaData.Children.NO_INFERIORS.equals(inferiors);
+        final boolean hasChildren = MailboxMetaData.Children.HAS_CHILDREN.equals(inferiors);
+        final boolean hasNoChildren = MailboxMetaData.Children.HAS_NO_CHILDREN.equals(inferiors);
         boolean noSelect = false;
         boolean marked = false;
         boolean unmarked = false;
@@ -167,7 +171,7 @@
                 break;
         }
         responder.respond(createResponse(noInferior, noSelect, marked,
-                unmarked, delimiter, mailboxName));
+                unmarked, hasChildren, hasNoChildren, delimiter, mailboxName));
     }
 
     private String mailboxName(final boolean removeUserPrefix,

Modified: james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/ListProcessorTest.java
URL: http://svn.apache.org/viewvc/james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/ListProcessorTest.java?rev=762739&r1=762738&r2=762739&view=diff
==============================================================================
--- james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/ListProcessorTest.java
(original)
+++ james/imap/trunk/processor/src/test/java/org/apache/james/imap/processor/ListProcessorTest.java
Tue Apr  7 12:24:18 2009
@@ -69,51 +69,67 @@
     }
 
     ListResponse createResponse(boolean noinferior, boolean noselect,
-            boolean marked, boolean unmarked, String hierarchyDelimiter,
-            String mailboxName) {
+            boolean marked, boolean unmarked, boolean hasChildren,
+            boolean hasNoChildren, String hierarchyDelimiter, String mailboxName) {
         return new ListResponse(noinferior, noselect, marked, unmarked,
-                false, false, hierarchyDelimiter, mailboxName);
+                hasChildren, hasNoChildren, hierarchyDelimiter, mailboxName);
     }
 
-    void setUpResult(final boolean isNoinferiors, final MailboxMetaData.Selectability selectability,
+    void setUpResult(final MailboxMetaData.Children children, final MailboxMetaData.Selectability
selectability,
             final String hierarchyDelimiter, final String name) {
         checking(new Expectations() {{
-            oneOf(result).inferiors();will(returnValue(isNoinferiors?MailboxMetaData.Children.NO_INFERIORS:MailboxMetaData.Children.CHILDREN_ALLOWED_BUT_UNKNOWN));
+            oneOf(result).inferiors();will(returnValue(children));
             oneOf(result).getSelectability();will(returnValue(selectability));
             oneOf(result).getHierarchyDelimiter();will(returnValue(hierarchyDelimiter));
             oneOf(result).getName();will(returnValue(name));
         }});
     }
+    
+    public void testHasChildren() throws Exception {
+        setUpResult(MailboxMetaData.Children.HAS_CHILDREN, MailboxMetaData.Selectability.NONE,
".", "#INBOX");
+        checking(new Expectations() {{
+            oneOf(responder).respond(with(equal(createResponse(false, false, false, false,
true, false, ".", "#INBOX"))));
+        }});
+        processor.processResult(responder, false, 0, result);
+    }
 
+    public void testHasNoChildren() throws Exception {
+        setUpResult(MailboxMetaData.Children.HAS_NO_CHILDREN, MailboxMetaData.Selectability.NONE,
".", "#INBOX");
+        checking(new Expectations() {{
+            oneOf(responder).respond(with(equal(createResponse(false, false, false, false,
false, true, ".", "#INBOX"))));
+        }});
+        processor.processResult(responder, false, 0, result);
+    }
+    
     public void testNoInferiors() throws Exception {
-        setUpResult(true, MailboxMetaData.Selectability.NONE, ".", "#INBOX");
+        setUpResult(MailboxMetaData.Children.NO_INFERIORS, MailboxMetaData.Selectability.NONE,
".", "#INBOX");
         checking(new Expectations() {{
-            oneOf(responder).respond(with(equal(createResponse(true, false, false, false,
".", "#INBOX"))));
+            oneOf(responder).respond(with(equal(createResponse(true, false, false, false,
false, false, ".", "#INBOX"))));
         }});
         processor.processResult(responder, false, 0, result);
     }
 
     public void testNoSelect() throws Exception {
-        setUpResult(false, MailboxMetaData.Selectability.NOSELECT, ".", "#INBOX");
+        setUpResult(MailboxMetaData.Children.CHILDREN_ALLOWED_BUT_UNKNOWN, MailboxMetaData.Selectability.NOSELECT,
".", "#INBOX");
         checking(new Expectations() {{
-            oneOf(responder).respond(with(equal(createResponse(false, true, false, false,
".", "#INBOX"))));
+            oneOf(responder).respond(with(equal(createResponse(false, true, false, false,
false, false, ".", "#INBOX"))));
         }});
         processor.processResult(responder, false, 0, result);
     }
 
     public void testUnMarked() throws Exception {
-        setUpResult(false, MailboxMetaData.Selectability.UNMARKED, ".",
+        setUpResult(MailboxMetaData.Children.CHILDREN_ALLOWED_BUT_UNKNOWN, MailboxMetaData.Selectability.UNMARKED,
".",
                 "#INBOX");
         checking(new Expectations() {{
-            oneOf(responder).respond(with(equal(createResponse(false, false, false, true,
".", "#INBOX"))));
+            oneOf(responder).respond(with(equal(createResponse(false, false, false, true,
false, false, ".", "#INBOX"))));
         }});
         processor.processResult(responder, false, 0, result);
     }
 
     public void testMarked() throws Exception {
-        setUpResult(false, MailboxMetaData.Selectability.MARKED, ".", "#INBOX");
+        setUpResult(MailboxMetaData.Children.CHILDREN_ALLOWED_BUT_UNKNOWN, MailboxMetaData.Selectability.MARKED,
".", "#INBOX");
         checking(new Expectations() {{
-            oneOf(responder).respond(with(equal(createResponse(false, false, true, false,
".", "#INBOX"))));
+            oneOf(responder).respond(with(equal(createResponse(false, false, true, false,
false, false, ".", "#INBOX"))));
         }});
         processor.processResult(responder, false, 0, result);
     }



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