You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by an...@apache.org on 2008/04/18 10:01:01 UTC
svn commit: r649398 - in
/jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi:
ReplaceNode.java ReplaceNodeTest.java TestAll.java
Author: angela
Date: Fri Apr 18 01:00:58 2008
New Revision: 649398
URL: http://svn.apache.org/viewvc?rev=649398&view=rev
Log:
rename ReplaceNode test class to ReplaceNodeTest, adjust TestAll.
Added:
jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReplaceNodeTest.java (with props)
Removed:
jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReplaceNode.java
Modified:
jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/TestAll.java
Added: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReplaceNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReplaceNodeTest.java?rev=649398&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReplaceNodeTest.java (added)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReplaceNodeTest.java Fri Apr 18 01:00:58 2008
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.jcr2spi;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.apache.jackrabbit.test.NotExecutableException;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Node;
+import javax.jcr.UnsupportedRepositoryOperationException;
+
+/**
+ * <code>ReplaceNodeTest</code>
+ */
+public class ReplaceNodeTest extends AbstractJCRTest {
+
+ private static Logger log = LoggerFactory.getLogger(ReplaceNodeTest.class);
+
+ private Node removeNode;
+ private String uuid;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ if (testRootNode.hasNode(nodeName1)) {
+ throw new NotExecutableException("Parent node must not yet contain a child node '" + nodeName1 + "'.");
+ }
+ removeNode = testRootNode.addNode(nodeName1, testNodeType);
+ // make sure the new node is persisted.
+ testRootNode.save();
+ // assert removeNode is referenceable
+ if (!removeNode.isNodeType(mixReferenceable)) {
+ if (!removeNode.canAddMixin(mixReferenceable)) {
+ throw new NotExecutableException("Cannot make remove-node '" + nodeName1 + "' mix:referenceable.");
+ }
+ removeNode.addMixin(mixReferenceable);
+ testRootNode.save();
+ }
+ uuid = removeNode.getUUID();
+ }
+
+ protected void tearDown() throws Exception {
+ removeNode = null;
+ super.tearDown();
+ }
+
+ public void testAddReplacementAfterRemove() throws RepositoryException {
+ // transient removal of the 'removeNode'
+ removeNode.remove();
+ // add node that replaces the transiently removed node
+ Node n = testRootNode.addNode(nodeName2, testNodeType);
+ // ... and a child node.
+ n.addNode(nodeName3, testNodeType);
+ testRootNode.save();
+
+ try {
+ // if (for impl reasons) 'n' is referenceable -> it must have a
+ // different uuid.
+ assertFalse(uuid.equals(n.getUUID()));
+ } catch (UnsupportedRepositoryOperationException e) {
+ // n has not been made referenceable before -> OK.
+ }
+ }
+
+ public void testAddReplacementAfterMove() throws RepositoryException {
+ // transiently move the 'removeNode'
+ superuser.move(removeNode.getPath(), testRootNode.getPath() + "/" + nodeName4);
+ // add node that replaces the moved node
+ Node n = testRootNode.addNode(nodeName1, testNodeType);
+ // ... and a child node.
+ n.addNode(nodeName2, testNodeType);
+ testRootNode.save();
+
+ try {
+ // if (for impl reasons) 'n' is referenceable -> it must have a
+ // different uuid.
+ assertFalse(uuid.equals(n.getUUID()));
+ } catch (UnsupportedRepositoryOperationException e) {
+ // n has not been made referenceable before -> OK.
+ }
+ }
+}
\ No newline at end of file
Propchange: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReplaceNodeTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReplaceNodeTest.java
------------------------------------------------------------------------------
svn:keywords = author date id revision url
Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/TestAll.java?rev=649398&r1=649397&r2=649398&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/TestAll.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/TestAll.java Fri Apr 18 01:00:58 2008
@@ -80,7 +80,7 @@
suite.addTestSuite(UpdateTest.class);
// various
- suite.addTestSuite(ReplaceNode.class);
+ suite.addTestSuite(ReplaceNodeTest.class);
suite.addTestSuite(HierarchyNodeTest.class);
suite.addTestSuite(LazyItemIteratorTest.class);