/** {@inheritDoc} */ public String getStoredQueryPath() throws RepositoryException, RemoteException { return query.getStoredQueryPath(); }
@Override public String getStoredQueryPath() throws ItemNotFoundException, RepositoryException { return this.query.getStoredQueryPath(); }
/** * @inheritDoc */ public String getStoredQueryPath() throws ItemNotFoundException, RepositoryException { return query.getStoredQueryPath(); }
@Override public String getStoredQueryPath() throws RepositoryException { return delegate.getStoredQueryPath(); }
public String getStoredQueryPath() throws RepositoryException { return getDelegate().getStoredQueryPath(); }
public String execute() throws Exception { return getDelegate().getStoredQueryPath(); } });
/** * Tests if a non-persistent query throws an {@link ItemNotFoundException} * when {@link Query#getStoredQueryPath()} is called. */ public void testGetStoredQueryPath() throws RepositoryException { String statement = "/" + jcrRoot; Query q = session.getWorkspace().getQueryManager().createQuery(statement, qsXPATH); try { q.getStoredQueryPath(); fail("Query.getStoredQueryPath() on a transient query must throw an ItemNotFoundException."); } catch (ItemNotFoundException e) { // success } } }
/** * Tests if {@link Query#getStoredQueryPath()} returns the correct path * where the query had been saved. * * @throws NotExecutableException if the repository does not support the * node type nt:query. */ public void testGetPersistentQueryPath() throws RepositoryException, NotExecutableException { try { superuser.getWorkspace().getNodeTypeManager().getNodeType(ntQuery); } catch (NoSuchNodeTypeException e) { // not supported throw new NotExecutableException("repository does not support nt:query"); } String statement = "/" + jcrRoot; Query q = superuser.getWorkspace().getQueryManager().createQuery(statement, qsXPATH); String path = testRoot + "/" + nodeName1; q.storeAsNode(path); assertEquals("Query.getPersistentQueryPath() does not return the correct path.", path, q.getStoredQueryPath()); } }
@Test public void shouldLoadStoredQuery() throws Exception { 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)); assertThat(loaded.getStatement(), is(statement)); assertThat(loaded.getStoredQueryPath(), is(node.getPath())); }