james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r635205 - in /james/server/trunk: core-library/src/main/java/org/apache/james/mailboxmanager/mailbox/ core-library/src/main/java/org/apache/james/mailboxmanager/util/ torque-mailboxmanager-function/src/main/java/org/apache/james/mailboxmana...
Date Sun, 09 Mar 2008 09:36:19 GMT
Author: rdonkin
Date: Sun Mar  9 01:36:16 2008
New Revision: 635205

URL: http://svn.apache.org/viewvc?rev=635205&view=rev
Log:
Converted to a POJO so that log can be injected.

Added:
    james/server/trunk/torque-mailboxmanager-function/src/main/java/org/apache/james/mailboxmanager/torque/MessageSearches.java
      - copied, changed from r635199, james/server/trunk/torque-mailboxmanager-function/src/main/java/org/apache/james/mailboxmanager/torque/SearchUtils.java
Removed:
    james/server/trunk/torque-mailboxmanager-function/src/main/java/org/apache/james/mailboxmanager/torque/SearchUtils.java
Modified:
    james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/mailbox/AbstractImapMailbox.java
    james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/util/AbstractLogFactoryAware.java
    james/server/trunk/torque-mailboxmanager-function/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java
    james/server/trunk/torque-mailboxmanager-function/src/test/java/org/apache/james/mailboxmanager/torque/SearchUtilsMultipartMixedTest.java
    james/server/trunk/torque-mailboxmanager-function/src/test/java/org/apache/james/mailboxmanager/torque/SearchUtilsRFC822Test.java
    james/server/trunk/torque-mailboxmanager-function/src/test/java/org/apache/james/mailboxmanager/torque/SearchUtilsTest.java

Modified: james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/mailbox/AbstractImapMailbox.java
URL: http://svn.apache.org/viewvc/james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/mailbox/AbstractImapMailbox.java?rev=635205&r1=635204&r2=635205&view=diff
==============================================================================
--- james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/mailbox/AbstractImapMailbox.java (original)
+++ james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/mailbox/AbstractImapMailbox.java Sun Mar  9 01:36:16 2008
@@ -29,7 +29,6 @@
 import org.apache.james.mailboxmanager.MailboxManagerException;
 import org.apache.james.mailboxmanager.MailboxSession;
 import org.apache.james.mailboxmanager.MessageResult;
-import org.apache.james.mailboxmanager.MessageResult.FetchGroup;
 import org.apache.james.mailboxmanager.impl.FetchGroupImpl;
 import org.apache.james.mailboxmanager.impl.GeneralMessageSetImpl;
 import org.apache.james.mailboxmanager.util.AbstractLogFactoryAware;

Modified: james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/util/AbstractLogFactoryAware.java
URL: http://svn.apache.org/viewvc/james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/util/AbstractLogFactoryAware.java?rev=635205&r1=635204&r2=635205&view=diff
==============================================================================
--- james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/util/AbstractLogFactoryAware.java (original)
+++ james/server/trunk/core-library/src/main/java/org/apache/james/mailboxmanager/util/AbstractLogFactoryAware.java Sun Mar  9 01:36:16 2008
@@ -62,7 +62,7 @@
 
     public void enableLogging(Logger logger) {
         this.logFactory=new AvalonLogFactory(logger);
-        this.log=logFactory.getLog();
+        setLog(logFactory.getLog());
     }
     
     

Copied: james/server/trunk/torque-mailboxmanager-function/src/main/java/org/apache/james/mailboxmanager/torque/MessageSearches.java (from r635199, james/server/trunk/torque-mailboxmanager-function/src/main/java/org/apache/james/mailboxmanager/torque/SearchUtils.java)
URL: http://svn.apache.org/viewvc/james/server/trunk/torque-mailboxmanager-function/src/main/java/org/apache/james/mailboxmanager/torque/MessageSearches.java?p2=james/server/trunk/torque-mailboxmanager-function/src/main/java/org/apache/james/mailboxmanager/torque/MessageSearches.java&p1=james/server/trunk/torque-mailboxmanager-function/src/main/java/org/apache/james/mailboxmanager/torque/SearchUtils.java&r1=635199&r2=635205&rev=635205&view=diff
==============================================================================
--- james/server/trunk/torque-mailboxmanager-function/src/main/java/org/apache/james/mailboxmanager/torque/SearchUtils.java (original)
+++ james/server/trunk/torque-mailboxmanager-function/src/main/java/org/apache/james/mailboxmanager/torque/MessageSearches.java Sun Mar  9 01:36:16 2008
@@ -31,6 +31,8 @@
 
 import javax.mail.Flags;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.james.mailboxmanager.SearchQuery;
 import org.apache.james.mailboxmanager.SearchQuery.NumericRange;
 import org.apache.james.mailboxmanager.torque.om.MessageFlags;
@@ -45,8 +47,23 @@
 /**
  * Uility methods to help perform search operations.
  */
