Author: bdelacretaz
Date: Fri May 20 09:40:50 2016
New Revision: 1744678
URL: http://svn.apache.org/viewvc?rev=1744678&view=rev
Log:
SLING-5355 - ProvisioningModelIT passes
Removed:
sling/trunk/bundles/extensions/repoinit/it/src/main/provisioning/model.txt
Modified:
sling/trunk/bundles/extensions/repoinit/it/pom.xml
sling/trunk/bundles/extensions/repoinit/it/src/main/provisioning/repoinit.txt
sling/trunk/bundles/extensions/repoinit/it/src/test/java/org/apache/sling/repoinit/it/ProvisioningModelIT.java
sling/trunk/bundles/extensions/repoinit/oak-jcr/src/main/java/org/apache/sling/repoinit/jcr/RepositoryInitializer.java
Modified: sling/trunk/bundles/extensions/repoinit/it/pom.xml
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/repoinit/it/pom.xml?rev=1744678&r1=1744677&r2=1744678&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/repoinit/it/pom.xml (original)
+++ sling/trunk/bundles/extensions/repoinit/it/pom.xml Fri May 20 09:40:50 2016
@@ -61,11 +61,10 @@
<integration.test.wait>false</integration.test.wait>
<!--
- if set to "true" this will start the launchpad with the following debug
options:
- -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000
- otherwise you can provide your own debug settings
+ If set to "true" this will start the launchpad with standard debug
options,
+ or set to a string to provide custom debug settings
-->
- <debug.options/>
+ <launchpad.debug/>
</properties>
<build>
@@ -130,7 +129,7 @@
<controlPort>${sling.control.port}</controlPort>
<runmode>jackrabbit</runmode>
<contextPath>${http.base.path}</contextPath>
- <debug>${debug.options}</debug>
+ <debug>${launchpad.debug}</debug>
</server>
</servers>
</configuration>
Modified:
sling/trunk/bundles/extensions/repoinit/it/src/main/provisioning/repoinit.txt
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/repoinit/it/src/main/provisioning/repoinit.txt?rev=1744678&r1=1744677&r2=1744678&view=diff
==============================================================================
---
sling/trunk/bundles/extensions/repoinit/it/src/main/provisioning/repoinit.txt
(original)
+++
sling/trunk/bundles/extensions/repoinit/it/src/main/provisioning/repoinit.txt
Fri May 20 09:40:50 2016
@@ -16,9 +16,28 @@
# specific language governing permissions and limitations
# under the License.
#
-[feature name=repoinit]
+[feature name=repoinit-tests]
-[artifacts]
- org.apache.sling/org.apache.sling.repoinit.parser/0.0.1-SNAPSHOT
+[artifacts startLevel=2]
org.apache.sling/org.apache.sling.repoinit.oak-jcr/0.0.1-SNAPSHOT
-
\ No newline at end of file
+ org.apache.sling/org.apache.sling.repoinit.parser/0.0.1-SNAPSHOT
+ org.apache.sling/org.apache.sling.provisioning.model/1.4.2
+
+[artifacts]
+ org.apache.sling/org.apache.sling.junit.core/1.0.14
+ org.apache.sling/org.apache.sling.testing.tools/1.0.10
+ org.apache.sling/org.apache.sling.jcr.api/2.3.1-SNAPSHOT
+
+[settings]
+ org.apache.sling.commons.log.julenabled=true
+
+[:repoinit]
+#Â Test the RepositoryInitializer which reads such sections
+create path /repoinit/fromProvisioningModel
+
+create service user userFromProvisioningModel
+
+set ACL for userFromProvisioningModel
+ allow jcr:read on /repoinit/fromProvisioningModel
+ deny jcr:write on /repoinit/fromProvisioningModel
+end
\ No newline at end of file
Modified:
sling/trunk/bundles/extensions/repoinit/it/src/test/java/org/apache/sling/repoinit/it/ProvisioningModelIT.java
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/repoinit/it/src/test/java/org/apache/sling/repoinit/it/ProvisioningModelIT.java?rev=1744678&r1=1744677&r2=1744678&view=diff
==============================================================================
---
sling/trunk/bundles/extensions/repoinit/it/src/test/java/org/apache/sling/repoinit/it/ProvisioningModelIT.java
(original)
+++
sling/trunk/bundles/extensions/repoinit/it/src/test/java/org/apache/sling/repoinit/it/ProvisioningModelIT.java
Fri May 20 09:40:50 2016
@@ -30,13 +30,12 @@ import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
-@Ignore("Fails for now - initializer not executed?")
/** Test repoinit statements supplied by our provisioning model */
public class ProvisioningModelIT {
private Session session;
private static final String TEST_PATH = "/repoinit/fromProvisioningModel";
- private static final String TEST_USER = "fromProvisioningModel";
+ private static final String TEST_USER = "userFromProvisioningModel";
@Rule
public TeleporterRule teleporter = TeleporterRule.forClass(getClass(),
"IT");
Modified:
sling/trunk/bundles/extensions/repoinit/oak-jcr/src/main/java/org/apache/sling/repoinit/jcr/RepositoryInitializer.java
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/repoinit/oak-jcr/src/main/java/org/apache/sling/repoinit/jcr/RepositoryInitializer.java?rev=1744678&r1=1744677&r2=1744678&view=diff
==============================================================================
---
sling/trunk/bundles/extensions/repoinit/oak-jcr/src/main/java/org/apache/sling/repoinit/jcr/RepositoryInitializer.java
(original)
+++
sling/trunk/bundles/extensions/repoinit/oak-jcr/src/main/java/org/apache/sling/repoinit/jcr/RepositoryInitializer.java
Fri May 20 09:40:50 2016
@@ -49,7 +49,10 @@ import org.slf4j.LoggerFactory;
/** SlingRepositoryInitializer that executes repoinit statements read
* from a configurable URL.
*/
-@Component
+@Component(
+ name="Apache Sling Repository Initializer",
+ description="Initializes the JCR content repository using repoinit
statements",
+ metatype=true)
@Service(SlingRepositoryInitializer.class)
@Properties({
// SlingRepositoryInitializers are executed in ascending
@@ -69,13 +72,13 @@ public class RepositoryInitializer imple
public static final String PROP_TEXT_URL = "text.url";
private String textURL;
- public static final String DEFAULT_MODEL_SECTION_NAME = ":repoinit";
+ public static final String DEFAULT_MODEL_SECTION_NAME = "repoinit";
@Property(
label="Model section name",
description=
- "Optional provisioning model section name to used to extract
repoinit statements"
- + " from the raw text provided by our text URL. Leave empty to
consider the content"
+ "Optional provisioning model additional section name (without
leading colon) used to extract"
+ + " repoinit statements from the raw text provided by our text
URL. Leave empty to consider the content"
+ " provided by that URL to already be in repoinit format",
value=DEFAULT_MODEL_SECTION_NAME)
public static final String PROP_MODEL_SECTION_NAME = "model.section.name";
@@ -104,6 +107,7 @@ public class RepositoryInitializer imple
log.info("Executing {}", op);
op.accept(v);
}
+ s.save();
log.info("{} repoinit operations executed", count);
} finally {
s.logout();
@@ -122,6 +126,7 @@ public class RepositoryInitializer imple
} else {
final StringWriter w = new StringWriter();
IOUtils.copy(is, w, "UTF-8");
+ result = w.toString();
}
} catch(Exception e) {
log.warn("Error reading repoinit statements from " + textURL, e);
@@ -138,6 +143,7 @@ public class RepositoryInitializer imple
}
String result = getRawRepoInitText();
log.debug("Raw text from {}: \n{}", textURL, result);
+ log.info("Got {} characters from {}", result.length(), textURL);
if(parseRawText) {
final StringReader r = new StringReader(result);
try {