You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Oliver Lietz <ap...@oliverlietz.de> on 2018/05/14 18:34:09 UTC
Re: [sling-org-apache-sling-commons-html] branch master updated: Activate testing.log for Pax tests
On Wednesday 09 May 2018 09:40:28 bdelacretaz@apache.org wrote:
> This is an automated email from the ASF dual-hosted git repository.
>
> bdelacretaz pushed a commit to branch master
> in repository
> https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-html.git
>
>
> The following commit(s) were added to refs/heads/master by this push:
> new e9ffa3b Activate testing.log for Pax tests
> e9ffa3b is described below
>
> commit e9ffa3b09a170492258a8513ac0caaac8432caba
> Author: Bertrand Delacretaz <bd...@apache.org>
> AuthorDate: Wed May 9 11:40:00 2018 +0200
>
> Activate testing.log for Pax tests
> ---
> .../sling/commons/html/it/HtmlTestSupport.java | 15 ++++++++++-
> src/test/resources/exam.properties | 19 ++++++++++++++
> src/test/resources/logback.xml | 30
> ++++++++++++++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-)
>
> diff --git
> a/src/test/java/org/apache/sling/commons/html/it/HtmlTestSupport.java
> b/src/test/java/org/apache/sling/commons/html/it/HtmlTestSupport.java index
> 767848f..b1d5b51 100644
> --- a/src/test/java/org/apache/sling/commons/html/it/HtmlTestSupport.java
> +++ b/src/test/java/org/apache/sling/commons/html/it/HtmlTestSupport.java
> @@ -26,6 +26,8 @@ import static
> org.apache.sling.testing.paxexam.SlingVersionResolver.SLING_GROUP_ 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.systemProperty;
> +import org.ops4j.pax.exam.util.PathUtils;
>
> public abstract class HtmlTestSupport extends TestSupport {
>
> @@ -39,8 +41,19 @@ public abstract class HtmlTestSupport extends TestSupport
> { // testing
>
> mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apac
> he.servicemix.bundles.hamcrest").versionAsInProject(),
> mavenBundle().groupId("org.apache.commons").artifactId("commons-lang3").ver
> sionAsInProject(), - junitBundles()
> + junitBundles(),
> + logging()
> );
> }
>
> + protected Option logging() {
> + final String filename =
> String.format("file:%s/src/test/resources/logback.xml",
> PathUtils.getBaseDir()); + return composite(
> + systemProperty("logback.configurationFile").value(filename),
> +
> mavenBundle().groupId("org.slf4j").artifactId("slf4j-api").version("1.7.21"
> ), +
> mavenBundle().groupId("org.slf4j").artifactId("jcl-over-slf4j").version("1.
> 7.21"), +
> mavenBundle().groupId("ch.qos.logback").artifactId("logback-core").version(
> "1.1.7"), +
> mavenBundle().groupId("ch.qos.logback").artifactId("logback-classic").versi
> on("1.1.7") + );
> + }
> }
Usually the log output in target/failsafe-reports/*-output.txt is sufficient,
but in case you really want to tune output and use Logback there is
SlingOptions#logback().
Regards,
O.
> diff --git a/src/test/resources/exam.properties
> b/src/test/resources/exam.properties new file mode 100644
> index 0000000..c98a668
> --- /dev/null
> +++ b/src/test/resources/exam.properties
> @@ -0,0 +1,19 @@
> +#
> +# 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.
> +#
> +pax.exam.logging=none
> diff --git a/src/test/resources/logback.xml b/src/test/resources/logback.xml
> new file mode 100644
> index 0000000..d46a4ae
> --- /dev/null
> +++ b/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/testing.log</file>
> + <encoder>
> + <pattern>%date %level [%thread] %logger{10} [%file : %line]
> %msg%n</pattern> + </encoder>
> + </appender>
> + <root level="debug">
> + <appender-ref ref="file"/>
> + </root>
> +</configuration>