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/07 20:40:13 UTC

[sling-org-apache-sling-scripting-freemarker] branch master updated: SLING-11479 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-freemarker.git


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

commit d549e8868d07328aa486d0c0197cb1d8d56594ad
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Wed Sep 7 22:39:57 2022 +0200

    SLING-11479 Update Testing PaxExam to 4.0.0
    
    * use Testing PaxExam 4.0.0-SNAPSHOT
    * update test dependencies
    * use Hamcrest's assertThat
---
 pom.xml                                            |  4 ++--
 .../freemarker/it/tests/AdaptToModelIT.java        |  2 +-
 .../tests/FreemarkerBindingsValuesProviderIT.java  |  2 +-
 .../it/tests/FreemarkerScriptEngineFactoryIT.java  |  6 +++---
 .../freemarker/it/tests/FreemarkerTestSupport.java | 23 +++++-----------------
 .../scripting/freemarker/it/tests/IncludeIT.java   |  2 +-
 .../scripting/freemarker/it/tests/SimpleIT.java    |  2 +-
 7 files changed, 14 insertions(+), 27 deletions(-)

diff --git a/pom.xml b/pom.xml
index e4cb2b2..3801a10 100644
--- a/pom.xml
+++ b/pom.xml
@@ -201,7 +201,7 @@
     <dependency>
       <groupId>org.apache.sling</groupId>
       <artifactId>org.apache.sling.testing.paxexam</artifactId>
-      <version>3.1.0</version>
+      <version>4.0.0-SNAPSHOT</version>
       <scope>test</scope>
     </dependency>
     <!-- FreeMarker -->
@@ -221,7 +221,7 @@
     <dependency>
       <groupId>org.jsoup</groupId>
       <artifactId>jsoup</artifactId>
-      <version>1.13.1</version>
+      <version>1.15.3</version>
       <scope>test</scope>
     </dependency>
     <!-- logging -->
diff --git a/src/test/java/org/apache/sling/scripting/freemarker/it/tests/AdaptToModelIT.java b/src/test/java/org/apache/sling/scripting/freemarker/it/tests/AdaptToModelIT.java
index cdc67ca..b57955c 100644
--- a/src/test/java/org/apache/sling/scripting/freemarker/it/tests/AdaptToModelIT.java
+++ b/src/test/java/org/apache/sling/scripting/freemarker/it/tests/AdaptToModelIT.java
@@ -36,8 +36,8 @@ import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 import org.ops4j.pax.exam.util.Filter;
 
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
 import static org.ops4j.pax.exam.CoreOptions.options;
 import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;
 
diff --git a/src/test/java/org/apache/sling/scripting/freemarker/it/tests/FreemarkerBindingsValuesProviderIT.java b/src/test/java/org/apache/sling/scripting/freemarker/it/tests/FreemarkerBindingsValuesProviderIT.java
index 81fab72..6404a4f 100644
--- a/src/test/java/org/apache/sling/scripting/freemarker/it/tests/FreemarkerBindingsValuesProviderIT.java
+++ b/src/test/java/org/apache/sling/scripting/freemarker/it/tests/FreemarkerBindingsValuesProviderIT.java
@@ -35,8 +35,8 @@ import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 import org.ops4j.pax.exam.util.Filter;
 
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
 import static org.ops4j.pax.exam.CoreOptions.options;
 import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;
 
diff --git a/src/test/java/org/apache/sling/scripting/freemarker/it/tests/FreemarkerScriptEngineFactoryIT.java b/src/test/java/org/apache/sling/scripting/freemarker/it/tests/FreemarkerScriptEngineFactoryIT.java
index fe228a5..fce6c89 100644
--- a/src/test/java/org/apache/sling/scripting/freemarker/it/tests/FreemarkerScriptEngineFactoryIT.java
+++ b/src/test/java/org/apache/sling/scripting/freemarker/it/tests/FreemarkerScriptEngineFactoryIT.java
@@ -32,12 +32,12 @@ import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 import org.ops4j.pax.exam.util.Filter;
 
