Author: bcarothers
Date: 2009-05-15 10:01:49 -0400 (Fri, 15 May 2009)
New Revision: 905
Modified:
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrQueryManager.java
trunk/dna-jcr/src/test/resources/repositoryStubImpl.properties
Log:
DNA-410 Several JCR Query Persistence Tests Are Failing
Applied patch which makes the following changes:
- Makes JcrQueryManager.AbstractJcrQuery update its internal storedPath field when
storeAsNode() is called successfully
- Removes @Immutable annotation from JcrQueryManager.AbstractJcrQuery and
JcrQueryManager.XPathQuery, as the storedPath field is now mutable.
- Adds check in storeAsNode to throw RepositoryException if a malformed path is provided
as an argument
- Fixes test configuration to use a special node type for the SaveTest class that does not
allow children. This needs to be overridden on a per-test-class basis as many other test
classes assume that the same node type does allow children.
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrQueryManager.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrQueryManager.java 2009-05-15 13:17:40
UTC (rev 904)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrQueryManager.java 2009-05-15 14:01:49
UTC (rev 905)
@@ -34,6 +34,7 @@
import javax.jcr.query.QueryManager;
import javax.jcr.query.QueryResult;
import net.jcip.annotations.Immutable;
+import net.jcip.annotations.NotThreadSafe;
import org.jboss.dna.graph.property.NamespaceRegistry;
import org.jboss.dna.graph.property.Path;
@@ -112,12 +113,12 @@
return new String[] {Query.XPATH};
}
- @Immutable
+ @NotThreadSafe
protected abstract class AbstractJcrQuery implements Query {
private final JcrSession session;
private final String language;
private final String statement;
- private final Path storedPath;
+ private Path storedPath;
protected AbstractJcrQuery( JcrSession session,
String statement,
@@ -184,7 +185,13 @@
throws PathNotFoundException, ConstraintViolationException,
RepositoryException {
NamespaceRegistry namespaces = this.session.namespaces();
- Path path =
session.getExecutionContext().getValueFactories().getPathFactory().create(absPath);
+ Path path;
+ try {
+ path =
session.getExecutionContext().getValueFactories().getPathFactory().create(absPath);
+ }
+ catch (IllegalArgumentException iae) {
+ throw new
RepositoryException(JcrI18n.invalidPathParameter.text("absPath", absPath));
+ }
Path parentPath = path.getParent();
Node parentNode = session.getNode(parentPath);
@@ -194,12 +201,14 @@
queryNode.setProperty(JcrLexicon.LANGUAGE.getString(namespaces),
this.language);
queryNode.setProperty(JcrLexicon.STATEMENT.getString(namespaces),
this.statement);
+ this.storedPath = path;
+
return queryNode;
}
}
- @Immutable
+ @NotThreadSafe
protected class XPathQuery extends AbstractJcrQuery {
XPathQuery( JcrSession session,
Modified: trunk/dna-jcr/src/test/resources/repositoryStubImpl.properties
===================================================================
--- trunk/dna-jcr/src/test/resources/repositoryStubImpl.properties 2009-05-15 13:17:40 UTC
(rev 904)
+++ trunk/dna-jcr/src/test/resources/repositoryStubImpl.properties 2009-05-15 14:01:49 UTC
(rev 905)
@@ -43,6 +43,8 @@
javax.jcr.tck.NodeTest.testSaveContstraintViolationException.nodetype2=dnatest\:nodeWithMandatoryProperty
javax.jcr.tck.NodeOrderableChildNodesTest.testOrderBeforeUnsupportedRepositoryOperationException.nodetype2=dnatest\:unorderableUnstructured
javax.jcr.tck.NodeOrderableChildNodesTest.testOrderBeforeUnsupportedRepositoryOperationException.nodetype3=dnatest\:unorderableUnstructured
+# For some reason, this test assumes testNodeType doesn't allow children - most other
tests assume that it does
+javax.jcr.tck.SaveTest.nodetype=nt\:query
# Test users
javax.jcr.tck.superuser.name=superuser
Show replies by date