chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r955563 - in /incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src: main/java/org/apache/chemistry/opencmis/inmemory/query/ test/java/org/apache/chemistry/opencmis/inmemory/query/
Date Thu, 17 Jun 2010 12:02:48 GMT
Author: jens
Date: Thu Jun 17 12:02:48 2010
New Revision: 955563

URL: http://svn.apache.org/viewvc?rev=955563&view=rev
Log:
CMIS-216
preserver order in collected types in FROM 
add another test case

Modified:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/QueryObject.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/EvalQueryTest.java

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/QueryObject.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/QueryObject.java?rev=955563&r1=955562&r2=955563&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/QueryObject.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/QueryObject.java
Thu Jun 17 12:02:48 2010
@@ -21,6 +21,7 @@ package org.apache.chemistry.opencmis.in
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -57,7 +58,7 @@ public class QueryObject {
     /** 
      * map from alias name to type query name
      */
-    private Map<String,String> froms = new HashMap<String,String>();
+    private Map<String,String> froms = new LinkedHashMap<String,String>();
 
     // where part
 //    private IdentityHashMap<Object, CmisSelector> columnReferences = new IdentityHashMap<Object,
CmisSelector>(); 

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/EvalQueryTest.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/EvalQueryTest.java?rev=955563&r1=955562&r2=955563&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/EvalQueryTest.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/EvalQueryTest.java
Thu Jun 17 12:02:48 2010
@@ -23,6 +23,7 @@ import static org.apache.chemistry.openc
 import static org.apache.chemistry.opencmis.inmemory.UnitTestTypeSystemCreator.PROP_ID_DATETIME;
 import static org.apache.chemistry.opencmis.inmemory.UnitTestTypeSystemCreator.PROP_ID_DECIMAL;
 import static org.apache.chemistry.opencmis.inmemory.UnitTestTypeSystemCreator.PROP_ID_INT;
+import static org.junit.Assert.*;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -593,26 +594,44 @@ public class EvalQueryTest extends Abstr
         assertTrue(resultContains("gamma", res));    
         assertTrue(resultContains("delta", res));    
         assertTrue(resultContains("epsilon", res));    
+
+        statement = "SELECT * FROM " + COMPLEX_TYPE + " WHERE IN_FOLDER(UnknownType, '" +
dataCreator.getFolder2() + "')";
+        try {
+            res = doQuery(statement);
+            fail("Unknown type in folder should throw exception");
+        } catch (Exception e) {
+            assertTrue(e.toString().contains("must be in FROM list"));
+            log.debug("expected Exception: " + e);
+        }
     }
 
     @Test
     public void testInTree() {
         dataCreator.createLikeTestDocuments(dataCreator.getFolder11());
 
-        String statement = "SELECT * FROM " + COMPLEX_TYPE + " WHERE IN_TREE('" + dataCreator.getFolder1()
+ "')";
+        String statement = "SELECT * FROM " + COMPLEX_TYPE + " WHERE IN_TREE(" + COMPLEX_TYPE
+ ", '" + dataCreator.getFolder1() + "')";
         ObjectList res = doQuery(statement);
         assertEquals(3, res.getObjects().size());
         assertTrue(resultContains("likedoc1", res));    
         assertTrue(resultContains("likedoc2", res));    
         assertTrue(resultContains("likedoc3", res));
         
-        statement = "SELECT * FROM " + COMPLEX_TYPE + " WHERE IN_FOLDER(" + COMPLEX_TYPE
+ ", '" + dataCreator.getFolder1() + "')";
+        statement = "SELECT * FROM " + COMPLEX_TYPE + " WHERE IN_FOLDER('" + dataCreator.getFolder1()
+ "')";
         res = doQuery(statement);
         assertEquals(0, res.getObjects().size());
 
         statement = "SELECT * FROM " + COMPLEX_TYPE + " WHERE IN_TREE('" + dataCreator.getFolder2()
+ "')";
         res = doQuery(statement);
         assertEquals(0, res.getObjects().size());
+
+        statement = "SELECT * FROM " + COMPLEX_TYPE + " WHERE IN_TREE(UnknownType, '" + dataCreator.getFolder2()
+ "')";
+        try {
+            res = doQuery(statement);
+            fail("Unknown type in folder should throw exception");
+        } catch (Exception e) {
+            assertTrue(e.toString().contains("must be in FROM list"));
+            log.debug("expected Exception: " + e);
+        }
     }
 
     private ObjectList doQuery(String queryString) {



Mime
View raw message