fantonangeli commented on code in PR #4078:
URL:
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4078#discussion_r2480639493
##########
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/GreetRestIT.java:
##########
@@ -67,6 +68,43 @@ void testVersion() {
.body("version", is("1.0"));
}
+ @Test
+ void testHtmlResponse() {
+ given()
+ .accept("text/html")
+ .when()
+ .get("/greet")
+ .then()
+ .statusCode(is(200))
Review Comment:
Let's follow the other tests already in this file
```suggestion
.statusCode(200)
```
##########
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/GreetRestIT.java:
##########
@@ -67,6 +68,43 @@ void testVersion() {
.body("version", is("1.0"));
}
+ @Test
+ void testHtmlResponse() {
+ given()
+ .accept("text/html")
+ .when()
+ .get("/greet")
+ .then()
+ .statusCode(is(200))
+ .contentType(startsWith("text/html"))
Review Comment:
see my previous comment
```suggestion
.contentType(ContentType.HTML)
```
##########
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/GreetRestIT.java:
##########
@@ -67,6 +68,43 @@ void testVersion() {
.body("version", is("1.0"));
}
+ @Test
+ void testHtmlResponse() {
+ given()
+ .accept("text/html")
+ .when()
+ .get("/greet")
+ .then()
+ .statusCode(is(200))
+ .contentType(startsWith("text/html"))
+ .body(containsString("SONATAFLOW WORKFLOW ENDPOINT"));
+ }
+
+ @Test
+ void testJsonResponseWithHeader() {
+ given()
+ .accept(ContentType.JSON)
+ .when()
+ .get("/greetdetails")
Review Comment:
`greetdetails` workflow is java workflow. We should use `greet`, which is a
classic workflow.
```suggestion
.get("/greet")
```
##########
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/GreetRestIT.java:
##########
@@ -67,6 +68,43 @@ void testVersion() {
.body("version", is("1.0"));
}
+ @Test
+ void testHtmlResponse() {
+ given()
+ .accept("text/html")
Review Comment:
it's better to avoid hardcoding of contentypes. We already have
`ContentType` constant.
```suggestion
.accept(ContentType.HTML)
```
##########
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/GreetRestIT.java:
##########
@@ -67,6 +68,43 @@ void testVersion() {
.body("version", is("1.0"));
}
+ @Test
+ void testHtmlResponse() {
+ given()
+ .accept("text/html")
+ .when()
+ .get("/greet")
+ .then()
+ .statusCode(is(200))
+ .contentType(startsWith("text/html"))
+ .body(containsString("SONATAFLOW WORKFLOW ENDPOINT"));
+ }
+
+ @Test
+ void testJsonResponseWithHeader() {
+ given()
+ .accept(ContentType.JSON)
+ .when()
+ .get("/greetdetails")
+ .then()
+ .statusCode(200)
+ .contentType(ContentType.JSON)
+ .body("version", is("1.0"))
+ .body("type", is("SW"));
Review Comment:
Like in other `greet` WF tests.
```suggestion
.body(is("[]"));
```
##########
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/GreetRestIT.java:
##########
@@ -67,6 +68,43 @@ void testVersion() {
.body("version", is("1.0"));
}
+ @Test
+ void testHtmlResponse() {
+ given()
+ .accept("text/html")
+ .when()
+ .get("/greet")
+ .then()
+ .statusCode(is(200))
+ .contentType(startsWith("text/html"))
+ .body(containsString("SONATAFLOW WORKFLOW ENDPOINT"));
+ }
+
+ @Test
+ void testJsonResponseWithHeader() {
+ given()
+ .accept(ContentType.JSON)
+ .when()
+ .get("/greetdetails")
+ .then()
+ .statusCode(200)
+ .contentType(ContentType.JSON)
+ .body("version", is("1.0"))
+ .body("type", is("SW"));
+ }
+
+ @Test
+ void testJsonResponseWithoutHeader() {
+ given()
+ .when()
+ .get("/greetdetails")
Review Comment:
`greetdetails` workflow is java workflow. We should use `greet`, which is a
classic workflow.
```suggestion
.get("/greet")
```
##########
kogito-codegen-modules/kogito-codegen-processes/src/main/resources/META-INF/resources/index.html:
##########
Review Comment:
Can you please check if this directory is used?
If not, I think we can delete it.
##########
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/GreetRestIT.java:
##########
@@ -67,6 +68,43 @@ void testVersion() {
.body("version", is("1.0"));
}
+ @Test
+ void testHtmlResponse() {
+ given()
+ .accept("text/html")
+ .when()
+ .get("/greet")
+ .then()
+ .statusCode(is(200))
+ .contentType(startsWith("text/html"))
+ .body(containsString("SONATAFLOW WORKFLOW ENDPOINT"));
+ }
+
+ @Test
+ void testJsonResponseWithHeader() {
Review Comment:
```suggestion
void testJsonResponseWithAcceptHeader() {
```
##########
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/GreetRestIT.java:
##########
@@ -67,6 +68,43 @@ void testVersion() {
.body("version", is("1.0"));
}
+ @Test
+ void testHtmlResponse() {
+ given()
+ .accept("text/html")
+ .when()
+ .get("/greet")
+ .then()
+ .statusCode(is(200))
+ .contentType(startsWith("text/html"))
+ .body(containsString("SONATAFLOW WORKFLOW ENDPOINT"));
+ }
+
+ @Test
+ void testJsonResponseWithHeader() {
+ given()
+ .accept(ContentType.JSON)
+ .when()
+ .get("/greetdetails")
+ .then()
+ .statusCode(200)
+ .contentType(ContentType.JSON)
+ .body("version", is("1.0"))
+ .body("type", is("SW"));
+ }
+
+ @Test
+ void testJsonResponseWithoutHeader() {
+ given()
+ .when()
+ .get("/greetdetails")
+ .then()
+ .statusCode(200)
+ .contentType(ContentType.JSON)
+ .body("version", is("1.0"))
+ .body("type", is("SW"));
Review Comment:
Like in other `greet` WF tests.
```suggestion
.body(is("[]"));
```
##########
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/GreetRestIT.java:
##########
@@ -67,6 +68,43 @@ void testVersion() {
.body("version", is("1.0"));
}
+ @Test
+ void testHtmlResponse() {
+ given()
+ .accept("text/html")
+ .when()
+ .get("/greet")
+ .then()
+ .statusCode(is(200))
+ .contentType(startsWith("text/html"))
+ .body(containsString("SONATAFLOW WORKFLOW ENDPOINT"));
+ }
+
+ @Test
+ void testJsonResponseWithHeader() {
+ given()
+ .accept(ContentType.JSON)
+ .when()
+ .get("/greetdetails")
+ .then()
+ .statusCode(200)
+ .contentType(ContentType.JSON)
+ .body("version", is("1.0"))
+ .body("type", is("SW"));
+ }
+
+ @Test
+ void testJsonResponseWithoutHeader() {
Review Comment:
```suggestion
void testJsonResponseWithoutAcceptHeader() {
```
--
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]