You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2015/08/26 15:02:41 UTC
svn commit: r1697921 - in /httpcomponents/httpcore/branches/4.4.x:
httpcore-osgi/ httpcore-osgi/src/test/java/org/apache/http/osgi/
httpcore-osgi/src/test/resources/ httpcore/
Author: olegk
Date: Wed Aug 26 13:02:40 2015
New Revision: 1697921
URL: http://svn.apache.org/r1697921
Log:
HTTPCORE-406: PAX-EXAM tests with an embedded HTTP server
Contributed by Benson Margulies <benson at basistech.com>
Added:
httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/src/test/java/org/apache/http/osgi/ActuallyConnectIT.java (with props)
httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/src/test/resources/
httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/src/test/resources/logback.xml (with props)
Removed:
httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/src/test/java/org/apache/http/osgi/BasicIT.java
Modified:
httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/pom.xml
httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/src/test/java/org/apache/http/osgi/Common.java
httpcomponents/httpcore/branches/4.4.x/httpcore/pom.xml
Modified: httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/pom.xml
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/pom.xml?rev=1697921&r1=1697920&r2=1697921&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/pom.xml (original)
+++ httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/pom.xml Wed Aug 26 13:02:40 2015
@@ -42,6 +42,7 @@
<pax.url.version>2.0.0</pax.url.version>
<pax.exam.version>3.5.0</pax.exam.version>
<slf4j.version>1.5.4</slf4j.version>
+ <logback.version>1.0.1</logback.version>
</properties>
<dependencies>
<dependency>
@@ -65,6 +66,12 @@
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-native</artifactId>
<version>${pax.exam.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId> org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </exclusion>
+ </exclusions>
<scope>test</scope>
</dependency>
<dependency>
@@ -86,25 +93,39 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.ops4j.pax.url</groupId>
+ <artifactId>pax-url-wrap</artifactId>
+ <version>${pax.url.version}</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId> org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
+ <version>1.6.4</version>
<scope>test</scope>
- <version>${slf4j.version}</version>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>${logback.version}</version>
<scope>test</scope>
- <version>${slf4j.version}</version>
</dependency>
<dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-core</artifactId>
+ <version>${logback.version}</version>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.framework</artifactId>
+ <version>4.2.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Added: httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/src/test/java/org/apache/http/osgi/ActuallyConnectIT.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/src/test/java/org/apache/http/osgi/ActuallyConnectIT.java?rev=1697921&view=auto
==============================================================================
--- httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/src/test/java/org/apache/http/osgi/ActuallyConnectIT.java (added)
+++ httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/src/test/java/org/apache/http/osgi/ActuallyConnectIT.java Wed Aug 26 13:02:40 2015
@@ -0,0 +1,49 @@
+/*
+ * ====================================================================
+ * 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.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.osgi;
+
+import org.apache.http.integration.TestSyncHttp;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+
+/**
+ * Use the test methods from TestSyncHttp.
+ */
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class ActuallyConnectIT extends TestSyncHttp {
+
+ @Configuration
+ public static Option[] options() {
+ return Common.config();
+ }
+}
Propchange: httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/src/test/java/org/apache/http/osgi/ActuallyConnectIT.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/src/test/java/org/apache/http/osgi/ActuallyConnectIT.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/src/test/java/org/apache/http/osgi/ActuallyConnectIT.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/src/test/java/org/apache/http/osgi/Common.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/src/test/java/org/apache/http/osgi/Common.java?rev=1697921&r1=1697920&r2=1697921&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/src/test/java/org/apache/http/osgi/Common.java (original)
+++ httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/src/test/java/org/apache/http/osgi/Common.java Wed Aug 26 13:02:40 2015
@@ -27,8 +27,13 @@
package org.apache.http.osgi;
+import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.ops4j.pax.exam.util.PathUtils;
import java.io.IOException;
import java.net.URL;
@@ -38,17 +43,18 @@ import static org.ops4j.pax.exam.CoreOpt
import static org.ops4j.pax.exam.CoreOptions.junitBundles;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.systemPackages;
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
import static org.ops4j.pax.exam.CoreOptions.wrappedBundle;
/**
* Test inherit from this.
*/
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
public class Common {
public static String getDependencyVersion(final String groupId, final String artifactId) {
- final URL depPropsUrl = BasicIT.class.getResource("META-INF/maven/dependencies.properties");
+ final URL depPropsUrl = Common.class.getResource("/META-INF/maven/dependencies.properties");
final Properties depProps = new Properties();
try {
depProps.load(depPropsUrl.openStream());
@@ -65,26 +71,36 @@ public class Common {
@Configuration
- public Option[] config() {
+ public static Option[] config() {
final String projectVersion = System.getProperty("project.version");
final String buildDir = System.getProperty("project.build.directory", "target");
final String paxLoggingLevel = System.getProperty("bt.osgi.pax.logging.level", "WARN");
return options(
- bundle(String.format("%s/org.apache.httpcomponents.httpcore_%s",
+ bundle(String.format("file:%s/org.apache.httpcomponents.httpcore_%s.jar",
buildDir,
projectVersion)),
wrappedBundle(mavenBundle().groupId("org.apache.httpcomponents")
- .artifactId("httpcore")
- .version(projectVersion)
- .type("test-jar")),
- mavenBundle("org.mockito", "mockito-core", getDependencyVersion("org.mockito", "mockito-core")),
- systemPackages(
- String.format("org.slf4j;version=\"%s\"", getDependencyVersion("org.slf4j", "slf4j-api"))
- ),
+ .artifactId("httpcore")
+ .version(projectVersion)
+ .classifier("tests"))
+ .exports("org.apache.http.integration")
+ .imports("org.apache.http.protocol",
+ "org.apache.http",
+ "org.apache.http.config",
+ "org.apache.http.entity",
+ "org.apache.http.impl",
+ "org.apache.http.impl.bootstrap",
+ "org.apache.http.util",
+ "org.apache.http.message",
+ "org.apache.commons.logging; provider=paxlogging",
+ "org.junit"),
junitBundles(),
systemProperty("pax.exam.osgi.unresolved.fail").value("true"),
- systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value(paxLoggingLevel)
+ systemProperty("pax.exam.logging").value("none"),
+ systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value(paxLoggingLevel),
+ systemProperty("logback.configurationFile")
+ .value("file:" + PathUtils.getBaseDir() + "/src/test/resources/logback.xml")
);
}
}
Added: httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/src/test/resources/logback.xml
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/src/test/resources/logback.xml?rev=1697921&view=auto
==============================================================================
--- httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/src/test/resources/logback.xml (added)
+++ httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/src/test/resources/logback.xml Wed Aug 26 13:02:40 2015
@@ -0,0 +1,36 @@
+<?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.
+ ====================================================================
+
+ This software consists of voluntary contributions made by many
+ individuals on behalf of the Apache Software Foundation. For more
+ information on the Apache Software Foundation, please see
+ <http://www.apache.org />.
+ -->
+<configuration>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{5} - %msg%n</pattern>
+ </encoder>
+ </appender>
+ <root level="INFO">
+ <appender-ref ref="STDOUT" />
+ </root>
+</configuration>
Propchange: httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/src/test/resources/logback.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/src/test/resources/logback.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/branches/4.4.x/httpcore-osgi/src/test/resources/logback.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: httpcomponents/httpcore/branches/4.4.x/httpcore/pom.xml
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/httpcore/pom.xml?rev=1697921&r1=1697920&r2=1697921&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.4.x/httpcore/pom.xml (original)
+++ httpcomponents/httpcore/branches/4.4.x/httpcore/pom.xml Wed Aug 26 13:02:40 2015
@@ -60,6 +60,25 @@
<build>
<plugins>
<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.8</version>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>src/main/java-deprecated</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<executions>
@@ -100,27 +119,6 @@
</includes>
</resource>
</resources>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.8</version>
- <executions>
- <execution>
- <id>add-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>src/main/java-deprecated</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
</build>
<reporting>