james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r636485 [1/3] - in /james/server/trunk/experimental-seda-imap-function/src/test: java/org/apache/james/test/functional/ resources/org/apache/james/test/functional/imap/scripts/
Date Wed, 12 Mar 2008 19:57:27 GMT
Author: rdonkin
Date: Wed Mar 12 12:57:22 2008
New Revision: 636485

URL: http://svn.apache.org/viewvc?rev=636485&view=rev
Log:
More comprehensive search test scripts.

Added:
    james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/SearchAtoms.test
    james/server/trunk/experimental-seda-imap-function/src/test/resources/org/apache/james/test/functional/imap/scripts/SearchCombinations
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=636485&r1=636484&r2=636485&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
Wed Mar 12 12:57:22 2008
@@ -20,24 +20,191 @@
 package org.apache.james.test.functional;
 
 public class CreateScript {
+    
+    public static final String RE = "Re:";
+    public static final String HEADER = "Delivered-To";
+    public static final String ANOTHER_HEADER = "Received";
+    public static final String COMMON_LETTER = "o";
+    public static final String COMMON_WORD = "the";
+    public static final String UNCOMMON_WORD = "thy";
+    public static final String UNCOMMON_PHRASE = "\"nothing worthy prove\"";
+    public static final String ANOTHER_NAME = "Robert";
+    public static final String NAME = "tim";
+    public static final String DOMAIN = "example.org";
+    public static final String ANOTHER_DOMAIN = "apache.org";
 
     public static final void main(String[] args) throws Exception {
         ScriptBuilder builder = ScriptBuilder.open("localhost", 143);
-        searchAtoms(builder);
+        searchCombinations(builder);
     }
     
+    public static void searchCombinations(ScriptBuilder builder) throws Exception {
+        setupSearch(builder);
+        builder.body(COMMON_LETTER).undraft().unflagged().answered().search();
+        builder.to(COMMON_LETTER).draft().flagged().answered().search();
+        builder.to(COMMON_LETTER).smaller(10000).all().draft().search();
+        builder.bcc(COMMON_LETTER).larger(1000).search();
+        builder.from(COMMON_LETTER).larger(1000).flagged().search();
+        builder.from(COMMON_LETTER).to(COMMON_LETTER).answered().flagged().all().body(COMMON_LETTER).sentbefore(2009,
1, 1).search();
+        builder.or().openParen().from(COMMON_LETTER).to(COMMON_LETTER).answered().flagged()
+            .all().body(COMMON_LETTER).sentbefore(2009, 1, 1).closeParen()
+            .openParen().header(HEADER, "\"\"").draft().closeParen().search();
+        builder.or().openParen().cc(COMMON_LETTER).text(COMMON_LETTER).unseen().larger(1000)
+            .all().body(COMMON_LETTER).senton(2008, 4, 8).closeParen()
+            .openParen().header(HEADER, "\"\"").draft().closeParen().search();
+        builder.or().openParen().cc(COMMON_LETTER).to(COMMON_LETTER).draft().unseen()
+            .all().text(COMMON_LETTER).sentsince(2000, 1, 1).closeParen()
+            .openParen().header(HEADER, "\"\"").draft().closeParen().search();
+        builder.or().openParen().or().openParen().or().openParen().not().text(COMMON_LETTER).cc(COMMON_LETTER).unseen().flagged()
+            .all().body(COMMON_LETTER).not().senton(2008, 3, 1).closeParen()
+            .openParen().header(HEADER, DOMAIN).flagged().closeParen().closeParen().
+            openParen().from(COMMON_LETTER).to(COMMON_LETTER).answered().flagged().all().body(COMMON_LETTER).sentbefore(2009,
1, 1)
+            .closeParen().closeParen().openParen().answered().flagged().draft().closeParen().all().deleted().search();
+        builder.or().openParen().or().openParen().or().openParen().from(COMMON_LETTER).to(COMMON_LETTER).answered().flagged()
+            .all().body(COMMON_LETTER).sentbefore(2009, 1, 1).closeParen()
+            .openParen().header(HEADER, "\"\"").draft().closeParen().closeParen().
+            openParen().from(COMMON_LETTER).to(COMMON_LETTER).answered().flagged().all().body(COMMON_LETTER).sentbefore(2009,
1, 1)
+            .closeParen().closeParen().openParen().answered().flagged().draft().closeParen().all().unanswered().search();
+        builder.quit();
+    }
     
     public static void searchAtoms(ScriptBuilder builder) throws Exception {
+        setupSearch(builder);
+        builder.all().search();
+        builder.answered().search();
+        builder.bcc(COMMON_LETTER).search();
+        builder.bcc(NAME).search();
+        builder.bcc(ANOTHER_NAME).search();
+        builder.bcc(DOMAIN).search();
+        builder.bcc(ANOTHER_DOMAIN).search();
+        builder.body(COMMON_LETTER).search();
+        builder.body(COMMON_WORD).search();
+        builder.body(UNCOMMON_WORD).search();
+        builder.body(UNCOMMON_PHRASE).search();
+        builder.cc(COMMON_LETTER).search();
+        builder.cc(NAME).search();
+        builder.cc(ANOTHER_NAME).search();
+        builder.cc(DOMAIN).search();
+        builder.cc(ANOTHER_DOMAIN).search();
+        builder.deleted().search();
+        builder.draft().search();
+        builder.flagged().search();
+        builder.from(COMMON_LETTER).search();
+        builder.from(NAME).search();
+        builder.from(ANOTHER_NAME).search();
+        builder.from(DOMAIN).search();
+        builder.from(ANOTHER_DOMAIN).search();
+        builder.header(HEADER, DOMAIN).search();
+        builder.header(HEADER, COMMON_LETTER).search();
+        builder.header(HEADER, ANOTHER_DOMAIN).search();
+        builder.header(HEADER, "\"\"").search();
+        builder.header(ANOTHER_HEADER, DOMAIN).search();
+        builder.header(ANOTHER_HEADER, COMMON_LETTER).search();
+        builder.header(ANOTHER_HEADER, ANOTHER_DOMAIN).search();
+        builder.header(ANOTHER_HEADER, "\"\"").search();
+        builder.larger(10).search();
+        builder.larger(100).search();
+        builder.larger(1000).search();
+        builder.larger(10000).search();
+        builder.larger(12500).search();
+        builder.larger(15000).search();
+        builder.larger(20000).search();
+        builder.NEW().search();
+        builder.not().flagged().search();
+        builder.msn(3, 5).search();
+        builder.msnAndDown(10).search();
+        builder.msnAndUp(17).search();
+        builder.old().search();
+        builder.or().answered().flagged().search();
+        builder.recent().search();
+        builder.seen().search();
+        builder.sentbefore(2007, 10, 10).search();
+        builder.sentbefore(2008, 1, 1).search();
+        builder.sentbefore(2008, 2, 1).search();
+        builder.sentbefore(2008, 2, 10).search();
+        builder.sentbefore(2008, 2, 20).search();
+        builder.sentbefore(2008, 2, 25).search();
+        builder.sentbefore(2008, 3, 1).search();
+        builder.sentbefore(2008, 3, 5).search();
+        builder.sentbefore(2008, 3, 10).search();
+        builder.sentbefore(2008, 4, 1).search();
+        builder.senton(2007, 10, 10).search();
+        builder.senton(2008, 1, 1).search();
+        builder.senton(2008, 2, 1).search();
+        builder.senton(2008, 2, 10).search();
+        builder.senton(2008, 2, 20).search();
+        builder.senton(2008, 2, 25).search();
+        builder.senton(2008, 3, 1).search();
+        builder.senton(2008, 3, 5).search();
+        builder.senton(2008, 3, 10).search();
+        builder.senton(2008, 4, 1).search();
+        builder.sentsince(2007, 10, 10).search();
+        builder.sentsince(2008, 1, 1).search();
+        builder.sentsince(2008, 2, 1).search();
+        builder.sentsince(2008, 2, 10).search();
+        builder.sentsince(2008, 2, 20).search();
+        builder.sentsince(2008, 2, 25).search();
+        builder.sentsince(2008, 3, 1).search();
+        builder.sentsince(2008, 3, 5).search();
+        builder.sentsince(2008, 3, 10).search();
+        builder.sentsince(2008, 4, 1).search();
+        builder.smaller(10).search();
+        builder.smaller(100).search();
+        builder.smaller(1000).search();
+        builder.smaller(10000).search();
+        builder.smaller(12500).search();
+        builder.smaller(15000).search();
+        builder.smaller(20000).search();
+        builder.subject(COMMON_LETTER).search();
+        builder.subject(COMMON_WORD).search();
+        builder.subject(UNCOMMON_PHRASE).search();
+        builder.subject(UNCOMMON_WORD).search();
+        builder.subject(RE).search();
+        builder.text(COMMON_LETTER).search();
+        builder.text(COMMON_WORD).search();
+        builder.text(UNCOMMON_PHRASE).search();
+        builder.text(UNCOMMON_WORD).search();
+        builder.text(RE).search();
+        builder.text(DOMAIN).search();
+        builder.text(ANOTHER_DOMAIN).search();
+        builder.text(ANOTHER_NAME).search();
+        builder.text(NAME).search();
+        builder.to(COMMON_LETTER).search();
+        builder.to(NAME).search();
+        builder.to(ANOTHER_NAME).search();
+        builder.to(DOMAIN).search();
+        builder.to(ANOTHER_DOMAIN).search();
+        builder.uid().msn(1, 4).search();
+        builder.unanswered().search();
+        builder.undeleted().search();
+        builder.undraft().search();
+        builder.unflagged().search();
+        builder.unseen().search();
+        builder.quit();
+    }
+
+    private static void setupSearch(ScriptBuilder builder) throws Exception {
         builder.login();
         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();
+        builder.store(builder.flags().add().flagged().range(1, 9));
+        builder.store(builder.flags().add().answered().range(1, 4));
+        builder.store(builder.flags().add().answered().range(10, 14));
+        builder.store(builder.flags().add().seen().range(1, 2));
+        builder.store(builder.flags().add().seen().range(5, 7));
+        builder.store(builder.flags().add().seen().range(10, 12));
+        builder.store(builder.flags().add().seen().range(15, 17));
+        builder.store(builder.flags().add().draft().msn(1));
+        builder.store(builder.flags().add().draft().msn(3));
+        builder.store(builder.flags().add().draft().msn(5));
+        builder.store(builder.flags().add().draft().msn(7));
+        builder.store(builder.flags().add().draft().msn(9));
+        builder.store(builder.flags().add().draft().msn(11));
+        builder.store(builder.flags().add().draft().msn(13));
+        builder.store(builder.flags().add().draft().msn(15));
+        builder.store(builder.flags().add().draft().msn(17));
+        builder.store(builder.flags().add().deleted().range(1,3));
     }
 
 

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=636485&r1=636484&r2=636485&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
Wed Mar 12 12:57:22 2008
@@ -165,6 +165,206 @@
         search = new Search();
     }
     
