Author: unico
Date: Mon Jun 18 06:42:20 2012
New Revision: 1351214
URL: http://svn.apache.org/viewvc?rev=1351214&view=rev
Log:
RAVE-603 don't reload by default; don't package resources for local tests; add
test base class for rave repository
Added:
rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/test/
rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/test/AbstractRaveJCRTest.java
Modified:
rave/sandbox/content-services/rave-jcr-config/pom.xml
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
Modified: rave/sandbox/content-services/rave-jcr-config/pom.xml
URL:
http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-config/pom.xml?rev=1351214&r1=1351213&r2=1351214&view=diff
==============================================================================
--- rave/sandbox/content-services/rave-jcr-config/pom.xml (original)
+++ rave/sandbox/content-services/rave-jcr-config/pom.xml Mon Jun 18 06:42:20
2012
@@ -132,6 +132,14 @@
<goals>
<goal>test-jar</goal>
</goals>
+ <configuration>
+ <excludes>
+ <exclude>resources.jar</exclude>
+ <exclude>META-INF/**</exclude>
+ <exlude>*.properties</exlude>
+ <exclude>log4j.*</exclude>
+ </excludes>
+ </configuration>
</execution>
</executions>
</plugin>
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=1351214&r1=1351213&r2=1351214&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
Mon Jun 18 06:42:20 2012
@@ -355,7 +355,7 @@ public final class ModuleRegistry {
final Node item = iter.nextNode();
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 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)) {
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=1351214&r1=1351213&r2=1351214&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
Mon Jun 18 06:42:20 2012
@@ -148,7 +148,7 @@ 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 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)) {
Added:
rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/test/AbstractRaveJCRTest.java
URL:
http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/test/AbstractRaveJCRTest.java?rev=1351214&view=auto
==============================================================================
---
rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/test/AbstractRaveJCRTest.java
(added)
+++
rave/sandbox/content-services/rave-jcr-config/src/test/java/org/apache/rave/jcr/test/AbstractRaveJCRTest.java
Mon Jun 18 06:42:20 2012
@@ -0,0 +1,48 @@
+package org.apache.rave.jcr.test;
+
+import java.io.InputStream;
+
+import javax.jcr.Repository;
+import javax.jcr.Session;
+
+import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.apache.rave.jcr.importing.ContentImporter;
+import org.apache.rave.jcr.importing.ImportBehavior;
+import org.apache.rave.jcr.jackrabbit.RaveRepositoryImpl;
+import org.apache.rave.jcr.jackrabbit.RaveRepositoryStub;
+
+/**
+ * Abstract base class for tests that want to run against a rave-bootstrapped
repository.
+ * You must make sure that you define
+ * <code>
+ *
javax.jcr.tck.repository_stub_impl=org.apache.rave.jcr.jackrabbit.RaveRepositoryStub
+ * </code>
+ * in your repositoryStubImpl.properties
+ */
+public abstract class AbstractRaveJCRTest extends AbstractJCRTest {
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ final Repository repository = getHelper().getRepository();
+ if (!(repository instanceof RaveRepositoryImpl)) {
+ throw new IllegalStateException("Expected a RaveRepositoryImpl:
make sure you are using " + RaveRepositoryStub.class.getName());
+ }
+ ((RaveRepositoryImpl) repository).bootstrap(false);
+ }
+
+ /**
+ * Import a json content file into the repository directly below /testroot.
+ * The node and its subtree are removed again during tearDown.
+ *
+ * @param nodeName the name of the node to be added below /testroot
+ * @param content the inputstream of json content to be imported.
+ * @throws Exception
+ */
+ protected void importContent(String nodeName, InputStream content) throws
Exception {
+ Session session = getHelper().getReadWriteSession();
+ ContentImporter importer = new ContentImporter(session);
+ importer.importContent("/testroot", nodeName, content,
ImportBehavior.REPLACE);
+ session.save();
+ }
+}