Skip to content

Commit

Permalink
Fix incorrect endpoint paths in REST producer test
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnetherton committed Jul 29, 2024
1 parent 1d6fcd6 commit f1e885a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
*/
package org.apache.camel.quarkus.component.openapijava.it;

import java.util.List;

import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
Expand All @@ -26,7 +24,7 @@
import jakarta.ws.rs.core.MediaType;
import org.apache.camel.ProducerTemplate;

@Path("/api")
@Path("/invoke")
public class OpenApiResource {

@Inject
Expand All @@ -36,9 +34,10 @@ public class OpenApiResource {
@Path("/fruits/list")
@Produces(MediaType.APPLICATION_JSON)
@SuppressWarnings("unchecked")
public List<String> invokeFruitsListApiFromOpenApiDoc(@QueryParam("port") int port) {
public String invokeFruitsListApiFromOpenApiDoc(@QueryParam("port") int port) {
String apiHost = "localhost:" + port;
String apiDocUrl = "http://" + apiHost + "/openapi";
return producerTemplate.requestBody("rest:get:fruits/list?host=" + apiHost + "&apiDoc=" + apiDocUrl, null, List.class);
return producerTemplate.requestBody("rest:get:/api/fruits/list?host=" + apiHost + "&apiDoc=" + apiDocUrl, null,
String.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void configure() throws Exception {
.apiProperty("cors", "true")
.apiProperty("schemes", "http,https")
.apiProperty("api.path", "/api-docs")
.apiProperty("base.path", "/api")
.apiProperty("base.path", "/")
.apiProperty("api.termsOfService", "https://camel.apache.org")
.apiProperty("api.contact.name", "Mr Camel Quarkus")
.apiProperty("api.contact.email", "mrcq@cq.org")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static void beforeAll() {
public void invokeApiEndpoint() {
RestAssured.given()
.queryParam("port", RestAssured.port)
.get("/api/fruits/list")
.get("/invoke/fruits/list")
.then()
.contentType(ContentType.JSON)
.statusCode(200)
Expand Down Expand Up @@ -267,7 +267,7 @@ public void openApiServers(OpenApiContentType contentType) {
.then()
.contentType(ContentType.JSON)
.statusCode(200)
.body("servers[0].url", is("http://localhost:8080/api"));
.body("servers[0].url", is("http://localhost:8080/"));
}

@ParameterizedTest
Expand Down

0 comments on commit f1e885a

Please sign in to comment.