[exo-jcr-commits] exo-jcr SVN: r5327 - in jcr/trunk/exo.jcr.component.core/src/test: resources and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Dec 14 02:46:16 EST 2011


Author: nzamosenchuk
Date: 2011-12-14 02:46:15 -0500 (Wed, 14 Dec 2011)
New Revision: 5327

Modified:
   jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/IndexingRuleTest.java
   jcr/trunk/exo.jcr.component.core/src/test/resources/conf/test/nodetypes-config-extended.xml
   jcr/trunk/exo.jcr.component.core/src/test/resources/indexing-configuration.xml
Log:
EXOJCR-1677 : adding a simple test for IndexingRules with no conditional parameter.

Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/IndexingRuleTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/IndexingRuleTest.java	2011-12-14 07:38:32 UTC (rev 5326)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/IndexingRuleTest.java	2011-12-14 07:46:15 UTC (rev 5327)
@@ -22,6 +22,7 @@
 
 import javax.jcr.Node;
 import javax.jcr.NodeIterator;
+import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.Value;
 import javax.jcr.query.RowIterator;
@@ -125,4 +126,23 @@
       assertNotNull("No excerpt created", excerpt);
       assertTrue("Title must not be present in excerpt", excerpt.getString().indexOf("Platform") == -1);
    }
+   
+
+   public void testSimpleIndexingRule() throws Exception
+   {
+      Node node = testRootNode.addNode("testPropertySkip", "jcr:extendedUnstructured");
+      node.setProperty("anyProperty", "Marvin", PropertyType.STRING);
+      node.setProperty("included", "Thomas", PropertyType.STRING);
+
+      testRootNode.save();
+
+      String sqlBase = "SELECT * FROM nt:unstructured WHERE CONTAINS";
+      String sqlSkippedProperty = sqlBase + "(*, 'Marvin')";
+      String sqlNotSkippedProperty = sqlBase + "(*, 'Thomas')";
+
+      // this should find nothing, property is not indexed.
+      executeSQLQuery(sqlSkippedProperty, new Node[]{});
+      // this should find node, because property "name" is included to index 
+      executeSQLQuery(sqlNotSkippedProperty, new Node[]{node});
+   }
 }

Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/test/nodetypes-config-extended.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/test/nodetypes-config-extended.xml	2011-12-14 07:38:32 UTC (rev 5326)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/test/nodetypes-config-extended.xml	2011-12-14 07:46:15 UTC (rev 5327)
@@ -810,6 +810,12 @@
 
    <nodeType name="exo:videoFolder" isMixin="true" hasOrderableChildNodes="false" primaryItemName="">
    </nodeType>
+   
+      <nodeType name="jcr:extendedUnstructured" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
+      <supertypes>
+         <supertype>nt:unstructured</supertype>
+      </supertypes>
+   </nodeType>
 
 </nodeTypes>
 

Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/indexing-configuration.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/indexing-configuration.xml	2011-12-14 07:38:32 UTC (rev 5326)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/indexing-configuration.xml	2011-12-14 07:46:15 UTC (rev 5327)
@@ -40,6 +40,10 @@
     <index-rule nodeType="nt:hierarchyNode">
         <!-- do not index any properties -->
     </index-rule>
+    
+    <index-rule nodeType="jcr:extendedUnstructured">
+        <property>included</property>
+    </index-rule>
 
     <aggregate primaryType="nt:file">
         <include>jcr:content</include>



More information about the exo-jcr-commits mailing list