-class SearchUtils {
+class MessageSearches {
     
+    private Log log;
+    private boolean isCustomLog = false;
+    
+    public final Log getLog() {
+        if (log == null) {
+            log = LogFactory.getLog(MessageSearches.class);
+        }
+        return log;
+    }
+
+    public final void setLog(Log log) {
+        isCustomLog = true;
+        this.log = log;
+    }
+
     /**
      * Does the row match the given criteria?
      * @param query <code>SearchQuery</code>, not null
@@ -55,7 +72,7 @@
      * false otherwise
      * @throws TorqueException
      */
-    public static boolean isMatch(final SearchQuery query, final MessageRow row) throws TorqueException {
+    public boolean isMatch(final SearchQuery query, final MessageRow row) throws TorqueException {
         final List criteria = query.getCriterias();
         boolean result = true;
         if (criteria != null) {
@@ -78,7 +95,7 @@
      * false otherwise
      * @throws TorqueException
      */
-    public static boolean isMatch(SearchQuery.Criterion criterion, MessageRow row) throws TorqueException {
+    public boolean isMatch(SearchQuery.Criterion criterion, MessageRow row) throws TorqueException {
         final boolean result;
         if (criterion instanceof SearchQuery.InternalDateCriterion) {
             result = matches((SearchQuery.InternalDateCriterion) criterion, row);
@@ -103,7 +120,7 @@
     }
     
     
-    private static boolean matches(SearchQuery.TextCriterion criterion, MessageRow row) throws TorqueException {
+    private boolean matches(SearchQuery.TextCriterion criterion, MessageRow row) throws TorqueException {
         try {
             final SearchQuery.ContainsOperator operator = criterion.getOperator();
             final String value = operator.getValue();
@@ -120,21 +137,28 @@
         }
     }
     
-    private static boolean bodyContains(String value, MessageRow row) throws TorqueException, IOException, MimeException {
+    private boolean bodyContains(String value, MessageRow row) throws TorqueException, IOException, MimeException {
         final InputStream input = MessageRowUtils.toInput(row);
-        final MessageSearcher searcher = new MessageSearcher(value, true, false);
+        final boolean result = isInMessage(value, input, false);
+        return result;
+    }
+
+    private boolean isInMessage(String value, final InputStream input, boolean header) throws IOException, MimeException {
+        final MessageSearcher searcher = new MessageSearcher(value, true, header);
+        if (isCustomLog) {
+            searcher.setLogger(log);
+        }
         final boolean result = searcher.isFoundIn(input);
         return result;
     }
 
-    private static boolean messageContains(String value, MessageRow row) throws TorqueException, IOException, MimeException {
+    private boolean messageContains(String value, MessageRow row) throws TorqueException, IOException, MimeException {
         final InputStream input = MessageRowUtils.toInput(row);
-        final MessageSearcher searcher = new MessageSearcher(value, true, true);
-        final boolean result = searcher.isFoundIn(input);
+        final boolean result = isInMessage(value, input, true);
         return result;
     }
 
-    private static boolean matches(SearchQuery.ConjunctionCriterion criterion, MessageRow row) throws TorqueException {
+    private boolean matches(SearchQuery.ConjunctionCriterion criterion, MessageRow row) throws TorqueException {
         final int type = criterion.getType();
         final List criteria = criterion.getCriteria();
         switch (type) {
@@ -145,7 +169,7 @@
         }
     }
     
-    private static boolean and(final List criteria, final MessageRow row) throws TorqueException {
+    private boolean and(final List criteria, final MessageRow row) throws TorqueException {
         boolean result = true;
         for (Iterator it = criteria.iterator(); it.hasNext();) {
             final SearchQuery.Criterion criterion = (SearchQuery.Criterion) it.next();
@@ -158,7 +182,7 @@
         return result;
     }
     
-    private static boolean or(final List criteria, final MessageRow row) throws TorqueException {
+    private boolean or(final List criteria, final MessageRow row) throws TorqueException {
         boolean result = false;
         for (Iterator it = criteria.iterator(); it.hasNext();) {
             final SearchQuery.Criterion criterion = (SearchQuery.Criterion) it.next();
@@ -171,7 +195,7 @@
         return result;
     }
     
-    private static boolean nor(final List criteria, final MessageRow row) throws TorqueException {
+    private boolean nor(final List criteria, final MessageRow row) throws TorqueException {
         boolean result = true;
         for (Iterator it = criteria.iterator(); it.hasNext();) {
             final SearchQuery.Criterion criterion = (SearchQuery.Criterion) it.next();
@@ -184,7 +208,7 @@
         return result;
     }
 
-    private static boolean matches(SearchQuery.FlagCriterion criterion, MessageRow row) throws TorqueException {
+    private boolean matches(SearchQuery.FlagCriterion criterion, MessageRow row) throws TorqueException {
         final SearchQuery.BooleanOperator operator = criterion.getOperator();
         final boolean isSet = operator.isSet();
         final Flags.Flag flag = criterion.getFlag();
@@ -208,7 +232,7 @@
         return result;
     }
     
-    private static boolean matches(SearchQuery.UidCriterion criterion, MessageRow row) throws TorqueException {
+    private boolean matches(SearchQuery.UidCriterion criterion, MessageRow row) throws TorqueException {
         final SearchQuery.InOperator operator = criterion.getOperator();
         final NumericRange[] ranges = operator.getRange();
         final long uid = row.getUid();
@@ -224,7 +248,7 @@
         return result;
     }
     
-    private static boolean matches(SearchQuery.HeaderCriterion criterion, MessageRow row) throws TorqueException {
+    private boolean matches(SearchQuery.HeaderCriterion criterion, MessageRow row) throws TorqueException {
         final SearchQuery.HeaderOperator operator = criterion.getOperator();
         final String headerName = criterion.getHeaderName();
         final boolean result;
@@ -240,7 +264,7 @@
         return result;
     }
 
-    private static boolean exists(String headerName, MessageRow row) throws TorqueException {
+    private boolean exists(String headerName, MessageRow row) throws TorqueException {
         boolean result = false;
         final List headers = row.getMessageHeaders();
         for (Iterator it = headers.iterator(); it.hasNext();) {
@@ -254,7 +278,7 @@
         return result;
     }
 
-    private static boolean matches(final SearchQuery.ContainsOperator operator, final String headerName, final MessageRow row) throws TorqueException {
+    private boolean matches(final SearchQuery.ContainsOperator operator, final String headerName, final MessageRow row) throws TorqueException {
         final String text = operator.getValue().toUpperCase();
         boolean result = false;
         final List headers = row.getMessageHeaders();
@@ -274,7 +298,7 @@
         return result;
     }
 
-    private static boolean matches(final SearchQuery.DateOperator operator, final String headerName, final MessageRow row) throws TorqueException {
+    private boolean matches(final SearchQuery.DateOperator operator, final String headerName, final MessageRow row) throws TorqueException {
         final int day = operator.getDay();
         final int month = operator.getMonth();
         final int year = operator.getYear();
@@ -298,7 +322,7 @@
         }
     }
 
-    private static String headerValue(final String headerName, final MessageRow row) throws TorqueException {
+    private String headerValue(final String headerName, final MessageRow row) throws TorqueException {
         final List headers = row.getMessageHeaders();
         String value = null;
         for (Iterator it = headers.iterator(); it.hasNext();) {
@@ -312,14 +336,14 @@
         return value;
     }
 
-    private static int toISODate(String value) throws ParseException {
+    private int toISODate(String value) throws ParseException {
         final StringReader reader = new StringReader(value);
         final DateTime dateTime = new DateTimeParser(reader).parseAll();
         final int isoFieldValue = toISODate(dateTime.getDay(), dateTime.getMonth(), dateTime.getYear());
         return isoFieldValue;
     }
     
-    private static boolean matches(SearchQuery.SizeCriterion criterion, MessageRow row) throws UnsupportedSearchException {
+    private boolean matches(SearchQuery.SizeCriterion criterion, MessageRow row) throws UnsupportedSearchException {
         final SearchQuery.NumericOperator operator = criterion.getOperator();
         final int size = row.getSize();
         final long value = operator.getValue();
@@ -332,13 +356,13 @@
         }
     }
     
-    private static boolean matches(SearchQuery.InternalDateCriterion criterion, MessageRow row) throws UnsupportedSearchException {
+    private boolean matches(SearchQuery.InternalDateCriterion criterion, MessageRow row) throws UnsupportedSearchException {
         final SearchQuery.DateOperator operator = criterion.getOperator();
         final boolean result = matchesInternalDate(operator, row);
         return result;
     }
 
-    private static boolean matchesInternalDate(final SearchQuery.DateOperator operator, final MessageRow row) throws UnsupportedSearchException {
+    private boolean matchesInternalDate(final SearchQuery.DateOperator operator, final MessageRow row) throws UnsupportedSearchException {
         final int day = operator.getDay();
         final int month = operator.getMonth();
         final int year = operator.getYear();
@@ -352,7 +376,7 @@
         }
     }
     
-    private static boolean on(final int day, final int month, final int year, final Date date) {
+    private boolean on(final int day, final int month, final int year, final Date date) {
         final Calendar gmt = getGMT();
         gmt.setTime(date);
         return day == gmt.get(Calendar.DAY_OF_MONTH) 
@@ -360,15 +384,15 @@
                             && year == gmt.get(Calendar.YEAR);
     }
     
-    private static boolean before(final int day, final int month, final int year, final Date date) {
+    private boolean before(final int day, final int month, final int year, final Date date) {
         return toISODate(date) < toISODate(day, month, year);
     }
     
-    private static boolean after(final int day, final int month, final int year, final Date date) {
+    private boolean after(final int day, final int month, final int year, final Date date) {
         return toISODate(date) > toISODate(day, month, year);
     }
     
-    private static int toISODate(final Date date) {
+    private int toISODate(final Date date) {
         final Calendar gmt = getGMT();
         gmt.setTime(date);
         final int day = gmt.get(Calendar.DAY_OF_MONTH);
@@ -378,7 +402,7 @@
         return result;
     }
     
-    private static Calendar getGMT() {
+    private Calendar getGMT() {
         return Calendar.getInstance(TimeZone.getTimeZone("GMT"), Locale.UK);
     }
     

Modified: james/server/trunk/torque-mailboxmanager-function/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java
URL: http://svn.apache.org/viewvc/james/server/trunk/torque-mailboxmanager-function/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java?rev=635205&r1=635204&r2=635205&view=diff
==============================================================================
--- james/server/trunk/torque-mailboxmanager-function/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java (original)
+++ james/server/trunk/torque-mailboxmanager-function/src/main/java/org/apache/james/mailboxmanager/torque/TorqueMailbox.java Sun Mar  9 01:36:16 2008
@@ -82,7 +82,10 @@
     
     private final ReadWriteLock lock;
     
+    private final MessageSearches searches;
+    
     TorqueMailbox(final MailboxRow mailboxRow, final ReadWriteLock lock, final Log log) {
+        this.searches = new MessageSearches();
         setLog(log);
         this.mailboxRow = mailboxRow;
         this.tracker = new UidChangeTracker(mailboxRow.getLastUid());
@@ -624,7 +627,7 @@
                         .hasNext();) {
                     final MessageRow row = (MessageRow) it.next();
                     try {
-                        if (SearchUtils.isMatch(query, row)) {
+                        if (searches.isMatch(query, row)) {
                             rows.add(row);
                         }
                     } catch (TorqueException e) {
@@ -682,5 +685,10 @@
 
     public boolean isWriteable() {
         return true;
+    }
+
+    public void setLog(Log log) {
+        super.setLog(log);
+        searches.setLog(log);
     }    
 }

Modified: james/server/trunk/torque-mailboxmanager-function/src/test/java/org/apache/james/mailboxmanager/torque/SearchUtilsMultipartMixedTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/torque-mailboxmanager-function/src/test/java/org/apache/james/mailboxmanager/torque/SearchUtilsMultipartMixedTest.java?rev=635205&r1=635204&r2=635205&view=diff
==============================================================================
--- james/server/trunk/torque-mailboxmanager-function/src/test/java/org/apache/james/mailboxmanager/torque/SearchUtilsMultipartMixedTest.java (original)
+++ james/server/trunk/torque-mailboxmanager-function/src/test/java/org/apache/james/mailboxmanager/torque/SearchUtilsMultipartMixedTest.java Sun Mar  9 01:36:16 2008
@@ -106,6 +106,7 @@
     
     
     MessageRow row;
+    MessageSearches searches;
     
     protected void setUp() throws Exception {
         super.setUp();
@@ -116,6 +117,7 @@
         row.addMessageHeader(new MessageHeader(RFC2822Headers.DATE, "Thu, 14 Feb 2008 12:00:00 +0000 (GMT)"));
         row.addMessageHeader(new MessageHeader("Content-Type", "multipart/mixed;boundary=1729"));
         row.addMessageBody(new MessageBody(Charset.forName("us-ascii").encode(BODY).array()));
+        searches = new MessageSearches();
     }
 
     protected void tearDown() throws Exception {
@@ -123,54 +125,54 @@
     }
     
     public void testShouldNotFindWhatIsNotThere() throws Exception {
-        assertFalse(SearchUtils.isMatch(SearchQuery.bodyContains("BOGUS"), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.mailContains("BOGUS"), row));
+        assertFalse(searches.isMatch(SearchQuery.bodyContains("BOGUS"), row));
+        assertFalse(searches.isMatch(SearchQuery.mailContains("BOGUS"), row));
     }
     
     public void testBodyShouldFindTextInBody() throws Exception {
-        assertTrue(SearchUtils.isMatch(SearchQuery.bodyContains(SAMPLE_INNER_MAIL_BODY_ONE), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.bodyContains(SAMPLE_PART_ONE), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.bodyContains(SAMPLE_PART_TWO), row));
+        assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_INNER_MAIL_BODY_ONE), row));
+        assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_ONE), row));
+        assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_TWO), row));
     }
     
     public void testBodyShouldFindTextInBodyCaseInsensitive() throws Exception {
-        assertTrue(SearchUtils.isMatch(SearchQuery.bodyContains(SAMPLE_INNER_MAIL_BODY_ONE), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.bodyContains(SAMPLE_PART_ONE), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.bodyContains(SAMPLE_PART_TWO), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.bodyContains(SAMPLE_INNER_MAIL_BODY_ONE.toLowerCase()), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.bodyContains(SAMPLE_PART_ONE.toLowerCase()), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.bodyContains(SAMPLE_PART_TWO.toLowerCase()), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.bodyContains(SAMPLE_INNER_MAIL_BODY_ONE.toUpperCase()), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.bodyContains(SAMPLE_PART_ONE.toUpperCase()), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.bodyContains(SAMPLE_PART_TWO.toUpperCase()), row));
+        assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_INNER_MAIL_BODY_ONE), row));
+        assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_ONE), row));
+        assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_TWO), row));
+        assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_INNER_MAIL_BODY_ONE.toLowerCase()), row));
+        assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_ONE.toLowerCase()), row));
+        assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_TWO.toLowerCase()), row));
+        assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_INNER_MAIL_BODY_ONE.toUpperCase()), row));
+        assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_ONE.toUpperCase()), row));
+        assertTrue(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_TWO.toUpperCase()), row));
     }
     
     public void testBodyShouldNotFindTextInHeaders() throws Exception {
-        assertFalse(SearchUtils.isMatch(SearchQuery.bodyContains(SAMPLE_INNER_MAIL_FIELD), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.bodyContains(SAMPLE_PART_TWO_FIELD), row));
+        assertFalse(searches.isMatch(SearchQuery.bodyContains(SAMPLE_INNER_MAIL_FIELD), row));
+        assertFalse(searches.isMatch(SearchQuery.bodyContains(SAMPLE_PART_TWO_FIELD), row));
     }
     
     public void testTextShouldFindTextInBody() throws Exception {
-        assertTrue(SearchUtils.isMatch(SearchQuery.mailContains(SAMPLE_INNER_MAIL_BODY_ONE), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.mailContains(SAMPLE_PART_ONE), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.mailContains(SAMPLE_PART_TWO), row));
+        assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_INNER_MAIL_BODY_ONE), row));
+        assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_ONE), row));
+        assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_TWO), row));
     }
     
     public void testTextShouldFindTextInBodyCaseInsensitive() throws Exception {
-        assertTrue(SearchUtils.isMatch(SearchQuery.mailContains(SAMPLE_INNER_MAIL_BODY_ONE), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.mailContains(SAMPLE_PART_ONE), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.mailContains(SAMPLE_PART_TWO), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.mailContains(SAMPLE_INNER_MAIL_BODY_ONE.toLowerCase()), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.mailContains(SAMPLE_PART_ONE.toLowerCase()), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.mailContains(SAMPLE_PART_TWO.toLowerCase()), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.mailContains(SAMPLE_INNER_MAIL_BODY_ONE.toUpperCase()), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.mailContains(SAMPLE_PART_ONE.toUpperCase()), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.mailContains(SAMPLE_PART_TWO.toUpperCase()), row));
+        assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_INNER_MAIL_BODY_ONE), row));
+        assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_ONE), row));
+        assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_TWO), row));
+        assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_INNER_MAIL_BODY_ONE.toLowerCase()), row));
+        assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_ONE.toLowerCase()), row));
+        assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_TWO.toLowerCase()), row));
+        assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_INNER_MAIL_BODY_ONE.toUpperCase()), row));
+        assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_ONE.toUpperCase()), row));
+        assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_TWO.toUpperCase()), row));
     }
     
     public void testTextShouldFindTextInHeaders() throws Exception {
-        assertTrue(SearchUtils.isMatch(SearchQuery.mailContains(SAMPLE_INNER_MAIL_FIELD), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.mailContains(SAMPLE_INNER_MAIL_BODY_ONE), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.mailContains(SAMPLE_PART_TWO_FIELD), row));
+        assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_INNER_MAIL_FIELD), row));
+        assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_INNER_MAIL_BODY_ONE), row));
+        assertTrue(searches.isMatch(SearchQuery.mailContains(SAMPLE_PART_TWO_FIELD), row));
     }
 }

