jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r762737 - in /jackrabbit/trunk/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/JackrabbitRepositoryStub.java test/repository/workspaces/test/
Date Wed, 08 Apr 2009 04:10:31 GMT
Author: jukka
Date: Tue Apr  7 12:23:27 2009
New Revision: 762737

URL: http://svn.apache.org/viewvc?rev=762737&view=rev
Log:
JCR-2055: RepositoryStub implementation in jackrabbit-core

Create the "test" workspace automatically in JackrabbitRepositoryStub.

Removed:
    jackrabbit/trunk/jackrabbit-core/src/test/repository/workspaces/test/
Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/JackrabbitRepositoryStub.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/JackrabbitRepositoryStub.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/JackrabbitRepositoryStub.java?rev=762737&r1=762736&r2=762737&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/JackrabbitRepositoryStub.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/JackrabbitRepositoryStub.java
Tue Apr  7 12:23:27 2009
@@ -22,8 +22,11 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Calendar;
+import java.util.HashSet;
 import java.util.Properties;
+import java.util.Set;
 
 import javax.jcr.Node;
 import javax.jcr.PathNotFoundException;
@@ -36,6 +39,7 @@
 
 import org.apache.commons.io.IOUtils;
 import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
+import org.apache.jackrabbit.api.JackrabbitWorkspace;
 import org.apache.jackrabbit.core.config.RepositoryConfig;
 import org.apache.jackrabbit.test.RepositoryStub;
 import org.apache.jackrabbit.test.RepositoryStubException;
@@ -170,8 +174,16 @@
 
     private void prepareTestContent(Session session)
             throws RepositoryException, IOException {
-        JackrabbitNodeTypeManager manager = (JackrabbitNodeTypeManager)
-            session.getWorkspace().getNodeTypeManager();
+        JackrabbitWorkspace workspace =
+            (JackrabbitWorkspace) session.getWorkspace();
+        Set workspaces = new HashSet(
+                Arrays.asList(workspace.getAccessibleWorkspaceNames()));
+        if (!workspaces.contains("test")) {
+            workspace.createWorkspace("test");
+        }
+
+        JackrabbitNodeTypeManager manager =
+            (JackrabbitNodeTypeManager) workspace.getNodeTypeManager();
         if (!manager.hasNodeType("test:versionable")) {
             InputStream xml = getResource("test-nodetypes.xml");
             try {



Mime
View raw message