chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1516753 [7/8] - in /chemistry/opencmis/trunk/chemistry-opencmis-server: chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/ chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis...
Date Fri, 23 Aug 2013 08:53:50 GMT
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/ProcessQueryTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/ProcessQueryTest.java?rev=1516753&r1=1516752&r2=1516753&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/ProcessQueryTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/ProcessQueryTest.java Fri Aug 23 08:53:49 2013
@@ -50,7 +50,7 @@ public class ProcessQueryTest extends Ab
         private static final String ON_EQUALS = "onEqualsWasCalled";
         private static final String ON_NOT_EQUALS = "onNotEqualsWasCalled";
         private static final String ON_GREATER_THAN = "onGreaterThanWasCalled";
-        private static final String ON_GREATER_OR_EQUALS ="onGreaterOrEqualsWasCalled";
+        private static final String ON_GREATER_OR_EQUALS = "onGreaterOrEqualsWasCalled";
         private static final String ON_LESS_THAN = "onLessThanWasCalled";
         private static final String ON_LESS_OR_EQUALS = "onLessOrEqualsWasCalled";
         private static final String ON_NOT = "onNotWasCalled";
@@ -59,15 +59,15 @@ public class ProcessQueryTest extends Ab
         private static final String ON_IN = "onInWasCalled";
         private static final String ON_NOT_IN = "onNotInWasCalled";
         private static final String ON_IN_ANY = "onInAnyWasCalled";
-        private static final String ON_NOT_IN_ANY ="onNotInAnyWasCalled";
+        private static final String ON_NOT_IN_ANY = "onNotInAnyWasCalled";
         private static final String ON_EQ_ANY = "onEqAnyWasCalled";
         private static final String ON_IS_NULL = "onIsNullWasCalled";
-        private static final String ON_IS_NOT_NULL ="onIsNotNullWasCalled";
+        private static final String ON_IS_NOT_NULL = "onIsNotNullWasCalled";
         private static final String ON_IS_LIKE = "onIsLikeWasCalled";
         private static final String ON_IS_NOT_LIKE = "onIsNotLikeWasCalled";
-        private static final String ON_CONTAINS  = "onContainsWasCalled";
-        private static final String ON_IN_FOLDER  = "onInFolderWasCalled";
-        private static final String ON_IN_TREE  = "onInTreeWasCalled";
+        private static final String ON_CONTAINS = "onContainsWasCalled";
+        private static final String ON_IN_FOLDER = "onInFolderWasCalled";
+        private static final String ON_IN_TREE = "onInTreeWasCalled";
         private static final String ON_SCORE = "onScoreWasCalled";
         private static final String ON_TEXT_AND = "onTextAndWasCalled";
         private static final String ON_TEXT_OR = "onTextOrWasCalled";
@@ -75,10 +75,8 @@ public class ProcessQueryTest extends Ab
         private static final String ON_TEXT_PHRASE = "onTextPhraseWasCalled";
         private static final String ON_TEXT_WORD = "onTextWordWasCalled";
 
-
-        final Map<String, Integer> rulesTrackerMap =
-            new HashMap<String, Integer>() {
-                private static final long serialVersionUID = 1L;
+        final Map<String, Integer> rulesTrackerMap = new HashMap<String, Integer>() {
+            private static final long serialVersionUID = 1L;
             {
                 put(ON_START, 0);
                 put(ON_STOP, 0);
@@ -109,297 +107,296 @@ public class ProcessQueryTest extends Ab
                 put(ON_TEXT_MINUS, 0);
                 put(ON_TEXT_PHRASE, 0);
                 put(ON_TEXT_WORD, 0);
-           }};
+            }
+        };
 
-           private int counter;
+        private int counter;
 
-       public TestQueryProcessor() {
-           counter = 1;
-       }
+        public TestQueryProcessor() {
+            counter = 1;
+        }
 
-       @Override
-       public void onStartProcessing(Tree node) {
+        @Override
+        public void onStartProcessing(Tree node) {
             LOG.debug("TestQueryProcessor:onStartProcessing()");
             rulesTrackerMap.put(ON_START, counter++);
             assertEquals(CmisQlStrictLexer.WHERE, node.getParent().getType());
-       }
+        }
+
+        @Override
+        public void onStopProcessing() {
+            LOG.debug("TestQueryProcessor:onStopProcessing()");
+            rulesTrackerMap.put(ON_STOP, counter++);
+        }
+
+        @Override
+        public void onEquals(Tree eqNode, Tree leftNode, Tree rightNode) {
+            rulesTrackerMap.put(ON_EQUALS, counter++);
+            assertEquals(CmisQlStrictLexer.EQ, eqNode.getType());
+            assertTrue(CmisQlStrictLexer.COL == leftNode.getType() || CmisQlStrictLexer.SCORE == leftNode.getType());
+            assertTrue(isLiteral(rightNode));
+        }
+
+        @Override
+        public void onNotEquals(Tree neNode, Tree leftNode, Tree rightNode) {
+            rulesTrackerMap.put(ON_NOT_EQUALS, counter++);
+            assertEquals(CmisQlStrictLexer.NEQ, neNode.getType());
+            assertEquals(CmisQlStrictLexer.COL, leftNode.getType());
+            assertTrue(isLiteral(rightNode));
+            Object value = onLiteral(rightNode, Integer.class);
+            assertEquals(100, value);
+        }
+
+        @Override
+        public void onLessOrEquals(Tree leqNode, Tree leftNode, Tree rightNode) {
+            rulesTrackerMap.put(ON_LESS_OR_EQUALS, counter++);
+            assertEquals(CmisQlStrictLexer.LTEQ, leqNode.getType());
+            assertEquals(CmisQlStrictLexer.COL, leftNode.getType());
+            assertTrue(isLiteral(rightNode));
+            Object value = onLiteral(rightNode, Integer.class);
+            assertEquals(100, value);
+        }
+
+        @Override
+        public void onLessThan(Tree ltNode, Tree leftNode, Tree rightNode) {
+            rulesTrackerMap.put(ON_LESS_THAN, counter++);
+            assertEquals(CmisQlStrictLexer.LT, ltNode.getType());
+            assertEquals(CmisQlStrictLexer.COL, leftNode.getType());
+            assertTrue(isLiteral(rightNode));
+            Object value = onLiteral(rightNode, Integer.class);
+            assertEquals(100, value);
+        }
+
+        @Override
+        public void onGreaterOrEquals(Tree geNode, Tree leftNode, Tree rightNode) {
+            rulesTrackerMap.put(ON_GREATER_OR_EQUALS, counter++);
+            assertEquals(CmisQlStrictLexer.GTEQ, geNode.getType());
+            assertEquals(CmisQlStrictLexer.COL, leftNode.getType());
+            assertTrue(isLiteral(rightNode));
+            Object value = onLiteral(rightNode, Integer.class);
+            assertEquals(100, value);
+        }
+
+        @Override
+        public void onGreaterThan(Tree gtNode, Tree leftNode, Tree rightNode) {
+            rulesTrackerMap.put(ON_GREATER_THAN, counter++);
+            assertEquals(CmisQlStrictLexer.GT, gtNode.getType());
+            assertEquals(CmisQlStrictLexer.COL, leftNode.getType());
+            assertTrue(isLiteral(rightNode));
+            Object value = onLiteral(rightNode, Integer.class);
+            assertEquals(100, value);
+        }
+
+        @Override
+        public void onNot(Tree opNode, Tree leftNode) {
+            rulesTrackerMap.put(ON_NOT, counter++);
+            assertEquals(CmisQlStrictLexer.NOT, opNode.getType());
+        }
+
+        @Override
+        public void onAnd(Tree opNode, Tree leftNode, Tree rightNode) {
+            assertEquals(CmisQlStrictLexer.AND, opNode.getType());
+            rulesTrackerMap.put(ON_AND, counter++);
+        }
+
+        @Override
+        public void onOr(Tree opNode, Tree leftNode, Tree rightNode) {
+            assertEquals(CmisQlStrictLexer.OR, opNode.getType());
+            rulesTrackerMap.put(ON_OR, counter++);
+        }
+
+        @Override
+        public void onIn(Tree opNode, Tree colNode, Tree listNode) {
+            assertEquals(CmisQlStrictLexer.IN, opNode.getType());
+            assertEquals(CmisQlStrictLexer.COL, colNode.getType());
+            assertEquals(CmisQlStrictLexer.IN_LIST, listNode.getType());
+            Object value = onLiteral(listNode.getChild(0), String.class);
+            assertEquals("'Joe'", value);
+            value = onLiteral(listNode.getChild(1), String.class);
+            assertEquals("'Jim'", value);
+            rulesTrackerMap.put(ON_IN, counter++);
+        }
+
+        @Override
+        public void onNotIn(Tree node, Tree colNode, Tree listNode) {
+            assertEquals(CmisQlStrictLexer.NOT_IN, node.getType());
+            assertEquals(CmisQlStrictLexer.COL, colNode.getType());
+            assertEquals(CmisQlStrictLexer.IN_LIST, listNode.getType());
+            Object value = onLiteral(listNode.getChild(0), String.class);
+            assertEquals("'Joe'", value);
+            value = onLiteral(listNode.getChild(1), String.class);
+            assertEquals("'Jim'", value);
+            rulesTrackerMap.put(ON_NOT_IN, counter++);
+        }
+
+        @Override
+        public void onEqAny(Tree node, Tree literalNode, Tree colNode) {
+            assertEquals(CmisQlStrictLexer.EQ_ANY, node.getType());
+            assertEquals(CmisQlStrictLexer.COL, colNode.getType());
+            assertTrue(isLiteral(literalNode));
+            Object value = onLiteral(literalNode, String.class);
+            assertEquals("'Joe'", value);
+            rulesTrackerMap.put(ON_EQ_ANY, counter++);
+        }
+
+        @Override
+        public void onInAny(Tree node, Tree colNode, Tree listNode) {
+            assertEquals(CmisQlStrictLexer.IN_ANY, node.getType());
+            assertEquals(CmisQlStrictLexer.COL, colNode.getType());
+            assertEquals(CmisQlStrictLexer.IN_LIST, listNode.getType());
+            Object value = onLiteral(listNode.getChild(0), String.class);
+            assertEquals("'Joe'", value);
+            value = onLiteral(listNode.getChild(1), String.class);
+            assertEquals("'Jim'", value);
+            rulesTrackerMap.put(ON_IN_ANY, counter++);
+        }
 
