jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r704161 - /jackrabbit/sandbox/jackrabbit-test-harness/compatibility/base/src/main/java/org/apache/jackrabbit/harness/compatibility/AbstractRepositoryTest.java
Date Mon, 13 Oct 2008 16:46:28 GMT
Author: jukka
Date: Mon Oct 13 09:46:28 2008
New Revision: 704161

URL: http://svn.apache.org/viewvc?rev=704161&view=rev
Log:
JCR-1803: Node.restore() throws java.lang.ClassCastException

Added backwards compatibility tests for Node.restore().

Modified:
    jackrabbit/sandbox/jackrabbit-test-harness/compatibility/base/src/main/java/org/apache/jackrabbit/harness/compatibility/AbstractRepositoryTest.java

Modified: jackrabbit/sandbox/jackrabbit-test-harness/compatibility/base/src/main/java/org/apache/jackrabbit/harness/compatibility/AbstractRepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-test-harness/compatibility/base/src/main/java/org/apache/jackrabbit/harness/compatibility/AbstractRepositoryTest.java?rev=704161&r1=704160&r2=704161&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-test-harness/compatibility/base/src/main/java/org/apache/jackrabbit/harness/compatibility/AbstractRepositoryTest.java
(original)
+++ jackrabbit/sandbox/jackrabbit-test-harness/compatibility/base/src/main/java/org/apache/jackrabbit/harness/compatibility/AbstractRepositoryTest.java
Mon Oct 13 09:46:28 2008
@@ -96,13 +96,19 @@
 
         Node test = root.addNode("test", "nt:unstructured");
 
-        Node versionable = test.addNode("versionable", "nt:folder");
+        Node versionable = test.addNode("versionable", "nt:unstructured");
         versionable.addMixin("mix:versionable");
+        versionable.setProperty("foo", "A");
         session.save();
 
-        Version version = versionable.checkin();
         VersionHistory history = versionable.getVersionHistory();
-        history.addVersionLabel(version.getName(), "label", false);
+        Version versionA = versionable.checkin();
+        history.addVersionLabel(versionA.getName(), "labelA", false);
+        versionable.checkout();
+        versionable.setProperty("foo", "B");
+        session.save();
+        Version versionB = versionable.checkin();
+        history.addVersionLabel(versionB.getName(), "labelB", false);
 
         Node properties = test.addNode("properties", "nt:unstructured");
         properties.setProperty("boolean", true);
@@ -125,14 +131,20 @@
 
         assert test.hasNode("versionable");
         Node versionable = test.getNode("versionable");
-        assert versionable.isNodeType("nt:folder");
+        assert versionable.isNodeType("nt:unstructured");
         assert versionable.isNodeType("mix:versionable");
+        assert !versionable.isCheckedOut();
 
-        Version version = versionable.getBaseVersion();
         VersionHistory history = versionable.getVersionHistory();
-        String[] labels = history.getVersionLabels(version);
+        Version versionB = versionable.getBaseVersion();
+        String[] labels = history.getVersionLabels(versionB);
         assert labels.length == 1;
-        assert labels[0].equals("label");
+        assert labels[0].equals("labelB");
+        Version versionA = history.getVersionByLabel("labelA");
+        versionable.restore(versionA, true);
+        assert versionable.getProperty("foo").getString().equals("A");
+        versionable.restore(versionB, true);
+        assert versionable.getProperty("foo").getString().equals("B");
 
         assert test.hasNode("properties");
         Node properties = test.getNode("properties");



Mime
View raw message