This is an automated email from the ASF dual-hosted git repository. sseifert pushed a commit to branch feature/SLING-13050-integration-tests-single-pom in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-models-impl.git
commit d4f3dbf5a11125828ab61b28a538e8bf2f653a85 Author: Stefan Seifert <[email protected]> AuthorDate: Fri Jan 23 11:21:37 2026 +0100 SLING-13050 add sling launcher --- pom.xml | 192 ++++++++++++++++++++++++++++++++ src/test/features/launcher-repoinit.txt | 23 ++++ src/test/features/launcher.json | 30 +++++ 3 files changed, 245 insertions(+) diff --git a/pom.xml b/pom.xml index e5d0f43..1f93553 100644 --- a/pom.xml +++ b/pom.xml @@ -41,6 +41,11 @@ <project.build.outputTimestamp>2025-08-27T03:14:05Z</project.build.outputTimestamp> <sling.java.version>17</sling.java.version> <models.api.version>2.0.0</models.api.version> + <!-- integration tests --> + <sling.starter.version>14-SNAPSHOT</sling.starter.version> + <starter.min.bundles.count>200</starter.min.bundles.count> + <it.startTimeoutSeconds>60</it.startTimeoutSeconds> + <it.models.log.level>info</it.models.log.level> </properties> <dependencies> @@ -242,9 +247,54 @@ <version>1.9.4</version> <scope>test</scope> </dependency> + <!-- Integration test dependencies --> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.junit.core</artifactId> + <version>1.2.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.testing.rules</artifactId> + <version>2.0.2</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.testing.clients</artifactId> + <version>3.1.0</version> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.junit.teleporter</artifactId> + <version>1.1.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.commons.johnzon</artifactId> + <version>2.0.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.engine</artifactId> + <version>3.0.0</version> + <scope>test</scope> + </dependency> </dependencies> + <build> <plugins> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> @@ -261,6 +311,7 @@ </dependency> </dependencies> </plugin> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> @@ -296,6 +347,7 @@ </execution> </executions> </plugin> + <plugin> <groupId>org.apache.rat</groupId> <artifactId>apache-rat-plugin</artifactId> @@ -306,6 +358,7 @@ </excludes> </configuration> </plugin> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> @@ -313,6 +366,145 @@ <attach>false</attach> </configuration> </plugin> + + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <id>reserve-network-port</id> + <goals> + <goal>reserve-network-port</goal> + </goals> + <phase>initialize</phase> + <configuration> + <portNames> + <portName>http.port</portName> + </portNames> + </configuration> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.apache.sling</groupId> + <artifactId>slingfeature-maven-plugin</artifactId> + <version>1.9.2</version> + <extensions>true</extensions> + + <configuration> + <replacePropertyVariables>models.api.version,it.models.log.level</replacePropertyVariables> + <skipAddFeatureDependencies>true</skipAddFeatureDependencies> + <aggregates> + <aggregate> + <classifier>it-app</classifier> + <filesInclude>*.json</filesInclude> + <variablesOverrides> + <http.port>${http.port}</http.port> + </variablesOverrides> + <artifactsOverrides> + <artifactsOverride>org.apache.sling:org.apache.sling.models.api:HIGHEST</artifactsOverride> + <artifactsOverride>org.apache.sling:org.apache.sling.models.impl:HIGHEST</artifactsOverride> + </artifactsOverrides> + <includeArtifact> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.starter</artifactId> + <classifier>nosample_base</classifier> + <version>${sling.starter.version}</version> + <type>slingosgifeature</type> + </includeArtifact> + <includeArtifact> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.starter</artifactId> + <classifier>oak_persistence_sns</classifier> + <version>${sling.starter.version}</version> + <type>slingosgifeature</type> + </includeArtifact> + <includeArtifact> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.starter</artifactId> + <classifier>junit</classifier> + <version>${sling.starter.version}</version> + <type>slingosgifeature</type> + </includeArtifact> + </aggregate> + </aggregates> + <scans> + <scan> + <includeClassifier>it-app</includeClassifier> + </scan> + </scans> + </configuration> + <executions> + <execution> + <id>prepare-features</id> + <goals> + <goal>aggregate-features</goal> + <goal>analyse-features</goal> + <goal>attach-features</goal> + </goals> + <phase>prepare-package</phase> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.apache.sling</groupId> + <artifactId>feature-launcher-maven-plugin</artifactId> + <version>1.0.2</version> + <configuration> + <launches> + <launch> + <id>sling-starter-oak-tar</id> + <feature> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.models.impl</artifactId> + <version>${project.version}</version> + <classifier>it-app</classifier> + <type>slingosgifeature</type> + </feature> + <launcherArguments> + <vmOptions> + <value>--add-opens java.base/java.lang=ALL-UNNAMED</value> + </vmOptions> + <frameworkProperties> + <org.osgi.service.http.port>${http.port}</org.osgi.service.http.port> + <org.apache.felix.http.jetty.responseBufferSize>5000000</org.apache.felix.http.jetty.responseBufferSize> + </frameworkProperties> + </launcherArguments> + <startTimeoutSeconds>${it.startTimeoutSeconds}</startTimeoutSeconds> + </launch> + </launches> + </configuration> + <executions> + <execution> + <id>launcher-start</id> + <goals> + <goal>start</goal> + <goal>stop</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> </build> + + <profiles> + <!-- + Debugging profile: + - Run on port 8080 (not random port) + - Waits for user input after tests are completed to allow inspection before shutting down the Sling instance + - Sets log level for Sling Models to DEBUG + --> + <profile> + <id>it-debug</id> + <properties> + <http.port>8080</http.port> + <feature-launcher.waitForInput>true</feature-launcher.waitForInput> + <it.models.log.level>debug</it.models.log.level> + </properties> + </profile> + </profiles> + </project> diff --git a/src/test/features/launcher-repoinit.txt b/src/test/features/launcher-repoinit.txt new file mode 100644 index 0000000..7d36118 --- /dev/null +++ b/src/test/features/launcher-repoinit.txt @@ -0,0 +1,23 @@ +# +# 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 models-it +set ACL for models-it + allow jcr:all on / +end \ No newline at end of file diff --git a/src/test/features/launcher.json b/src/test/features/launcher.json new file mode 100644 index 0000000..291d66e --- /dev/null +++ b/src/test/features/launcher.json @@ -0,0 +1,30 @@ +{ + "bundles": [ + { + "id": "org.apache.sling/org.apache.sling.models.api/${models.api.version}", + "start-order": 20 + }, + { + "id": "org.apache.sling/org.apache.sling.models.impl/${project.version}", + "start-order": 20 + }, + { + "id": "org.apache.sling/org.apache.sling.models.impl.it.test-models/${project.version}", + "start-order": 20 + } + ], + "configurations": { + "org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended~integration-tests": { + "user.mapping": [ + "org.apache.sling.junit.core=models-it" + ] + }, + "org.apache.sling.commons.log.LogManager.factory.config~integration-tests": { + "org.apache.sling.commons.log.names": [ + "org.apache.sling.models" + ], + "org.apache.sling.commons.log.level": "${it.models.log.level}" + } + }, + "repoinit:TEXT|true": "@file" +} \ No newline at end of file
