You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by GitBox <gi...@apache.org> on 2022/08/12 22:10:58 UTC

[GitHub] [cxf] awrb opened a new pull request, #982: CXF-8750: only add trailing slash if necessary when locating webjars …

awrb opened a new pull request, #982:
URL: https://github.com/apache/cxf/pull/982

   …resources for Swagger UI in OSGi environment


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [cxf] reta commented on pull request #982: CXF-8750: only add trailing slash if necessary when locating webjars …

Posted by GitBox <gi...@apache.org>.
reta commented on PR #982:
URL: https://github.com/apache/cxf/pull/982#issuecomment-1216010454

   Thanks @awrb, it seems to be a client-side issue (not the server side).
   
   > Should XML work OOTB without a provider? 
   
   Yes, JAXB should be there
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [cxf] reta commented on a diff in pull request #982: CXF-8750: only add trailing slash if necessary when locating webjars …

Posted by GitBox <gi...@apache.org>.
reta commented on code in PR #982:
URL: https://github.com/apache/cxf/pull/982#discussion_r945298926


##########
osgi/itests/src/test/java/org/apache/cxf/osgi/itests/jaxrs/JaxRsServiceTest.java:
##########
@@ -99,6 +112,41 @@ public void testJaxRsPut() throws Exception {
         assertStatus(Status.OK, response);
     }
 
