You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cr...@apache.org on 2020/11/24 22:52:08 UTC
[sling-org-apache-sling-junit-core] 01/01: WIP: Started integration
tests for @TestReference. Not working.
This is an automated email from the ASF dual-hosted git repository.
cris 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
commit b6de942fccb17f99fd44077c693afe55a2bcdfab
Author: Cris Rockwell <cm...@umich.edu>
AuthorDate: Tue Nov 24 17:51:35 2020 -0500
WIP: Started integration tests for @TestReference. Not working.
---
pom.xml | 60 +++++++
src/it/annotations-it/README.md | 2 +
src/it/annotations-it/bnd.bnd | 4 +
src/it/annotations-it/invoker.properties | 17 ++
src/it/annotations-it/pom.xml | 185 +++++++++++++++++++++
.../org/apache/sling/junit/tests/MyServiceIT.java | 25 +++
.../tests/impl/MyCoolServiceForTestingIT.java | 42 +++++
.../tests/impl/MyLameServiceForTestingIT.java | 41 +++++
.../sling/junit/annotations/TestReferenceIT.java | 138 +++++++++++++++
.../annotations-it/src/test/resources/logback.xml | 30 ++++
.../annotations/SlingAnnotationsTestRunner.java | 2 -
.../sling/junit/impl/AnnotationsProcessor.java | 3 +-
12 files changed, 546 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
index 0ea7095..eddff30 100644
--- a/pom.xml
+++ b/pom.xml
@@ -56,7 +56,67 @@
<excludePackageNames>org.apache.sling.junit.impl;org.apache.sling.junit.impl.*</excludePackageNames>
</configuration>
</plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>3.2.1</version>
+ <configuration>
+ <debug>false</debug>
+ <projectsDirectory>src/it</projectsDirectory>
+ <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+ <pomIncludes>
+ <pomInclude>*/pom.xml</pomInclude>
+ </pomIncludes>
+ <postBuildHookScript>verify</postBuildHookScript>
+ <localRepositoryPath>${project.build.directory}/it-repo</localRepositoryPath>
+<!-- <settingsFile>src/it/settings.xml</settingsFile>-->
+ <!-- this causes verbose output, probably good to have for CI builds? -->
+ <streamLogs>true</streamLogs>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy</artifactId>
+ <version>3.0.6</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>install</goal>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>src/it/annotations-it/target/**</exclude>
+ <exclude>src/it/annotations-it/README.md</exclude>
+ <exclude>src/it/annotations-it/bnd.bnd</exclude>
+ <exclude>src/it/annotations-it/build.log</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>src/it/annotations-it/target</directory>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+
</plugins>
+
<pluginManagement>
<plugins>
<plugin>
diff --git a/src/it/annotations-it/README.md b/src/it/annotations-it/README.md
new file mode 100644
index 0000000..f1a8191
--- /dev/null
+++ b/src/it/annotations-it/README.md
@@ -0,0 +1,2 @@
+Integration tests for the server testing annotation @TestReference
+
diff --git a/src/it/annotations-it/bnd.bnd b/src/it/annotations-it/bnd.bnd
new file mode 100644
index 0000000..f98c8cd
--- /dev/null
+++ b/src/it/annotations-it/bnd.bnd
@@ -0,0 +1,4 @@
+# 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
diff --git a/src/it/annotations-it/invoker.properties b/src/it/annotations-it/invoker.properties
new file mode 100644
index 0000000..b9bcb58
--- /dev/null
+++ b/src/it/annotations-it/invoker.properties
@@ -0,0 +1,17 @@
+# 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.
+
+invoker.goals = clean verify -Dannotations.bundle.version=${project.version} -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN
+invoker.debug = false
\ No newline at end of file
diff --git a/src/it/annotations-it/pom.xml b/src/it/annotations-it/pom.xml
new file mode 100644
index 0000000..094125d
--- /dev/null
+++ b/src/it/annotations-it/pom.xml
@@ -0,0 +1,185 @@
+<?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. -->
+<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>40</version>
+ <relativePath/>
+ </parent>
+
+ <artifactId>org.apache.sling.junit.annotations.it</artifactId>
+ <version>1.0.0</version>
+ <name>Apache Sling Junit Server Annotations IT</name>
+ <description>
+ Integration tests for the server testing annotation @TestReference
+ </description>
+
+
+ <properties>
+ <sling.java.version>8</sling.java.version>
+ <org.ops4j.pax.exam.version>4.13.4</org.ops4j.pax.exam.version>
+ <!-- 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>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>biz.aQute.bnd</groupId>
+ <artifactId>bnd-maven-plugin</artifactId>
+ <version>5.0.0</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>3.0.0-M5</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <systemPropertyVariables>
+<!-- ${bundle.filename}-->
+ <bundle.filename>hello</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>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>build.log</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <!-- dependency under test -->
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.junit.core</artifactId>
+ <version>${annotations.bundle.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+
+
+ <!-- testing dependencies -->
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.servlets.resolver</artifactId>
+ <version>2.5.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.testing.clients</artifactId>
+ <version>2.0.8</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.testing.rules</artifactId>
+ <version>1.0.8</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>osgi.core</artifactId>
+ <version>6.0.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.framework</artifactId>
+ <version>6.0.3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.testing.paxexam</artifactId>
+ <version>3.1.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam</artifactId>
+ <version>${org.ops4j.pax.exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-cm</artifactId>
+ <version>${org.ops4j.pax.exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-container-forked</artifactId>
+ <version>${org.ops4j.pax.exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-junit4</artifactId>
+ <version>${org.ops4j.pax.exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam-link-mvn</artifactId>
+ <version>${org.ops4j.pax.exam.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.url</groupId>
+ <artifactId>pax-url-wrap</artifactId>
+ <version>2.3.0</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+</project>
\ No newline at end of file
diff --git a/src/it/annotations-it/src/main/java/org/apache/sling/junit/tests/MyServiceIT.java b/src/it/annotations-it/src/main/java/org/apache/sling/junit/tests/MyServiceIT.java
new file mode 100644
index 0000000..f00c485
--- /dev/null
+++ b/src/it/annotations-it/src/main/java/org/apache/sling/junit/tests/MyServiceIT.java
@@ -0,0 +1,25 @@
+/*
+ * 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.junit.tests;
+
+public interface MyServiceIT {
+ /** @return Name of the Service which is used to discover the Service by the User **/
+ String getName();
+
+ /** @return Description of the Service **/
+ String getDescription();
+}
diff --git a/src/it/annotations-it/src/main/java/org/apache/sling/junit/tests/impl/MyCoolServiceForTestingIT.java b/src/it/annotations-it/src/main/java/org/apache/sling/junit/tests/impl/MyCoolServiceForTestingIT.java
new file mode 100644
index 0000000..df60b4d
--- /dev/null
+++ b/src/it/annotations-it/src/main/java/org/apache/sling/junit/tests/impl/MyCoolServiceForTestingIT.java
@@ -0,0 +1,42 @@
+/*
+ * 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.junit.tests.impl;
+
+import org.apache.sling.junit.tests.MyServiceIT;
+import org.osgi.service.component.annotations.Component;
+
+@Component(
+ service = MyServiceIT.class
+)
+public class MyCoolServiceForTestingIT implements MyServiceIT {
+
+ /**
+ * @return Name of the Service which is used to discover the Service by the User
+ **/
+ @Override
+ public String getName() {
+ return "Cool Service";
+ }
+
+ /**
+ * @return Description of the Service
+ **/
+ @Override
+ public String getDescription() {
+ return "My Cool Service is for testing @TestReference for in running JUnit tests within Sling";
+ }
+}
diff --git a/src/it/annotations-it/src/main/java/org/apache/sling/junit/tests/impl/MyLameServiceForTestingIT.java b/src/it/annotations-it/src/main/java/org/apache/sling/junit/tests/impl/MyLameServiceForTestingIT.java
new file mode 100644
index 0000000..8c61695
--- /dev/null
+++ b/src/it/annotations-it/src/main/java/org/apache/sling/junit/tests/impl/MyLameServiceForTestingIT.java
@@ -0,0 +1,41 @@
+/*
+ * 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.junit.tests.impl;
+
+import org.apache.sling.junit.tests.MyServiceIT;
+import org.osgi.service.component.annotations.Component;
+
+@Component(
+ service = MyServiceIT.class
+)
+public class MyLameServiceForTestingIT implements MyServiceIT {
+ /**
+ * @return Name of the Service which is used to discover the Service by the User
+ **/
+ @Override
+ public String getName() {
+ return "Lame Service";
+ }
+
+ /**
+ * @return Description of the Service
+ **/
+ @Override
+ public String getDescription() {
+ return "My Lame Service is for testing @TestReference for in running JUnit tests within Sling";
+ }
+}
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/TestReferenceIT.java
new file mode 100644
index 0000000..5e79800
--- /dev/null
+++ b/src/it/annotations-it/src/test/java/org/apache/sling/junit/annotations/TestReferenceIT.java
@@ -0,0 +1,138 @@
+/*
+ * 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.junit.annotations;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.sling.junit.tests.MyServiceIT;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.apache.sling.testing.clients.osgi.OsgiConsoleClient;
+
+import java.net.ServerSocket;
+import java.net.URI;
+
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExamServer;
+import org.ops4j.pax.exam.options.extra.VMOption;
+
+import static junit.framework.TestCase.assertTrue;
+import static org.apache.sling.testing.paxexam.SlingOptions.logback;
+import static org.apache.sling.testing.paxexam.SlingOptions.slingQuickstartOakTar;
+import static org.ops4j.pax.exam.CoreOptions.composite;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+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 {
+ protected static int httpPort;
+ protected static OsgiConsoleClient CLIENT;
+ private final static int STARTUP_WAIT_SECONDS = 30;
+
+ @ClassRule
+ public static PaxExamServer serverRule = new PaxExamServer() {
+ @Override
+ protected void before() throws Exception {
+ // Use a different port for each OSGi framework instance
+ // that's started - they can overlap if the previous one
+ // is not fully stopped when the next one starts.
+ setHttpPort();
+ super.before();
+ }
+ };
+
+ @Configuration
+ public Option[] configuration() throws Exception {
+
+ final String vmOpt = System.getProperty("pax.vm.options");
+ VMOption vmOption = null;
+ if (StringUtils.isNotEmpty(vmOpt)) {
+ vmOption = new VMOption(vmOpt);
+ }
+
+ final String jacocoOpt = System.getProperty("jacoco.command");
+ VMOption jacocoCommand = null;
+ if (StringUtils.isNotEmpty(jacocoOpt)) {
+ jacocoCommand = new VMOption(jacocoOpt);
+ }
+
+ 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
+ //super.baseConfiguration(),
+
+ when(vmOption != null).useOptions(vmOption),
+ when(jacocoCommand != null).useOptions(jacocoCommand),
+
+ // For some reason, Jetty starts first on port 8080 without this
+ systemProperty("org.osgi.service.http.port").value(String.valueOf(httpPort)),
+
+ slingQuickstartOakTar(workingDirectory, httpPort),
+ testBundle("bundle.filename"),
+
+ logback(),
+ mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.log").version("1.2.4"),
+ mavenBundle().groupId("log4j").artifactId("log4j").version("1.2.17"),
+ mavenBundle().groupId("org.apache.aries.spifly").artifactId("org.apache.aries.spifly.dynamic.framework.extension").version("1.3.2"),
+ mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.webconsole.plugins.ds").version("2.1.0")
+
+ ).getOptions();
+ }
+
+ @BeforeClass
+ public static void waitForSling() throws Exception {
+ final URI url = new URI(String.format("http://localhost:%d", httpPort));
+ CLIENT = new OsgiConsoleClient(url, "admin", "admin");
+
+ CLIENT.waitExists("/", STARTUP_WAIT_SECONDS * 1000, 500);
+ CLIENT.waitComponentRegistered(MyServiceIT.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);
+ Thread.sleep(100);
+ }
+ }
+
+ static void setHttpPort() {
+ try {
+ final ServerSocket serverSocket = new ServerSocket(0);
+ httpPort = serverSocket.getLocalPort();
+ serverSocket.close();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Test
+ public void basicTest() {
+ assertTrue(true);
+ }
+}
diff --git a/src/it/annotations-it/src/test/resources/logback.xml b/src/it/annotations-it/src/test/resources/logback.xml
new file mode 100644
index 0000000..b8b7262
--- /dev/null
+++ b/src/it/annotations-it/src/test/resources/logback.xml
@@ -0,0 +1,30 @@
+<?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.
+-->
+<configuration>
+ <appender name="file" class="ch.qos.logback.core.FileAppender">
+ <file>target/test.log</file>
+ <append>true</append>
+ <encoder>
+ <pattern>%date level=%level thread=%thread logger=%logger sourcefile=%file line=%line %mdc message=%msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <root level="info">
+ <appender-ref ref="file"/>
+ </root>
+</configuration>
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/junit/annotations/SlingAnnotationsTestRunner.java b/src/main/java/org/apache/sling/junit/annotations/SlingAnnotationsTestRunner.java
index 585b579..5f708cf 100644
--- a/src/main/java/org/apache/sling/junit/annotations/SlingAnnotationsTestRunner.java
+++ b/src/main/java/org/apache/sling/junit/annotations/SlingAnnotationsTestRunner.java
@@ -62,8 +62,6 @@ public class SlingAnnotationsTestRunner extends BlockJUnit4ClassRunner {
public void run(RunNotifier notifier){
try {
super.run(notifier);
- } catch (Exception e) {
- log.error("Test 'run' method", e);
} finally {
AnnotationsProcessor ap = (AnnotationsProcessor) top;
ap.closeAllServices();
diff --git a/src/main/java/org/apache/sling/junit/impl/AnnotationsProcessor.java b/src/main/java/org/apache/sling/junit/impl/AnnotationsProcessor.java
index 68ca2bf..b30c9dd 100644
--- a/src/main/java/org/apache/sling/junit/impl/AnnotationsProcessor.java
+++ b/src/main/java/org/apache/sling/junit/impl/AnnotationsProcessor.java
@@ -19,6 +19,7 @@ package org.apache.sling.junit.impl;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.util.ArrayList;
+import java.util.List;
import java.util.Objects;
import org.apache.sling.junit.TestObjectProcessor;
@@ -34,7 +35,7 @@ import org.slf4j.LoggerFactory;
public class AnnotationsProcessor implements TestObjectProcessor {
private Logger log = LoggerFactory.getLogger(getClass());
private BundleContext bundleContext;
- private ArrayList<ServiceGetter<? extends Object>> serviceGetters;
+ private List<ServiceGetter<? extends Object>> serviceGetters;
protected void activate(ComponentContext ctx) {
bundleContext = ctx.getBundleContext();