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 2008/03/17 14:54:36 UTC

svn commit: r637891 - /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/CheckinRemoveVersionTest.java

Author: mreutegg
Date: Mon Mar 17 06:54:34 2008
New Revision: 637891

URL: http://svn.apache.org/viewvc?rev=637891&view=rev
Log:
JCR-1481: VersionHistory.removeVersion() does not throw ReferentialIntegrityException

Added:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/CheckinRemoveVersionTest.java   (with props)

Added: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/CheckinRemoveVersionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/CheckinRemoveVersionTest.java?rev=637891&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/CheckinRemoveVersionTest.java (added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/CheckinRemoveVersionTest.java Mon Mar 17 06:54:34 2008
@@ -0,0 +1,50 @@
+/*
+ * 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.core.version;
+
+import org.apache.jackrabbit.core.UserTransactionImpl;
+import org.apache.jackrabbit.test.AbstractJCRTest;
+
+import javax.jcr.Node;
+import javax.jcr.ReferentialIntegrityException;
+import javax.jcr.version.Version;
+
+/**
+ * Test case for JCR-1481
+ */
+public class CheckinRemoveVersionTest extends AbstractJCRTest {
+
+    public void testCheckinRemoveVersionWithXA() throws Exception {
+        Node n = testRootNode.addNode(nodeName1);
+        n.addMixin(mixVersionable);
+        testRootNode.save();
+        UserTransactionImpl tx = new UserTransactionImpl(superuser);
+        tx.begin();
+        try {
+            Version v10 = n.checkin();
+            try {
+                n.getVersionHistory().removeVersion(v10.getName());
+                fail("VersionHistory.removeVersion() must throw ReferentialIntegrityException when" +
+                        " version is still referenced.");
+            } catch (ReferentialIntegrityException e) {
+                // expected
+            }
+        } finally {
+            tx.rollback();
+        }
+    }
+}

Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/CheckinRemoveVersionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native