You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ol...@apache.org on 2022/09/08 10:37:02 UTC

[sling-org-apache-sling-scripting-thymeleaf] branch master updated: SLING-11481 Update Testing PaxExam to 4.0.0

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

olli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-thymeleaf.git


The following commit(s) were added to refs/heads/master by this push:
     new 083f897  SLING-11481 Update Testing PaxExam to 4.0.0
083f897 is described below

commit 083f897f79b803198b9036657ac221d33a1eca0e
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Thu Sep 8 12:28:16 2022 +0200

    SLING-11481 Update Testing PaxExam to 4.0.0
    
    * use Testing PaxExam 4.0.0-SNAPSHOT
    * update test dependencies
    * use Hamcrest's assertThat
---
 pom.xml                                            | 12 ++++++--
 .../it/tests/PatternTemplateModeProviderIT.java    |  4 +--
 .../thymeleaf/it/tests/TemplateEngineIT.java       |  8 +++---
 .../it/tests/ThymeleafScriptEngineFactoryIT.java   |  6 ++--
 .../thymeleaf/it/tests/ThymeleafTestSupport.java   | 33 +++++++++-------------
 .../thymeleaf/it/tests/html/AdaptToModelIT.java    |  2 +-
 .../thymeleaf/it/tests/html/LinkBuilderIT.java     |  2 +-
 .../thymeleaf/it/tests/html/SlingIncludeIT.java    |  2 +-
 .../html/ThymeleafBindingsValuesProviderIT.java    |  2 +-
 .../html/ThymeleafDecoupledTemplateLogicIT.java    |  2 +-
 .../it/tests/html/ThymeleafReplaceIT.java          |  2 +-
 .../thymeleaf/it/tests/html/ThymeleafTextIT.java   |  2 +-
 12 files changed, 38 insertions(+), 39 deletions(-)

diff --git a/pom.xml b/pom.xml
index 1b1428b..4d9d6d4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -134,7 +134,7 @@
     <dependency>
       <groupId>org.apache.felix</groupId>
       <artifactId>org.apache.felix.framework</artifactId>
-      <version>6.0.3</version>
+      <version>7.0.5</version>
       <scope>test</scope>
     </dependency>
     <!-- Apache Sling -->
@@ -168,6 +168,12 @@
       <version>1.3.6</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.sling</groupId>
+      <artifactId>org.apache.sling.resource.presence</artifactId>
+      <scope>test</scope>
+      <version>0.0.2</version>
+    </dependency>
     <dependency>
       <groupId>org.apache.sling</groupId>
       <artifactId>org.apache.sling.serviceusermapper</artifactId>
@@ -189,7 +195,7 @@
     <dependency>
       <groupId>org.apache.sling</groupId>
       <artifactId>org.apache.sling.testing.paxexam</artifactId>
-      <version>3.0.0</version>
+      <version>4.0.0-SNAPSHOT</version>
       <scope>test</scope>
     </dependency>
     <!-- Thymeleaf -->
@@ -227,7 +233,7 @@
     <dependency>
       <groupId>org.jsoup</groupId>
       <artifactId>jsoup</artifactId>
-      <version>1.11.3</version>
+      <version>1.15.3</version>
       <scope>test</scope>
     </dependency>
     <!-- nullability -->
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/PatternTemplateModeProviderIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/PatternTemplateModeProviderIT.java
index 32b1eae..36fa82c 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/PatternTemplateModeProviderIT.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/PatternTemplateModeProviderIT.java
@@ -30,9 +30,9 @@ import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 import org.thymeleaf.templatemode.TemplateMode;
 
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
 import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.nullValue;
 
 @RunWith(PaxExam.class)
 @ExamReactorStrategy(PerClass.class)
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/TemplateEngineIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/TemplateEngineIT.java
index dbd84b4..f6bff99 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/TemplateEngineIT.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/TemplateEngineIT.java
@@ -24,10 +24,10 @@ import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 
-import static org.hamcrest.Matchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.greaterThan;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
 
 @RunWith(PaxExam.class)
 @ExamReactorStrategy(PerClass.class)
