You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2025/04/11 14:52:19 UTC

(sling-org-apache-sling-servlets-resolver) 02/02: SLING-12739 - setup for external, independent tests

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

bdelacretaz pushed a commit to branch issues/SLING-12739
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-servlets-resolver.git

commit 2ebbb8e1ff23fecabe5b5b0100ac3f7be196dfb1
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri Apr 11 16:51:00 2025 +0200

    SLING-12739 - setup for external, independent tests
---
 pom.xml                                            | 35 +++++++++
 src/ext-it/.gitignore                              |  1 +
 src/ext-it/pom.xml                                 | 87 ++++++++++++++++++++++
 .../resolver/external/it/TestSetupTest.java        | 40 ++++++++++
 4 files changed, 163 insertions(+)

diff --git a/pom.xml b/pom.xml
index 85c3d33..f7f32b3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -129,6 +129,41 @@
                     </systemProperties>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>exec-maven-plugin</artifactId>
+                <version>3.1.0</version>
+                <executions>
+                    <execution>
+                        <id>external-IT</id>
+                        <phase>integration-test</phase>
+                        <goals>
+                            <goal>exec</goal>
+                        </goals>
+                        <configuration>
+                            <executable>mvn</executable>
+                            <arguments>
+                                <argument>clean</argument>
+                                <argument>verify</argument>
+                                <argument>-f</argument>
+                                <argument>${project.basedir}/src/ext-it/pom.xml</argument>
+                                <argument>-D</argument>
+                                <argument>
+                                    bundle.filename=${basedir}/target/${project.build.finalName}.jar</argument>
+                            </arguments>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.rat</groupId>
+                <artifactId>apache-rat-plugin</artifactId>
+                <configuration>
+                    <excludes combine.children="append">
+                        <exclude>src/ext-it/target/**</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
         </plugins>
         <pluginManagement>
             <plugins>
diff --git a/src/ext-it/.gitignore b/src/ext-it/.gitignore
new file mode 100644
index 0000000..2f7896d
--- /dev/null
+++ b/src/ext-it/.gitignore
@@ -0,0 +1 @@
+target/
diff --git a/src/ext-it/pom.xml b/src/ext-it/pom.xml
new file mode 100644
index 0000000..d439ced
--- /dev/null
+++ b/src/ext-it/pom.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling</artifactId>
+        <version>49</version>
+        <relativePath />
+    </parent>
+
+    <artifactId>org.apache.sling.servlets.resolver.external.it</artifactId>
+    <version>0.0.1</version>
+    <packaging>jar</packaging>
+
+    <name>Apache Sling Servlets Resolver External Integration Tests</name>
+    <description>
+        Additional external integrations tests for the Servlets Resolver
+    </description>
+
+    <properties>
+        <org.ops4j.pax.exam.version>4.13.3</org.ops4j.pax.exam.version>
+    </properties>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-failsafe-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>integration-test</id>
+                        <phase>integration-test</phase>
+                        <goals>
+                            <goal>integration-test</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>verify</id>
+                        <phase>integration-test</phase>
+                        <goals>
+                            <goal>verify</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <redirectTestOutputToFile>true</redirectTestOutputToFile>
+                    <systemProperties>
+                        <property>
+                            <name>bundle.filename</name>
+                            <value>MUST_BE_SET_BY_EXEC_PLUGIN</value>
+                        </property>
+                    </systemProperties>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/src/ext-it/src/test/java/org/apache/sling/servlets/resolver/external/it/TestSetupTest.java b/src/ext-it/src/test/java/org/apache/sling/servlets/resolver/external/it/TestSetupTest.java
new file mode 100644
index 0000000..ee698c2
--- /dev/null
+++ b/src/ext-it/src/test/java/org/apache/sling/servlets/resolver/external/it/TestSetupTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+package org.apache.sling.servlets.resolver.external.it;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.regex.Pattern;
+
+import org.junit.Test;
+
+/** The idea is to run tests here which are independent from the existing
+ *  test setup of the resourceresolver module. More recent dependencies,
+ *  latest version of the pax exam tools, etc, while making as few changes
+ *  as possible to the original module.
+ */
+public class TestSetupTest {
+    @Test
+    public void testTheTestSetup() {
+        // We'll need the filename of the bundle to test
+        final String filename = System.getProperty("bundle.filename");
+        final Pattern regexp = Pattern.compile(".*org.apache.sling.servlets.resolver.*jar");
+        assertTrue("Expecting " + filename + " to match " + regexp, regexp.matcher(filename).matches());
+    }
+}
\ No newline at end of file