-       @Override
-       public void onStopProcessing() {
-           LOG.debug("TestQueryProcessor:onStopProcessing()");
-           rulesTrackerMap.put(ON_STOP, counter++);
-       }
-
-
-       @Override
-       public void onEquals(Tree eqNode, Tree leftNode, Tree rightNode) {
-           rulesTrackerMap.put(ON_EQUALS, counter++);
-           assertEquals(CmisQlStrictLexer.EQ, eqNode.getType());
-           assertTrue(CmisQlStrictLexer.COL==leftNode.getType() || CmisQlStrictLexer.SCORE==leftNode.getType());
-           assertTrue(isLiteral(rightNode));
-       }
-
-       @Override
-       public void onNotEquals(Tree neNode, Tree leftNode, Tree rightNode) {
-           rulesTrackerMap.put(ON_NOT_EQUALS, counter++);
-           assertEquals(CmisQlStrictLexer.NEQ, neNode.getType());
-           assertEquals(CmisQlStrictLexer.COL, leftNode.getType());
-           assertTrue(isLiteral(rightNode));
-           Object value=onLiteral(rightNode, Integer.class);
-           assertEquals(100, value);
-       }
-
-       @Override
-       public void onLessOrEquals(Tree leqNode, Tree leftNode, Tree rightNode) {
-           rulesTrackerMap.put(ON_LESS_OR_EQUALS, counter++);
-           assertEquals(CmisQlStrictLexer.LTEQ, leqNode.getType());
-           assertEquals(CmisQlStrictLexer.COL, leftNode.getType());
-           assertTrue(isLiteral(rightNode));
-           Object value=onLiteral(rightNode, Integer.class);
-           assertEquals(100, value);
-       }
-
-       @Override
-       public void onLessThan(Tree ltNode, Tree leftNode, Tree rightNode) {
-           rulesTrackerMap.put(ON_LESS_THAN, counter++);
-           assertEquals(CmisQlStrictLexer.LT, ltNode.getType());
-           assertEquals(CmisQlStrictLexer.COL, leftNode.getType());
-           assertTrue(isLiteral(rightNode));
-           Object value=onLiteral(rightNode, Integer.class);
-           assertEquals(100, value);
-       }
-
-       @Override
-       public void onGreaterOrEquals(Tree geNode, Tree leftNode, Tree rightNode) {
-           rulesTrackerMap.put(ON_GREATER_OR_EQUALS, counter++);
-           assertEquals(CmisQlStrictLexer.GTEQ, geNode.getType());
-           assertEquals(CmisQlStrictLexer.COL, leftNode.getType());
-           assertTrue(isLiteral(rightNode));
-           Object value=onLiteral(rightNode, Integer.class);
-           assertEquals(100, value);
-       }
-
-       @Override
-       public void onGreaterThan(Tree gtNode, Tree leftNode, Tree rightNode) {
-           rulesTrackerMap.put(ON_GREATER_THAN, counter++);
-           assertEquals(CmisQlStrictLexer.GT, gtNode.getType());
-           assertEquals(CmisQlStrictLexer.COL, leftNode.getType());
-           assertTrue(isLiteral(rightNode));
-           Object value=onLiteral(rightNode, Integer.class);
-           assertEquals(100, value);
-       }
-
-       @Override
-       public void onNot(Tree opNode, Tree leftNode) {
-           rulesTrackerMap.put(ON_NOT, counter++);
-           assertEquals(CmisQlStrictLexer.NOT, opNode.getType());
-       }
-
-       @Override
-       public void onAnd(Tree opNode, Tree leftNode, Tree rightNode) {
-           assertEquals(CmisQlStrictLexer.AND, opNode.getType());
-           rulesTrackerMap.put(ON_AND, counter++);
-       }
-
-       @Override
-       public void onOr(Tree opNode, Tree leftNode, Tree rightNode) {
-           assertEquals(CmisQlStrictLexer.OR, opNode.getType());
-           rulesTrackerMap.put(ON_OR, counter++);
-       }
-
-       @Override
-       public void onIn(Tree opNode, Tree colNode, Tree listNode) {
-           assertEquals(CmisQlStrictLexer.IN, opNode.getType());
-           assertEquals(CmisQlStrictLexer.COL, colNode.getType());
-           assertEquals(CmisQlStrictLexer.IN_LIST, listNode.getType());
-           Object value=onLiteral(listNode.getChild(0), String.class);
-           assertEquals("'Joe'", value);
-           value=onLiteral(listNode.getChild(1), String.class);
-           assertEquals("'Jim'", value);
-           rulesTrackerMap.put(ON_IN, counter++);
-       }
-
-       @Override
-       public void onNotIn(Tree node, Tree colNode, Tree listNode) {
-           assertEquals(CmisQlStrictLexer.NOT_IN, node.getType());
-           assertEquals(CmisQlStrictLexer.COL, colNode.getType());
-           assertEquals(CmisQlStrictLexer.IN_LIST, listNode.getType());
-           Object value=onLiteral(listNode.getChild(0), String.class);
-           assertEquals("'Joe'", value);
-           value=onLiteral(listNode.getChild(1), String.class);
-           assertEquals("'Jim'", value);
-           rulesTrackerMap.put(ON_NOT_IN, counter++);
-       }
-
-       @Override
-       public void onEqAny(Tree node, Tree literalNode, Tree colNode) {
-           assertEquals(CmisQlStrictLexer.EQ_ANY, node.getType());
-           assertEquals(CmisQlStrictLexer.COL, colNode.getType());
-           assertTrue(isLiteral(literalNode));
-           Object value=onLiteral(literalNode, String.class);
-           assertEquals("'Joe'", value);
-           rulesTrackerMap.put(ON_EQ_ANY, counter++);
-       }
-
-       @Override
-       public void onInAny(Tree node, Tree colNode, Tree listNode) {
-           assertEquals(CmisQlStrictLexer.IN_ANY, node.getType());
-           assertEquals(CmisQlStrictLexer.COL, colNode.getType());
-           assertEquals(CmisQlStrictLexer.IN_LIST, listNode.getType());
-           Object value=onLiteral(listNode.getChild(0), String.class);
-           assertEquals("'Joe'", value);
-           value=onLiteral(listNode.getChild(1), String.class);
-           assertEquals("'Jim'", value);
-           rulesTrackerMap.put(ON_IN_ANY, counter++);
-       }
-
-       @Override
-       public void onNotInAny(Tree node, Tree colNode, Tree listNode) {
-           assertEquals(CmisQlStrictLexer.NOT_IN_ANY, node.getType());
-           assertEquals(CmisQlStrictLexer.COL, colNode.getType());
-           assertEquals(CmisQlStrictLexer.IN_LIST, listNode.getType());
-           Object value=onLiteral(listNode.getChild(0), String.class);
-           assertEquals("'Joe'", value);
-           value=onLiteral(listNode.getChild(1), String.class);
-           assertEquals("'Jim'", value);
-           rulesTrackerMap.put(ON_NOT_IN_ANY, counter++);
-       }
-
-       @Override
-       public void onIsNull(Tree nullNode, Tree colNode) {
-           assertEquals(CmisQlStrictLexer.COL, colNode.getType());
-           assertEquals(CmisQlStrictLexer.IS_NULL, nullNode.getType());
-           rulesTrackerMap.put(ON_IS_NULL, counter++);
-       }
-
-       @Override
-       public void onIsNotNull(Tree notNullNode, Tree colNode) {
-           assertEquals(CmisQlStrictLexer.COL, colNode.getType());
-           assertEquals(CmisQlStrictLexer.IS_NOT_NULL, notNullNode.getType());
-           rulesTrackerMap.put(ON_IS_NOT_NULL, counter++);
-       }
-
-       @Override
-       public void onIsLike(Tree node, Tree colNode, Tree stringNode) {
-           assertEquals(CmisQlStrictLexer.LIKE, node.getType());
-           assertEquals(CmisQlStrictLexer.COL, colNode.getType());
-           assertEquals(CmisQlStrictLexer.STRING_LIT, stringNode.getType());
-           Object value=onLiteral(stringNode, String.class);
-           assertEquals("'Harry%'", value);
-           rulesTrackerMap.put(ON_IS_LIKE, counter++);
-       }
-
-       @Override
-       public void onIsNotLike(Tree node, Tree colNode, Tree stringNode) {
-           assertEquals(CmisQlStrictLexer.NOT_LIKE, node.getType());
-           assertEquals(CmisQlStrictLexer.COL, colNode.getType());
-           assertEquals(CmisQlStrictLexer.STRING_LIT, stringNode.getType());
-           Object value=onLiteral(stringNode, String.class);
-           assertEquals("'Harry%'", value);
-           rulesTrackerMap.put(ON_IS_NOT_LIKE, counter++);
-       }
-
-       @Override
-       public void onContains(Tree node, Tree typeNode, Tree searchExprNode) {
-           assertEquals(CmisQlStrictLexer.CONTAINS, node.getType());
-           assertTrue( null != searchExprNode);
-           rulesTrackerMap.put(ON_CONTAINS, counter++);
-           super.onContains(node, typeNode, searchExprNode);
-       }
-
-       @Override
-       public void onInFolder(Tree node, Tree colNode, Tree paramNode) {
-           assertEquals(CmisQlStrictLexer.IN_FOLDER, node.getType());
-           assertTrue(colNode==null || CmisQlStrictLexer.STRING_LIT == paramNode.getType());
-           assertEquals(CmisQlStrictLexer.STRING_LIT, paramNode.getType());
-           rulesTrackerMap.put(ON_IN_FOLDER, counter++);
-       }
-
-       @Override
-       public void onInTree(Tree node, Tree colNode, Tree paramNode) {
-           assertEquals(CmisQlStrictLexer.IN_TREE, node.getType());
-           assertTrue(colNode==null || CmisQlStrictLexer.STRING_LIT == paramNode.getType());
-           assertEquals(CmisQlStrictLexer.STRING_LIT, paramNode.getType());
-           rulesTrackerMap.put(ON_IN_TREE, counter++);
-       }
-
-       @Override
-       public void onScore(Tree node) {
-           assertEquals(CmisQlStrictLexer.SCORE, node.getType());
-           rulesTrackerMap.put(ON_SCORE, counter++);
-       }
-
-       @Override
-       public void onTextAnd(Tree node, List<Tree> conjunctionNodes, int index) {
-           assertEquals(TextSearchLexer.TEXT_AND, node.getType());
-           assertTrue(conjunctionNodes.size() >= 2);
-           rulesTrackerMap.put(ON_TEXT_AND, counter++);
-       }
-
-       @Override
-       public void onTextOr(Tree node, List<Tree> termNodes, int index) {
-           assertEquals(TextSearchLexer.TEXT_OR, node.getType());
-           assertTrue(termNodes.size() >= 2);
-           rulesTrackerMap.put(ON_TEXT_OR, counter++);
-       }
-
-       @Override
-       public void onTextMinus(Tree node, Tree notNode) {
-           assertEquals(TextSearchLexer.TEXT_MINUS, node.getType());
-           assertTrue(notNode.getType() == TextSearchLexer.TEXT_SEARCH_PHRASE_STRING_LIT ||
-                   notNode.getType() == TextSearchLexer.TEXT_SEARCH_WORD_LIT);
-           rulesTrackerMap.put(ON_TEXT_MINUS, counter++);
-       }
-
-       @Override
-       public void onTextWord(String word) {
-           assertTrue(word != null && word.length() > 0);
-           rulesTrackerMap.put(ON_TEXT_WORD, counter++);
-       }
-
-       @Override
-       public void onTextPhrase(String phrase) {
-           assertTrue(phrase != null && phrase.length() > 0);
-           rulesTrackerMap.put(ON_TEXT_PHRASE, counter++);
-       }
-
-
-       // private helper functions:
-
-       private static boolean isLiteral(Tree node) {
-           int type = node.getType();
-           return type==CmisQlStrictLexer.BOOL_LIT || type==CmisQlStrictLexer.NUM_LIT ||
-           type==CmisQlStrictLexer.STRING_LIT || type==CmisQlStrictLexer.TIME_LIT;
-       }
-
-       private static Object onLiteral(Tree node, Class<?> clazz) {
-           int type = node.getType();
-           switch (type) {
-           case CmisQlStrictLexer.BOOL_LIT:
-               return clazz==Boolean.class ? Boolean.parseBoolean(node.getText()) : null;
-           case CmisQlStrictLexer.NUM_LIT:
-               if (clazz == Integer.class) {
-                return Integer.parseInt(node.getText());
-            } else if (clazz == Long.class) {
-                return Long.parseLong(node.getText());
-            } else if (clazz == Short.class) {
-                return Short.parseShort(node.getText());
-            } else if (clazz == Double.class) {
-                return Double.parseDouble(node.getText());
-            } else if (clazz == Float.class) {
-                return Float.parseFloat(node.getText());
-            } else {
+        @Override
+        public void onNotInAny(Tree node, Tree colNode, Tree listNode) {
+            assertEquals(CmisQlStrictLexer.NOT_IN_ANY, node.getType());
+            assertEquals(CmisQlStrictLexer.COL, colNode.getType());
+            assertEquals(CmisQlStrictLexer.IN_LIST, listNode.getType());
+            Object value = onLiteral(listNode.getChild(0), String.class);
+            assertEquals("'Joe'", value);
+            value = onLiteral(listNode.getChild(1), String.class);
+            assertEquals("'Jim'", value);
+            rulesTrackerMap.put(ON_NOT_IN_ANY, counter++);
+        }
+
+        @Override
+        public void onIsNull(Tree nullNode, Tree colNode) {
+            assertEquals(CmisQlStrictLexer.COL, colNode.getType());
+            assertEquals(CmisQlStrictLexer.IS_NULL, nullNode.getType());
+            rulesTrackerMap.put(ON_IS_NULL, counter++);
+        }
+
+        @Override
+        public void onIsNotNull(Tree notNullNode, Tree colNode) {
+            assertEquals(CmisQlStrictLexer.COL, colNode.getType());
+            assertEquals(CmisQlStrictLexer.IS_NOT_NULL, notNullNode.getType());
+            rulesTrackerMap.put(ON_IS_NOT_NULL, counter++);
+        }
+
+        @Override
+        public void onIsLike(Tree node, Tree colNode, Tree stringNode) {
+            assertEquals(CmisQlStrictLexer.LIKE, node.getType());
+            assertEquals(CmisQlStrictLexer.COL, colNode.getType());
+            assertEquals(CmisQlStrictLexer.STRING_LIT, stringNode.getType());
+            Object value = onLiteral(stringNode, String.class);
+            assertEquals("'Harry%'", value);
+            rulesTrackerMap.put(ON_IS_LIKE, counter++);
+        }
+
+        @Override
+        public void onIsNotLike(Tree node, Tree colNode, Tree stringNode) {
+            assertEquals(CmisQlStrictLexer.NOT_LIKE, node.getType());
+            assertEquals(CmisQlStrictLexer.COL, colNode.getType());
+            assertEquals(CmisQlStrictLexer.STRING_LIT, stringNode.getType());
+            Object value = onLiteral(stringNode, String.class);
+            assertEquals("'Harry%'", value);
+            rulesTrackerMap.put(ON_IS_NOT_LIKE, counter++);
+        }
+
+        @Override
+        public void onContains(Tree node, Tree typeNode, Tree searchExprNode) {
+            assertEquals(CmisQlStrictLexer.CONTAINS, node.getType());
+            assertTrue(null != searchExprNode);
+            rulesTrackerMap.put(ON_CONTAINS, counter++);
+            super.onContains(node, typeNode, searchExprNode);
+        }
+
+        @Override
+        public void onInFolder(Tree node, Tree colNode, Tree paramNode) {
+            assertEquals(CmisQlStrictLexer.IN_FOLDER, node.getType());
+            assertTrue(colNode == null || CmisQlStrictLexer.STRING_LIT == paramNode.getType());
+            assertEquals(CmisQlStrictLexer.STRING_LIT, paramNode.getType());
+            rulesTrackerMap.put(ON_IN_FOLDER, counter++);
+        }
+
+        @Override
+        public void onInTree(Tree node, Tree colNode, Tree paramNode) {
+            assertEquals(CmisQlStrictLexer.IN_TREE, node.getType());
+            assertTrue(colNode == null || CmisQlStrictLexer.STRING_LIT == paramNode.getType());
+            assertEquals(CmisQlStrictLexer.STRING_LIT, paramNode.getType());
+            rulesTrackerMap.put(ON_IN_TREE, counter++);
+        }
+
+        @Override
+        public void onScore(Tree node) {
+            assertEquals(CmisQlStrictLexer.SCORE, node.getType());
+            rulesTrackerMap.put(ON_SCORE, counter++);
+        }
+
+        @Override
+        public void onTextAnd(Tree node, List<Tree> conjunctionNodes, int index) {
+            assertEquals(TextSearchLexer.TEXT_AND, node.getType());
+            assertTrue(conjunctionNodes.size() >= 2);
+            rulesTrackerMap.put(ON_TEXT_AND, counter++);
+        }
+
+        @Override
+        public void onTextOr(Tree node, List<Tree> termNodes, int index) {
+            assertEquals(TextSearchLexer.TEXT_OR, node.getType());
+            assertTrue(termNodes.size() >= 2);
+            rulesTrackerMap.put(ON_TEXT_OR, counter++);
+        }
+
+        @Override
+        public void onTextMinus(Tree node, Tree notNode) {
+            assertEquals(TextSearchLexer.TEXT_MINUS, node.getType());
+            assertTrue(notNode.getType() == TextSearchLexer.TEXT_SEARCH_PHRASE_STRING_LIT
+                    || notNode.getType() == TextSearchLexer.TEXT_SEARCH_WORD_LIT);
+            rulesTrackerMap.put(ON_TEXT_MINUS, counter++);
+        }
+
+        @Override
+        public void onTextWord(String word) {
+            assertTrue(word != null && word.length() > 0);
+            rulesTrackerMap.put(ON_TEXT_WORD, counter++);
+        }
+
+        @Override
+        public void onTextPhrase(String phrase) {
+            assertTrue(phrase != null && phrase.length() > 0);
+            rulesTrackerMap.put(ON_TEXT_PHRASE, counter++);
+        }
+
+        // private helper functions:
+
+        private static boolean isLiteral(Tree node) {
+            int type = node.getType();
+            return type == CmisQlStrictLexer.BOOL_LIT || type == CmisQlStrictLexer.NUM_LIT
+                    || type == CmisQlStrictLexer.STRING_LIT || type == CmisQlStrictLexer.TIME_LIT;
+        }
+
+        private static Object onLiteral(Tree node, Class<?> clazz) {
+            int type = node.getType();
+            switch (type) {
+            case CmisQlStrictLexer.BOOL_LIT:
+                return clazz == Boolean.class ? Boolean.parseBoolean(node.getText()) : null;
+            case CmisQlStrictLexer.NUM_LIT:
+                if (clazz == Integer.class) {
+                    return Integer.parseInt(node.getText());
+                } else if (clazz == Long.class) {
+                    return Long.parseLong(node.getText());
+                } else if (clazz == Short.class) {
+                    return Short.parseShort(node.getText());
+                } else if (clazz == Double.class) {
+                    return Double.parseDouble(node.getText());
+                } else if (clazz == Float.class) {
+                    return Float.parseFloat(node.getText());
+                } else {
+                    return null;
+                }
+            case CmisQlStrictLexer.STRING_LIT:
+                return clazz == String.class ? node.getText() : null;
+            case CmisQlStrictLexer.TIME_LIT:
+                return clazz == GregorianCalendar.class ? CalendarHelper.fromString(node.getText()) : null;
+            default:
+                LOG.error("Unknown literal. " + node);
                 return null;
             }
-           case CmisQlStrictLexer.STRING_LIT:
-               return clazz==String.class ? node.getText() : null;
-           case CmisQlStrictLexer.TIME_LIT:
-               return clazz==GregorianCalendar.class ?  CalendarHelper.fromString(node.getText()) : null;
-           default:
-               LOG.error("Unknown literal. " + node);
-               return null;
-           }
-       }
+        }
 
         @Override
         public void onColNode(Tree node) {
@@ -490,7 +487,7 @@ public class ProcessQueryTest extends Ab
     @Test
     public void testOr() {
         String statement = "SELECT BookType.Title, BookType.Author FROM BookType WHERE ISBN = 100 OR Title LIKE 'Harry%'";
-        testStatementMultiRule(statement,TestQueryProcessor.ON_OR);
+        testStatementMultiRule(statement, TestQueryProcessor.ON_OR);
         assertTrue(queryProcessor.rulesTrackerMap.get(TestQueryProcessor.ON_START) == 1);
         assertTrue(queryProcessor.rulesTrackerMap.get(TestQueryProcessor.ON_EQUALS) == 2);
         assertTrue(queryProcessor.rulesTrackerMap.get(TestQueryProcessor.ON_OR) == 3);
@@ -639,8 +636,8 @@ public class ProcessQueryTest extends Ab
     private void checkOtherRulesNotCalled(String ruleAssertion) {
         for (Entry<String, Integer> e : queryProcessor.rulesTrackerMap.entrySet()) {
             if (!e.getKey().equals(ruleAssertion) && !e.getKey().equals("onPropertyValueWasCalled")
-                    && !e.getKey().equals(TestQueryProcessor.ON_START) && !e.getKey().equals(TestQueryProcessor.ON_STOP)
-                    && !e.getKey().contains("Literal")) {
+                    && !e.getKey().equals(TestQueryProcessor.ON_START)
+                    && !e.getKey().equals(TestQueryProcessor.ON_STOP) && !e.getKey().contains("Literal")) {
                 assertFalse("Rule " + e.getKey() + " was expected not to be executed, but was executed.",
                         queryProcessor.rulesTrackerMap.get(e.getKey()) > 0);
             }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryConditionProcessor.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryConditionProcessor.java?rev=1516753&r1=1516752&r2=1516753&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryConditionProcessor.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryConditionProcessor.java Fri Aug 23 08:53:49 2013
@@ -24,61 +24,89 @@ import org.antlr.runtime.tree.Tree;
 import org.apache.chemistry.opencmis.server.support.query.PredicateWalkerBase;
 
 /**
- * An interface used by the walker when traversing the AST from the grammar.
- * The interface consists of callback methods that are called when a rule
- * is processed (as part of the WHERE statement)
+ * An interface used by the walker when traversing the AST from the grammar. The
+ * interface consists of callback methods that are called when a rule is
+ * processed (as part of the WHERE statement)
+ * 
  * @author Jens
- *
+ * 
  */
 public interface QueryConditionProcessor extends PredicateWalkerBase {
 
     void onStartProcessing(Tree whereNode);
+
     void onStopProcessing();
 
     // Compare operators
     void onEquals(Tree eqNode, Tree leftNode, Tree rightNode);
+
     void onNotEquals(Tree neNode, Tree leftNode, Tree rightNode);
+
     void onGreaterThan(Tree gtNode, Tree leftNode, Tree rightNode);
+
     void onGreaterOrEquals(Tree geNode, Tree leftNode, Tree rightNode);
+
     void onLessThan(Tree ltNode, Tree leftNode, Tree rightNode);
+
     void onLessOrEquals(Tree leqNode, Tree leftNode, Tree rightNode);
 
     // Boolean operators
     void onPreNot(Tree opNode, Tree leftNode);
+
     void onNot(Tree opNode, Tree leftNode);
+
     void onPostNot(Tree opNode, Tree leftNode);
+
     void onPreAnd(Tree opNode, Tree leftNode, Tree rightNode);
+
     void onAnd(Tree opNode, Tree leftNode, Tree rightNode);
+
     void onPostAnd(Tree opNode, Tree leftNode, Tree rightNode);
+
     void onPreOr(Tree opNode, Tree leftNode, Tree rightNode);
+
     void onOr(Tree opNode, Tree leftNode, Tree rightNode);
+
     void onPostOr(Tree opNode, Tree leftNode, Tree rightNode);
 
     // Multi-value:
     void onIn(Tree node, Tree colNode, Tree listNode);
+
     void onNotIn(Tree node, Tree colNode, Tree listNode);
+
     void onInAny(Tree node, Tree colNode, Tree listNode);
+
     void onNotInAny(Tree node, Tree colNode, Tree listNode);
+
     void onEqAny(Tree node, Tree literalNode, Tree colNode);
 
     // Null comparisons:
     void onIsNull(Tree nullNode, Tree colNode);
+
     void onIsNotNull(Tree notNullNode, Tree colNode);
 
     // String matching:
     void onIsLike(Tree node, Tree colNode, Tree stringNode);
+
     void onIsNotLike(Tree node, Tree colNode, Tree stringNode);
 
     // Functions:
     void onContains(Tree node, Tree typeNode, Tree searchExprNode);
+
     void onInFolder(Tree node, Tree colNode, Tree paramNode);
+
     void onInTree(Tree node, Tree colNode, Tree paramNode);
+
     void onScore(Tree node);
-    
+
     // full text search
     void onTextAnd(Tree node, List<Tree> conjunctionNodes);
+
     void onTextOr(Tree node, List<Tree> termNodes);
+
     void onTextMinus(Tree node, Tree notNode);
+
     void onTextWord(String word);
+
     void onTextPhrase(String phrase);
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryParseTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryParseTest.java?rev=1516753&r1=1516752&r2=1516753&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryParseTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryParseTest.java Fri Aug 23 08:53:49 2013
@@ -53,7 +53,8 @@ public class QueryParseTest extends Abst
 
     @Before
     public void setUp() {
-        // initialize query object, we do not need a type manager for just testing parsing
+        // initialize query object, we do not need a type manager for just
+        // testing parsing
         super.setUp(null, null);
     }
 
@@ -81,7 +82,7 @@ public class QueryParseTest extends Abst
         assertTrue(1 == selects.size());
         assertTrue(selects.get(0) instanceof FunctionReference);
 
-        FunctionReference funcRef = ((FunctionReference)selects.get(0));
+        FunctionReference funcRef = ((FunctionReference) selects.get(0));
         assertTrue(FunctionReference.CmisQlFunction.SCORE == funcRef.getFunction());
     }
 
@@ -99,7 +100,7 @@ public class QueryParseTest extends Abst
         // nothing should be in where references
         assertTrue(0 == queryObj.getWhereReferences().size());
 
-        ColumnReference colRef = ((ColumnReference)selects.get(0));
+        ColumnReference colRef = ((ColumnReference) selects.get(0));
         assertTrue(selects.get(0) instanceof ColumnReference);
         assertEquals("abc", colRef.getPropertyQueryName());
     }
@@ -119,7 +120,7 @@ public class QueryParseTest extends Abst
         assertTrue(0 == queryObj.getWhereReferences().size());
         assertTrue(selects.get(0) instanceof ColumnReference);
 
-        ColumnReference colRef = ((ColumnReference)selects.get(0));
+        ColumnReference colRef = ((ColumnReference) selects.get(0));
         assertEquals("t1", colRef.getQualifier());
         assertEquals("abc", colRef.getPropertyQueryName());
     }
@@ -138,7 +139,7 @@ public class QueryParseTest extends Abst
         // nothing should be in where references
         assertTrue(0 == queryObj.getWhereReferences().size());
 
-        ColumnReference colRef = ((ColumnReference)selects.get(0));
+        ColumnReference colRef = ((ColumnReference) selects.get(0));
         assertTrue(selects.get(0) instanceof ColumnReference);
         assertEquals(null, colRef.getQualifier());
         assertEquals("*", colRef.getPropertyQueryName());
@@ -159,7 +160,7 @@ public class QueryParseTest extends Abst
         assertTrue(0 == queryObj.getWhereReferences().size());
         assertTrue(selects.get(0) instanceof ColumnReference);
 
-        ColumnReference colRef = ((ColumnReference)selects.get(0));
+        ColumnReference colRef = ((ColumnReference) selects.get(0));
         assertEquals("t1", colRef.getQualifier());
         assertEquals("*", colRef.getPropertyQueryName());
     }
@@ -179,7 +180,7 @@ public class QueryParseTest extends Abst
         assertTrue(0 == queryObj.getWhereReferences().size());
         assertTrue(selects.get(0) instanceof ColumnReference);
 
-        ColumnReference colRef = ((ColumnReference)selects.get(0));
+        ColumnReference colRef = ((ColumnReference) selects.get(0));
         assertEquals("t2", colRef.getQualifier());
         assertEquals("aaa", colRef.getPropertyQueryName());
     }
@@ -205,7 +206,7 @@ public class QueryParseTest extends Abst
         assertNotNull(queryUtil.getQueryObject());
         QueryObject queryObj = queryUtil.getQueryObject();
 
-        Map<String,String> types = queryObj.getTypes();
+        Map<String, String> types = queryObj.getTypes();
         assertTrue(1 == types.size());
 
         String key = types.keySet().iterator().next();
@@ -222,7 +223,7 @@ public class QueryParseTest extends Abst
         assertNotNull(queryUtil.getQueryObject());
         QueryObject queryObj = queryUtil.getQueryObject();
 
-        Map<String,String> types = queryObj.getTypes();
+        Map<String, String> types = queryObj.getTypes();
         assertTrue(1 == types.size());
 
         String key = types.keySet().iterator().next();
@@ -239,7 +240,7 @@ public class QueryParseTest extends Abst
         assertNotNull(queryUtil.getQueryObject());
         QueryObject queryObj = queryUtil.getQueryObject();
 
-        Map<String,String> types = queryObj.getTypes();
+        Map<String, String> types = queryObj.getTypes();
         assertTrue(1 == types.size());
 
         String key = types.keySet().iterator().next();
@@ -256,7 +257,7 @@ public class QueryParseTest extends Abst
         assertNotNull(queryUtil.getQueryObject());
         QueryObject queryObj = queryUtil.getQueryObject();
 
-        Map<String,String> types = queryObj.getTypes();
+        Map<String, String> types = queryObj.getTypes();
         assertTrue(1 == types.size());
 
         String key = types.keySet().iterator().next();
@@ -274,24 +275,25 @@ public class QueryParseTest extends Abst
         assertNotNull(queryUtil.getQueryObject());
         QueryObject queryObj = queryUtil.getQueryObject();
         CmisQueryWalker walker = queryUtil.getWalker();
-            
+
         List<CmisSelector> whereRefs = queryObj.getWhereReferences();
         Map<Integer, CmisSelector> colRefs = queryObj.getColumnReferences();
         assertTrue(1 == whereRefs.size());
 
         CmisSelector value = whereRefs.iterator().next();
         assertTrue(value instanceof ColumnReference);
-        assertEquals("MyProp1", ((ColumnReference)value).getPropertyQueryName());
+        assertEquals("MyProp1", ((ColumnReference) value).getPropertyQueryName());
         // only "*" should be in select references
         assertTrue(1 == queryObj.getSelectReferences().size());
 
         CommonTree tree = (CommonTree) walker.getTreeNodeStream().getTreeSource();
 
-//        assertTrue(traverseTreeAndFindNodeInColumnMap(tree, colRefs));
+        // assertTrue(traverseTreeAndFindNodeInColumnMap(tree, colRefs));
         traverseTreeAndFindNodeInColumnMap2(tree, colRefs);
     }
 
