You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by un...@apache.org on 2012/06/05 12:10:53 UTC
svn commit: r1346327 - in /rave/sandbox/content-services:
rave-jcr-config/src/main/java/org/apache/jackrabbit/core/
rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/
rave-jcr-config/src/main/java/org/apache/rave/jcr/importing/ rave-jcr-c...
Author: unico
Date: Tue Jun 5 10:10:52 2012
New Revision: 1346327
URL: http://svn.apache.org/viewvc?rev=1346327&view=rev
Log:
RAVE-603 add option for resource and content module items to be imported into specific workspace
Modified:
rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/jackrabbit/core/AccessibleRepositoryImpl.java
rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/Module.java
rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleImporter.java
rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleRegistry.java
rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleScanner.java
rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/SessionProvider.java
rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/importing/ResourceImporter.java
rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/bootstrapping/ModuleRegistryTest.java
rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/bootstrapping/ModuleScannerTest.java
rave/sandbox/content-services/rave-jcr-config/src/test/resources/META-INF/rave/module.json
rave/sandbox/content-services/rave-jcr-integration/module2/src/main/resources/META-INF/rave/module.json
rave/sandbox/content-services/rave-jcr-integration/test/src/test/java/org/apache/rave/jcr/RaveRepositoryTest.java
Modified: rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/jackrabbit/core/AccessibleRepositoryImpl.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/jackrabbit/core/AccessibleRepositoryImpl.java?rev=1346327&r1=1346326&r2=1346327&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/jackrabbit/core/AccessibleRepositoryImpl.java (original)
+++ rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/jackrabbit/core/AccessibleRepositoryImpl.java Tue Jun 5 10:10:52 2012
@@ -19,6 +19,7 @@
package org.apache.jackrabbit.core;
+import javax.jcr.NoSuchWorkspaceException;
import javax.jcr.RepositoryException;
import org.apache.jackrabbit.core.config.RepositoryConfig;
@@ -34,7 +35,7 @@ public class AccessibleRepositoryImpl ex
}
@Override
- protected SystemSession getSystemSession(String workspaceName) throws RepositoryException {
+ protected SystemSession getSystemSession(String workspaceName) throws RepositoryException, NoSuchWorkspaceException {
return super.getSystemSession(workspaceName);
}
Modified: rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/Module.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/Module.java?rev=1346327&r1=1346326&r2=1346327&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/Module.java (original)
+++ rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/Module.java Tue Jun 5 10:10:52 2012
@@ -173,11 +173,11 @@ public final class Module {
return contents;
}
- void addContent(String name, String file, String parent, boolean reload, ImportBehavior importBehavior, Status status) {
+ void addContent(String name, String file, String parent, boolean reload, String workspace, ImportBehavior importBehavior, Status status) {
if (contents == null) {
contents = new ArrayList<Content>();
}
- contents.add(new Content(name, file, parent, reload, importBehavior, status));
+ contents.add(new Content(name, file, parent, reload, workspace, importBehavior, status));
}
public List<Resource> getResources() {
@@ -187,11 +187,11 @@ public final class Module {
return resources;
}
- void addResource(String name, String path, String parent, boolean reload, ImportBehavior importBehavior, Status status) {
+ void addResource(String name, String path, String parent, boolean reload, String workspace, ImportBehavior importBehavior, Status status) {
if (resources == null) {
resources = new ArrayList<Resource>();
}
- resources.add(new Resource(name, path, parent, reload, importBehavior, status));
+ resources.add(new Resource(name, path, parent, reload, workspace, importBehavior, status));
}
@Override
@@ -436,13 +436,15 @@ public final class Module {
private final String file;
private final String parent;
private final boolean reload;
+ private final String workspace;
private ImportBehavior importBehavior;
- private Content(String name, String file, String parent, boolean reload, ImportBehavior importBehavior, Status status) {
+ private Content(String name, String file, String parent, boolean reload, String workspace, ImportBehavior importBehavior, Status status) {
super(name, status);
this.file = file;
this.parent = parent;
this.reload = reload;
+ this.workspace = workspace;
this.importBehavior = importBehavior;
}
@@ -462,6 +464,10 @@ public final class Module {
return reload;
}
+ public String getWorkspace() {
+ return workspace;
+ }
+
URL getURL() throws MalformedURLException {
return new URL((baseUrl.endsWith("/") ? baseUrl : baseUrl + "/") + file);
}
@@ -497,6 +503,9 @@ public final class Module {
if (!file.equals(content.file)) {
return false;
}
+ if (workspace != null ? !workspace.equals(content.workspace) : content.workspace != null) {
+ return false;
+ }
if (importBehavior != null ? !importBehavior.equals(content.importBehavior) : content.importBehavior != null) {
return false;
}
@@ -510,6 +519,7 @@ public final class Module {
result = 31 * result + file.hashCode();
result = 31 * result + parent.hashCode();
result = 31 * result + (reload ? 1 : 0);
+ result = 31 * result + workspace.hashCode();
result = importBehavior == null ? result : 31 * result + importBehavior.hashCode();
return result;
}
@@ -522,6 +532,7 @@ public final class Module {
"file='" + file + '\'' +
", parent='" + parent + '\'' +
", reload=" + reload +
+ ", workspace='" + workspace + '\'' +
", importBehavior=" + importBehavior +
'}';
}
@@ -532,13 +543,15 @@ public final class Module {
private final String path;
private final String parent;
private final boolean reload;
+ private final String workspace;
private ImportBehavior importBehavior;
- private Resource(String name, String path, String parent, boolean reload, ImportBehavior importBehavior, Status status) {
+ private Resource(String name, String path, String parent, boolean reload, String workspace, ImportBehavior importBehavior, Status status) {
super(name, status);
this.path = path;
this.parent = parent;
this.reload = reload;
+ this.workspace = workspace;
this.importBehavior = importBehavior;
}
@@ -550,6 +563,10 @@ public final class Module {
return parent;
}
+ public String getWorkspace() {
+ return workspace;
+ }
+
public ImportBehavior getImportBehavior() {
return importBehavior;
}
Modified: rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleImporter.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleImporter.java?rev=1346327&r1=1346326&r2=1346327&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleImporter.java (original)
+++ rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleImporter.java Tue Jun 5 10:10:52 2012
@@ -31,6 +31,7 @@ import java.util.Map;
import javax.jcr.NamespaceException;
import javax.jcr.NamespaceRegistry;
+import javax.jcr.NoSuchWorkspaceException;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
@@ -254,7 +255,7 @@ public final class ModuleImporter {
return;
}
for (Module.Content content : contents) {
- final Session session = sessionProvider.getSession(null);
+ final Session session = getSession(content.getWorkspace());
final ContentImporter contentImporter = new ContentImporter(session);
final Module module = content.getModule();
if (!session.nodeExists(content.getParent())) {
@@ -293,7 +294,7 @@ public final class ModuleImporter {
return;
}
for (Module.Resource resource : resources) {
- final Session session = sessionProvider.getSession(null);
+ final Session session = getSession(resource.getWorkspace());
final ResourceImporter resourceImporter = new ResourceImporter(session, mimeTypeResolver);
final Module module = resource.getModule();
if (!session.nodeExists(resource.getParent())) {
@@ -335,6 +336,17 @@ public final class ModuleImporter {
}
}
+ private Session getSession(String workspaceName) throws RepositoryException {
+ try {
+ return sessionProvider.getSession(workspaceName);
+ } catch (NoSuchWorkspaceException e) {
+ log.info("No such workspace yet: '" + workspaceName + "'. Creating it.");
+ final Session session = sessionProvider.getSession(null);
+ session.getWorkspace().createWorkspace(workspaceName);
+ return sessionProvider.getSession(workspaceName);
+ }
+ }
+
private static class CndComparator implements Comparator<Module.Cnd> {
private static final CndComparator INSTANCE = new CndComparator();
Modified: rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleRegistry.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleRegistry.java?rev=1346327&r1=1346326&r2=1346327&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleRegistry.java (original)
+++ rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleRegistry.java Tue Jun 5 10:10:52 2012
@@ -54,6 +54,7 @@ public final class ModuleRegistry {
private static final String STATUS = "status";
private static final String FILE = "file";
private static final String RELOAD = "reload";
+ private static final String WORKSPACE = "workspace";
private static final String PARENT = "parent";
private static final String URI = "uri";
private static final String PATH = "path";
@@ -348,12 +349,13 @@ public final class ModuleRegistry {
final String file = item.getProperty(FILE).getString();
final String parent = item.getProperty(PARENT).getString();
final boolean reload = !item.hasProperty(RELOAD) || item.getProperty(RELOAD).getBoolean();
+ final String workspace = !item.hasProperty(WORKSPACE) ? null : item.getProperty(WORKSPACE).getString();
ImportBehavior importBehavior = null;
if (item.hasProperty(IMPORTBEHAVIOR)) {
importBehavior = ImportBehavior.valueOf(item.getProperty(IMPORTBEHAVIOR).getString().toUpperCase());
}
status = Module.Status.valueOf(item.getProperty(STATUS).getString());
- module.addContent(item.getName(), file, parent, reload, importBehavior, status);
+ module.addContent(item.getName(), file, parent, reload, workspace, importBehavior, status);
}
}
@@ -364,12 +366,13 @@ public final class ModuleRegistry {
final String path = item.getProperty(PATH).getString();
final String parent = item.getProperty(PARENT).getString();
final boolean reload = !item.hasProperty(RELOAD) || item.getProperty(RELOAD).getBoolean();
+ final String workspace = !item.hasProperty(WORKSPACE) ? null : item.getProperty(WORKSPACE).getString();
ImportBehavior importBehavior = null;
if (item.hasProperty(IMPORTBEHAVIOR)) {
importBehavior = ImportBehavior.valueOf(item.getProperty(IMPORTBEHAVIOR).getString().toUpperCase());
}
status = Module.Status.valueOf(item.getProperty(STATUS).getString());
- module.addResource(item.getName(), path, parent, reload, importBehavior, status);
+ module.addResource(item.getName(), path, parent, reload, workspace, importBehavior, status);
}
}
@@ -400,6 +403,9 @@ public final class ModuleRegistry {
contentNode.setProperty(FILE, content.getFile());
contentNode.setProperty(RELOAD, content.isReload());
contentNode.setProperty(PARENT, content.getParent());
+ if (content.getWorkspace() != null) {
+ contentNode.setProperty(WORKSPACE, content.getWorkspace());
+ }
if (content.getImportBehavior() != null) {
contentNode.setProperty(IMPORTBEHAVIOR, content.getImportBehavior().toString());
}
@@ -409,6 +415,9 @@ public final class ModuleRegistry {
resourceNode.setProperty(PATH, resource.getPath());
resourceNode.setProperty(PARENT, resource.getParent());
resourceNode.setProperty(RELOAD, resource.isReload());
+ if (resource.getWorkspace() != null) {
+ resourceNode.setProperty(WORKSPACE, resource.getWorkspace());
+ }
if (resource.getImportBehavior() != null) {
resourceNode.setProperty(IMPORTBEHAVIOR, resource.getImportBehavior().toString());
}
Modified: rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleScanner.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleScanner.java?rev=1346327&r1=1346326&r2=1346327&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleScanner.java (original)
+++ rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/ModuleScanner.java Tue Jun 5 10:10:52 2012
@@ -52,6 +52,7 @@ public final class ModuleScanner {
private static final String RESOURCES = "resources";
private static final String FILE = "file";
private static final String RELOAD = "reload";
+ private static final String WORKSPACE = "workspace";
private static final String PARENT = "parent";
private static final String PATH = "path";
private static final String IMPORTBEHAVIOR = "importBehavior";
@@ -148,11 +149,12 @@ public final class ModuleScanner {
final String file = content.get(FILE).textValue();
final String parent = content.get(PARENT).textValue();
final boolean reload = !content.has(RELOAD) || content.get(RELOAD).booleanValue();
+ final String workspace = !content.has(WORKSPACE) ? null : content.get(WORKSPACE).textValue();
ImportBehavior importBehavior = null;
if (content.has(IMPORTBEHAVIOR)) {
importBehavior = ImportBehavior.valueOf(content.get(IMPORTBEHAVIOR).textValue().toUpperCase());
}
- module.addContent(name, file, parent, reload, importBehavior, null);
+ module.addContent(name, file, parent, reload, workspace, importBehavior, null);
}
}
@@ -168,11 +170,12 @@ public final class ModuleScanner {
final String path = resource.has(PATH) ? resource.get(PATH).textValue() : "";
final String parent = resource.get(PARENT).textValue();
final boolean reload = !resource.has(RELOAD) || resource.get(RELOAD).booleanValue();
+ final String workspace = !resource.has(WORKSPACE) ? null : resource.get(WORKSPACE).textValue();;
ImportBehavior importBehavior = null;
if (resource.has(IMPORTBEHAVIOR)) {
importBehavior = ImportBehavior.valueOf(resource.get(IMPORTBEHAVIOR).textValue().toUpperCase());
}
- module.addResource(name, path, parent, reload, importBehavior, null);
+ module.addResource(name, path, parent, reload, workspace, importBehavior, null);
}
}
Modified: rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/SessionProvider.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/SessionProvider.java?rev=1346327&r1=1346326&r2=1346327&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/SessionProvider.java (original)
+++ rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/bootstrapping/SessionProvider.java Tue Jun 5 10:10:52 2012
@@ -18,11 +18,15 @@
*/
package org.apache.rave.jcr.bootstrapping;
+import javax.jcr.NoSuchWorkspaceException;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
+/**
+ * Provides JCR sessions to the {@link ModuleImporter}
+ */
public interface SessionProvider {
- Session getSession(String workspaceName) throws RepositoryException;
+ Session getSession(String workspaceName) throws RepositoryException, NoSuchWorkspaceException;
}
Modified: rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/importing/ResourceImporter.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/importing/ResourceImporter.java?rev=1346327&r1=1346326&r2=1346327&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/importing/ResourceImporter.java (original)
+++ rave/sandbox/content-services/rave-jcr-config/src/main/java/org/apache/rave/jcr/importing/ResourceImporter.java Tue Jun 5 10:10:52 2012
@@ -64,7 +64,7 @@ public class ResourceImporter {
final String name = entry.getName().lastIndexOf('/') == entry.getName().length()-1 ? entry.getName().substring(0, entry.getName().length()-1) : entry.getName();
if (!name.equals(resourcePath)) {
final String relPath = resourcePath.isEmpty() ? name : name.substring(resourcePath.length()+1);
- final String nodePath = parentPath + "/" + relPath;
+ final String nodePath = parentPath.equals("/") ? parentPath + relPath : parentPath + "/" + relPath;
if (entry.isDirectory()) {
if (!createFolderNode(nodePath, importBehavior)) {
return;
@@ -143,6 +143,9 @@ public class ResourceImporter {
private String getParentPath(String path) {
int offset = path.lastIndexOf('/');
if (offset != -1) {
+ if (offset == 0) {
+ return "/";
+ }
return path.substring(0, offset);
}
return null;
Modified: rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/bootstrapping/ModuleRegistryTest.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/bootstrapping/ModuleRegistryTest.java?rev=1346327&r1=1346326&r2=1346327&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/bootstrapping/ModuleRegistryTest.java (original)
+++ rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/bootstrapping/ModuleRegistryTest.java Tue Jun 5 10:10:52 2012
@@ -107,6 +107,10 @@ public class ModuleRegistryTest extends
assertTrue(contentNode.hasProperty("importBehavior"));
assertEquals("MERGE", contentNode.getProperty("importBehavior").getString());
+ contentNode = moduleNode.getNode("contents/bar");
+ assertTrue(contentNode.hasProperty("workspace"));
+ assertEquals("myws", contentNode.getProperty("workspace").getString());
+
// resources
assertTrue(moduleNode.hasNode("resources"));
assertEquals(1, moduleNode.getNode("resources").getNodes().getSize());
Modified: rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/bootstrapping/ModuleScannerTest.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/bootstrapping/ModuleScannerTest.java?rev=1346327&r1=1346326&r2=1346327&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/bootstrapping/ModuleScannerTest.java (original)
+++ rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/bootstrapping/ModuleScannerTest.java Tue Jun 5 10:10:52 2012
@@ -75,6 +75,7 @@ public class ModuleScannerTest {
assertEquals("bar.json", bar.getFile());
assertEquals("/testroot", bar.getParent());
assertFalse(bar.isReload());
+ assertEquals("myws", bar.getWorkspace());
assertEquals(1, module.getResources().size());
final Module.Resource resource = module.getResources().iterator().next();
Modified: rave/sandbox/content-services/rave-jcr-config/src/test/resources/META-INF/rave/module.json
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-config/src/test/resources/META-INF/rave/module.json?rev=1346327&r1=1346326&r2=1346327&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-jcr-config/src/test/resources/META-INF/rave/module.json (original)
+++ rave/sandbox/content-services/rave-jcr-config/src/test/resources/META-INF/rave/module.json Tue Jun 5 10:10:52 2012
@@ -20,7 +20,8 @@
"bar" : {
"file" : "bar.json",
"parent" : "/testroot",
- "reload" : false
+ "reload" : false,
+ "workspace" : "myws"
}
},
"resources" : {
Modified: rave/sandbox/content-services/rave-jcr-integration/module2/src/main/resources/META-INF/rave/module.json
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-integration/module2/src/main/resources/META-INF/rave/module.json?rev=1346327&r1=1346326&r2=1346327&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-jcr-integration/module2/src/main/resources/META-INF/rave/module.json (original)
+++ rave/sandbox/content-services/rave-jcr-integration/module2/src/main/resources/META-INF/rave/module.json Tue Jun 5 10:10:52 2012
@@ -23,7 +23,8 @@
"resources" : {
"quux" : {
"path" : "resources",
- "parent" : "/testroot"
+ "parent" : "/",
+ "workspace" : "myws"
}
}
}
Modified: rave/sandbox/content-services/rave-jcr-integration/test/src/test/java/org/apache/rave/jcr/RaveRepositoryTest.java
URL: http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-integration/test/src/test/java/org/apache/rave/jcr/RaveRepositoryTest.java?rev=1346327&r1=1346326&r2=1346327&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-jcr-integration/test/src/test/java/org/apache/rave/jcr/RaveRepositoryTest.java (original)
+++ rave/sandbox/content-services/rave-jcr-integration/test/src/test/java/org/apache/rave/jcr/RaveRepositoryTest.java Tue Jun 5 10:10:52 2012
@@ -1,5 +1,6 @@
package org.apache.rave.jcr;
+import javax.jcr.NoSuchWorkspaceException;
import javax.jcr.Node;
import javax.jcr.Property;
import javax.jcr.Session;
@@ -9,8 +10,21 @@ import org.apache.rave.jcr.jackrabbit.Ra
public class RaveRepositoryTest extends AbstractJCRTest {
+ @Override
+ public void tearDown() throws Exception {
+ super.tearDown();
+ // Delete workspace is not yet implemented by JR: remove nodes instead
+// getHelper().getSuperuserSession().getWorkspace().deleteWorkspace("myws");
+ try {
+ Session session = getHelper().getSuperuserSession("myws");
+ if (session.nodeExists("/images")) {
+ session.getNode("/images").remove();
+ }
+ } catch (NoSuchWorkspaceException ignore) {}
+ }
+
public void testBootstrap() throws Exception {
- final Session session = getHelper().getSuperuserSession();
+ Session session = getHelper().getReadOnlySession();
((RaveRepositoryImpl) session.getRepository()).bootstrap(false);
assertTrue(session.nodeExists("/testroot/foo"));
@@ -26,12 +40,13 @@ public class RaveRepositoryTest extends
final Node bar = foo.getNode("bar");
assertTrue(bar.isNodeType("bar:bar"));
- assertTrue(session.nodeExists("/testroot/images"));
- final Node images = session.getNode("/testroot/images");
+ session = getHelper().getReadOnlySession("myws");
+ assertTrue(session.nodeExists("/images"));
+ final Node images = session.getNode("/images");
assertTrue(images.isNodeType("nt:folder"));
- assertTrue(session.nodeExists("/testroot/images/blank.gif"));
- final Node gif = session.getNode("/testroot/images/blank.gif");
+ assertTrue(session.nodeExists("/images/blank.gif"));
+ final Node gif = session.getNode("/images/blank.gif");
assertTrue(gif.isNodeType("nt:file"));
}