You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:14:28 UTC

[sling-org-apache-sling-scripting-thymeleaf] 26/39: SLING-5928 Use Service ResourceResolver in SlingResourceTemplateResolver

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.scripting.thymeleaf-1.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git

commit a93b728ddb558b8010569dff3803f17c6858a71c
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Wed Jan 25 00:15:51 2017 +0000

    SLING-5928 Use Service ResourceResolver in SlingResourceTemplateResolver
    
    adjust testing
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/org.apache.sling.scripting.thymeleaf@1780129 13f79535-47bb-0310-9956-ffa450edef68
---
 .../thymeleaf/it/tests/ThymeleafTestSupport.java   | 30 +++++--------------
 ...UserMapperImpl.amended-scripting_thymeleaf.json |  7 +++++
 src/test/resources/repoinit.txt                    | 34 ----------------------
 3 files changed, 15 insertions(+), 56 deletions(-)

diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
index ea1a28e..521e5da 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafTestSupport.java
@@ -25,8 +25,7 @@ import org.apache.sling.api.servlets.ServletResolver;
 import org.apache.sling.auth.core.AuthenticationSupport;
 import org.apache.sling.engine.SlingRequestProcessor;
 import org.apache.sling.scripting.thymeleaf.it.app.Activator;
-import org.apache.sling.testing.paxexam.SlingOptions;
-import org.apache.sling.testing.paxexam.SlingVersionResolver;
+import org.apache.sling.serviceusermapping.ServiceUserMapped;
 import org.apache.sling.testing.paxexam.TestSupport;
 import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.Option;
@@ -40,6 +39,7 @@ import org.thymeleaf.ITemplateEngine;
 
 import static org.apache.sling.testing.paxexam.SlingOptions.slingExtensionI18n;
 import static org.apache.sling.testing.paxexam.SlingOptions.slingExtensionModels;
+import static org.apache.sling.testing.paxexam.SlingOptions.slingInstallerProviderJcr;
 import static org.apache.sling.testing.paxexam.SlingOptions.slingLaunchpadOakTar;
 import static org.apache.sling.testing.paxexam.SlingOptions.slingScripting;
 import static org.apache.sling.testing.paxexam.SlingOptions.slingScriptingJsp;
