james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r636131 - in /james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional: CreateScript.java ScriptBuilder.java
Date Tue, 11 Mar 2008 22:31:37 GMT
Author: rdonkin
Date: Tue Mar 11 15:31:30 2008
New Revision: 636131

URL: http://svn.apache.org/viewvc?rev=636131&view=rev
Log:
Added store to builder

Modified:
    james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/CreateScript.java
    james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/ScriptBuilder.java

Modified: james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/CreateScript.java
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/CreateScript.java?rev=636131&r1=636130&r2=636131&view=diff
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/CreateScript.java
(original)
+++ james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/CreateScript.java
Tue Mar 11 15:31:30 2008
@@ -23,7 +23,7 @@
 
     public static final void main(String[] args) throws Exception {
         ScriptBuilder builder = ScriptBuilder.open("localhost", 143);
-        notHeaderFetches(builder);
+        searchAtoms(builder);
     }
     
     
@@ -32,7 +32,11 @@
         builder.create();
         builder.select();
         loadLotsOfMail(builder);
-
+        builder.store(builder.flags().flagged().answered().range(3, 6));
+        builder.getSearch().all();
+        builder.search();
+        builder.getSearch().answered();
+        builder.search();
         builder.quit();
     }
 

Modified: james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/ScriptBuilder.java
URL: http://svn.apache.org/viewvc/james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/ScriptBuilder.java?rev=636131&r1=636130&r2=636131&view=diff
==============================================================================
--- james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/ScriptBuilder.java
(original)
+++ james/server/trunk/experimental-seda-imap-function/src/test/java/org/apache/james/test/functional/ScriptBuilder.java
Tue Mar 11 15:31:30 2008
@@ -162,6 +162,16 @@
     
     public void search() throws Exception {
         command(search.command());
+        search = new Search();
+    }
+    
+    public Flags flags() {
+        return new Flags();
+    }
+    
+    public void store(Flags flags) throws Exception {
+        String command = flags.command();
+        command(command);
     }
     
     public Search getSearch() throws Exception {
@@ -235,6 +245,109 @@
         delete();
         logout();
         close();
+    }
+    
+    public static final class Flags {
+        private StringBuffer flags;
+        private StringBuffer msn;
+        private boolean first;
+        private boolean silent;
+        private boolean add;
+        private boolean subtract;
+        
+        public Flags() {
+            add = false;
+            subtract = false;
+            silent = false;
+            first = true;
+            flags = new StringBuffer("(");
+            msn = new StringBuffer();
+        }
+        
+        public Flags msn(long number) {
+            msn.append(number);
+            msn.append(' ');
+            return this;
+        }
+        
+        public Flags range(long low, long high) {
+            msn.append(low);
+            msn.append(':');
+            msn.append(high);
+            msn.append(' ');
+            return this;
+        }
+        
+        public Flags rangeTill(long number) {
+            msn.append("*:");
+            msn.append(number);
+            msn.append(' ');
+            return this;
+        }
+        
+        public Flags rangeFrom(long number) {
+            msn.append(number);
+            msn.append(":* ");
+            return this;
+        }
+        
+        public Flags add() {
+            add = true;
+            subtract = false;
+            return this;
+        }
+        
+        public Flags subtract() {
+            add = false;
+            subtract = true;
+            return this;
+        }
+        
+        public Flags silent() {
+            silent = true;
+            return this;
+        }
+        
+        public Flags deleted() {
+            return append("\\DELETED");
+        }
+        
+        public Flags flagged() {
+            return append("\\FLAGGED");
+        }
+        
+        public Flags answered() {
+            return append("\\ANSWERED");
+        }
+        
+        public Flags seen() {
+            return append("\\SEEN");
+        }
+        
+        public String command() {
+            String flags;
+            if (add) {
+                flags =" +FLAGS " ;
+            } else if (subtract) {
+                flags =" -FLAGS " ;
+            } else {
+                flags = " FLAGS ";
+            }
+            if (silent) {
+                flags = flags + ".SILENT";
+            }
+            return "STORE " + msn + flags + this.flags + ")";
+        }
+        
+        private Flags append(String term) {
+            if (first) {
+                first = false;
+            } else {
+                flags.append(' ');
+            }
+            flags.append(term);
+            return this;
+        }
     }
     
     public static final class Search {



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