-    // check if the map containing all column references in the where clause has an existing node as key
+    // check if the map containing all column references in the where clause has
+    // an existing node as key
     private boolean traverseTreeAndFindNodeInColumnMap(Tree node, Map<Object, CmisSelector> colRefs) {
         boolean found = false;
 
@@ -300,7 +302,7 @@ public class QueryParseTest extends Abst
         }
 
         int count = node.getChildCount();
-        for (int i=0; i<count && !found; i++) {
+        for (int i = 0; i < count && !found; i++) {
             Tree child = node.getChild(i);
             found = traverseTreeAndFindNodeInColumnMap(child, colRefs);
         }
@@ -310,11 +312,11 @@ public class QueryParseTest extends Abst
     private boolean traverseTreeAndFindNodeInColumnMap2(Tree node, Object colRef) {
         int count = node.getChildCount();
         LOG.debug("  checking with: " + node + " identity hash code: " + System.identityHashCode(node));
-        if (node==colRef) {
+        if (node == colRef) {
             return true;
         }
         boolean found = false;
-        for (int i=0; i<count && !found; i++) {
+        for (int i = 0; i < count && !found; i++) {
             Tree child = node.getChild(i);
             found = traverseTreeAndFindNodeInColumnMap2(child, colRef);
         }
@@ -338,9 +340,9 @@ public class QueryParseTest extends Abst
         assertTrue(sp.isAscending());
 
         CmisSelector sortSpec = sp.getSelector();
-        assert(sortSpec instanceof ColumnReference);
-        assertEquals("abc", ((ColumnReference)sortSpec).getQualifier());
-        assertEquals("def", ((ColumnReference)sortSpec).getPropertyQueryName());
+        assert (sortSpec instanceof ColumnReference);
+        assertEquals("abc", ((ColumnReference) sortSpec).getQualifier());
+        assertEquals("def", ((ColumnReference) sortSpec).getPropertyQueryName());
     }
 
     @Test
@@ -359,9 +361,9 @@ public class QueryParseTest extends Abst
         assertFalse(sp.isAscending());
 
         CmisSelector sortSpec = sp.getSelector();
-        assert(sortSpec instanceof ColumnReference);
-        assertNull(((ColumnReference)sortSpec).getQualifier());
-        assertEquals("def", ((ColumnReference)sortSpec).getPropertyQueryName());
+        assert (sortSpec instanceof ColumnReference);
+        assertNull(((ColumnReference) sortSpec).getQualifier());
+        assertEquals("def", ((ColumnReference) sortSpec).getPropertyQueryName());
     }
 
     @Test
@@ -369,7 +371,7 @@ public class QueryParseTest extends Abst
         // System.out.println("printTreeTest():");
         String statement = "SELECT p1, p2, p3.t3 mycol FROM MyType AS MyAlias WHERE p1='abc' and p2=123 ORDER BY abc.def ASC";
         try {
-            
+
             CmisQueryWalker walker = getWalker(statement);
             Tree parserTree = (Tree) walker.getTreeNodeStream().getTreeSource();
             printTree(parserTree, statement);
@@ -475,7 +477,6 @@ public class QueryParseTest extends Abst
         checkTreeWhere(statement);
     }
 
-
     @Test
     public void whereTestAnyIn() {
         String statement = "SELECT p1 FROM MyType WHERE ANY Colors IN ('Red', 'Green', 'Blue')";
@@ -490,14 +491,14 @@ public class QueryParseTest extends Abst
 
     @Test
     public void whereTestTokensAfterStatement() {
-    	String statement = "SELECT p1 FROM MyType WHERE p1 LIKE 'abc*' IN_FOLDER('def')";
-    	try {
-            checkTreeWhere(statement);    		
-    	} catch (Exception e) {
-    		LOG.debug("Exception is: ", e);
-    		assertTrue(e instanceof CmisInvalidArgumentException);
-    		assertTrue(e.getMessage().contains("illegal tokens after end"));
-    	}
+        String statement = "SELECT p1 FROM MyType WHERE p1 LIKE 'abc*' IN_FOLDER('def')";
+        try {
+            checkTreeWhere(statement);
+        } catch (Exception e) {
+            LOG.debug("Exception is: ", e);
+            assertTrue(e instanceof CmisInvalidArgumentException);
+            assertTrue(e.getMessage().contains("illegal tokens after end"));
+        }
     }
 
     @Test
@@ -530,7 +531,7 @@ public class QueryParseTest extends Abst
     @Test
     public void whereTestContainsNoFulltextParse() throws Exception {
         String statement = "SELECT p1 FROM MyType WHERE CONTAINS('Beethoven')";
-        QueryUtilStrict queryUtil= new QueryUtilStrict(statement, typeManager, predicateWalker, false);
+        QueryUtilStrict queryUtil = new QueryUtilStrict(statement, typeManager, predicateWalker, false);
         queryUtil.parseStatement();
         assertNotNull(queryUtil);
         assertNotNull(queryUtil.getQueryObject());
@@ -567,7 +568,7 @@ public class QueryParseTest extends Abst
         CmisQueryWalker walker = queryUtil.getWalker();
         assertNotNull(walker);
 
-        Map<String,String> types = queryUtil.getQueryObject().getTypes();
+        Map<String, String> types = queryUtil.getQueryObject().getTypes();
         assertTrue(2 == types.size());
     }
 
@@ -602,7 +603,7 @@ public class QueryParseTest extends Abst
             fail("Parsing statement " + statement + " should fail with RecognitionException, but was: " + e.getClass());
         }
     }
-    
+
     @Test
     public void whereTestContains2() {
         String statement = "SELECT p1 FROM MyType WHERE CONTAINS('Beethoven OR \\'Johann Sebastian\\' Mozart -Cage AND Orff')";
@@ -610,7 +611,7 @@ public class QueryParseTest extends Abst
         Tree tree = findSearchExpression(statement);
         printSearchTree(tree, statement);
     }
-    
+
     @Test
     public void whereTestMultipleContains2() {
         String statement = "SELECT p1 FROM MyType WHERE CONTAINS('Beethoven') AND CONTAINS('Bach')";
@@ -618,31 +619,31 @@ public class QueryParseTest extends Abst
         int noContains = getNumberOfSearchExpression(statement);
         assertTrue(2 == noContains);
     }
-    
+
     private void checkTreeWhere(String statement) {
         LOG.info("\ncheckTreeWhere: " + statement);
         QueryUtilStrict queryUtil = traverseStatementAndCatchExc(statement);
         Tree whereTree = queryUtil.getWalker().getWherePredicateTree();
         evalWhereTree(whereTree);
     }
-    
+
     private Tree findSearchExpression(String statement) {
         QueryUtilStrict queryUtil = traverseStatementAndCatchExc(statement);
         Tree whereTree = queryUtil.getWalker().getWherePredicateTree();
         return findTextSearchNode(whereTree);
     }
-    
+
     private int getNumberOfSearchExpression(String statement) {
         QueryUtilStrict queryUtil = traverseStatementAndCatchExc(statement);
         return queryUtil.getWalker().getNumberOfContainsClauses();
     }
-    
+
     private Tree findTextSearchNode(Tree node) {
         int count = node.getChildCount();
         if (node.getType() == CmisQlStrictLexer.CONTAINS) {
             return node;
         } else {
-            for (int i=0; i<count; i++) {
+            for (int i = 0; i < count; i++) {
                 Tree child = node.getChild(i);
                 node = findTextSearchNode(child); // recursive descent
                 if (null != node) {
@@ -650,7 +651,7 @@ public class QueryParseTest extends Abst
                 }
             }
             return null;
-        }        
+        }
     }
 
     private void evalWhereTree(Tree root) {
@@ -658,23 +659,23 @@ public class QueryParseTest extends Abst
         if (root.getType() == CmisQlStrictLexer.CONTAINS) {
             evalSearchExprTree(root);
         } else {
-            for (int i=0; i<count; i++) {
+            for (int i = 0; i < count; i++) {
                 Tree child = root.getChild(i);
                 evaluateWhereNode(child);
                 evalWhereTree(child); // recursive descent
             }
         }
     }
-    
+
     private void evalSearchExprTree(Tree root) {
         int count = root.getChildCount();
-        for (int i=0; i<count; i++) {
+        for (int i = 0; i < count; i++) {
             Tree child = root.getChild(i);
             evaluateSearchExprNode(child);
             evalSearchExprTree(child); // recursive descent
         }
     }
-    
+
     private void printTree(Tree tree, String statement) {
         LOG.info("Printing the abstract syntax tree for statement:");
         LOG.info("  " + statement);
@@ -695,7 +696,7 @@ public class QueryParseTest extends Abst
         LOG.info(indentString() + printNode(node));
         ++indent;
         int count = node.getChildCount();
-        for (int i=0;i<count;i++) {
+        for (int i = 0; i < count; i++) {
             Tree child = node.getChild(i);
             printTree(child);
         }
@@ -794,7 +795,7 @@ public class QueryParseTest extends Abst
         LOG.info(indentString() + printSearchNode(node));
         ++indent;
         int count = node.getChildCount();
-        for (int i=0;i<count;i++) {
+        for (int i = 0; i < count; i++) {
             Tree child = node.getChild(i);
             printSearchTree(child);
         }
@@ -806,15 +807,15 @@ public class QueryParseTest extends Abst
         case TextSearchLexer.TEXT_AND:
         case TextSearchLexer.TEXT_OR:
         case TextSearchLexer.TEXT_SEARCH_PHRASE_STRING_LIT:
-        case TextSearchLexer.TEXT_SEARCH_WORD_LIT:            
+        case TextSearchLexer.TEXT_SEARCH_WORD_LIT:
             return node.toString();
         case TextSearchLexer.TEXT_MINUS:
             return "MINUS";
-         default:
-             return "Unknown token: " +  node.toString();
+        default:
+            return "Unknown token: " + node.toString();
         }
     }
-    
+
     // Ensure that we receive only valid tokens and nodes in the where clause:
     private void evaluateWhereNode(Tree node) {
         LOG.info("evaluating node: " + node.toString());
@@ -928,7 +929,7 @@ public class QueryParseTest extends Abst
         switch (node.getType()) {
         case TextSearchLexer.TEXT_AND:
         case TextSearchLexer.TEXT_OR:
-            assertTrue(node.getChildCount() >= 2 );
+            assertTrue(node.getChildCount() >= 2);
             break;
         case TextSearchLexer.TEXT_MINUS:
             assertEquals(1, node.getChildCount());
@@ -938,10 +939,10 @@ public class QueryParseTest extends Abst
             evalStringLiteral(node);
             break;
         default:
-            fail("[Unexpected node in text search expression: " + node.toString() + "]");         
+            fail("[Unexpected node in text search expression: " + node.toString() + "]");
         }
     }
-        
+
     private void evalInAny(Tree node) {
     }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryTestDataCreator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryTestDataCreator.java?rev=1516753&r1=1516752&r2=1516753&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryTestDataCreator.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryTestDataCreator.java Fri Aug 23 08:53:49 2013
@@ -64,23 +64,23 @@ import org.apache.chemistry.opencmis.inm
 /**
  * Utility class that fills the in-memory repository with some test objects that
  * can be used for query
- *
+ * 
  * @author Jens
- *
- * This class uses the following data for query testing. We have one document type
- * "ComplexType" and one folder type "FolderType" The document type has one property of
- * each of the types boolean, integer, decimal, string and datetime. id, uri and html are
- * treated like a string and do not make a difference.
- *
- * String   Int         Double      DateTime  Boolean
- * ------------------------------------------------
- * Alpha    -100        -1.6E-5     23.05.1618  true
- * Beta     -50         -4.0E24     08.05.1945  false
- * Gamma    0           3.141592    (now)       true
- * Delta    50          1.23456E-6  20.01.2038  true
- * Epsilon  100         1.2345E12   14.07.2345  false
- *
- * For folder and tree tests this series is put in each of the three test folders
+ * 
+ *         This class uses the following data for query testing. We have one
+ *         document type "ComplexType" and one folder type "FolderType" The
+ *         document type has one property of each of the types boolean, integer,
+ *         decimal, string and datetime. id, uri and html are treated like a
+ *         string and do not make a difference.
+ * 
+ *         String Int Double DateTime Boolean
+ *         ------------------------------------------------ Alpha -100 -1.6E-5
+ *         23.05.1618 true Beta -50 -4.0E24 08.05.1945 false Gamma 0 3.141592
+ *         (now) true Delta 50 1.23456E-6 20.01.2038 true Epsilon 100 1.2345E12
+ *         14.07.2345 false
+ * 
+ *         For folder and tree tests this series is put in each of the three
+ *         test folders
  */
 public class QueryTestDataCreator {
 
@@ -105,9 +105,11 @@ public class QueryTestDataCreator {
     public String getFolder1() {
         return folder1;
     }
+
     public String getFolder2() {
         return folder2;
     }
+
     public String getFolder11() {
         return folder11;
     }
@@ -124,15 +126,15 @@ public class QueryTestDataCreator {
         gc1.clear();
         gc1.set(1945, 4, 8);
 
-        final Map<String, Object> propertyMap1 =
-            new HashMap<String, Object>() {
+        final Map<String, Object> propertyMap1 = new HashMap<String, Object>() {
             {
                 put(PROP_ID_STRING, "Alpha");
                 put(PROP_ID_INT, Integer.valueOf(-100));
                 put(PROP_ID_DECIMAL, Double.valueOf(-4.0E24d));
                 put(PROP_ID_DATETIME, gc1);
                 put(PROP_ID_BOOLEAN, true);
-            }};
+            }
+        };
         ContentStream content1 = createContent("I have a cat.");
         doc1 = createDocument("alpha", rootFolderId, COMPLEX_TYPE, propertyMap1, content1);
         assertNotNull(doc1);
@@ -141,29 +143,29 @@ public class QueryTestDataCreator {
         gc2.clear();
         gc2.set(1618, 4, 23);
 
-        final Map<String, Object> propertyMap2 =
-            new HashMap<String, Object>() {
+        final Map<String, Object> propertyMap2 = new HashMap<String, Object>() {
             {
                 put(PROP_ID_STRING, "Beta");
                 put(PROP_ID_INT, Integer.valueOf(-50));
                 put(PROP_ID_DECIMAL, Double.valueOf(-1.6E-5d));
                 put(PROP_ID_DATETIME, gc2);
                 put(PROP_ID_BOOLEAN, false);
-            }};
+            }
+        };
         ContentStream content2 = createContent("I have a cat named Kitty Katty.");
         doc2 = createDocument("beta", rootFolderId, COMPLEX_TYPE, propertyMap2, content2);
         assertNotNull(doc2);
 
-        final Map<String, Object> propertyMap3 =
-            new HashMap<String, Object>() {
+        final Map<String, Object> propertyMap3 = new HashMap<String, Object>() {
             {
                 put(PROP_ID_STRING, "Gamma");
                 put(PROP_ID_INT, Integer.valueOf(0));
                 put(PROP_ID_DECIMAL, Double.valueOf(Math.PI));
                 put(PROP_ID_DATETIME, new GregorianCalendar(TZ));
                 put(PROP_ID_BOOLEAN, true);
-            }};
-        
+            }
+        };
+
         ContentStream content3 = createContent("I have a dog.");
         doc3 = createDocument("gamma", rootFolderId, COMPLEX_TYPE, propertyMap3, content3);
         assertNotNull(doc3);
@@ -172,15 +174,15 @@ public class QueryTestDataCreator {
         gc4.clear();
         gc4.set(2038, 0, 20);
 
-        final Map<String, Object> propertyMap4 =
-            new HashMap<String, Object>() {
+        final Map<String, Object> propertyMap4 = new HashMap<String, Object>() {
             {
                 put(PROP_ID_STRING, "Delta");
                 put(PROP_ID_INT, Integer.valueOf(50));
                 put(PROP_ID_DECIMAL, Double.valueOf(1.23456E-6));
                 put(PROP_ID_DATETIME, gc4);
                 put(PROP_ID_BOOLEAN, true);
-            }};
+            }
+        };
         ContentStream content4 = createContent("I have a cat and a dog.");
         doc4 = createDocument("delta", rootFolderId, COMPLEX_TYPE, propertyMap4, content4);
         assertNotNull(doc4);
@@ -189,15 +191,15 @@ public class QueryTestDataCreator {
         gc5.clear();
         gc5.set(2345, 6, 14);
 
-        final Map<String, Object> propertyMap5 =
-            new HashMap<String, Object>() {
+        final Map<String, Object> propertyMap5 = new HashMap<String, Object>() {
             {
                 put(PROP_ID_STRING, "Epsilon");
                 put(PROP_ID_INT, Integer.valueOf(100));
                 put(PROP_ID_DECIMAL, Double.valueOf(1.2345E12));
                 put(PROP_ID_DATETIME, gc5);
                 put(PROP_ID_BOOLEAN, false);
-            }};
+            }
+        };
         ContentStream content5 = createContent("I hate having pets.");
         doc5 = createDocument("epsilon", rootFolderId, COMPLEX_TYPE, propertyMap5, content5);
         assertNotNull(doc5);
@@ -206,109 +208,109 @@ public class QueryTestDataCreator {
 
     @SuppressWarnings("serial")
     public void createMultiValueDocuments() {
-        final List<String> mvProps1 =
-            new ArrayList<String>() {
+        final List<String> mvProps1 = new ArrayList<String>() {
             {
                 add("red");
                 add("green");
                 add("blue");
-            }};
+            }
+        };
 
-        final Map<String, Object> propertyMap1 =
-            new HashMap<String, Object>() {
+        final Map<String, Object> propertyMap1 = new HashMap<String, Object>() {
             {
                 put(PROP_ID_STRING_MULTI_VALUE, mvProps1);
                 put(PROP_ID_INT, Integer.valueOf(100));
-            }};
+            }
+        };
         createDocument("mv-alpha", rootFolderId, COMPLEX_TYPE, propertyMap1);
 
-        final List<String> mvProps2 =
-            new ArrayList<String>() {
+        final List<String> mvProps2 = new ArrayList<String>() {
             {
                 add("red");
                 add("pink");
                 add("violet");
-            }};
+            }
+        };
 
-        final Map<String, Object> propertyMap2 =
-            new HashMap<String, Object>() {
+        final Map<String, Object> propertyMap2 = new HashMap<String, Object>() {
             {
                 put(PROP_ID_STRING_MULTI_VALUE, mvProps2);
                 put(PROP_ID_INT, Integer.valueOf(200));
-            }};
+            }
+        };
         createDocument("mv-beta", rootFolderId, COMPLEX_TYPE, propertyMap2);
     }
 
     @SuppressWarnings("serial")
     public void createTestFolders() {
-        final Map<String, Object> propertyMap1 =
-            new HashMap<String, Object>() {
+        final Map<String, Object> propertyMap1 = new HashMap<String, Object>() {
             {
                 put(PROP_ID_INT, Integer.valueOf(1234));
                 put(PROP_ID_STRING, "ABCD");
-            }};
+            }
+        };
         folder1 = createFolder("Folder 1", rootFolderId, FOLDER_TYPE, propertyMap1);
 
-        final Map<String, Object> propertyMap2 =
-            new HashMap<String, Object>() {
+        final Map<String, Object> propertyMap2 = new HashMap<String, Object>() {
             {
                 put(PROP_ID_INT, Integer.valueOf(-2345));
                 put(PROP_ID_STRING, "defg");
-            }};
+            }
+        };
         folder2 = createFolder("Folder 2", rootFolderId, FOLDER_TYPE, propertyMap2);
 
-        final Map<String, Object> propertyMap3 =
-            new HashMap<String, Object>() {
+        final Map<String, Object> propertyMap3 = new HashMap<String, Object>() {
             {
                 put(PROP_ID_INT, Integer.valueOf(123));
                 put(PROP_ID_STRING, "ZZZZ");
-            }};
+            }
+        };
         folder11 = createFolder("Folder 11", folder1, FOLDER_TYPE, propertyMap3);
     }
 
     @SuppressWarnings("serial")
     public void createNullTestDocument() {
 
-        final Map<String, Object> propertyMap1 =
-            new HashMap<String, Object>() {
+        final Map<String, Object> propertyMap1 = new HashMap<String, Object>() {
             {
                 put(PROP_ID_STRING, "DocumentWithNulls");
-            }};
+            }
+        };
         createDocument("nulldoc", rootFolderId, COMPLEX_TYPE, propertyMap1);
     }
 
     @SuppressWarnings("serial")
     public void createLikeTestDocuments(String folderId) {
 
-        final Map<String, Object> propertyMap1 =
-            new HashMap<String, Object>() {
+        final Map<String, Object> propertyMap1 = new HashMap<String, Object>() {
             {
                 put(PROP_ID_STRING, "ABCDEF");
-            }};
+            }
+        };
         createDocument("likedoc1", folderId, COMPLEX_TYPE, propertyMap1);
 
