You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2021/06/05 20:14:40 UTC

[cxf] 01/03: Fixing NoAriesBlueprintTest for JDK16+ (fails with unknown protocol: http/https)

This is an automated email from the ASF dual-hosted git repository.

reta pushed a commit to branch 3.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 025d8bdb47aa3127cd975be5eb91fcaa20f39d2c
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Thu Jun 3 20:12:48 2021 -0400

    Fixing NoAriesBlueprintTest for JDK16+ (fails with unknown protocol: http/https)
    
    (cherry picked from commit e47b201c3032f64082e9173c0f02d54698388c06)
---
 osgi/itests-felix/pom.xml                               |  9 ++++++---
 .../apache/cxf/osgi/itests/NoAriesBlueprintTest.java    | 17 +++++++++++++++--
 parent/pom.xml                                          |  2 +-
 3 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/osgi/itests-felix/pom.xml b/osgi/itests-felix/pom.xml
index e31e248..c850238 100644
--- a/osgi/itests-felix/pom.xml
+++ b/osgi/itests-felix/pom.xml
@@ -108,10 +108,9 @@
         <dependency>
             <groupId>org.ops4j.pax.url</groupId>
             <artifactId>pax-url-aether</artifactId>
-            <version>2.6.2</version>
+            <version>2.6.7</version>
             <scope>test</scope>
         </dependency>
-       
         <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.framework</artifactId>
@@ -142,7 +141,11 @@
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
-
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
diff --git a/osgi/itests-felix/src/test/java/org/apache/cxf/osgi/itests/NoAriesBlueprintTest.java b/osgi/itests-felix/src/test/java/org/apache/cxf/osgi/itests/NoAriesBlueprintTest.java
index e6f0d34..d5a0ce1 100644
--- a/osgi/itests-felix/src/test/java/org/apache/cxf/osgi/itests/NoAriesBlueprintTest.java
+++ b/osgi/itests-felix/src/test/java/org/apache/cxf/osgi/itests/NoAriesBlueprintTest.java
@@ -18,8 +18,14 @@
  */
 package org.apache.cxf.osgi.itests;
 
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+
+import javax.crypto.NoSuchPaddingException;
+import javax.net.ssl.SSLContext;
 
 import org.apache.cxf.helpers.JavaUtils;
+import org.apache.http.ssl.SSLContextBuilder;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -30,13 +36,15 @@ import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
 import static org.ops4j.pax.exam.CoreOptions.junitBundles;
 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
 import static org.ops4j.pax.exam.CoreOptions.systemPackages;
 import static org.ops4j.pax.exam.CoreOptions.systemProperty;
 import static org.ops4j.pax.exam.CoreOptions.when;
 
-
 @RunWith(PaxExam.class)
 @ExamReactorStrategy(PerClass.class)
 public class NoAriesBlueprintTest extends OSGiTestSupport {
@@ -53,13 +61,14 @@ public class NoAriesBlueprintTest extends OSGiTestSupport {
     }
 
     @Configuration
-    public Option[] config() {
+    public Option[] config() throws NoSuchAlgorithmException, NoSuchPaddingException, KeyManagementException {
         String localRepo = System.getProperty("localRepository");
         if (localRepo == null) {
             localRepo = "";
         }
 
         final Option[] basicOptions = new Option[] {
+            junitBundles(),
             systemProperty("java.awt.headless").value("true"),
             when(!"".equals(localRepo))
                 .useOptions(systemProperty("org.ops4j.pax.url.mvn.localRepository").value(localRepo)),
@@ -82,6 +91,10 @@ public class NoAriesBlueprintTest extends OSGiTestSupport {
             )
         };
         if (JavaUtils.isJava9Compatible()) {
+            // Pre-create SSL context (on JDK16+, the HTTP/HTTPS URL handlers are not registered for some reason)
+            final SSLContext sslContext = new SSLContextBuilder().setProtocol("TLS").build();
+            assertThat(sslContext, not(nullValue()));
+
             return OptionUtils.combine(basicOptions,
                 mavenBundle("jakarta.annotation", "jakarta.annotation-api").versionAsInProject(),
                 mavenBundle("com.sun.activation", "jakarta.activation").versionAsInProject(),
diff --git a/parent/pom.xml b/parent/pom.xml
index baa7254..8422043 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -181,7 +181,7 @@
         <cxf.persistence-api.version>2.2.3</cxf.persistence-api.version>
         <cxf.plexus-archiver.version>4.2.0</cxf.plexus-archiver.version>
         <cxf.plexus-utils.version>3.2.0</cxf.plexus-utils.version>
-        <cxf.powermock.version>2.0.4</cxf.powermock.version>
+        <cxf.powermock.version>2.0.9</cxf.powermock.version>
         <cxf.reactivestreams.version>1.0.3</cxf.reactivestreams.version>
         <cxf.reactor.version>3.3.17.RELEASE</cxf.reactor.version>
         <cxf.rhino.version>1.7R2</cxf.rhino.version>