jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r798209 - /jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/WorkspaceManagementTest.java
Date Mon, 27 Jul 2009 16:34:43 GMT
Author: stefan
Date: Mon Jul 27 16:34:43 2009
New Revision: 798209

URL: http://svn.apache.org/viewvc?rev=798209&view=rev
Log:
JCR-2085:  test case (TCK) maintenance for JCR 2.0



Added:
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/WorkspaceManagementTest.java
      - copied, changed from r798178, jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/WorkspaceTest.java

Copied: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/WorkspaceManagementTest.java
(from r798178, jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/WorkspaceTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/WorkspaceManagementTest.java?p2=jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/WorkspaceManagementTest.java&p1=jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/WorkspaceTest.java&r1=798178&r2=798209&rev=798209&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/WorkspaceTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/WorkspaceManagementTest.java
Mon Jul 27 16:34:43 2009
@@ -20,37 +20,65 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.Workspace;
+import javax.jcr.NoSuchWorkspaceException;
 
 import org.apache.jackrabbit.test.AbstractJCRTest;
 
 /**
- * <code>WorkspaceTest</code>...
+ * <code>WorkspaceManagementTest</code>...
  */
-public class WorkspaceTest extends AbstractJCRTest {
+public class WorkspaceManagementTest extends AbstractJCRTest {
 
     private Workspace workspace;
 
     protected void setUp() throws Exception {
         super.setUp();
 
+        super.checkSupportedOption(Repository.OPTION_WORKSPACE_MANAGEMENT_SUPPORTED);
+
         workspace = superuser.getWorkspace();
     }
 
     /**
-     * Tests {@link javax.jcr.Workspace#getLockManager()}.
-     * 
-     * @throws RepositoryException
+     * Tests {@link javax.jcr.Workspace#createWorkspace(String)} and
+     * {@link javax.jcr.Workspace#createWorkspace(String, String)}.
+     *
+     * @throws javax.jcr.RepositoryException
+     */
+    public void testCreateWorkspace() throws RepositoryException {
+
+        try {
+            workspace.createWorkspace(workspaceName);
+            fail("creating a new workspace with the name of an already existing one must
fail");
+        } catch (RepositoryException e) {
+            // excepted
+        }
+
+        // create empty workspace
+        workspace.createWorkspace("tmp" + System.currentTimeMillis());
+
+        // create pre-initialized workspace, specifying unknwon src workspace
+        try {
+            workspace.createWorkspace("tmp" + System.currentTimeMillis(), "unknownworkspace");
+            fail("NoSuchWorkspaceException expected");
+        } catch (NoSuchWorkspaceException e) {
+            // excepted
+        }
+    }
+
+
+    /**
+     * Tests {@link javax.jcr.Workspace#deleteWorkspace(String)}.
+     *
+     * @throws javax.jcr.RepositoryException
      */
-    public void testGetLockManager() throws RepositoryException {
-        if (isSupported(Repository.OPTION_LOCKING_SUPPORTED)) {
-            assertNotNull(workspace.getLockManager());
-        } else {
-            try {
-                workspace.getLockManager();
-                fail("UnsupportedRepositoryOperationException expected. Locking is not supported.");
-            } catch (UnsupportedRepositoryOperationException e) {
-                // success.
-            }
+    public void testDeleteWorkspace() throws RepositoryException {
+
+        try {
+            workspace.deleteWorkspace("unknownworkspace");
+            fail("NoSuchWorkspaceException expected");
+        } catch (NoSuchWorkspaceException e) {
+            // excepted
         }
     }
 }
\ No newline at end of file



Mime
View raw message