jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r791505 - in /jackrabbit/trunk: jackrabbit-core/pom.xml jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/ActivitiesTest.java jackrabbit-spi2jcr/pom.xml
Date Mon, 06 Jul 2009 15:01:17 GMT
Author: reschke
Date: Mon Jul  6 15:01:17 2009
New Revision: 791505

URL: http://svn.apache.org/viewvc?rev=791505&view=rev
Log:
JCR-2085: add additional Activities tests

Modified:
    jackrabbit/trunk/jackrabbit-core/pom.xml
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/ActivitiesTest.java
  (contents, props changed)
    jackrabbit/trunk/jackrabbit-spi2jcr/pom.xml

Modified: jackrabbit/trunk/jackrabbit-core/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/pom.xml?rev=791505&r1=791504&r2=791505&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/pom.xml (original)
+++ jackrabbit/trunk/jackrabbit-core/pom.xml Mon Jul  6 15:01:17 2009
@@ -92,7 +92,7 @@
               <value>
                 org.apache.jackrabbit.core.xml.DocumentViewTest#testMultiValue
                 org.apache.jackrabbit.test.api.NodeReadMethodsTest#testGetPropertiesNamePatternArray
-                org.apache.jackrabbit.test.api.version.ActivitiesTest#testCreateRemoveActivity
+                org.apache.jackrabbit.test.api.version.ActivitiesTest#testActivitiesPath
               </value>
             </property>
           </systemProperties>

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/ActivitiesTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/ActivitiesTest.java?rev=791505&r1=791504&r2=791505&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/ActivitiesTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/ActivitiesTest.java
Mon Jul  6 15:01:17 2009
@@ -1,66 +1,152 @@
-/*
- * 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.test.api.version;
-
-import javax.jcr.Node;
-import javax.jcr.Repository;
-import javax.jcr.nodetype.NodeType;
-import javax.jcr.version.VersionManager;
-
-
-/**
- * <code>ActivitiesTest</code> covers methods related to the Activities
- * feature in Versioning.
- * @test
- * @sources ActivitiesTest.java
- * @executeClass org.apache.jackrabbit.test.api.version.ActivitiesTest
- * @keywords versioning
- * @since JCR 2.0
- */
-public class ActivitiesTest extends AbstractVersionTest {
-
-    protected void setUp() throws Exception {
-        super.setUp();
-        checkSupportedOption(Repository.OPTION_ACTIVITIES_SUPPORTED);
-    }
-
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-    public void testCreateRemoveActivity() throws Exception {
-        
-        VersionManager vm = superuser.getWorkspace().getVersionManager();
-        Node an = null;
-        
-        try {
-            an = vm.createActivity("foobar");
-            assertNotNull(an);
-            
-            NodeType annt = an.getPrimaryNodeType();
-            assertTrue("create node must be subtype of nt:activity", annt.isNodeType("nt:activity"));
-
-            String pathprefix = "/jcr:system/jcr:activities/";
-            assertTrue("path for activity must be below " + pathprefix + ", but was " + an.getPath(),
an.getPath().startsWith(pathprefix));
-        }
-        finally {
-            if (an != null) {
-                vm.removeActivity(an);
-            }
-        }
-    }
-}
+/*
+ * 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.test.api.version;
+
+import javax.jcr.Node;
+import javax.jcr.Property;
+import javax.jcr.PropertyType;
+import javax.jcr.Repository;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.version.VersionManager;
+
+
+/**
+ * <code>ActivitiesTest</code> covers methods related to the Activities
+ * feature in Versioning.
+ * @test
+ * @sources ActivitiesTest.java
+ * @executeClass org.apache.jackrabbit.test.api.version.ActivitiesTest
+ * @keywords versioning
+ * @since JCR 2.0
+ */
+public class ActivitiesTest extends AbstractVersionTest {
+
+    private VersionManager vm;
+
+    private static String PREFIX = "/jcr:system/jcr:activities/";
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+        checkSupportedOption(Repository.OPTION_ACTIVITIES_SUPPORTED);
+        vm = superuser.getWorkspace().getVersionManager();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    public void testCreateRemoveActivity() throws Exception {
+        
+        Node an = null;
+        
+        try {
+            an = vm.createActivity("foobar");
+            assertNotNull(an);
+            
+            NodeType annt = an.getPrimaryNodeType();
+            assertTrue("create node must be subtype of nt:activity", annt.isNodeType("nt:activity"));
+        }
+        finally {
+            if (an != null) {
+                vm.removeActivity(an);
+            }
+        }
+    }
+
+    public void testSetGetActivity() throws Exception {
+        
+        Node an = null;
+        
+        try {
+            an = vm.createActivity("foobar");
+            assertNotNull(an);
+            
+            assertNull(vm.getActivity());
+            
+            Node old = vm.setActivity(an);
+            assertNull(old);
+            assertEquals(an.getPath(), vm.getActivity().getPath());
+            
+            old = vm.setActivity(null);
+            assertEquals(old.getPath(), an.getPath());
+            assertNull(vm.getActivity());
+        }
+        finally {
+            if (an != null) {
+                vm.removeActivity(an);
+            }
+        }
+    }
+
+    public void testActivitiesPath() throws Exception {
+        
+        Node an = null;
+        
+        try {
+            an = vm.createActivity("foobar");
+            assertNotNull(an);
+            
+            NodeType annt = an.getPrimaryNodeType();
+            assertTrue("create node must be subtype of nt:activity", annt.isNodeType("nt:activity"));
+
+            assertTrue("path for activity must be below " + PREFIX + ", but was " + an.getPath(),
an.getPath().startsWith(PREFIX));
+
+            Node activities = superuser.getNode(PREFIX);
+            
+            assertFalse(activities.getPrimaryNodeType().canAddChildNode("foobar"));
+        }
+        finally {
+            if (an != null) {
+                vm.removeActivity(an);
+            }
+        }
+    }
+    
+    public void testActivitiesRelation() throws Exception {
+        
+        Node an = null;
+        
+        try {
+            an = vm.createActivity("foobar");
+            vm.setActivity(an);
+            
+            String path = versionableNode.getPath();
+            
+            if (versionableNode.isCheckedOut()) {
+                vm.checkin(path);
+            }
+            
+            vm.checkout(path);
+            
+            versionableNode = superuser.getNode(path);
+            Property act = versionableNode.getProperty(Property.JCR_ACTIVITY);
+            assertNotNull(act);
+            assertEquals(PropertyType.REFERENCE, act.getType());
+            assertTrue(act.getNode().isSame(an));
+            
+            versionableNode.remove();
+            versionableNode.getSession().save();
+        }
+        finally {
+            if (an != null) {
+                vm.removeActivity(an);
+            }
+        }
+    }
+    
+}
+

Propchange: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/ActivitiesTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/jackrabbit-spi2jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2jcr/pom.xml?rev=791505&r1=791504&r2=791505&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2jcr/pom.xml (original)
+++ jackrabbit/trunk/jackrabbit-spi2jcr/pom.xml Mon Jul  6 15:01:17 2009
@@ -72,7 +72,7 @@
                 org.apache.jackrabbit.test.api.ShareableNodeTest
                 org.apache.jackrabbit.test.api.version.simple
                 org.apache.jackrabbit.test.api.NodeReadMethodsTest#testGetPropertiesNamePatternArray
-                org.apache.jackrabbit.test.api.version.ActivitiesTest#testCreateRemoveActivity
+                org.apache.jackrabbit.test.api.version.ActivitiesTest
               </value>
             </property>
           </systemProperties>



Mime
View raw message