Modified: james/server/trunk/torque-mailboxmanager-function/src/test/java/org/apache/james/mailboxmanager/torque/SearchUtilsRFC822Test.java
URL: http://svn.apache.org/viewvc/james/server/trunk/torque-mailboxmanager-function/src/test/java/org/apache/james/mailboxmanager/torque/SearchUtilsRFC822Test.java?rev=635205&r1=635204&r2=635205&view=diff
==============================================================================
--- james/server/trunk/torque-mailboxmanager-function/src/test/java/org/apache/james/mailboxmanager/torque/SearchUtilsRFC822Test.java (original)
+++ james/server/trunk/torque-mailboxmanager-function/src/test/java/org/apache/james/mailboxmanager/torque/SearchUtilsRFC822Test.java Sun Mar  9 01:36:16 2008
@@ -41,6 +41,7 @@
             "It needs naught else.\r\n";
     
     MessageRow row;
+    MessageSearches searches;
     
     protected void setUp() throws Exception {
         super.setUp();
@@ -50,6 +51,7 @@
         row.addMessageHeader(new MessageHeader(RFC2822Headers.SUBJECT, "A " + SUBJECT_PART +" Multipart Mail"));
         row.addMessageHeader(new MessageHeader(RFC2822Headers.DATE, "Thu, 14 Feb 2008 12:00:00 +0000 (GMT)"));
         row.addMessageBody(new MessageBody(Charset.forName("us-ascii").encode(BODY).array()));
+        searches = new MessageSearches();
     }
 
     protected void tearDown() throws Exception {
@@ -57,34 +59,34 @@
     }
     
     public void testBodyShouldMatchPhraseInBody() throws Exception {
-        assertTrue(SearchUtils.isMatch(SearchQuery.bodyContains(CUSTARD), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.bodyContains(CUSTARD + CUSTARD), row));
+        assertTrue(searches.isMatch(SearchQuery.bodyContains(CUSTARD), row));
+        assertFalse(searches.isMatch(SearchQuery.bodyContains(CUSTARD + CUSTARD), row));
     }
     
     public void testBodyMatchShouldBeCaseInsensitive() throws Exception {
-        assertTrue(SearchUtils.isMatch(SearchQuery.bodyContains(RHUBARD), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.bodyContains(RHUBARD.toLowerCase()), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.bodyContains(RHUBARD.toLowerCase()), row));
+        assertTrue(searches.isMatch(SearchQuery.bodyContains(RHUBARD), row));
+        assertTrue(searches.isMatch(SearchQuery.bodyContains(RHUBARD.toLowerCase()), row));
+        assertTrue(searches.isMatch(SearchQuery.bodyContains(RHUBARD.toLowerCase()), row));
     }
     
     public void testBodyShouldNotMatchPhraseOnlyInHeader() throws Exception {
-        assertFalse(SearchUtils.isMatch(SearchQuery.bodyContains(FROM_ADDRESS), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.bodyContains(SUBJECT_PART), row));
+        assertFalse(searches.isMatch(SearchQuery.bodyContains(FROM_ADDRESS), row));
+        assertFalse(searches.isMatch(SearchQuery.bodyContains(SUBJECT_PART), row));
     }
     
     public void testTextShouldMatchPhraseInBody() throws Exception {
-        assertTrue(SearchUtils.isMatch(SearchQuery.mailContains(CUSTARD), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.mailContains(CUSTARD + CUSTARD), row));
+        assertTrue(searches.isMatch(SearchQuery.mailContains(CUSTARD), row));
+        assertFalse(searches.isMatch(SearchQuery.mailContains(CUSTARD + CUSTARD), row));
     }
     
     public void testTextMatchShouldBeCaseInsensitive() throws Exception {
-        assertTrue(SearchUtils.isMatch(SearchQuery.mailContains(RHUBARD), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.mailContains(RHUBARD.toLowerCase()), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.mailContains(RHUBARD.toLowerCase()), row));
+        assertTrue(searches.isMatch(SearchQuery.mailContains(RHUBARD), row));
+        assertTrue(searches.isMatch(SearchQuery.mailContains(RHUBARD.toLowerCase()), row));
+        assertTrue(searches.isMatch(SearchQuery.mailContains(RHUBARD.toLowerCase()), row));
     }
     
     public void testBodyShouldMatchPhraseOnlyInHeader() throws Exception {
-        assertTrue(SearchUtils.isMatch(SearchQuery.mailContains(FROM_ADDRESS), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.mailContains(SUBJECT_PART), row));
+        assertTrue(searches.isMatch(SearchQuery.mailContains(FROM_ADDRESS), row));
+        assertTrue(searches.isMatch(SearchQuery.mailContains(SUBJECT_PART), row));
     }
 }