+    public ScriptBuilder all() {
+        search.all();
+        return this;
+    }
+    
+    public ScriptBuilder answered() {
+        search.answered();
+        return this;
+    }
+    
+    public ScriptBuilder bcc(String address) {
+        search.bcc(address);
+        return this;
+    }
+
+    public ScriptBuilder before(int year, int month, int day) {
+        search.before(year, month, day);
+        return this;
+    }
+    
+    public ScriptBuilder body(String text) {
+        search.body(text);
+        return this;
+    }    
+
+    public ScriptBuilder cc(String address) {
+        search.cc(address);
+        return this;
+    }
+
+    public ScriptBuilder deleted() {
+        search.deleted();
+        return this;
+    }
+    
+    public ScriptBuilder draft() {
+        search.draft();
+        return this;
+    }
+
+    public ScriptBuilder flagged() {
+        search.flagged();
+        return this;
+    }
+
+    public ScriptBuilder from(String address) {
+        search.from(address);
+        return this;
+    }
+
+    public ScriptBuilder header(String field, String value) {
+        search.header(field, value);
+        return this; 
+    }
+    
+    public ScriptBuilder keyword(String flag) {
+        search.keyword(flag);
+        return this;
+    }
+    
+    public ScriptBuilder larger(long size) {
+        search.larger(size);
+        return this;
+    }
+
+    public ScriptBuilder NEW() {
+        search.NEW();
+        return this;
+    }
+    
+    public ScriptBuilder not() {
+        search.not();
+        return this;
+    }
+    
+    public ScriptBuilder old() {
+        search.old();
+        return this;
+    }
+    
+    public ScriptBuilder on(int year, int month, int day) {
+        search.on(year, month, day);
+        return this;
+    }
+
+    public ScriptBuilder or() {
+        search.or();
+        return this;
+    }
+
+    public ScriptBuilder recent() {
+        search.recent();
+        return this;
+    }
+
+    public ScriptBuilder seen() {
+        search.seen();
+        return this;
+    }
+
+    public ScriptBuilder sentbefore(int year, int month, int day) {
+        search.sentbefore(year, month, day);
+        return this;
+    }
+
+    public ScriptBuilder senton(int year, int month, int day) {
+        search.senton(year, month, day);
+        return this; 
+    }
+
+    public ScriptBuilder sentsince(int year, int month, int day) {
+        search.sentsince(year, month, day);
+        return this;
+    }
+    
+    public ScriptBuilder since(int year, int month, int day) {
+        search.since(year, month, day);
+        return this; 
+    }
+    
+    public ScriptBuilder smaller(int size) {
+        search.smaller(size);
+        return this;
+    }
+
+    public ScriptBuilder subject(String address) {
+        search.subject(address);
+        return this;
+    }
+    
+    public ScriptBuilder text(String text) {
+        search.text(text);
+        return this;
+    }
+    
+    public ScriptBuilder to(String address) {
+        search.to(address);
+        return this;
+    }
+    
+    public ScriptBuilder uid() {
+        search.uid();
+        return this;
+    }
+
+    public ScriptBuilder unanswered() {
+        search.unanswered();
+        return this;
+    }
+    
+    public ScriptBuilder undeleted() {
+        search.undeleted();
+        return this;
+    }
+
+    public ScriptBuilder undraft() {
+        search.undraft();
+        return this;
+    }
+    
+    public ScriptBuilder unflagged() {
+        search.unflagged();
+        return this;
+    }
+
+    public ScriptBuilder unkeyword(String flag) {
+        search.unkeyword(flag);
+        return this;
+    }
+    
+    public ScriptBuilder unseen() {
+        search.unseen();
+        return this;
+    }
+    
+    public ScriptBuilder openParen() {
+        search.openParen();
+        return this;
+    }
+    
+    public ScriptBuilder closeParen() {
+        search.closeParen();
+        return this;
+    }
+    
+    public ScriptBuilder msn(int low, int high) {
+        search.msn(low, high);
+        return this;
+    }
+    
+    public ScriptBuilder msnAndUp(int limit) {
+        search.msnAndUp(limit);
+        return this;
+    }
+    
+    public ScriptBuilder msnAndDown(int limit) {
+        search.msnAndDown(limit);
+        return this;
+    }
+    
     public Flags flags() {
         return new Flags();
     }
@@ -322,6 +522,10 @@
         
         public Flags seen() {
             return append("\\SEEN");
+        }
+        
+        public Flags draft() {
+            return append("\\DRAFT");
         }
         
         public String command() {



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