-        final Map<String, Object> propertyMap2 =
-            new HashMap<String, Object>() {
+        final Map<String, Object> propertyMap2 = new HashMap<String, Object>() {
             {
                 put(PROP_ID_STRING, "ABC123");
-            }};
+            }
+        };
         createDocument("likedoc2", folderId, COMPLEX_TYPE, propertyMap2);
 
-        final Map<String, Object> propertyMap3 =
-            new HashMap<String, Object>() {
+        final Map<String, Object> propertyMap3 = new HashMap<String, Object>() {
             {
                 put(PROP_ID_STRING, "123ABC");
-            }};
+            }
+        };
         createDocument("likedoc3", folderId, COMPLEX_TYPE, propertyMap3);
     }
 
     @SuppressWarnings("serial")
     public String createVersionedDocument() {
-        final Map<String, Object> propertyMap1 =
-            new HashMap<String, Object>() {
+        final Map<String, Object> propertyMap1 = new HashMap<String, Object>() {
             {
                 put(VERSION_PROPERTY_ID, "ver123");
-            }};
+            }
+        };
 
         String verIdV1 = createDocument("verdoc1", rootFolderId, UnitTestTypeSystemCreator.VERSIONED_TYPE,
                 propertyMap1, VersioningState.MAJOR, null);