Modified: james/server/trunk/torque-mailboxmanager-function/src/test/java/org/apache/james/mailboxmanager/torque/SearchUtilsTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/torque-mailboxmanager-function/src/test/java/org/apache/james/mailboxmanager/torque/SearchUtilsTest.java?rev=635205&r1=635204&r2=635205&view=diff
==============================================================================
--- james/server/trunk/torque-mailboxmanager-function/src/test/java/org/apache/james/mailboxmanager/torque/SearchUtilsTest.java (original)
+++ james/server/trunk/torque-mailboxmanager-function/src/test/java/org/apache/james/mailboxmanager/torque/SearchUtilsTest.java Sun Mar  9 01:36:16 2008
@@ -44,10 +44,12 @@
     private static final String TEXT = RHUBARD + RHUBARD + RHUBARD;
     
     MessageRow row;
+    MessageSearches searches;
     
     protected void setUp() throws Exception {
         super.setUp();
         row = new MessageRow();
+        searches = new MessageSearches();
     }
 
     protected void tearDown() throws Exception {
@@ -56,367 +58,367 @@
     
     public void testMatchSizeLessThan() throws Exception {
         row.setSize(SIZE);
-        assertFalse(SearchUtils.isMatch(SearchQuery.sizeLessThan(SIZE - 1), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.sizeLessThan(SIZE), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.sizeLessThan(SIZE + 1), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.sizeLessThan(Integer.MAX_VALUE), row));
+        assertFalse(searches.isMatch(SearchQuery.sizeLessThan(SIZE - 1), row));
+        assertFalse(searches.isMatch(SearchQuery.sizeLessThan(SIZE), row));
+        assertTrue(searches.isMatch(SearchQuery.sizeLessThan(SIZE + 1), row));
+        assertTrue(searches.isMatch(SearchQuery.sizeLessThan(Integer.MAX_VALUE), row));
     }
     
     public void testMatchSizeMoreThan() throws Exception {
         row.setSize(SIZE);
-        assertTrue(SearchUtils.isMatch(SearchQuery.sizeGreaterThan(SIZE - 1), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.sizeGreaterThan(SIZE), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.sizeGreaterThan(SIZE + 1), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.sizeGreaterThan(Integer.MAX_VALUE), row));
+        assertTrue(searches.isMatch(SearchQuery.sizeGreaterThan(SIZE - 1), row));
+        assertFalse(searches.isMatch(SearchQuery.sizeGreaterThan(SIZE), row));
+        assertFalse(searches.isMatch(SearchQuery.sizeGreaterThan(SIZE + 1), row));
+        assertFalse(searches.isMatch(SearchQuery.sizeGreaterThan(Integer.MAX_VALUE), row));
     }
     
     public void testMatchSizeEquals() throws Exception {
         row.setSize(SIZE);
-        assertFalse(SearchUtils.isMatch(SearchQuery.sizeEquals(SIZE - 1), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.sizeEquals(SIZE), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.sizeEquals(SIZE + 1), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.sizeEquals(Integer.MAX_VALUE), row));
+        assertFalse(searches.isMatch(SearchQuery.sizeEquals(SIZE - 1), row));
+        assertTrue(searches.isMatch(SearchQuery.sizeEquals(SIZE), row));
+        assertFalse(searches.isMatch(SearchQuery.sizeEquals(SIZE + 1), row));
+        assertFalse(searches.isMatch(SearchQuery.sizeEquals(Integer.MAX_VALUE), row));
     }
     
     public void testMatchInternalDateEquals() throws Exception {
         row.setInternalDate(SUN_SEP_9TH_2001);
-        assertFalse(SearchUtils.isMatch(SearchQuery.internalDateOn(9, 9, 2000), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.internalDateOn(8, 9, 2001), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.internalDateOn(9, 9, 2001), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.internalDateOn(10, 9, 2001), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.internalDateOn(9, 9, 2002), row));
+        assertFalse(searches.isMatch(SearchQuery.internalDateOn(9, 9, 2000), row));
+        assertFalse(searches.isMatch(SearchQuery.internalDateOn(8, 9, 2001), row));
+        assertTrue(searches.isMatch(SearchQuery.internalDateOn(9, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.internalDateOn(10, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.internalDateOn(9, 9, 2002), row));
     }
     
     public void testMatchInternalDateBefore() throws Exception {
         row.setInternalDate(SUN_SEP_9TH_2001);
-        assertFalse(SearchUtils.isMatch(SearchQuery.internalDateBefore(9, 9, 2000), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.internalDateBefore(8, 9, 2001), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.internalDateBefore(9, 9, 2001), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.internalDateBefore(10, 9, 2001), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.internalDateBefore(9, 9, 2002), row));
+        assertFalse(searches.isMatch(SearchQuery.internalDateBefore(9, 9, 2000), row));
+        assertFalse(searches.isMatch(SearchQuery.internalDateBefore(8, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.internalDateBefore(9, 9, 2001), row));
+        assertTrue(searches.isMatch(SearchQuery.internalDateBefore(10, 9, 2001), row));
+        assertTrue(searches.isMatch(SearchQuery.internalDateBefore(9, 9, 2002), row));
     }
         
     public void testMatchInternalDateAfter() throws Exception {
         row.setInternalDate(SUN_SEP_9TH_2001);
-        assertTrue(SearchUtils.isMatch(SearchQuery.internalDateAfter(9, 9, 2000), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.internalDateAfter(8, 9, 2001), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.internalDateAfter(9, 9, 2001), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.internalDateAfter(10, 9, 2001), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.internalDateAfter(9, 9, 2002), row));
+        assertTrue(searches.isMatch(SearchQuery.internalDateAfter(9, 9, 2000), row));
+        assertTrue(searches.isMatch(SearchQuery.internalDateAfter(8, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.internalDateAfter(9, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.internalDateAfter(10, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.internalDateAfter(9, 9, 2002), row));
     }
     
     public void testMatchHeaderDateAfter() throws Exception {
         addHeader(DATE_FIELD, RFC822_SUN_SEP_9TH_2001);
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerDateAfter(DATE_FIELD, 9, 9, 2000), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerDateAfter(DATE_FIELD,8, 9, 2001), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateAfter(DATE_FIELD,9, 9, 2001), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateAfter(DATE_FIELD,10, 9, 2001), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateAfter(DATE_FIELD,9, 9, 2002), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateAfter("BOGUS",9, 9, 2001), row));
+        assertTrue(searches.isMatch(SearchQuery.headerDateAfter(DATE_FIELD, 9, 9, 2000), row));
+        assertTrue(searches.isMatch(SearchQuery.headerDateAfter(DATE_FIELD,8, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateAfter(DATE_FIELD,9, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateAfter(DATE_FIELD,10, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateAfter(DATE_FIELD,9, 9, 2002), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateAfter("BOGUS",9, 9, 2001), row));
     }
     
     public void testShouldMatchCapsHeaderDateAfter() throws Exception {
         addHeader(DATE_FIELD.toUpperCase(), RFC822_SUN_SEP_9TH_2001);
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerDateAfter(DATE_FIELD, 9, 9, 2000), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerDateAfter(DATE_FIELD,8, 9, 2001), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateAfter(DATE_FIELD,9, 9, 2001), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateAfter(DATE_FIELD,10, 9, 2001), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateAfter(DATE_FIELD,9, 9, 2002), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateAfter("BOGUS",9, 9, 2001), row));
+        assertTrue(searches.isMatch(SearchQuery.headerDateAfter(DATE_FIELD, 9, 9, 2000), row));
+        assertTrue(searches.isMatch(SearchQuery.headerDateAfter(DATE_FIELD,8, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateAfter(DATE_FIELD,9, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateAfter(DATE_FIELD,10, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateAfter(DATE_FIELD,9, 9, 2002), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateAfter("BOGUS",9, 9, 2001), row));
     }
     
     public void testShouldMatchLowersHeaderDateAfter() throws Exception {
         addHeader(DATE_FIELD.toLowerCase(), RFC822_SUN_SEP_9TH_2001);
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerDateAfter(DATE_FIELD, 9, 9, 2000), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerDateAfter(DATE_FIELD,8, 9, 2001), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateAfter(DATE_FIELD,9, 9, 2001), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateAfter(DATE_FIELD,10, 9, 2001), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateAfter(DATE_FIELD,9, 9, 2002), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateAfter("BOGUS",9, 9, 2001), row));
+        assertTrue(searches.isMatch(SearchQuery.headerDateAfter(DATE_FIELD, 9, 9, 2000), row));
+        assertTrue(searches.isMatch(SearchQuery.headerDateAfter(DATE_FIELD,8, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateAfter(DATE_FIELD,9, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateAfter(DATE_FIELD,10, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateAfter(DATE_FIELD,9, 9, 2002), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateAfter("BOGUS",9, 9, 2001), row));
     }
     
     public void testMatchHeaderDateOn() throws Exception {
         addHeader(DATE_FIELD, RFC822_SUN_SEP_9TH_2001);
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateOn(DATE_FIELD, 9, 9, 2000), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateOn(DATE_FIELD,8, 9, 2001), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerDateOn(DATE_FIELD,9, 9, 2001), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateOn(DATE_FIELD,10, 9, 2001), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateOn(DATE_FIELD,9, 9, 2002), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateOn("BOGUS",9, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateOn(DATE_FIELD, 9, 9, 2000), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateOn(DATE_FIELD,8, 9, 2001), row));
+        assertTrue(searches.isMatch(SearchQuery.headerDateOn(DATE_FIELD,9, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateOn(DATE_FIELD,10, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateOn(DATE_FIELD,9, 9, 2002), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateOn("BOGUS",9, 9, 2001), row));
     }
     
     public void testShouldMatchCapsHeaderDateOn() throws Exception {
         addHeader(DATE_FIELD.toUpperCase(), RFC822_SUN_SEP_9TH_2001);
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateOn(DATE_FIELD, 9, 9, 2000), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateOn(DATE_FIELD,8, 9, 2001), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerDateOn(DATE_FIELD,9, 9, 2001), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateOn(DATE_FIELD,10, 9, 2001), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateOn(DATE_FIELD,9, 9, 2002), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateOn("BOGUS",9, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateOn(DATE_FIELD, 9, 9, 2000), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateOn(DATE_FIELD,8, 9, 2001), row));
+        assertTrue(searches.isMatch(SearchQuery.headerDateOn(DATE_FIELD,9, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateOn(DATE_FIELD,10, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateOn(DATE_FIELD,9, 9, 2002), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateOn("BOGUS",9, 9, 2001), row));
      }
     
     public void testShouldMatchLowersHeaderDateOn() throws Exception {
         addHeader(DATE_FIELD.toLowerCase(), RFC822_SUN_SEP_9TH_2001);
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateOn(DATE_FIELD, 9, 9, 2000), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateOn(DATE_FIELD,8, 9, 2001), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerDateOn(DATE_FIELD,9, 9, 2001), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateOn(DATE_FIELD,10, 9, 2001), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateOn(DATE_FIELD,9, 9, 2002), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateOn("BOGUS",9, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateOn(DATE_FIELD, 9, 9, 2000), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateOn(DATE_FIELD,8, 9, 2001), row));
+        assertTrue(searches.isMatch(SearchQuery.headerDateOn(DATE_FIELD,9, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateOn(DATE_FIELD,10, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateOn(DATE_FIELD,9, 9, 2002), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateOn("BOGUS",9, 9, 2001), row));
     }
     
     
     public void testMatchHeaderDateBefore() throws Exception {
         addHeader(DATE_FIELD, RFC822_SUN_SEP_9TH_2001);
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateBefore(DATE_FIELD, 9, 9, 2000), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateBefore(DATE_FIELD,8, 9, 2001), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateBefore(DATE_FIELD,9, 9, 2001), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerDateBefore(DATE_FIELD,10, 9, 2001), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerDateBefore(DATE_FIELD,9, 9, 2002), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateBefore("BOGUS",9, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateBefore(DATE_FIELD, 9, 9, 2000), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateBefore(DATE_FIELD,8, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateBefore(DATE_FIELD,9, 9, 2001), row));
+        assertTrue(searches.isMatch(SearchQuery.headerDateBefore(DATE_FIELD,10, 9, 2001), row));
+        assertTrue(searches.isMatch(SearchQuery.headerDateBefore(DATE_FIELD,9, 9, 2002), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateBefore("BOGUS",9, 9, 2001), row));
     }
     
     public void testShouldMatchCapsHeaderDateBefore() throws Exception {
         addHeader(DATE_FIELD.toUpperCase(), RFC822_SUN_SEP_9TH_2001);
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateBefore(DATE_FIELD, 9, 9, 2000), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateBefore(DATE_FIELD,8, 9, 2001), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateBefore(DATE_FIELD,9, 9, 2001), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerDateBefore(DATE_FIELD,10, 9, 2001), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerDateBefore(DATE_FIELD,9, 9, 2002), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateBefore("BOGUS",9, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateBefore(DATE_FIELD, 9, 9, 2000), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateBefore(DATE_FIELD,8, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateBefore(DATE_FIELD,9, 9, 2001), row));
+        assertTrue(searches.isMatch(SearchQuery.headerDateBefore(DATE_FIELD,10, 9, 2001), row));
+        assertTrue(searches.isMatch(SearchQuery.headerDateBefore(DATE_FIELD,9, 9, 2002), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateBefore("BOGUS",9, 9, 2001), row));
     }
     
     public void testShouldMatchLowersHeaderDateBefore() throws Exception {
         addHeader(DATE_FIELD.toLowerCase(), RFC822_SUN_SEP_9TH_2001);
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateBefore(DATE_FIELD, 9, 9, 2000), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateBefore(DATE_FIELD,8, 9, 2001), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateBefore(DATE_FIELD,9, 9, 2001), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerDateBefore(DATE_FIELD,10, 9, 2001), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerDateBefore(DATE_FIELD,9, 9, 2002), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerDateBefore("BOGUS",9, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateBefore(DATE_FIELD, 9, 9, 2000), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateBefore(DATE_FIELD,8, 9, 2001), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateBefore(DATE_FIELD,9, 9, 2001), row));
+        assertTrue(searches.isMatch(SearchQuery.headerDateBefore(DATE_FIELD,10, 9, 2001), row));
+        assertTrue(searches.isMatch(SearchQuery.headerDateBefore(DATE_FIELD,9, 9, 2002), row));
+        assertFalse(searches.isMatch(SearchQuery.headerDateBefore("BOGUS",9, 9, 2001), row));
     }
     
     public void testMatchHeaderContainsCaps() throws Exception {
         addHeader(SUBJECT_FIELD, TEXT.toUpperCase());
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerContains(DATE_FIELD, CUSTARD), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerContains(DATE_FIELD, TEXT), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, TEXT), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, RHUBARD), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, CUSTARD), row)); 
+        assertFalse(searches.isMatch(SearchQuery.headerContains(DATE_FIELD, CUSTARD), row));
+        assertFalse(searches.isMatch(SearchQuery.headerContains(DATE_FIELD, TEXT), row));
+        assertTrue(searches.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, TEXT), row));
+        assertTrue(searches.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, RHUBARD), row));
+        assertFalse(searches.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, CUSTARD), row)); 
     }
     
     public void testMatchHeaderContainsLowers() throws Exception {
         addHeader(SUBJECT_FIELD, TEXT.toLowerCase());
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerContains(DATE_FIELD, CUSTARD), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerContains(DATE_FIELD, TEXT), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, TEXT), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, RHUBARD), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, CUSTARD), row)); 
+        assertFalse(searches.isMatch(SearchQuery.headerContains(DATE_FIELD, CUSTARD), row));
+        assertFalse(searches.isMatch(SearchQuery.headerContains(DATE_FIELD, TEXT), row));
+        assertTrue(searches.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, TEXT), row));
+        assertTrue(searches.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, RHUBARD), row));
+        assertFalse(searches.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, CUSTARD), row)); 
     }
     
     public void testMatchHeaderContains() throws Exception {
         addHeader(SUBJECT_FIELD, TEXT);
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerContains(DATE_FIELD, CUSTARD), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerContains(DATE_FIELD, TEXT), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, TEXT), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, RHUBARD), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, CUSTARD), row)); 
+        assertFalse(searches.isMatch(SearchQuery.headerContains(DATE_FIELD, CUSTARD), row));
+        assertFalse(searches.isMatch(SearchQuery.headerContains(DATE_FIELD, TEXT), row));
+        assertTrue(searches.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, TEXT), row));
+        assertTrue(searches.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, RHUBARD), row));
+        assertFalse(searches.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, CUSTARD), row)); 
     }
     
     public void testShouldMatchLowerHeaderContains() throws Exception {
         addHeader(SUBJECT_FIELD.toLowerCase(), TEXT);
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerContains(DATE_FIELD, CUSTARD), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerContains(DATE_FIELD, TEXT), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, TEXT), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, RHUBARD), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, CUSTARD), row)); 
+        assertFalse(searches.isMatch(SearchQuery.headerContains(DATE_FIELD, CUSTARD), row));
+        assertFalse(searches.isMatch(SearchQuery.headerContains(DATE_FIELD, TEXT), row));
+        assertTrue(searches.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, TEXT), row));
+        assertTrue(searches.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, RHUBARD), row));
+        assertFalse(searches.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, CUSTARD), row)); 
     }
     
     public void testShouldMatchCapsHeaderContains() throws Exception {
         addHeader(SUBJECT_FIELD.toUpperCase(), TEXT);
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerContains(DATE_FIELD, CUSTARD), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerContains(DATE_FIELD, TEXT), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, TEXT), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, RHUBARD), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, CUSTARD), row)); 
+        assertFalse(searches.isMatch(SearchQuery.headerContains(DATE_FIELD, CUSTARD), row));
+        assertFalse(searches.isMatch(SearchQuery.headerContains(DATE_FIELD, TEXT), row));
+        assertTrue(searches.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, TEXT), row));
+        assertTrue(searches.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, RHUBARD), row));
+        assertFalse(searches.isMatch(SearchQuery.headerContains(SUBJECT_FIELD, CUSTARD), row)); 
     }
     
     public void testMatchHeaderExists() throws Exception {
         addHeader(SUBJECT_FIELD, TEXT);
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerExists(DATE_FIELD), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerExists(SUBJECT_FIELD), row));
+        assertFalse(searches.isMatch(SearchQuery.headerExists(DATE_FIELD), row));
+        assertTrue(searches.isMatch(SearchQuery.headerExists(SUBJECT_FIELD), row));
     }
 
     public void testShouldMatchLowersHeaderExists() throws Exception {
         addHeader(SUBJECT_FIELD.toLowerCase(), TEXT);
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerExists(DATE_FIELD), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerExists(SUBJECT_FIELD), row));
+        assertFalse(searches.isMatch(SearchQuery.headerExists(DATE_FIELD), row));
+        assertTrue(searches.isMatch(SearchQuery.headerExists(SUBJECT_FIELD), row));
     }
     
     public void testShouldMatchUppersHeaderExists() throws Exception {
         addHeader(SUBJECT_FIELD.toUpperCase(), TEXT);
-        assertFalse(SearchUtils.isMatch(SearchQuery.headerExists(DATE_FIELD), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.headerExists(SUBJECT_FIELD), row));
+        assertFalse(searches.isMatch(SearchQuery.headerExists(DATE_FIELD), row));
+        assertTrue(searches.isMatch(SearchQuery.headerExists(SUBJECT_FIELD), row));
     }
     
     public void testShouldMatchUidRange() throws Exception {
         row.setPrimaryKey(1, 1729);
-        assertFalse(SearchUtils.isMatch(SearchQuery.uid(range(1, 1)), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.uid(range(1728, 1728)), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.uid(range(1729, 1729)), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.uid(range(1730, 1730)), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.uid(range(1, 1728)), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.uid(range(1, 1729)), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.uid(range(1729, 1800)), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.uid(range(1730, Long.MAX_VALUE)), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.uid(range(1730, Long.MAX_VALUE, 1, 1728)), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.uid(range(1730, Long.MAX_VALUE, 1, 1729)), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.uid(range(1, 1728, 1800, 1810)), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.uid(range(1, 1, 1729, 1729)), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.uid(range(1, 1, 1800, 1800)), row));
+        assertFalse(searches.isMatch(SearchQuery.uid(range(1, 1)), row));
+        assertFalse(searches.isMatch(SearchQuery.uid(range(1728, 1728)), row));
+        assertTrue(searches.isMatch(SearchQuery.uid(range(1729, 1729)), row));
+        assertFalse(searches.isMatch(SearchQuery.uid(range(1730, 1730)), row));
+        assertFalse(searches.isMatch(SearchQuery.uid(range(1, 1728)), row));
+        assertTrue(searches.isMatch(SearchQuery.uid(range(1, 1729)), row));
+        assertTrue(searches.isMatch(SearchQuery.uid(range(1729, 1800)), row));
+        assertFalse(searches.isMatch(SearchQuery.uid(range(1730, Long.MAX_VALUE)), row));
+        assertFalse(searches.isMatch(SearchQuery.uid(range(1730, Long.MAX_VALUE, 1, 1728)), row));
+        assertTrue(searches.isMatch(SearchQuery.uid(range(1730, Long.MAX_VALUE, 1, 1729)), row));
+        assertFalse(searches.isMatch(SearchQuery.uid(range(1, 1728, 1800, 1810)), row));
+        assertTrue(searches.isMatch(SearchQuery.uid(range(1, 1, 1729, 1729)), row));
+        assertFalse(searches.isMatch(SearchQuery.uid(range(1, 1, 1800, 1800)), row));
     }
     
     public void testShouldMatchSeenFlagSet() throws Exception {
         setFlags(true, false, false, false, false, false);
-        assertTrue(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.SEEN), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.FLAGGED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.ANSWERED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.DRAFT), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.DELETED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.RECENT), row));
+        assertTrue(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.SEEN), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.FLAGGED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.ANSWERED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.DRAFT), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.DELETED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.RECENT), row));
     }
     
     public void testShouldMatchAnsweredFlagSet() throws Exception {
         setFlags(false, false, true, false, false, false);
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.SEEN), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.FLAGGED), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.ANSWERED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.DRAFT), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.DELETED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.RECENT), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.SEEN), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.FLAGGED), row));
+        assertTrue(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.ANSWERED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.DRAFT), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.DELETED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.RECENT), row));
     }
     
     public void testShouldMatchFlaggedFlagSet() throws Exception {
         setFlags(false, true, false, false, false, false);
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.SEEN), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.FLAGGED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.ANSWERED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.DRAFT), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.DELETED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.RECENT), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.SEEN), row));
+        assertTrue(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.FLAGGED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.ANSWERED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.DRAFT), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.DELETED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.RECENT), row));
     }
     
     public void testShouldMatchDraftFlagSet() throws Exception {
         setFlags(false, false, false, true, false, false);
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.SEEN), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.FLAGGED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.ANSWERED), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.DRAFT), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.DELETED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.RECENT), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.SEEN), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.FLAGGED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.ANSWERED), row));
+        assertTrue(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.DRAFT), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.DELETED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.RECENT), row));
     }
     
     public void testShouldMatchDeletedFlagSet() throws Exception {
         setFlags(false, false, false, false, true, false);
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.SEEN), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.FLAGGED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.ANSWERED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.DRAFT), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.DELETED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.RECENT), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.SEEN), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.FLAGGED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.ANSWERED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.DRAFT), row));
+        assertTrue(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.DELETED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.RECENT), row));
     }
     
     public void testShouldMatchSeenRecentSet() throws Exception {
         setFlags(false, false, false, false, false, true);
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.SEEN), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.FLAGGED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.ANSWERED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.DRAFT), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.DELETED), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.flagIsSet(Flags.Flag.RECENT), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.SEEN), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.FLAGGED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.ANSWERED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.DRAFT), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.DELETED), row));
+        assertTrue(searches.isMatch(SearchQuery.flagIsSet(Flags.Flag.RECENT), row));
     }
 
     public void testShouldMatchSeenFlagUnSet() throws Exception {
         setFlags(false, true, true, true, true, true);
-        assertTrue(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.SEEN), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.FLAGGED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.ANSWERED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.DRAFT), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.DELETED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.RECENT), row));
+        assertTrue(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.SEEN), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.FLAGGED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.ANSWERED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.DRAFT), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.DELETED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.RECENT), row));
     }
     
     public void testShouldMatchAnsweredFlagUnSet() throws Exception {
         setFlags(true, true, false, true, true, true);
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.SEEN), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.FLAGGED), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.ANSWERED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.DRAFT), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.DELETED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.RECENT), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.SEEN), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.FLAGGED), row));
+        assertTrue(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.ANSWERED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.DRAFT), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.DELETED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.RECENT), row));
     }
     
     public void testShouldMatchFlaggedFlagUnSet() throws Exception {
         setFlags(true, false, true, true, true, true);
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.SEEN), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.FLAGGED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.ANSWERED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.DRAFT), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.DELETED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.RECENT), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.SEEN), row));
+        assertTrue(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.FLAGGED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.ANSWERED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.DRAFT), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.DELETED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.RECENT), row));
     }
     
     public void testShouldMatchDraftFlagUnSet() throws Exception {
         setFlags(true, true, true, false, true, true);
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.SEEN), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.FLAGGED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.ANSWERED), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.DRAFT), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.DELETED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.RECENT), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.SEEN), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.FLAGGED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.ANSWERED), row));
+        assertTrue(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.DRAFT), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.DELETED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.RECENT), row));
     }
     
     public void testShouldMatchDeletedFlagUnSet() throws Exception {
         setFlags(true, true, true, true, false, true);
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.SEEN), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.FLAGGED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.ANSWERED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.DRAFT), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.DELETED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.RECENT), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.SEEN), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.FLAGGED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.ANSWERED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.DRAFT), row));
+        assertTrue(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.DELETED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.RECENT), row));
     }
     
     public void testShouldMatchSeenRecentUnSet() throws Exception {
         setFlags(true, true, true, true, true, false);
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.SEEN), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.FLAGGED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.ANSWERED), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.DRAFT), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.DELETED), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.RECENT), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.SEEN), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.FLAGGED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.ANSWERED), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.DRAFT), row));
+        assertFalse(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.DELETED), row));
+        assertTrue(searches.isMatch(SearchQuery.flagIsUnSet(Flags.Flag.RECENT), row));
     }
     
     public void testShouldMatchAll() throws Exception {
-        assertTrue(SearchUtils.isMatch(SearchQuery.all(), row));
+        assertTrue(searches.isMatch(SearchQuery.all(), row));
     }
     
     public void testShouldMatchNot() throws Exception {
-        assertFalse(SearchUtils.isMatch(SearchQuery.not(SearchQuery.all()), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.not(SearchQuery.headerExists(DATE_FIELD)), row));
+        assertFalse(searches.isMatch(SearchQuery.not(SearchQuery.all()), row));
+        assertTrue(searches.isMatch(SearchQuery.not(SearchQuery.headerExists(DATE_FIELD)), row));
     }
     
     public void testShouldMatchOr() throws Exception {
-        assertTrue(SearchUtils.isMatch(SearchQuery.or(SearchQuery.all(), SearchQuery.headerExists(DATE_FIELD)), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.or(SearchQuery.headerExists(DATE_FIELD), SearchQuery.all()), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.or(SearchQuery.headerExists(DATE_FIELD), SearchQuery.headerExists(DATE_FIELD)), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.or(SearchQuery.all(), SearchQuery.all()), row));
+        assertTrue(searches.isMatch(SearchQuery.or(SearchQuery.all(), SearchQuery.headerExists(DATE_FIELD)), row));
+        assertTrue(searches.isMatch(SearchQuery.or(SearchQuery.headerExists(DATE_FIELD), SearchQuery.all()), row));
+        assertFalse(searches.isMatch(SearchQuery.or(SearchQuery.headerExists(DATE_FIELD), SearchQuery.headerExists(DATE_FIELD)), row));
+        assertTrue(searches.isMatch(SearchQuery.or(SearchQuery.all(), SearchQuery.all()), row));
     }
     
     public void testShouldMatchAnd() throws Exception {
-        assertFalse(SearchUtils.isMatch(SearchQuery.and(SearchQuery.all(), SearchQuery.headerExists(DATE_FIELD)), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.and(SearchQuery.headerExists(DATE_FIELD), SearchQuery.all()), row));
-        assertFalse(SearchUtils.isMatch(SearchQuery.and(SearchQuery.headerExists(DATE_FIELD), SearchQuery.headerExists(DATE_FIELD)), row));
-        assertTrue(SearchUtils.isMatch(SearchQuery.and(SearchQuery.all(), SearchQuery.all()), row));
+        assertFalse(searches.isMatch(SearchQuery.and(SearchQuery.all(), SearchQuery.headerExists(DATE_FIELD)), row));
+        assertFalse(searches.isMatch(SearchQuery.and(SearchQuery.headerExists(DATE_FIELD), SearchQuery.all()), row));
+        assertFalse(searches.isMatch(SearchQuery.and(SearchQuery.headerExists(DATE_FIELD), SearchQuery.headerExists(DATE_FIELD)), row));
+        assertTrue(searches.isMatch(SearchQuery.and(SearchQuery.all(), SearchQuery.all()), row));
     }
     
     private void setFlags(boolean seen, boolean flagged, boolean answered, boolean draft, 



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