jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r613907 - in /jackrabbit/trunk/jackrabbit-core/src/test: java/org/apache/jackrabbit/core/query/ repository/workspaces/indexing-test/
Date Mon, 21 Jan 2008 14:48:54 GMT
Author: mreutegg
Date: Mon Jan 21 06:48:53 2008
New Revision: 613907

URL: http://svn.apache.org/viewvc?rev=613907&view=rev
Log:
JCR-1332: CLONE -Aggregate include ignored if no primaryType set
- test case

Added:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/IndexingAggregateTest.java
  (with props)
    jackrabbit/trunk/jackrabbit-core/src/test/repository/workspaces/indexing-test/
    jackrabbit/trunk/jackrabbit-core/src/test/repository/workspaces/indexing-test/indexing-configuration.xml
  (with props)
    jackrabbit/trunk/jackrabbit-core/src/test/repository/workspaces/indexing-test/workspace.xml
  (with props)
Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/TestAll.java

Added: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/IndexingAggregateTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/IndexingAggregateTest.java?rev=613907&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/IndexingAggregateTest.java
(added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/IndexingAggregateTest.java
Mon Jan 21 06:48:53 2008
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.query;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Node;
+import javax.jcr.Session;
+import java.io.ByteArrayOutputStream;
+import java.io.Writer;
+import java.io.OutputStreamWriter;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.Calendar;
+
+/**
+ * <code>IndexingAggregateTest</code> checks if the nt:file nt:resource
+ * aggregate defined in workspace indexing-test works properly.
+ */
+public class IndexingAggregateTest extends AbstractQueryTest {
+
+    private Session session;
+
+    private Node testRootNode;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        session = helper.getSuperuserSession("indexing-test");
+        testRootNode = cleanUpTestRoot(session);
+        // overwrite query manager
+        qm = session.getWorkspace().getQueryManager();
+    }
+
+    protected void tearDown() throws Exception {
+        cleanUpTestRoot(session);
+        session = null;
+        testRootNode = null;
+        super.tearDown();
+    }
+
+    public void testNtFileAggregate() throws RepositoryException, IOException {
+        String sqlBase = "SELECT * FROM nt:file"
+                + " WHERE jcr:path LIKE '" + testRoot + "/%"
+                + "' AND CONTAINS";
+        String sqlCat = sqlBase + "(., 'cat')";
+        String sqlDog = sqlBase + "(., 'dog')";
+
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        Writer writer = new OutputStreamWriter(out, "UTF-8");
+        writer.write("the quick brown fox jumps over the lazy dog.");
+        writer.flush();
+
+        Node file = testRootNode.addNode("myFile", "nt:file");
+        Node resource = file.addNode("jcr:content", "nt:resource");
+        resource.setProperty("jcr:lastModified", Calendar.getInstance());
+        resource.setProperty("jcr:encoding", "UTF-8");
+        resource.setProperty("jcr:mimeType", "text/plain");
+        resource.setProperty("jcr:data", new ByteArrayInputStream(out.toByteArray()));
+
+        testRootNode.save();
+
+        executeSQLQuery(sqlDog, new Node[]{file});
+
+        // update jcr:data
+        out.reset();
+        writer.write("the quick brown fox jumps over the lazy cat.");
+        writer.flush();
+        resource.setProperty("jcr:data", new ByteArrayInputStream(out.toByteArray()));
+        testRootNode.save();
+
+        executeSQLQuery(sqlCat, new Node[]{file});
+
+        // replace jcr:content with unstructured
+        resource.remove();
+        Node unstrContent = file.addNode("jcr:content", "nt:unstructured");
+        Node foo = unstrContent.addNode("foo");
+        foo.setProperty("text", "the quick brown fox jumps over the lazy dog.");
+        testRootNode.save();
+
+        executeSQLQuery(sqlDog, new Node[]{file});
+
+        // remove foo
+        foo.remove();
+        testRootNode.save();
+
+        executeSQLQuery(sqlDog, new Node[]{});
+
+        // replace jcr:content again with resource
+        unstrContent.remove();
+        resource = file.addNode("jcr:content", "nt:resource");
+        resource.setProperty("jcr:lastModified", Calendar.getInstance());
+        resource.setProperty("jcr:encoding", "UTF-8");
+        resource.setProperty("jcr:mimeType", "text/plain");
+        resource.setProperty("jcr:data", new ByteArrayInputStream(out.toByteArray()));
+        testRootNode.save();
+
+        executeSQLQuery(sqlCat, new Node[]{file});
+    }
+}

Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/IndexingAggregateTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/TestAll.java?rev=613907&r1=613906&r2=613907&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/TestAll.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/TestAll.java
Mon Jan 21 06:48:53 2008
@@ -55,6 +55,7 @@
         suite.addTestSuite(SynonymProviderTest.class);
         suite.addTestSuite(ArrayHitsTest.class);
         suite.addTestSuite(ExcerptTest.class);
+        suite.addTestSuite(IndexingAggregateTest.class);
 
         // exclude long running tests per default
         //suite.addTestSuite(MassiveRangeTest.class);

Added: jackrabbit/trunk/jackrabbit-core/src/test/repository/workspaces/indexing-test/indexing-configuration.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/repository/workspaces/indexing-test/indexing-configuration.xml?rev=613907&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/repository/workspaces/indexing-test/indexing-configuration.xml
(added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/repository/workspaces/indexing-test/indexing-configuration.xml
Mon Jan 21 06:48:53 2008
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<!DOCTYPE configuration SYSTEM "http://jackrabbit.apache.org/dtd/indexing-configuration-1.0.dtd">
+<configuration xmlns:jcr="http://www.jcp.org/jcr/1.0"
+               xmlns:nt="http://www.jcp.org/jcr/nt/1.0">
+
+  <aggregate primaryType="nt:file">
+    <include>jcr:content</include>
+    <include>jcr:content/*</include>
+  </aggregate>
+
+</configuration>
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-core/src/test/repository/workspaces/indexing-test/indexing-configuration.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/jackrabbit-core/src/test/repository/workspaces/indexing-test/workspace.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/repository/workspaces/indexing-test/workspace.xml?rev=613907&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/repository/workspaces/indexing-test/workspace.xml
(added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/repository/workspaces/indexing-test/workspace.xml
Mon Jan 21 06:48:53 2008
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+  -->
+<Workspace name="indexing-test">
+  <!--
+      virtual file system of the workspace:
+      class: FQN of class implementing FileSystem interface
+  -->
+  <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+    <param name="path" value="${wsp.home}" />
+  </FileSystem>
+  <!--
+      persistence of the workspace:
+      class: FQN of class implementing PersistenceManager interface
+  -->
+  <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.DerbyPersistenceManager">
+     <param name="url" value="jdbc:derby:${wsp.home}/db;create=true"/>
+     <param name="schemaObjectPrefix" value="${wsp.name}_"/>
+  </PersistenceManager>
+  <!--
+      Search index and the file system it uses.
+  -->
+  <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+    <param name="path" value="${wsp.home}/index" />
+    <param name="indexingConfiguration" value="${wsp.home}/indexing-configuration.xml"/>
+  </SearchIndex>
+</Workspace>
+

Propchange: jackrabbit/trunk/jackrabbit-core/src/test/repository/workspaces/indexing-test/workspace.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message