chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1182520 [2/2] - in /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src: main/java/org/apache/chemistry/opencmis/jcr/ main/java/org/apache/chemistry/opencmis/jcr/impl/ main/java/org/apache/chemistry/opencmi...
Date Wed, 12 Oct 2011 18:45:14 GMT
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/test/java/org/apache/chemistry/opencmis/jcr/query/XPathBuilderTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/test/java/org/apache/chemistry/opencmis/jcr/query/XPathBuilderTest.java?rev=1182520&r1=1182519&r2=1182520&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/test/java/org/apache/chemistry/opencmis/jcr/query/XPathBuilderTest.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/test/java/org/apache/chemistry/opencmis/jcr/query/XPathBuilderTest.java
Wed Oct 12 18:45:13 2011
@@ -21,11 +21,17 @@ package org.apache.chemistry.opencmis.jc
 
 import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
-import org.apache.chemistry.opencmis.jcr.DefaultJcrTypeManager;
+import org.apache.chemistry.opencmis.jcr.JcrTypeManager;
+import org.apache.chemistry.opencmis.jcr.PathManager;
+import org.apache.chemistry.opencmis.jcr.impl.DefaultDocumentTypeHandler;
+import org.apache.chemistry.opencmis.jcr.impl.DefaultFolderTypeHandler;
+import org.apache.chemistry.opencmis.jcr.impl.DefaultUnversionedDocumentTypeHandler;
+import org.apache.chemistry.opencmis.jcr.type.JcrTypeHandlerManager;
 import org.apache.chemistry.opencmis.jcr.util.ISO8601;
 import org.apache.chemistry.opencmis.server.support.query.CalendarHelper;
 import org.apache.chemistry.opencmis.server.support.query.QueryObject;
 import org.apache.chemistry.opencmis.server.support.query.QueryUtil;
+import org.junit.Before;
 import org.junit.Test;
 
 import java.util.Arrays;
@@ -37,6 +43,18 @@ import static org.junit.Assert.*;
 
 public class XPathBuilderTest {
 
+    private JcrTypeManager typeManager;
+
+    @Before
+    public void setUp() throws Exception {
+        typeManager = new JcrTypeManager();
+        PathManager pathManager = new PathManager(PathManager.CMIS_ROOT_PATH);
+        JcrTypeHandlerManager typeHandlerManager = new JcrTypeHandlerManager(pathManager,
typeManager);
+        typeHandlerManager.addHandler(new DefaultFolderTypeHandler());
+        typeHandlerManager.addHandler(new DefaultDocumentTypeHandler());
+        typeHandlerManager.addHandler(new DefaultUnversionedDocumentTypeHandler());
+    }
+
     @Test
     public void testValidQuery() {
         check("select * from cmis:document",
@@ -219,15 +237,15 @@ public class XPathBuilderTest {
         return Arrays.asList(elements);
     }
 
-    private static XPathBuilder execute(String statement) {
+    private XPathBuilder execute(String statement) {
         QueryUtil queryUtil = new QueryUtil();
-        QueryObject queryObject = new QueryObject(new DefaultJcrTypeManager());
+        QueryObject queryObject = new QueryObject(typeManager);
         ParseTreeWalker<XPathBuilder> parseTreeWalker = new ParseTreeWalker<XPathBuilder>(new
EvaluatorXPath());
         queryUtil.traverseStatementAndCatchExc(statement, queryObject, parseTreeWalker);
         return parseTreeWalker.getResult();
     }
 
-    private static void check(String query, String result, List<String> folderPredicates,
Boolean evaluation) {
+    private void check(String query, String result, List<String> folderPredicates,
Boolean evaluation) {
         XPathBuilder queryBuilder = execute(query);
         if (result == null) {
             assertEquals(null, queryBuilder);



Mime
View raw message