incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1524100 - /sling/whiteboard/bdelacretaz/it-repository/src/test/java/org/apache/sling/jcr/repository/it/SlingRepositoryITBase.java
Date Tue, 17 Sep 2013 15:45:03 GMT
Author: bdelacretaz
Date: Tue Sep 17 15:45:02 2013
New Revision: 1524100

URL: http://svn.apache.org/r1524100
Log:
SLING-3076 - test query using mixin

Modified:
    sling/whiteboard/bdelacretaz/it-repository/src/test/java/org/apache/sling/jcr/repository/it/SlingRepositoryITBase.java

Modified: sling/whiteboard/bdelacretaz/it-repository/src/test/java/org/apache/sling/jcr/repository/it/SlingRepositoryITBase.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/it-repository/src/test/java/org/apache/sling/jcr/repository/it/SlingRepositoryITBase.java?rev=1524100&r1=1524099&r2=1524100&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/it-repository/src/test/java/org/apache/sling/jcr/repository/it/SlingRepositoryITBase.java
(original)
+++ sling/whiteboard/bdelacretaz/it-repository/src/test/java/org/apache/sling/jcr/repository/it/SlingRepositoryITBase.java
Tue Sep 17 15:45:02 2013
@@ -176,7 +176,7 @@ public abstract class SlingRepositoryITB
     }
     
     @Test
-    public void testQuery() throws RepositoryException {
+    public void testSqlQuery() throws RepositoryException {
         final Session s = repository.loginAdministrative(null);
         final String id = "ID_" + System.currentTimeMillis();
         final String propName = "PROP_" + id;
@@ -207,6 +207,34 @@ public abstract class SlingRepositoryITB
     }
     
     @Test
+    public void testXpathQueryWithMixin() throws RepositoryException {
+        Session s = repository.loginAdministrative(null);
+        try {
+            final String path = "XPATH_QUERY_" + System.currentTimeMillis();
+            final String absPath = "/" + path;
+            final Node n = deleteAfterTests(s.getRootNode().addNode(path));
+            n.addMixin("mix:title");
+            s.save();
+            
+            final String statement = "/jcr:root//element(*, mix:title)";
+            @SuppressWarnings("deprecation")
+            final Query q = s.getWorkspace().getQueryManager().createQuery(statement, Query.XPATH);
+            final NodeIterator it = q.execute().getNodes();
+            assertTrue("Expecting a non-empty result", it.hasNext());
+            boolean found = false;
+            while(it.hasNext()) {
+                if(it.nextNode().getPath().equals(absPath)) {
+                    found = true;
+                    break;
+                }
+            }
+            assertTrue("Expecting test node " + absPath + " to be found", found);
+        } finally {
+            s.logout();
+        }
+    }
+    
+    @Test
     public final void checkRepositoryDescriptors() {
         doCheckRepositoryDescriptors();
     }



Mime
View raw message