@@ -316,14 +318,15 @@ public class QueryTestDataCreator {
                 false, false, null);
 
         // get version series id
-        String verIdSer = (String) version.getProperties().getProperties().get(PropertyIds.VERSION_SERIES_ID).getFirstValue();
+        String verIdSer = (String) version.getProperties().getProperties().get(PropertyIds.VERSION_SERIES_ID)
+                .getFirstValue();
 
         // create second version
-        final Map<String, Object> propertyMap2 =
-            new HashMap<String, Object>() {
+        final Map<String, Object> propertyMap2 = new HashMap<String, Object>() {
             {
                 put(VERSION_PROPERTY_ID, "ver456");
-            }};
+            }
+        };
         Properties propsV2 = createDocumentProperties(null, null, propertyMap2);
 
         Holder<String> idHolder = new Holder<String>(verIdV1);
@@ -350,37 +353,38 @@ public class QueryTestDataCreator {
         gc1.clear();
         gc1.set(1945, 4, 8);
 
-        final Map<String, Object> propertyMap1 =
-            new HashMap<String, Object>() {{
+        final Map<String, Object> propertyMap1 = new HashMap<String, Object>() {
+            {
                 put(PROP_ID_STRING, "Secondary");
                 put(PROP_ID_INT, Integer.valueOf(-100));
                 put(PROP_ID_DECIMAL, Double.valueOf(-4.0E24d));
                 put(PROP_ID_DATETIME, gc1);
                 put(PROP_ID_BOOLEAN, true);
                 put(SECONDARY_STRING_PROP, stringPropVal1);
-                put(SECONDARY_INTEGER_PROP,intPropVal1);
-                put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, SECONDARY_TYPE);     
-            }};
+                put(SECONDARY_INTEGER_PROP, intPropVal1);
+                put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, SECONDARY_TYPE);
+            }
+        };
         ContentStream content1 = createContent("Some more content.");
         doc1 = createDocument("docwithsecondary", rootFolderId, COMPLEX_TYPE, propertyMap1, content1);
         assertNotNull(doc1);