@@ -35,7 +35,7 @@ public class TemplateEngineIT extends ThymeleafTestSupport {
 
     @Test
     public void testTemplateEngine() {
-        assertNotNull(templateEngine);
+        assertThat(templateEngine, notNullValue());
     }
 
     @Test
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafScriptEngineFactoryIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafScriptEngineFactoryIT.java
index de0db6b..7304d22 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafScriptEngineFactoryIT.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/ThymeleafScriptEngineFactoryIT.java
@@ -24,11 +24,11 @@ import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.hasItem;
 import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
 import static org.hamcrest.Matchers.startsWith;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
 
 @RunWith(PaxExam.class)
 @ExamReactorStrategy(PerClass.class)
@@ -36,7 +36,7 @@ public class ThymeleafScriptEngineFactoryIT extends ThymeleafTestSupport {
 
     @Test
     public void testScriptEngineFactory() {
-        assertNotNull(scriptEngineFactory);
+        assertThat(scriptEngineFactory, notNullValue());
     }
 
     @Test
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 2a66607..9ad02e6 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
@@ -18,24 +18,20 @@
  */
 package org.apache.sling.scripting.thymeleaf.it.tests;
 
-import java.util.Objects;
-
 import javax.inject.Inject;
 import javax.script.ScriptEngineFactory;
 
 import org.apache.sling.api.servlets.ServletResolver;
 import org.apache.sling.auth.core.AuthenticationSupport;
 import org.apache.sling.engine.SlingRequestProcessor;
+import org.apache.sling.resource.presence.ResourcePresence;
 import org.apache.sling.scripting.thymeleaf.it.app.Activator;
-import org.apache.sling.serviceusermapping.ServiceUserMapped;
 import org.apache.sling.testing.paxexam.TestSupport;
 import org.jetbrains.annotations.NotNull;
 import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.ProbeBuilder;
 import org.ops4j.pax.exam.TestProbeBuilder;
-import org.ops4j.pax.exam.options.OptionalCompositeOption;
-import org.ops4j.pax.exam.options.extra.VMOption;
 import org.ops4j.pax.exam.util.Filter;
 import org.osgi.framework.Constants;
 import org.osgi.service.http.HttpService;
@@ -45,14 +41,13 @@ import static org.apache.sling.testing.paxexam.SlingOptions.slingI18n;
 import static org.apache.sling.testing.paxexam.SlingOptions.slingInstallerProviderJcr;
 import static org.apache.sling.testing.paxexam.SlingOptions.slingModels;
 import static org.apache.sling.testing.paxexam.SlingOptions.slingQuickstartOakTar;
+import static org.apache.sling.testing.paxexam.SlingOptions.slingResourcePresence;
 import static org.apache.sling.testing.paxexam.SlingOptions.slingScripting;
 import static org.apache.sling.testing.paxexam.SlingOptions.slingScriptingJsp;
 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.options;
-import static org.ops4j.pax.exam.CoreOptions.vmOption;
-import static org.ops4j.pax.exam.CoreOptions.when;
+import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;
 
 public abstract class ThymeleafTestSupport extends TestSupport {
 
@@ -76,7 +71,8 @@ public abstract class ThymeleafTestSupport extends TestSupport {
     protected ITemplateEngine templateEngine;
 
     @Inject
-    protected ServiceUserMapped serviceUserMapped;
+    @Filter(value = "(path=/apps/thymeleaf)")
+    private ResourcePresence resourcePresence;
 
     @Configuration
     public Option[] configuration() {
@@ -91,20 +87,17 @@ public abstract class ThymeleafTestSupport extends TestSupport {
             mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.ognl").versionAsInProject(),
             mavenBundle().groupId("org.javassist").artifactId("javassist").versionAsInProject(),
             // testing
-            mavenBundle().groupId("org.jsoup").artifactId("jsoup").versionAsInProject(),
-            mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").versionAsInProject(),
-            junitBundles(),
-            jacoco() // remove with Testing PaxExam 4.0
+            slingResourcePresence(),
+            factoryConfiguration("org.apache.sling.jcr.repoinit.RepositoryInitializer")
+                .put("scripts", new String[]{"create path (sling:OrderedFolder) /content/thymeleaf\nset ACL for everyone\nallow jcr:read on /content/thymeleaf\nend"})
+                .asOption(),
+            factoryConfiguration("org.apache.sling.resource.presence.internal.ResourcePresenter")
+                .put("path", "/apps/thymeleaf")
+                .asOption(),
+            mavenBundle().groupId("org.jsoup").artifactId("jsoup").versionAsInProject()
         );
     }
 
-    // remove with Testing PaxExam 4.0
-    protected OptionalCompositeOption jacoco() {
-        final String jacocoCommand = System.getProperty("jacoco.command");
-        final VMOption option = Objects.nonNull(jacocoCommand) && !jacocoCommand.trim().isEmpty() ? vmOption(jacocoCommand) : null;
-        return when(Objects.nonNull(option)).useOptions(option);
-    }
-
     @ProbeBuilder
     public TestProbeBuilder probeConfiguration(@NotNull final TestProbeBuilder testProbeBuilder) {
         testProbeBuilder.setHeader(Constants.BUNDLE_ACTIVATOR, Activator.class.getName());
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/AdaptToModelIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/AdaptToModelIT.java
index fcd193c..58fd2fd 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/AdaptToModelIT.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/AdaptToModelIT.java
@@ -31,8 +31,8 @@ import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
 
 @RunWith(PaxExam.class)
 @ExamReactorStrategy(PerClass.class)
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/LinkBuilderIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/LinkBuilderIT.java
index a5649d4..ed7b921 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/LinkBuilderIT.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/LinkBuilderIT.java
@@ -31,8 +31,8 @@ import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
 
 @RunWith(PaxExam.class)
 @ExamReactorStrategy(PerClass.class)
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/SlingIncludeIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/SlingIncludeIT.java
index 7422fab..3d25728 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/SlingIncludeIT.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/SlingIncludeIT.java
@@ -31,8 +31,8 @@ import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
 
 @RunWith(PaxExam.class)
 @ExamReactorStrategy(PerClass.class)
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafBindingsValuesProviderIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafBindingsValuesProviderIT.java
index a800db9..6a5ad58 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafBindingsValuesProviderIT.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafBindingsValuesProviderIT.java
@@ -30,8 +30,8 @@ import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
 
 @RunWith(PaxExam.class)
 @ExamReactorStrategy(PerClass.class)
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafDecoupledTemplateLogicIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafDecoupledTemplateLogicIT.java
index 70ba63c..8a0a780 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafDecoupledTemplateLogicIT.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafDecoupledTemplateLogicIT.java
@@ -30,8 +30,8 @@ import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
 
 @RunWith(PaxExam.class)
 @ExamReactorStrategy(PerClass.class)
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafReplaceIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafReplaceIT.java
index 5afa509..a75e631 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafReplaceIT.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafReplaceIT.java
@@ -30,8 +30,8 @@ import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
 
 @RunWith(PaxExam.class)
 @ExamReactorStrategy(PerClass.class)
diff --git a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafTextIT.java b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafTextIT.java
index 3cb76be..4b2bda3 100644
--- a/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafTextIT.java
+++ b/src/test/java/org/apache/sling/scripting/thymeleaf/it/tests/html/ThymeleafTextIT.java
@@ -31,8 +31,8 @@ import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
 
 @RunWith(PaxExam.class)
 @ExamReactorStrategy(PerClass.class)