You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by mr...@apache.org on 2006/08/02 18:49:43 UTC
svn commit: r428047 - in
/jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api:
AbstractImportXmlTest.java DocumentViewImportTest.java
Author: mreutegg
Date: Wed Aug 2 09:49:42 2006
New Revision: 428047
URL: http://svn.apache.org/viewvc?rev=428047&view=rev
Log:
JCR-512: TCK: AbstractImportXmlTest incorrectly assumes mix:referenceable can be added to created node
Modified:
jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/AbstractImportXmlTest.java
jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/DocumentViewImportTest.java
Modified: jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/AbstractImportXmlTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/AbstractImportXmlTest.java?rev=428047&r1=428046&r2=428047&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/AbstractImportXmlTest.java (original)
+++ jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/AbstractImportXmlTest.java Wed Aug 2 09:49:42 2006
@@ -17,6 +17,7 @@
package org.apache.jackrabbit.test.api;
import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.apache.jackrabbit.test.NotExecutableException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Attr;
@@ -279,7 +280,12 @@
public boolean isMixRefRespected() throws RepositoryException, IOException {
boolean respected = false;
if (supportsNodeType(mixReferenceable)) {
- String uuid = createReferenceableNode(referenced);
+ String uuid;
+ try {
+ uuid = createReferenceableNode(referenced);
+ } catch (NotExecutableException e) {
+ return false;
+ }
Document document = dom.newDocument();
Element root = document.createElement(rootElem);
root.setAttribute(XML_NS + ":jcr", NS_JCR_URI);
@@ -309,8 +315,10 @@
* @param name
* @return
* @throws RepositoryException
+ * @throws NotExecutableException if the created node is not referenceable
+ * and cannot be made referenceable by adding mix:referenceable.
*/
- public String createReferenceableNode(String name) throws RepositoryException {
+ public String createReferenceableNode(String name) throws RepositoryException, NotExecutableException {
// remove a yet existing node at the target
try {
Node node = testRootNode.getNode(name);
@@ -320,7 +328,13 @@
// ok
}
// a referenceable node
- Node n1 = testRootNode.addNode(name);
+ Node n1 = testRootNode.addNode(name, testNodeType);
+ if (!n1.isNodeType(mixReferenceable) && !n1.canAddMixin(mixReferenceable)) {
+ n1.remove();
+ session.save();
+ throw new NotExecutableException("node type " + testNodeType +
+ " does not support mix:referenceable");
+ }
n1.addMixin(mixReferenceable);
// make sure jcr:uuid is available
testRootNode.save();
Modified: jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/DocumentViewImportTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/DocumentViewImportTest.java?rev=428047&r1=428046&r2=428047&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/DocumentViewImportTest.java (original)
+++ jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/DocumentViewImportTest.java Wed Aug 2 09:49:42 2006
@@ -286,7 +286,7 @@
* receives a new uuid when imported in any case.
*/
public void checkImportDocumentView_IMPORT_UUID_CREATE_NEW()
- throws RepositoryException, IOException, SAXException {
+ throws RepositoryException, IOException, SAXException, NotExecutableException {
String uuid = createReferenceableNode(referenced);
// import a document with a element having the same uuid as the node referenced
@@ -304,7 +304,7 @@
* the existing node is removed in case of uuid collision.
*/
public void checkImportDocumentView_IMPORT_UUID_COLLISION_REMOVE_EXISTING()
- throws RepositoryException, IOException, SAXException {
+ throws RepositoryException, IOException, SAXException, NotExecutableException {
String uuid = createReferenceableNode(referenced);
// import a document with a element having the same uuid as the node referenced
@@ -334,7 +334,7 @@
* collision occurs.
*/
public void checkImportDocumentView_IMPORT_UUID_COLLISION_REPLACE_EXISTING()
- throws RepositoryException, IOException, SAXException {
+ throws RepositoryException, IOException, SAXException, NotExecutableException {
String uuid = createReferenceableNode(referenced);
// import a document with a element having the same uuid as the node referenced
@@ -359,7 +359,7 @@
* @throws IOException
*/
public void checkImportDocumentView_IMPORT_UUID_COLLISION_THROW()
- throws RepositoryException, IOException, SAXException {
+ throws RepositoryException, IOException, SAXException, NotExecutableException {
String uuid = createReferenceableNode(referenced);
try {
@@ -390,7 +390,7 @@
* parent of the import target.
*/
public void doTestSameUUIDAtAncestor(boolean withWorkspace, boolean withHandler)
- throws RepositoryException, IOException, SAXException {
+ throws RepositoryException, IOException, SAXException, NotExecutableException {
String uuid = createReferenceableNode(referenced);
Node node = testRootNode.getNode(referenced);
@@ -418,22 +418,22 @@
}
public void testSameUUIDAtAncestorWorkspaceHandler()
- throws RepositoryException, IOException, SAXException {
+ throws RepositoryException, IOException, SAXException, NotExecutableException {
doTestSameUUIDAtAncestor(WORKSPACE, CONTENTHANDLER);
}
public void testSameUUIDAtAncestorWorkspace()
- throws RepositoryException, IOException, SAXException {
+ throws RepositoryException, IOException, SAXException, NotExecutableException {
doTestSameUUIDAtAncestor(WORKSPACE, STREAM);
}
public void testSameUUIDAtAncestorSessionHandler()
- throws RepositoryException, IOException, SAXException {
+ throws RepositoryException, IOException, SAXException, NotExecutableException {
doTestSameUUIDAtAncestor(SESSION, CONTENTHANDLER);
}
public void testSameUUIDAtAncestorSession()
- throws RepositoryException, IOException, SAXException{
+ throws RepositoryException, IOException, SAXException, NotExecutableException {
doTestSameUUIDAtAncestor(SESSION, STREAM);
}
}