jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r985213 - in /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api: JackrabbitNodeTest.java TestAll.java
Date Fri, 13 Aug 2010 14:39:51 GMT
Author: stefan
Date: Fri Aug 13 14:39:51 2010
New Revision: 985213

URL: http://svn.apache.org/viewvc?rev=985213&view=rev
Log:
JCR-2683: Provide rename method for nodes

Added:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/JackrabbitNodeTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/TestAll.java

Added: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/JackrabbitNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/JackrabbitNodeTest.java?rev=985213&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/JackrabbitNodeTest.java
(added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/JackrabbitNodeTest.java
Fri Aug 13 14:39:51 2010
@@ -0,0 +1,70 @@
+/*
+ * 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.api;
+
+import org.apache.jackrabbit.test.AbstractJCRTest;
+
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.RepositoryException;
+
+/**
+ * <code>JackrabbitNodeTest</code>...
+ */
+public class JackrabbitNodeTest  extends AbstractJCRTest {
+
+    static final String SEQ_BEFORE = "jackrabbit";
+    static final String SEQ_AFTER =  "jackraBbit";
+    static final int RELPOS = 6;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        assertTrue(testRootNode.getPrimaryNodeType().hasOrderableChildNodes());
+        for (char c : SEQ_BEFORE.toCharArray()) {
+            testRootNode.addNode(new String(new char[]{c}));
+        }
+    }
+
+    public void testRename() throws RepositoryException {
+        Node renamedNode = null;
+        NodeIterator it = testRootNode.getNodes();
+        int pos = 0;
+        while (it.hasNext()) {
+            Node n = it.nextNode();
+            String name = n.getName();
+            assertEquals(name, new String(new char[]{SEQ_BEFORE.charAt(pos)}));
+            if (pos == RELPOS) {
+                JackrabbitNode node = (JackrabbitNode) n;
+                node.rename(name.toUpperCase());
+                renamedNode = n;
+            }
+            pos++;
+        }
+
+        it = testRootNode.getNodes();
+        pos = 0;
+        while (it.hasNext()) {
+            Node n = it.nextNode();
+            String name = n.getName();
+            assertEquals(name, new String(new char[]{SEQ_AFTER.charAt(pos)}));
+            if (pos == RELPOS) {
+                assertTrue(n.isSame(renamedNode));
+            }
+            pos++;
+        }
+    }
+}

Added: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/TestAll.java?rev=985213&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/TestAll.java
(added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/TestAll.java
Fri Aug 13 14:39:51 2010
@@ -0,0 +1,42 @@
+/*
+ * 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.api;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.jackrabbit.test.AbstractJCRTest;
+
+/**
+ * <code>TestAll</code>...
+ */
+public class TestAll extends AbstractJCRTest {
+
+        /**
+     * Returns a <code>Test</code> suite that executes all tests inside this
+     * package.
+     *
+     * @return a <code>Test</code> suite that executes all tests inside this
+     *         package.
+     */
+    public static Test suite() {
+        TestSuite suite = new TestSuite("api tests");
+
+        suite.addTestSuite(JackrabbitNodeTest.class);
+
+        return suite;
+    }
+}
\ No newline at end of file



Mime
View raw message