From commits-return-2641-apmail-jackrabbit-commits-archive=jackrabbit.apache.org@jackrabbit.apache.org Wed Aug 02 16:50:06 2006 Return-Path: Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: (qmail 77036 invoked from network); 2 Aug 2006 16:50:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 2 Aug 2006 16:50:05 -0000 Received: (qmail 97217 invoked by uid 500); 2 Aug 2006 16:50:05 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 97122 invoked by uid 500); 2 Aug 2006 16:50:05 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 97113 invoked by uid 99); 2 Aug 2006 16:50:05 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Aug 2006 09:50:04 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Aug 2006 09:50:04 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 0F6CB1A981A; Wed, 2 Aug 2006 09:49:44 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r428047 - in /jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api: AbstractImportXmlTest.java DocumentViewImportTest.java Date: Wed, 02 Aug 2006 16:49:43 -0000 To: commits@jackrabbit.apache.org From: mreutegg@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060802164944.0F6CB1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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); } }