Package javax.jcr.query

Examples of javax.jcr.query.Query.storeAsNode()


     */
    public void testGetPersistentQueryPath() throws RepositoryException {
        String statement = "/" + jcrRoot;
        Query q = superuser.getWorkspace().getQueryManager().createQuery(statement, Query.XPATH);
        String path = testRoot + "/" + nodeName1;
        q.storeAsNode(path);
        assertEquals("Query.getPersistentQueryPath() does not return the correct path.",
                path,
                q.getStoredQueryPath());
    }
}
View Full Code Here


      QueryResult res = q.execute();

      assertEquals(1, res.getNodes().getSize());

      Node node = q.storeAsNode("/stored_query");
      this.root.save();
      assertNotNull(node);
   }

   public void testGetQueryFromNode() throws Exception
View Full Code Here

      QueryResult res = q.execute();

      assertEquals(1, res.getNodes().getSize());

      Node node = q.storeAsNode("/stored_query");
      this.root.save();
      assertNotNull(node);

      Query stor_query = qman.getQuery(node);
      assertNotNull(stor_query);
View Full Code Here

            nodeFound++;
         }
      }
      assertEquals(2, it.getSize());
      assertEquals(2, nodeFound);
      query.storeAsNode("/TestQuote/myQuery");
      testRootNode.save();
      qm = session2.getWorkspace().getQueryManager();
      query = qm.getQuery(session2.getRootNode().getNode("TestQuote/myQuery"));
      result = query.execute();
      it = result.getNodes();
View Full Code Here

            nodeFound++;
         }
      }
      assertEquals(2, it.getSize());
      assertEquals(2, nodeFound);
      query.storeAsNode("/TestQuote/myQuery2");
      testRootNode.save();
      qm = session2.getWorkspace().getQueryManager();
      query = qm.getQuery(session2.getRootNode().getNode("TestQuote/myQuery2"));
      result = query.execute();
      it = result.getNodes();
View Full Code Here

        String statement = "Some query syntax";

        QueryManager queryManager = workspace.getQueryManager();
        Query query = queryManager.createQuery(statement, Query.XPATH);

        Node node = query.storeAsNode("/storedQuery");
        assertThat(node, is(notNullValue()));
        assertThat(node.getPrimaryNodeType().getName(), is("nt:query"));
        assertThat(node.getProperty("jcr:language").getString(), is(Query.XPATH));
        assertThat(node.getProperty("jcr:statement").getString(), is(statement));
    }
View Full Code Here

        String statement = "Some query syntax";

        QueryManager queryManager = workspace.getQueryManager();
        Query query = queryManager.createQuery(statement, Query.XPATH);

        Node node = query.storeAsNode("/storedQuery");

        Query loaded = queryManager.getQuery(node);

        assertThat(loaded, is(notNullValue()));
        assertThat(loaded.getLanguage(), is(Query.XPATH));
View Full Code Here

        String statement = "SELECT * FROM [nt:unstructured]";

        QueryManager queryManager = workspace.getQueryManager();
        Query query = queryManager.createQuery(statement, Query.JCR_SQL2);

        Node node = query.storeAsNode("/storedQuery");
        assertThat(node, is(notNullValue()));
        assertThat(node.getPrimaryNodeType().getName(), is("nt:query"));
        assertThat(node.getProperty("jcr:language").getString(), is(Query.JCR_SQL2));
        assertThat(node.getProperty("jcr:statement").getString(), is(statement));
    }
View Full Code Here

        String statement = "SELECT * FROM [nt:unstructured]";

        QueryManager queryManager = workspace.getQueryManager();
        Query query = queryManager.createQuery(statement, Query.JCR_SQL2);

        Node node = query.storeAsNode("/storedQuery");

        Query loaded = queryManager.getQuery(node);

        assertThat(loaded, is(notNullValue()));
        assertThat(loaded.getLanguage(), is(Query.JCR_SQL2));
View Full Code Here

     * @throws NotExecutableException if nt:query is not supported.
     */
    public void testSave() throws RepositoryException, NotExecutableException {
        checkNtQuery();
        Query query = superuser.getWorkspace().getQueryManager().createQuery(statement, Query.XPATH);
        query.storeAsNode(testRoot + "/" + nodeName1);

        assertTrue("Node has not been stored", testRootNode.hasNode(nodeName1));

        Node queryNode = testRootNode.getNode(nodeName1);
        assertTrue("Query node is not of type nt:query", queryNode.isNodeType(ntQuery));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.