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 2022/08/18 12:20:56 UTC

[cxf] 03/04: Attempt to fix flaky JaxRsServiceTest tests (CXF-8750 post merge) (#984)

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 bdac7b5c5c3d9bf3ba394a2d91e675611a351666
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Mon Aug 15 22:29:19 2022 -0400

    Attempt to fix flaky JaxRsServiceTest tests (CXF-8750 post merge) (#984)
    
    (cherry picked from commit c075688d5b2e4b20c3171a5dd9a20c6855d490e5)
---
 .../java/org/apache/cxf/osgi/itests/jaxrs/JaxRsServiceTest.java     | 6 +++++-
 .../java/org/apache/cxf/osgi/itests/jaxrs/JaxRsTestActivator.java   | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/jaxrs/JaxRsServiceTest.java b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/jaxrs/JaxRsServiceTest.java
index f22008c5fc..d0cf69b34a 100644
--- a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/jaxrs/JaxRsServiceTest.java
+++ b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/jaxrs/JaxRsServiceTest.java
@@ -28,6 +28,7 @@ import javax.ws.rs.core.Response.Status;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
 
 import org.apache.cxf.helpers.JavaUtils;
 import org.apache.cxf.osgi.itests.AbstractServerActivator;
@@ -64,7 +65,10 @@ public class JaxRsServiceTest extends CXFOSGiTestSupport {
     private static final String SWAGGER_PATH = "api-docs";
     private static final String OPEN_API_FILE_PATH = "openapi.json";
 
-    private final WebTarget wt = ClientBuilder.newClient().target(BASE_URL);
+    private final WebTarget wt = ClientBuilder
+        .newClient()
+        .register(JacksonJsonProvider.class)
+        .target(BASE_URL);
 
     @Test
     public void testJaxRsGet() throws Exception {
diff --git a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/jaxrs/JaxRsTestActivator.java b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/jaxrs/JaxRsTestActivator.java
index 5e9238c09f..b7176ba039 100644
--- a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/jaxrs/JaxRsTestActivator.java
+++ b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/jaxrs/JaxRsTestActivator.java
@@ -35,9 +35,9 @@ public class JaxRsTestActivator extends AbstractServerActivator {
         JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
         sf.setBus(bus);
         sf.setResourceClasses(BookStore.class);
+
         OpenApiFeature openApiFeature = new OpenApiFeature();
         openApiFeature.setScan(false);
-        openApiFeature.setUseContextBasedConfig(true);
         SwaggerUiConfig swaggerUiConfig = new SwaggerUiConfig();
         swaggerUiConfig.setUrl("/cxf/jaxrs/openapi.json");
         openApiFeature.setSwaggerUiConfig(swaggerUiConfig);