-        
-        final Map<String, Object> propertyMap2 =
-            new HashMap<String, Object>() {{
+
+        final Map<String, Object> propertyMap2 = new HashMap<String, Object>() {
+            {
                 put(PROP_ID_STRING, "Secondary 2");
                 put(PROP_ID_INT, Integer.valueOf(123));
                 put(PROP_ID_DECIMAL, Double.valueOf(1.23E24d));
                 put(PROP_ID_BOOLEAN, false);
                 put(SECONDARY_STRING_PROP, stringPropVal2);
-                put(SECONDARY_INTEGER_PROP,intPropVal2);
-                put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, SECONDARY_TYPE);     
-            }};
+                put(SECONDARY_INTEGER_PROP, intPropVal2);
+                put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, SECONDARY_TYPE);
+            }
+        };
         ContentStream content2 = createContent("Even still some more content.");
         doc1 = createDocument("docwithsecondary2", rootFolderId, COMPLEX_TYPE, propertyMap2, content2);
         assertNotNull(doc1);
     }
-    
-    
+
     private String createFolder(String folderName, String parentFolderId, String typeId, Map<String, Object> properties) {
         Properties props = createFolderProperties(folderName, typeId, properties);
         String id = null;
@@ -435,9 +439,8 @@ public class QueryTestDataCreator {
         if (typeId != null) {
             properties.add(fFactory.createPropertyIdData(PropertyIds.OBJECT_TYPE_ID, typeId));
         }
-        for (Map.Entry<String,Object> propEntry :propertyMap.entrySet()) {
-            PropertyData<?> pd =
-            createPropertyData(propEntry.getKey(), propEntry.getValue());
+        for (Map.Entry<String, Object> propEntry : propertyMap.entrySet()) {
+            PropertyData<?> pd = createPropertyData(propEntry.getKey(), propEntry.getValue());
             properties.add(pd);
         }
         Properties props = fFactory.createPropertiesData(properties);
@@ -448,50 +451,49 @@ public class QueryTestDataCreator {
         List<PropertyData<?>> properties = new ArrayList<PropertyData<?>>();
         properties.add(fFactory.createPropertyIdData(PropertyIds.NAME, folderName));
         properties.add(fFactory.createPropertyIdData(PropertyIds.OBJECT_TYPE_ID, typeId));
-        for (Map.Entry<String,Object> propEntry :propertyMap.entrySet()) {
-            PropertyData<?> pd =
-            createPropertyData(propEntry.getKey(), propEntry.getValue());
+        for (Map.Entry<String, Object> propEntry : propertyMap.entrySet()) {
+            PropertyData<?> pd = createPropertyData(propEntry.getKey(), propEntry.getValue());
             properties.add(pd);
         }
         Properties props = fFactory.createPropertiesData(properties);
         return props;
     }
 
-
     /**
-     * Simplified property creation method, create Property of Boolean, String, Integer,
-     * Decimal, or DataTime depending on class of value (Boolean, String, Integer, Double,
-     * or GregorianCalendar. Id, Html and URI are not supported
-     *
+     * Simplified property creation method, create Property of Boolean, String,
+     * Integer, Decimal, or DataTime depending on class of value (Boolean,
+     * String, Integer, Double, or GregorianCalendar. Id, Html and URI are not
+     * supported
+     * 
      * @param propId
      * @param value
      * @return
      */
     @SuppressWarnings("unchecked")
-    private PropertyData<?> createPropertyData (String propId, Object value) {
+    private PropertyData<?> createPropertyData(String propId, Object value) {
         Class<?> clazz = value.getClass();
         if (clazz.equals(Boolean.class)) {
-            return fFactory.createPropertyBooleanData(propId, (Boolean)value);
+            return fFactory.createPropertyBooleanData(propId, (Boolean) value);
         } else if (clazz.equals(Double.class)) {
-            return fFactory.createPropertyDecimalData(propId, BigDecimal.valueOf((Double)value));
+            return fFactory.createPropertyDecimalData(propId, BigDecimal.valueOf((Double) value));
         } else if (clazz.equals(Integer.class)) {
-            return fFactory.createPropertyIntegerData(propId, BigInteger.valueOf((Integer)value));
+            return fFactory.createPropertyIntegerData(propId, BigInteger.valueOf((Integer) value));
         } else if (clazz.equals(String.class)) {
-            return fFactory.createPropertyStringData(propId, (String)value);
+            return fFactory.createPropertyStringData(propId, (String) value);
         } else if (clazz.equals(GregorianCalendar.class)) {
-            return fFactory.createPropertyDateTimeData(propId, (GregorianCalendar)value);
+            return fFactory.createPropertyDateTimeData(propId, (GregorianCalendar) value);
         } else if (value instanceof List) {
-            clazz = ((List<?>)value).get(0).getClass();
+            clazz = ((List<?>) value).get(0).getClass();
             if (clazz.equals(Boolean.class)) {
-                return fFactory.createPropertyBooleanData(propId, (List<Boolean>)value);
+                return fFactory.createPropertyBooleanData(propId, (List<Boolean>) value);
             } else if (clazz.equals(Double.class)) {
-                return fFactory.createPropertyDecimalData(propId, (List<BigDecimal>)value);
+                return fFactory.createPropertyDecimalData(propId, (List<BigDecimal>) value);
             } else if (clazz.equals(Integer.class)) {
-                return fFactory.createPropertyIntegerData(propId, (List<BigInteger>)value);
+                return fFactory.createPropertyIntegerData(propId, (List<BigInteger>) value);
             } else if (clazz.equals(String.class)) {
-                return fFactory.createPropertyStringData(propId, (List<String>)value);
+                return fFactory.createPropertyStringData(propId, (List<String>) value);
             } else if (clazz.equals(GregorianCalendar.class)) {
-                return fFactory.createPropertyDateTimeData(propId, (List<GregorianCalendar>)value);
+                return fFactory.createPropertyDateTimeData(propId, (List<GregorianCalendar>) value);
             } else {
                 fail("unsupported type in propery value: " + clazz);
             }
@@ -500,7 +502,7 @@ public class QueryTestDataCreator {
         }
         return null;
     }
-    
+
     private ContentStream createContent(String text) {
         ContentStreamDataImpl content = new ContentStreamDataImpl(-1);
         content.setFileName("data.txt");
@@ -513,5 +515,5 @@ public class QueryTestDataCreator {
         }
         return content;
     }
-    
+
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryTypesTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryTypesTest.java?rev=1516753&r1=1516752&r2=1516753&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryTypesTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryTypesTest.java Fri Aug 23 08:53:49 2013
@@ -53,6 +53,7 @@ public class QueryTypesTest extends Abst
 
     public static class TestPredicateWalker extends AbstractPredicateWalker {
         List<Integer> ids = new LinkedList<Integer>();
+
         @Override
         public Object walkId(Tree node) {
             ids.add(node.getTokenStartIndex());
@@ -83,7 +84,8 @@ public class QueryTypesTest extends Abst
 
     @Test
     public void resolveTypesTest1() throws Exception {
-        String statement = "SELECT " + TITLE_PROP + ", " + AUTHOR_PROP + " FROM " + BOOK_TYPE + " AS BooksAlias WHERE " + ISBN_PROP + " = '100'";
+        String statement = "SELECT " + TITLE_PROP + ", " + AUTHOR_PROP + " FROM " + BOOK_TYPE + " AS BooksAlias WHERE "
+                + ISBN_PROP + " = '100'";
         verifyResolveSelect(statement);
     }
 
@@ -158,7 +160,7 @@ public class QueryTypesTest extends Abst
         CmisQueryWalker walker = getWalker(statement);
         assertNotNull(queryObj);
         assertNotNull(walker);
-        Map<String,String> types = queryObj.getTypes();
+        Map<String, String> types = queryObj.getTypes();
         assertTrue(1 == types.size());
         List<CmisSelector> selects = queryObj.getSelectReferences();
         assertTrue(2 == selects.size());
@@ -166,7 +168,8 @@ public class QueryTypesTest extends Abst
             assertTrue(select instanceof ColumnReference);
             ColumnReference colRef = ((ColumnReference) select);
             assertEquals(bookType, colRef.getTypeDefinition());
-            assertTrue(colRef.getPropertyQueryName().equals(TITLE_PROP) || colRef.getPropertyQueryName().equals(AUTHOR_PROP));
+            assertTrue(colRef.getPropertyQueryName().equals(TITLE_PROP)
+                    || colRef.getPropertyQueryName().equals(AUTHOR_PROP));
         }
     }
 
@@ -176,7 +179,7 @@ public class QueryTypesTest extends Abst
 
         CmisQueryWalker walker = getWalker(statement);
         assertNotNull(walker);
-        Map<String,String> types = queryObj.getTypes();
+        Map<String, String> types = queryObj.getTypes();
         assertTrue(2 == types.size());
         List<CmisSelector> selects = queryObj.getSelectReferences();
         assertTrue(2 == selects.size());
@@ -191,8 +194,7 @@ public class QueryTypesTest extends Abst
     }
 
     @Test
-    public void resolveTypesWithTwoFromsSameTypeCorrectlyQualified()
-            throws Exception {
+    public void resolveTypesWithTwoFromsSameTypeCorrectlyQualified() throws Exception {
         String statement = "SELECT A.Title FROM BookType A JOIN BookType B";
 
         CmisQueryWalker walker = getWalker(statement);
@@ -209,16 +211,14 @@ public class QueryTypesTest extends Abst
     }
 
     @Test
-    public void resolveTypesWithTwoFromsSameTypeAmbiguouslyQualified()
-            throws Exception {
+    public void resolveTypesWithTwoFromsSameTypeAmbiguouslyQualified() throws Exception {
         String statement = "SELECT BookType.Title FROM BookType A JOIN BookType B";
         try {
             traverseStatement(statement);
             fail("Select with an ambiguously qualified property should fail.");
         } catch (Exception e) {
             assertTrue(e instanceof RecognitionException);
-            assertTrue(e.toString().contains(
-                    "BookType is an ambiguous type query name"));
+            assertTrue(e.toString().contains("BookType is an ambiguous type query name"));
         }
     }
 
@@ -229,7 +229,7 @@ public class QueryTypesTest extends Abst
         CmisQueryWalker walker = getWalker(statement);
         assertNotNull(queryObj);
         assertNotNull(walker);
-        Map<String,String> types = queryObj.getTypes();
+        Map<String, String> types = queryObj.getTypes();
         assertTrue(2 == types.size());
         List<CmisSelector> selects = queryObj.getSelectReferences();
         assertTrue(2 == selects.size());
@@ -263,7 +263,7 @@ public class QueryTypesTest extends Abst
         CmisQueryWalker walker = getWalker(statement);
         assertNotNull(queryObj);
         assertNotNull(walker);
-        Map<String,String> types = queryObj.getTypes();
+        Map<String, String> types = queryObj.getTypes();
         assertTrue(2 == types.size());
         List<CmisSelector> selects = queryObj.getSelectReferences();
         assertTrue(1 == selects.size());
@@ -278,7 +278,7 @@ public class QueryTypesTest extends Abst
         CmisQueryWalker walker = getWalker(statement);
         assertNotNull(queryObj);
         assertNotNull(walker);
-        Map<String,String> types = queryObj.getTypes();
+        Map<String, String> types = queryObj.getTypes();
         assertTrue(1 == types.size());
         List<CmisSelector> selects = queryObj.getSelectReferences();
         assertTrue(1 == selects.size());
@@ -293,7 +293,7 @@ public class QueryTypesTest extends Abst
         CmisQueryWalker walker = getWalker(statement);
         assertNotNull(queryObj);
         assertNotNull(walker);
-        Map<String,String> types = queryObj.getTypes();
+        Map<String, String> types = queryObj.getTypes();
         assertTrue(2 == types.size());
         List<CmisSelector> selects = queryObj.getSelectReferences();
         assertTrue(1 == selects.size());
@@ -358,7 +358,6 @@ public class QueryTypesTest extends Abst
         }
     }
 
-
     @Test
     public void resolveTypesWhereWithTwoFromsQualifiedWithAlias() throws Exception {
         String statement = "SELECT * FROM BookType AS MyBookAlias JOIN MyDocType  WHERE MyBookAlias.ISBN = '100'";
@@ -394,7 +393,7 @@ public class QueryTypesTest extends Abst
         CmisQueryWalker walker = getWalker(statement);
         assertNotNull(queryObj);
         assertNotNull(walker);
-        Map<String,String> types = queryObj.getTypes();
+        Map<String, String> types = queryObj.getTypes();
         assertTrue(1 == types.size());
         List<CmisSelector> wheres = queryObj.getWhereReferences();
         assertTrue(1 == wheres.size());
@@ -506,11 +505,12 @@ public class QueryTypesTest extends Abst
 
     @Test
     public void resolveJoinTypesWithAlias() throws Exception {
-        String statement = "SELECT Y.ISBN, X.MyBooleanProp, Y.Author FROM (MyDocType AS X JOIN BookType AS Y ON X.MyStringProp = Y.Title) "+
-                           "WHERE ('Joe' = ANY Y.Author)";
-//        "SELECT    Y.CLAIM_NUM, X.PROPERTY_ADDRESS, Y.DAMAGE_ESTIMATES " +
-//        "FROM   ( POLICY AS X JOIN CLAIMS AS Y ON X.POLICY_NUM = Y.POLICY_NUM ) " +
-//        "WHERE ( 100000 = ANY Y.DAMAGE_ESTIMATES )";
+        String statement = "SELECT Y.ISBN, X.MyBooleanProp, Y.Author FROM (MyDocType AS X JOIN BookType AS Y ON X.MyStringProp = Y.Title) "
+                + "WHERE ('Joe' = ANY Y.Author)";
+        // "SELECT    Y.CLAIM_NUM, X.PROPERTY_ADDRESS, Y.DAMAGE_ESTIMATES " +
+        // "FROM   ( POLICY AS X JOIN CLAIMS AS Y ON X.POLICY_NUM = Y.POLICY_NUM ) "
+        // +
+        // "WHERE ( 100000 = ANY Y.DAMAGE_ESTIMATES )";
         CmisQueryWalker walker = getWalker(statement);
         assertNotNull(queryObj);
         assertNotNull(walker);
@@ -528,7 +528,7 @@ public class QueryTypesTest extends Abst
             }
         }
     }
-    
+
     @Test
     public void testSecondaryJoin() throws RecognitionException {
         // needs some special types:
@@ -536,7 +536,7 @@ public class QueryTypesTest extends Abst
         tm.initTypeSystem(null, true); // create CMIS default types
 
         // create some types for testing
-        List<TypeDefinition> typeDefs = UnitTestTypeSystemCreator.getTypesList(); 
+        List<TypeDefinition> typeDefs = UnitTestTypeSystemCreator.getTypesList();
         for (TypeDefinition typeDef : typeDefs) {
             tm.addTypeDefinition(typeDef, true);
         }
@@ -554,13 +554,13 @@ public class QueryTypesTest extends Abst
         walker = getWalker(statement);
         secondaryJoinedTypes = queryObj.getJoinedSecondaryTypes();
         assertNull(secondaryJoinedTypes);
-        
+
         statement = "SELECT * FROM cmis:document JOIN " + UnitTestTypeSystemCreator.COMPLEX_TYPE + " WHERE "
                 + UnitTestTypeSystemCreator.PROP_ID_STRING + "='groovy'";
         walker = getWalker(statement);
         secondaryJoinedTypes = queryObj.getJoinedSecondaryTypes();
         assertNull(secondaryJoinedTypes);
-        
+
         statement = "SELECT * FROM cmis:document JOIN " + UnitTestTypeSystemCreator.SECONDARY_TYPE
                 + " ON cmis:document.cmis:objectId = " + UnitTestTypeSystemCreator.SECONDARY_TYPE
                 + ".cmis:objectId WHERE SecondaryStringProp='groovy'";
@@ -568,9 +568,9 @@ public class QueryTypesTest extends Abst
         secondaryJoinedTypes = queryObj.getJoinedSecondaryTypes();
         assertEquals(1, secondaryJoinedTypes.size());
         assertEquals(UnitTestTypeSystemCreator.SECONDARY_TYPE, secondaryJoinedTypes.get(0).getId());
-        
-        statement = "SELECT * FROM cmis:document JOIN " + UnitTestTypeSystemCreator.SECONDARY_TYPE
-                + " ON " + UnitTestTypeSystemCreator.SECONDARY_TYPE
+
+        statement = "SELECT * FROM cmis:document JOIN " + UnitTestTypeSystemCreator.SECONDARY_TYPE + " ON "
+                + UnitTestTypeSystemCreator.SECONDARY_TYPE
                 + ".cmis:objectId = cmis:document.cmis:objectId WHERE SecondaryStringProp='groovy'";
         walker = getWalker(statement);
         secondaryJoinedTypes = queryObj.getJoinedSecondaryTypes();
@@ -590,7 +590,7 @@ public class QueryTypesTest extends Abst
         assertEquals(1, secondaryJoinedTypes.size());
         assertEquals(UnitTestTypeSystemCreator.SECONDARY_TYPE, secondaryJoinedTypes.get(0).getId());
     }
-    
+
     @Test
     public void resolveTypeQualifiers1() throws Exception {
         String statement = "SELECT Title FROM BookType WHERE IN_TREE(BookType, 'foo')";
@@ -626,8 +626,7 @@ public class QueryTypesTest extends Abst
             fail("invalid correlation name should fail");
         } catch (Exception e) {
             assertTrue(e instanceof RecognitionException);
-            assertTrue(e.toString().contains(
-                    "dummy is neither a type query name nor an alias"));
+            assertTrue(e.toString().contains("dummy is neither a type query name nor an alias"));
         }
     }
 
@@ -644,8 +643,7 @@ public class QueryTypesTest extends Abst
 
     @Test
     public void resolveTypeQualifiers6() throws Exception {
-        String statement = "SELECT B.Title FROM BookType B JOIN MyDocType D"
-                + " WHERE IN_TREE(MyDocType, 'foo')";
+        String statement = "SELECT B.Title FROM BookType B JOIN MyDocType D" + " WHERE IN_TREE(MyDocType, 'foo')";
         CmisQueryWalker walker = getWalker(statement);
         assertNotNull(queryObj);
         assertNotNull(walker);
@@ -654,15 +652,13 @@ public class QueryTypesTest extends Abst
 
     @Test
     public void resolveTypeQualifiers7() throws Exception {
-        String statement = "SELECT B1.Title FROM BookType B1 JOIN BookType B2"
-                + " WHERE IN_TREE(BookType, 'foo')";
+        String statement = "SELECT B1.Title FROM BookType B1 JOIN BookType B2" + " WHERE IN_TREE(BookType, 'foo')";
         try {
             traverseStatement(statement);
             fail("ambiguous correlation name should fail");
         } catch (Exception e) {
             assertTrue(e instanceof RecognitionException);
-            assertTrue(e.toString().contains(
-                    "BookType is an ambiguous type query name"));
+            assertTrue(e.toString().contains("BookType is an ambiguous type query name"));
         }
     }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeManager.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeManager.java?rev=1516753&r1=1516752&r2=1516753&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeManager.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeManager.java Fri Aug 23 08:53:49 2013
@@ -48,6 +48,7 @@ public interface TypeManager {
      * return a list of all types known in this repository
      * 
      * @return
+     *      list of type definitions
      */
     Collection<TypeDefinitionContainer> getTypeDefinitionList();
 
@@ -56,6 +57,7 @@ public interface TypeManager {
      * document, folder, policy and relationship
      * 
      * @return
+     *      list of type definitions
      */
     List<TypeDefinitionContainer> getRootTypes();
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/PredicateWalker.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/PredicateWalker.java?rev=1516753&r1=1516752&r2=1516753&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/PredicateWalker.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/PredicateWalker.java Fri Aug 23 08:53:49 2013
@@ -29,7 +29,7 @@ import org.antlr.runtime.tree.Tree;
  * Can be used to build another datastructure, or for direct value evaluation
  * (thus the boolean return values for clauses, and Object for values).
  * <p>
- * The method {@link walkClause} is the entry point.
+ * The method {@link #walkExpr} is the entry point.
  */
 public interface PredicateWalker extends PredicateWalkerBase {
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/PredicateWalkerBase.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/PredicateWalkerBase.java?rev=1516753&r1=1516752&r2=1516753&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/PredicateWalkerBase.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/PredicateWalkerBase.java Fri Aug 23 08:53:49 2013
@@ -27,7 +27,6 @@ import org.antlr.runtime.tree.Tree;
  * initiate a tree walk for evaluating the query. You can inherit from
  * this interface if you want to have your own walking mechanism
  * <p>
- * The method {@link walkClause} is the entry point.
  */
 public interface PredicateWalkerBase {
 



Mime
View raw message