jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1128362 - in /jackrabbit/sandbox/spi2microkernel/src: main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java test/java/org/apache/jackrabbit/spi2microkernel/Tests.java
Date Fri, 27 May 2011 15:34:06 GMT
Author: mduerig
Date: Fri May 27 15:34:06 2011
New Revision: 1128362

URL: http://svn.apache.org/viewvc?rev=1128362&view=rev
Log:
spi2microkernel prototype (WIP)

Modified:
    jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
    jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/Tests.java

Modified: jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java?rev=1128362&r1=1128361&r2=1128362&view=diff
==============================================================================
--- jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
(original)
+++ jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
Fri May 27 15:34:06 2011
@@ -294,14 +294,13 @@ public class RepositoryServiceImpl exten
         microKernel.commit("/", '+' + wspName + " : {}" , revisionId);
     }
 
-    private void copyWorkspace(String revisionId, String name, String srcWorkspaceName) throws
RepositoryException {
-        // todo implement copyWorkspace
-        throw new UnsupportedRepositoryOperationException();
+    private static void copyWorkspace(String revisionId, String name, String srcWorkspaceName)
throws RepositoryException {
+        throw new UnsupportedRepositoryOperationException("Copying workspace is not supported");
     }
 
     private void deleteWorkspace(String revisionId, String name)  throws RepositoryException
{
-        // todo implement deleteWorkspace
-        throw new UnsupportedRepositoryOperationException();
+        String wspName = Paths.getWorkspaceName(name);
+        microKernel.commit("/", '-' + wspName + " : ", revisionId);
     }
 
 }

Modified: jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/Tests.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/Tests.java?rev=1128362&r1=1128361&r2=1128362&view=diff
==============================================================================
--- jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/Tests.java
(original)
+++ jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/Tests.java
Fri May 27 15:34:06 2011
@@ -34,14 +34,13 @@ import javax.jcr.RepositoryFactory;
 import javax.jcr.Session;
 import javax.jcr.Value;
 import java.io.File;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
 
 public class Tests {
     private static final File REPO_HOME_DIR = new File("target/repository");
@@ -92,6 +91,22 @@ public class Tests {
     }
 
     @Test
+    public void createDeleteWorkspace() throws RepositoryException {
+        Session session1 = getSession();
+        session1.getWorkspace().createWorkspace("new");
+
+        Session session2 = getSession();
+        String[] workspaces = session2.getWorkspace().getAccessibleWorkspaceNames();
+        assertTrue(Arrays.asList(workspaces).contains("new"));
+
+        session2.getWorkspace().deleteWorkspace("new");
+
+        Session session3 = getSession();
+        workspaces = session3.getWorkspace().getAccessibleWorkspaceNames();
+        assertFalse(Arrays.asList(workspaces).contains("new"));
+    }
+
+    @Test
     public void getRoot() throws RepositoryException {
         Session session = getSession();
         Node root = session.getRootNode();



Mime
View raw message