+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.sameInstance;
 import static org.hamcrest.Matchers.startsWith;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
 import static org.ops4j.pax.exam.CoreOptions.options;
 
 @RunWith(PaxExam.class)
@@ -61,7 +61,7 @@ public class FreemarkerScriptEngineFactoryIT extends FreemarkerTestSupport {
 
     @Test
     public void testScriptEngineFactory() {
-        assertNotNull(scriptEngineFactory);
+        assertThat(scriptEngineFactory, notNullValue());
     }
 
     @Test
diff --git a/src/test/java/org/apache/sling/scripting/freemarker/it/tests/FreemarkerTestSupport.java b/src/test/java/org/apache/sling/scripting/freemarker/it/tests/FreemarkerTestSupport.java
index f96437f..b620019 100644
--- a/src/test/java/org/apache/sling/scripting/freemarker/it/tests/FreemarkerTestSupport.java
+++ b/src/test/java/org/apache/sling/scripting/freemarker/it/tests/FreemarkerTestSupport.java
@@ -18,8 +18,6 @@
  */
 package org.apache.sling.scripting.freemarker.it.tests;
 
-import java.util.Objects;
-
 import javax.inject.Inject;
 import javax.script.ScriptEngineFactory;
 
@@ -32,8 +30,6 @@ import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.ProbeBuilder;
 import org.ops4j.pax.exam.TestProbeBuilder;
 import org.ops4j.pax.exam.options.ModifiableCompositeOption;
-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;
@@ -44,10 +40,8 @@ import static org.apache.sling.testing.paxexam.SlingOptions.slingResourcePresenc
 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.vmOption;
-import static org.ops4j.pax.exam.CoreOptions.when;
+import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;
 
 public abstract class FreemarkerTestSupport extends TestSupport {
 
@@ -81,21 +75,14 @@ public abstract class FreemarkerTestSupport extends TestSupport {
             mavenBundle().groupId("org.freemarker").artifactId("freemarker").versionAsInProject(),
             mavenBundle().groupId("org.apache.servicemix.specs").artifactId("org.apache.servicemix.specs.jaxp-api-1.4").versionAsInProject(),
             // testing
+            factoryConfiguration("org.apache.sling.jcr.repoinit.RepositoryInitializer")
+                .put("scripts", new String[]{"create path (sling:OrderedFolder) /content/freemarker\nset ACL for everyone\nallow jcr:read on /content/freemarker\nend"})
+                .asOption(),
             slingResourcePresence(),
-            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
+            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(final TestProbeBuilder testProbeBuilder) {
         testProbeBuilder.setHeader(Constants.EXPORT_PACKAGE, "org.apache.sling.scripting.freemarker.it.app");
diff --git a/src/test/java/org/apache/sling/scripting/freemarker/it/tests/IncludeIT.java b/src/test/java/org/apache/sling/scripting/freemarker/it/tests/IncludeIT.java
index b90760a..1a4ecbe 100644
--- a/src/test/java/org/apache/sling/scripting/freemarker/it/tests/IncludeIT.java
+++ b/src/test/java/org/apache/sling/scripting/freemarker/it/tests/IncludeIT.java
@@ -37,8 +37,8 @@ import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 import org.ops4j.pax.exam.util.Filter;
 
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
 import static org.ops4j.pax.exam.CoreOptions.options;
 import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;
 
diff --git a/src/test/java/org/apache/sling/scripting/freemarker/it/tests/SimpleIT.java b/src/test/java/org/apache/sling/scripting/freemarker/it/tests/SimpleIT.java
index 89075a2..35cf336 100644
--- a/src/test/java/org/apache/sling/scripting/freemarker/it/tests/SimpleIT.java
+++ b/src/test/java/org/apache/sling/scripting/freemarker/it/tests/SimpleIT.java
@@ -36,8 +36,8 @@ import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 import org.ops4j.pax.exam.util.Filter;
 
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
 import static org.ops4j.pax.exam.CoreOptions.options;
 import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.factoryConfiguration;