fjtirado commented on code in PR #4135:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4135#discussion_r2568272659


##########
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/OpenAPIInterfaceGenIT.java:
##########
@@ -18,37 +18,77 @@
  */
 package org.kie.kogito.quarkus.workflows;
 
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
 
+import io.quarkus.test.common.http.TestHTTPResource;
 import io.quarkus.test.junit.QuarkusIntegrationTest;
 import io.restassured.RestAssured;
 import io.restassured.http.ContentType;
+import io.restassured.path.json.JsonPath;
 
 import static io.restassured.RestAssured.given;
-import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * Handle integration tests for OpenAPI Spec Interface generation for SW 
projects.
  */
 @QuarkusIntegrationTest
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
 public class OpenAPIInterfaceGenIT {
+    @TestHTTPResource
+    URL baseUrl;
+    private JsonPath jp;
 
     @BeforeAll
-    static void init() {
+    void init() {
         RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
-    }
 
-    @Test
-    void verifyOperationIdIsGeneratedByDefault() {
-        given()
+        String openapi = given()
+                .baseUri(baseUrl.toString())
                 .accept(ContentType.JSON)
                 .when()
                 .get("/q/openapi?format=json")
                 .then()
                 .statusCode(200)
-                // verifies the get path in the helloworld SW
-                .body("paths.'/helloworld'.get.operationId", 
is("getAllProcessInstances_helloworld"));
+                .extract()
+                .asString();
+
+        jp = new JsonPath(openapi);
+    }
+
+    @Test
+    void verifyOperationIdIsGeneratedByDefault() {
+        assertThat(jp.getString("paths.'/helloworld'.get.operationId"), 
is("getAllProcessInstances_helloworld"));
     }
 
+    @ParameterizedTest
+    @ValueSource(strings = { "helloworld", "expression", "greet", "long-call", 
"squareService" })

Review Comment:
   This test covers general structure assumption of a json schema file. 
   I think we can add, with another PR, a specific test for the "expression" 
workflow that checks that the generated schema includes reference to the json 
input and output schema that are defined for this 
   expression workflow. 
   It might be too custom (thats why I feel might be a different PR), but its 
the only way to really be 100%  sure we have not caused a regression (although 
smaller) when changing the code. 
   In any case this is a great addition, thanks @gmunozfe!



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to