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 2020/11/25 09:53:12 UTC
[sling-org-apache-sling-junit-core] branch
SLING-9915-junit-annotation-int-tests updated: WIP: Fix integration tests
This is an automated email from the ASF dual-hosted git repository.
bdelacretaz pushed a commit to branch SLING-9915-junit-annotation-int-tests
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-junit-core.git
The following commit(s) were added to refs/heads/SLING-9915-junit-annotation-int-tests by this push:
new 99d8a32 WIP: Fix integration tests
99d8a32 is described below
commit 99d8a32ba22c754be67d4daa1f11870109de2d79
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Wed Nov 25 10:52:08 2020 +0100
WIP: Fix integration tests
---
pom.xml | 2 +-
src/it/annotations-it/README.md | 8 ++-
src/it/annotations-it/bnd.bnd | 5 +-
src/it/annotations-it/pom.xml | 17 +++----
.../{TestReferenceIT.java => ReferenceIT.java} | 22 +++-----
src/it/settings.xml | 59 ++++++++++++++++++++++
6 files changed, 83 insertions(+), 30 deletions(-)
diff --git a/pom.xml b/pom.xml
index eddff30..952f3f7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -70,7 +70,7 @@
</pomIncludes>
<postBuildHookScript>verify</postBuildHookScript>
<localRepositoryPath>${project.build.directory}/it-repo</localRepositoryPath>
-<!-- <settingsFile>src/it/settings.xml</settingsFile>-->
+ <settingsFile>src/it/settings.xml</settingsFile>
<!-- this causes verbose output, probably good to have for CI builds? -->
<streamLogs>true</streamLogs>
</configuration>
diff --git a/src/it/annotations-it/README.md b/src/it/annotations-it/README.md
index f1a8191..788e923 100644
--- a/src/it/annotations-it/README.md
+++ b/src/it/annotations-it/README.md
@@ -1,2 +1,8 @@
-Integration tests for the server testing annotation @TestReference
+Integration tests for the server testing annotation @TestReference
+
+To run or debug the tests from this folder, use:
+
+ mvn clean verify -Dannotations.bundle.version=VVV
+
+Where VVV is the version of the junit-core bundle to test.
diff --git a/src/it/annotations-it/bnd.bnd b/src/it/annotations-it/bnd.bnd
index f98c8cd..4958986 100644
--- a/src/it/annotations-it/bnd.bnd
+++ b/src/it/annotations-it/bnd.bnd
@@ -1,4 +1 @@
-# This simulates using the right version of the servlets resolver bundle,
-# for the SlingServletPathsStrict annotation
-Provide-Capability:\
- osgi.extender;osgi.extender="org.apache.sling.servlets.resolver";version:Version="1.1"
\ No newline at end of file
+# Nothing needed here so far for this bundle
\ No newline at end of file
diff --git a/src/it/annotations-it/pom.xml b/src/it/annotations-it/pom.xml
index 094125d..c469e87 100644
--- a/src/it/annotations-it/pom.xml
+++ b/src/it/annotations-it/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>40</version>
+ <version>33</version>
<relativePath/>
</parent>
@@ -34,8 +34,7 @@
<!-- additional options that can be passed to Pax before executing the tests -->
<pax.vm.options />
<bundle.filename>${basedir}/target/${project.build.finalName}.jar</bundle.filename>
-<!-- <annotations.bundle.version>MUST_BE_SET_BY_INVOKER</annotations.bundle.version>-->
- <annotations.bundle.version>1.1.1-SNAPSHOT</annotations.bundle.version>
+ <annotations.bundle.version>MUST_BE_SET_BY_INVOKER</annotations.bundle.version>
</properties>
<build>
@@ -59,16 +58,16 @@
</executions>
<configuration>
<systemPropertyVariables>
-<!-- ${bundle.filename}-->
- <bundle.filename>hello</bundle.filename>
+ <bundle.filename>${bundle.filename}</bundle.filename>
<pax.vm.options>${pax.vm.options}</pax.vm.options>
</systemPropertyVariables>
</configuration>
</plugin>
-<!-- <plugin>-->
-<!-- <groupId>org.apache.servicemix.tooling</groupId>-->
-<!-- <artifactId>depends-maven-plugin</artifactId>-->
-<!-- </plugin>-->
+ <plugin>
+ <!-- Needed for mavenBundle..versionAsInProject() -->
+ <groupId>org.apache.servicemix.tooling</groupId>
+ <artifactId>depends-maven-plugin</artifactId>
+ </plugin>
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
diff --git a/src/it/annotations-it/src/test/java/org/apache/sling/junit/annotations/TestReferenceIT.java b/src/it/annotations-it/src/test/java/org/apache/sling/junit/annotations/ReferenceIT.java
similarity index 86%
rename from src/it/annotations-it/src/test/java/org/apache/sling/junit/annotations/TestReferenceIT.java
rename to src/it/annotations-it/src/test/java/org/apache/sling/junit/annotations/ReferenceIT.java
index 5e79800..44a6cb2 100644
--- a/src/it/annotations-it/src/test/java/org/apache/sling/junit/annotations/TestReferenceIT.java
+++ b/src/it/annotations-it/src/test/java/org/apache/sling/junit/annotations/ReferenceIT.java
@@ -17,7 +17,7 @@
package org.apache.sling.junit.annotations;
import org.apache.commons.lang3.StringUtils;
-import org.apache.sling.junit.tests.MyServiceIT;
+import org.apache.sling.junit.tests.impl.MyLameServiceForTestingIT;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
@@ -40,7 +40,7 @@ import static org.ops4j.pax.exam.CoreOptions.systemProperty;
import static org.ops4j.pax.exam.CoreOptions.when;
import org.apache.sling.testing.paxexam.TestSupport;
-public class TestReferenceIT extends TestSupport {
+public class ReferenceIT extends TestSupport {
protected static int httpPort;
protected static OsgiConsoleClient CLIENT;
private final static int STARTUP_WAIT_SECONDS = 30;
@@ -74,18 +74,9 @@ public class TestReferenceIT extends TestSupport {
final String workingDirectory = workingDirectory();
- String filename = System.getProperty("bundle.filename");
- System.out.println("<<<<<<<<<<<<<<<<<<<<<<<");
- System.out.println("Bundle File");
- System.out.println(filename);
- System.out.println("jacoco");
- System.out.println(jacocoOpt);
- System.out.println("pax.vm.options");
- System.out.println(vmOpt);
- System.out.println("<<<<<<<<<<<<<<<<<<<<<<<");
return composite(
// TODO not sure why the below list of bundles is different from
- // running tests with PaxExam.class - but this setup works
+ // running tests with PaxExam.class (SLING-9929)
//super.baseConfiguration(),
when(vmOption != null).useOptions(vmOption),
@@ -112,11 +103,12 @@ public class TestReferenceIT extends TestSupport {
CLIENT = new OsgiConsoleClient(url, "admin", "admin");
CLIENT.waitExists("/", STARTUP_WAIT_SECONDS * 1000, 500);
- CLIENT.waitComponentRegistered(MyServiceIT.class.getName(), 10 * 1000, 500);
+
+ CLIENT.waitComponentRegistered(MyLameServiceForTestingIT.class.getName(), 10 * 1000, 500);
// Verify stable status for a bit
for(int i=0; i < 10 ; i++) {
- CLIENT.waitComponentRegistered(MyServiceIT.class.getName(), 1000, 100);
+ CLIENT.waitComponentRegistered(MyLameServiceForTestingIT.class.getName(), 1000, 100);
Thread.sleep(100);
}
}
@@ -135,4 +127,4 @@ public class TestReferenceIT extends TestSupport {
public void basicTest() {
assertTrue(true);
}
-}
+}
\ No newline at end of file
diff --git a/src/it/settings.xml b/src/it/settings.xml
new file mode 100644
index 0000000..3404fda
--- /dev/null
+++ b/src/it/settings.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<!--
+ As per https://maven.apache.org/plugins/maven-invoker-plugin/examples/fast-use.html
+ this lets invoked builds grab artifacts from the local repository instead of
+ downloading all of them.
+-->
+<settings>
+ <profiles>
+ <profile>
+ <id>it-repo</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <repositories>
+ <repository>
+ <id>local.central</id>
+ <url>@localRepositoryUrl@</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>local.central</id>
+ <url>@localRepositoryUrl@</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+ </profiles>
+</settings>
\ No newline at end of file