You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Mark Waschkowski (JIRA)" <ji...@apache.org> on 2007/06/28 15:59:26 UTC
[jira] Created: (JCR-991) Queries 'see' added nodes within
repository before being persisted, not allowed according to spec (6.6.12)
Queries 'see' added nodes within repository before being persisted, not allowed according to spec (6.6.12)
----------------------------------------------------------------------------------------------------------
Key: JCR-991
URL: https://issues.apache.org/jira/browse/JCR-991
Project: Jackrabbit
Issue Type: Bug
Components: query
Affects Versions: 1.3
Reporter: Mark Waschkowski
Priority: Minor
I believe the last assertion should hold true since session.save() has not been called.
ie. (as far as I understand from 6.6.12 of the spec) a query should NOT see added nodes in the query results, as search is against persistent state.
public void testSession() throws RepositoryException{
String parentNodeName = "documents";
Node parentNode = session.getRootNode().addNode(parentNodeName);
String nodeName = "contact";
Node node = session.getRootNode().getNode(parentNodeName).addNode(nodeName);
node.setProperty("firstName", "joe");
Node contactNode = session.getRootNode().getNode(parentNodeName + "/" + nodeName);
assertNotNull(contactNode);
String xpath = parentNodeName;
NodeIterator ni = session.getRootNode().getNode(xpath).getNodes();
System.out.println("ni count =" + ni.getSize());
String name1 = ni.nextNode().getName().toString();
System.out.println("Found node using getNode(xpath):" + name1);
//session.save();
Workspace ws = session.getWorkspace();
QueryManager qm = ws.getQueryManager();
Query q = qm.createQuery(xpath, Query.XPATH);
NodeIterator iter = q.execute().getNodes();
while(iter.hasNext()){
Node queryNode = iter.nextNode();
System.out.println("Found node using Query:" + queryNode.getName());
}
System.out.println("iter size=" + iter.getSize());
assertEquals(0, iter.getSize());
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (JCR-991) Queries 'see' added nodes within
repository before being persisted, not allowed according to spec (6.6.12)
Posted by "Mark Waschkowski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508899 ]
Mark Waschkowski commented on JCR-991:
--------------------------------------
As well,
System.out.println("Found node using Query:" + queryNode.getName());
prints out "documents" twice during iteration, which looks incorrect.
> Queries 'see' added nodes within repository before being persisted, not allowed according to spec (6.6.12)
> ----------------------------------------------------------------------------------------------------------
>
> Key: JCR-991
> URL: https://issues.apache.org/jira/browse/JCR-991
> Project: Jackrabbit
> Issue Type: Bug
> Components: query
> Affects Versions: 1.3
> Reporter: Mark Waschkowski
> Priority: Minor
>
> I believe the last assertion should hold true since session.save() has not been called.
> ie. (as far as I understand from 6.6.12 of the spec) a query should NOT see added nodes in the query results, as search is against persistent state.
> public void testSession() throws RepositoryException{
> String parentNodeName = "documents";
> Node parentNode = session.getRootNode().addNode(parentNodeName);
>
> String nodeName = "contact";
> Node node = session.getRootNode().getNode(parentNodeName).addNode(nodeName);
> node.setProperty("firstName", "joe");
>
> Node contactNode = session.getRootNode().getNode(parentNodeName + "/" + nodeName);
> assertNotNull(contactNode);
>
> String xpath = parentNodeName;
> NodeIterator ni = session.getRootNode().getNode(xpath).getNodes();
> System.out.println("ni count =" + ni.getSize());
> String name1 = ni.nextNode().getName().toString();
> System.out.println("Found node using getNode(xpath):" + name1);
>
> //session.save();
> Workspace ws = session.getWorkspace();
> QueryManager qm = ws.getQueryManager();
> Query q = qm.createQuery(xpath, Query.XPATH);
> NodeIterator iter = q.execute().getNodes();
> while(iter.hasNext()){
> Node queryNode = iter.nextNode();
> System.out.println("Found node using Query:" + queryNode.getName());
> }
>
> System.out.println("iter size=" + iter.getSize());
> assertEquals(0, iter.getSize());
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (JCR-991) Queries 'see' added nodes within
repository before being persisted, not allowed according to spec (6.6.12)
Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-991?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Marcel Reutegger resolved JCR-991.
----------------------------------
Resolution: Cannot Reproduce
When I run the test it prints:
ni count =1
Found node using getNode(xpath):contact
iter size=0
Please make sure the repository is empty when you execute the test.
And again the method getNode() only takes a relative path as an argument, not an XPath expression!
> Queries 'see' added nodes within repository before being persisted, not allowed according to spec (6.6.12)
> ----------------------------------------------------------------------------------------------------------
>
> Key: JCR-991
> URL: https://issues.apache.org/jira/browse/JCR-991
> Project: Jackrabbit
> Issue Type: Bug
> Components: query
> Affects Versions: 1.3
> Reporter: Mark Waschkowski
> Priority: Minor
>
> I believe the last assertion should hold true since session.save() has not been called.
> ie. (as far as I understand from 6.6.12 of the spec) a query should NOT see added nodes in the query results, as search is against persistent state.
> public void testSession() throws RepositoryException{
> String parentNodeName = "documents";
> Node parentNode = session.getRootNode().addNode(parentNodeName);
>
> String nodeName = "contact";
> Node node = session.getRootNode().getNode(parentNodeName).addNode(nodeName);
> node.setProperty("firstName", "joe");
>
> Node contactNode = session.getRootNode().getNode(parentNodeName + "/" + nodeName);
> assertNotNull(contactNode);
>
> String xpath = parentNodeName;
> NodeIterator ni = session.getRootNode().getNode(xpath).getNodes();
> System.out.println("ni count =" + ni.getSize());
> String name1 = ni.nextNode().getName().toString();
> System.out.println("Found node using getNode(xpath):" + name1);
>
> //session.save();
> Workspace ws = session.getWorkspace();
> QueryManager qm = ws.getQueryManager();
> Query q = qm.createQuery(xpath, Query.XPATH);
> NodeIterator iter = q.execute().getNodes();
> while(iter.hasNext()){
> Node queryNode = iter.nextNode();
> System.out.println("Found node using Query:" + queryNode.getName());
> }
>
> System.out.println("iter size=" + iter.getSize());
> assertEquals(0, iter.getSize());
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.