@@ -47,7 +47,6 @@ import static org.ops4j.pax.exam.CoreOptions.composite;
 import static org.ops4j.pax.exam.CoreOptions.junitBundles;
 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
 import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;
 import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration;
 
 public abstract class ThymeleafTestSupport extends TestSupport {
@@ -71,16 +70,11 @@ public abstract class ThymeleafTestSupport extends TestSupport {
     @Inject
     protected ITemplateEngine templateEngine;
 
+    @Inject
+    protected ServiceUserMapped serviceUserMapped;
+
     @Configuration
     public Option[] configuration() {
-        // SlingOptions.versionResolver.setVersionFromProject(SlingVersionResolver.SLING_GROUP_ID, "org.apache.sling.scripting.api");
-        // SlingOptions.versionResolver.setVersionFromProject(SlingVersionResolver.SLING_GROUP_ID, "org.apache.sling.scripting.core");
-        SlingOptions.versionResolver.setVersion(SlingVersionResolver.SLING_GROUP_ID, "org.apache.sling.api", "2.14.3-SNAPSHOT");
-        SlingOptions.versionResolver.setVersion(SlingVersionResolver.SLING_GROUP_ID, "org.apache.sling.jcr.base", "2.4.1-SNAPSHOT");
-        SlingOptions.versionResolver.setVersion(SlingVersionResolver.SLING_GROUP_ID, "org.apache.sling.jcr.oak.server", "1.1.1-SNAPSHOT");
-        SlingOptions.versionResolver.setVersion(SlingVersionResolver.SLING_GROUP_ID, "org.apache.sling.jcr.repoinit", "1.0.3-SNAPSHOT");
-        SlingOptions.versionResolver.setVersion(SlingVersionResolver.SLING_GROUP_ID, "org.apache.sling.jcr.resource", "2.8.1-SNAPSHOT");
-        SlingOptions.versionResolver.setVersion(SlingVersionResolver.SLING_GROUP_ID, "org.apache.sling.resourceresolver", "1.4.19-SNAPSHOT");
         return new Option[]{
             baseConfiguration(),
             launchpad(),
@@ -98,6 +92,7 @@ public abstract class ThymeleafTestSupport extends TestSupport {
     @ProbeBuilder
     public TestProbeBuilder probeConfiguration(final TestProbeBuilder testProbeBuilder) {
         testProbeBuilder.setHeader(Constants.BUNDLE_ACTIVATOR, Activator.class.getName());
+        testProbeBuilder.setHeader(Constants.BUNDLE_SYMBOLICNAME, "org.apache.sling.scripting.thymeleaf.it.app");
         testProbeBuilder.setHeader(Constants.EXPORT_PACKAGE, "org.apache.sling.scripting.thymeleaf.it.app");
         testProbeBuilder.setHeader("Sling-Model-Packages", "org.apache.sling.scripting.thymeleaf.it.app");
         testProbeBuilder.setHeader("Sling-Initial-Content", String.join(",",
@@ -111,22 +106,13 @@ public abstract class ThymeleafTestSupport extends TestSupport {
     protected Option launchpad() {
         final int httpPort = findFreePort();
         final String workingDirectory = workingDirectory();
-        final String repoinit = String.format("raw:file:%s/src/test/resources/repoinit.txt", PathUtils.getBaseDir());
         return composite(
             slingLaunchpadOakTar(workingDirectory, httpPort),
             slingExtensionI18n(),
             slingExtensionModels(),
+            slingInstallerProviderJcr(),
             slingScripting(),
-            slingScriptingJsp(),
-            newConfiguration("org.apache.sling.jcr.repoinit.impl.RepositoryInitializer")
-                .put("references", new String[]{repoinit})
-                .asOption(),
-            factoryConfiguration("org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended")
-                .put("user.mapping", "org.apache.sling.scripting.thymeleaf=sling-scripting")
-                .asOption(),
-            newConfiguration("org.apache.sling.jcr.base.internal.LoginAdminWhitelist")
-                .put("whitelist.bundles.regexp", "org.apache.sling.*")
-                .asOption()
+            slingScriptingJsp()
         );
     }
 
diff --git a/src/test/resources/apps/thymeleaf/config/org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-scripting_thymeleaf.json b/src/test/resources/apps/thymeleaf/config/org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-scripting_thymeleaf.json
new file mode 100644
index 0000000..9ace1b3
--- /dev/null
+++ b/src/test/resources/apps/thymeleaf/config/org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-scripting_thymeleaf.json
@@ -0,0 +1,7 @@
+{
+  "jcr:primaryType": "sling:OsgiConfig",
+  "user.mapping": [
+    "org.apache.sling.scripting.thymeleaf=sling-scripting",
+    "org.apache.sling.scripting.thymeleaf.it.app=sling-scripting"
+  ]
+}
diff --git a/src/test/resources/repoinit.txt b/src/test/resources/repoinit.txt
deleted file mode 100644
index fc4c50c..0000000
--- a/src/test/resources/repoinit.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-################################################################################
-#
-#    Licensed to the Apache Software Foundation (ASF) under one or more
-#    contributor license agreements.  See the NOTICE file distributed with
-#    this work for additional information regarding copyright ownership.
-#    The ASF licenses this file to You under the Apache License, Version 2.0
-#    (the "License"); you may not use this file except in compliance with
-#    the License.  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS,
-#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#    See the License for the specific language governing permissions and
-#    limitations under the License.
-#
-################################################################################
-
-create service user sling-scripting
-
-create path (sling:Folder) /apps
-create path (sling:Folder) /libs
-
-set ACL for sling-scripting
-  allow jcr:read on /apps
-  allow jcr:read on /libs
-end
-
-create path (sling:OrderedFolder) /content
-
-set ACL for everyone
-  allow jcr:read on /content
-end

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.