+    @Test
+    public void testGetSwaggerUi() {
+        WebTarget swaggerWt = ClientBuilder.newClient().target(SWAGGER_URL)
+                .queryParam("url", "/cxf/jaxrs/openapi.json");
+        Response response = swaggerWt.request().get();
+        String swaggerFileHtml = readResponseAsString(response);
+
+        assertStatus(Status.OK, response);
+        assertTrue(swaggerFileHtml.contains("<html"));
+        assertTrue(swaggerFileHtml.contains("<head>"));
+        assertTrue(swaggerFileHtml.contains("<title>Swagger UI</title>"));
+        assertTrue(swaggerFileHtml.contains("</html>"));
+    }
+
+    @Test
+    public void testGetOpenApiJsonFile() {
+        WebTarget openApiWt = ClientBuilder.newClient().target(OPEN_API_FILE_URL);
+        Response response = openApiWt.request().get();
+        String openApiJson = readResponseAsString(response);
+
+        try {
+            new ObjectMapper().readValue(openApiJson, Object.class);
+            assertTrue(openApiJson.contains("/bookstore/"));
+        } catch (JsonProcessingException e) {
+            fail();
+        }
+    }
+
+    private String readResponseAsString(Response response) {

Review Comment:
   This is not necessary, you could just use `response.readEntity(String.class)` directly



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [cxf] reta commented on a diff in pull request #982: CXF-8750: only add trailing slash if necessary when locating webjars …

Posted by GitBox <gi...@apache.org>.
reta commented on code in PR #982:
URL: https://github.com/apache/cxf/pull/982#discussion_r945298979


##########
osgi/itests/src/test/java/org/apache/cxf/osgi/itests/jaxrs/JaxRsServiceTest.java:
##########
@@ -99,6 +112,41 @@ public void testJaxRsPut() throws Exception {
         assertStatus(Status.OK, response);
     }
 
+    @Test
+    public void testGetSwaggerUi() {
+        WebTarget swaggerWt = ClientBuilder.newClient().target(SWAGGER_URL)
+                .queryParam("url", "/cxf/jaxrs/openapi.json");
+        Response response = swaggerWt.request().get();
+        String swaggerFileHtml = readResponseAsString(response);

Review Comment:
   ```suggestion
           String swaggerFileHtml = response.readEntity(String.class);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [cxf] awrb commented on pull request #982: CXF-8750: only add trailing slash if necessary when locating webjars …

Posted by GitBox <gi...@apache.org>.
awrb commented on PR #982:
URL: https://github.com/apache/cxf/pull/982#issuecomment-1214414044

   Thanks for the review @reta, I addressed the comments. I closed the previous PR (#981) too.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [cxf] reta commented on a diff in pull request #982: CXF-8750: only add trailing slash if necessary when locating webjars …

Posted by GitBox <gi...@apache.org>.
reta commented on code in PR #982:
URL: https://github.com/apache/cxf/pull/982#discussion_r945299016


##########
osgi/itests/src/test/java/org/apache/cxf/osgi/itests/jaxrs/JaxRsServiceTest.java:
##########
@@ -99,6 +112,41 @@ public void testJaxRsPut() throws Exception {
         assertStatus(Status.OK, response);
     }
 
+    @Test
+    public void testGetSwaggerUi() {
+        WebTarget swaggerWt = ClientBuilder.newClient().target(SWAGGER_URL)
+                .queryParam("url", "/cxf/jaxrs/openapi.json");
+        Response response = swaggerWt.request().get();
+        String swaggerFileHtml = readResponseAsString(response);
+
+        assertStatus(Status.OK, response);
+        assertTrue(swaggerFileHtml.contains("<html"));
+        assertTrue(swaggerFileHtml.contains("<head>"));
+        assertTrue(swaggerFileHtml.contains("<title>Swagger UI</title>"));
+        assertTrue(swaggerFileHtml.contains("</html>"));
+    }
+
+    @Test
+    public void testGetOpenApiJsonFile() {
+        WebTarget openApiWt = ClientBuilder.newClient().target(OPEN_API_FILE_URL);
+        Response response = openApiWt.request().get();
+        String openApiJson = readResponseAsString(response);

Review Comment:
   ```suggestion
           String openApiJson = response.readEntity(String.class);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [cxf] reta commented on pull request #982: CXF-8750: only add trailing slash if necessary when locating webjars …

Posted by GitBox <gi...@apache.org>.
reta commented on PR #982:
URL: https://github.com/apache/cxf/pull/982#issuecomment-1214390302

   Thanks @awrb , minor comments, LGTM otherwise!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [cxf] awrb commented on pull request #982: CXF-8750: only add trailing slash if necessary when locating webjars …

Posted by GitBox <gi...@apache.org>.
awrb commented on PR #982:
URL: https://github.com/apache/cxf/pull/982#issuecomment-1214768795

   Oops.. it never failed for me locally before. I have run the tests in `osgi/itests` several times now (via `mvn clean test` or `install`), but it always passes, so I cannot reproduce this.
   
   The pipeline reports
   `No message body writer has been found for class org.apache.cxf.osgi.itests.jaxrs.Book`
   and indeed there is no XML provider in set up for JAXRSServerFactoryBean. Should XML work OOTB without a provider? If you were using JSON, you would have to add JacksonJsonProvider, so I would expect the same for XML.
   
   Can you look at #983 to see if it helps?
   
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [cxf] reta commented on pull request #982: CXF-8750: only add trailing slash if necessary when locating webjars …

Posted by GitBox <gi...@apache.org>.
reta commented on PR #982:
URL: https://github.com/apache/cxf/pull/982#issuecomment-1214417138

   Thank you, @awrb !


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [cxf] reta merged pull request #982: CXF-8750: only add trailing slash if necessary when locating webjars …

Posted by GitBox <gi...@apache.org>.
reta merged PR #982:
URL: https://github.com/apache/cxf/pull/982


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [cxf] reta commented on pull request #982: CXF-8750: only add trailing slash if necessary when locating webjars …

Posted by GitBox <gi...@apache.org>.
reta commented on PR #982:
URL: https://github.com/apache/cxf/pull/982#issuecomment-1214508129

   Hm ... the change introduced flakyness into `osgi/itests` [1], [2] [3], also seeing it flipping locally, looking into it right now:
   
   [1] https://ci-builds.apache.org/job/CXF/job/pipeline/job/3.5.x-fixes/270/
   [2] https://ci-builds.apache.org/job/CXF/job/pipeline/job/3.5.x-fixes/269/
   [3] https://ci-builds.apache.org/job/CXF/job/pipeline/job/3.5.x-fixes/267/
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org