Re: [PR] [Fix #4075] Generate message error from server response [incubator-kie-kogito-runtimes]

2025-10-18 Thread via GitHub


kie-ci3 commented on PR #4076:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4076#issuecomment-3365452412

   
   **PR job** `#7` was: **UNSTABLE**
   Possible explanation: This should be test failures
   
   
   
   Reproducer
   
   
   
   build-chain build full_downstream  -f 
'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml'
 -o 'bc' -p apache/incubator-kie-kogito-runtimes -u 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4076 
--skipParallelCheckout
   
   NOTE: To install the build-chain tool, please refer to 
https://github.com/kiegroup/github-action-build-chain#local-execution
   
   
   
   
   Please look here: 
https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-4076/7/display/redirect
   
   **Test results:**
   - PASSED: 3662
   - FAILED: 3
   
   Those are the test failures: 
   
   https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-4076/7/testReport/org.kie.kogito.quarkus.workflows/ConversionFlowIT/wrongData/";>org.kie.kogito.quarkus.workflows.ConversionFlowIT.wrongData
   1 expectation failed.Expected status code <400> but was <500>.
   
   
   https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-4076/7/testReport/org.kie.kogito.quarkus.workflows/ConversionFlowIT/wrongCluster/";>org.kie.kogito.quarkus.workflows.ConversionFlowIT.wrongCluster
   1 expectation failed.Expected status code <400> but was <500>.
   
   
   https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-4076/7/testReport/org.kie.kogito.quarkus.workflows/ConversionFlowIT/sanityVerification/";>org.kie.kogito.quarkus.workflows.ConversionFlowIT.sanityVerification
   1 expectation failed.Expected status code <201> but was <500>.
   
   


-- 
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]



Re: [PR] [Fix #4075] Generate message error from server response [incubator-kie-kogito-runtimes]

2025-10-03 Thread via GitHub


fjtirado merged PR #4076:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/4076


-- 
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]



Re: [PR] [Fix #4075] Generate message error from server response [incubator-kie-kogito-runtimes]

2025-10-03 Thread via GitHub


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


##
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow/src/main/java/org/kie/kogito/serverless/workflow/openapi/OpenApiWorkItemHandler.java:
##
@@ -69,14 +78,29 @@ public void filter(ClientRequestContext requestContext) 
throws IOException {
 });
 }
 }
-}, Integer.MIN_VALUE).build(clazz);
+}, Integer.MIN_VALUE).register((ResponseExceptionMapper) response -> 
new WebApplicationException(fromResponse(response), 
response.getStatus())).build(clazz);
 try {
 return internalExecute(ref, parameters);
 } catch (WebApplicationException ex) {
 throw new 
WorkItemExecutionException(Integer.toString(ex.getResponse().getStatus()), 
ex.getMessage());
 }
 }
 
+private String fromResponse(Response response) {
+Object entity = response.getEntity();
+if (entity instanceof ByteArrayInputStream input) {
+if 
(MediaType.APPLICATION_JSON_TYPE.equals(response.getMediaType())) {
+try {
+return 
ObjectMapperFactory.get().readTree(input).toString();
+} catch (IOException e) {
+logger.warn("Error parsing json error response {}", 
e.toString());

Review Comment:
   Took into account that this will appear only if the operation has failed, so 
I feel it might provoke confusion during analysis of the trace if another long 
stack trace appear. 
   Also, since this will be a jackson exception, probably the message will be 
enough to find out why the json cannot be parsed



-- 
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]



Re: [PR] [Fix #4075] Generate message error from server response [incubator-kie-kogito-runtimes]

2025-10-03 Thread via GitHub


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


##
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow/src/main/java/org/kie/kogito/serverless/workflow/openapi/OpenApiWorkItemHandler.java:
##
@@ -69,14 +78,29 @@ public void filter(ClientRequestContext requestContext) 
throws IOException {
 });
 }
 }
-}, Integer.MIN_VALUE).build(clazz);
+}, Integer.MIN_VALUE).register((ResponseExceptionMapper) response -> 
new WebApplicationException(fromResponse(response), 
response.getStatus())).build(clazz);
 try {
 return internalExecute(ref, parameters);
 } catch (WebApplicationException ex) {
 throw new 
WorkItemExecutionException(Integer.toString(ex.getResponse().getStatus()), 
ex.getMessage());
 }
 }
 
+private String fromResponse(Response response) {
+Object entity = response.getEntity();
+if (entity instanceof ByteArrayInputStream input) {
+if 
(MediaType.APPLICATION_JSON_TYPE.equals(response.getMediaType())) {
+try {
+return 
ObjectMapperFactory.get().readTree(input).toString();
+} catch (IOException e) {
+logger.warn("Error parsing json error response {}", 
e.toString());

Review Comment:
   ook into account that this will appear only if the operation has failed, so 
I feel it might provoke confusion during analysis of the trace if another long 
stack trace appear. 



-- 
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]



Re: [PR] [Fix #4075] Generate message error from server response [incubator-kie-kogito-runtimes]

2025-10-03 Thread via GitHub


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


##
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/OperationsMockServiceError.java:
##
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.quarkus.workflows;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.UnaryOperator;
+
+import com.github.tomakehurst.wiremock.WireMockServer;
+import com.github.tomakehurst.wiremock.client.MappingBuilder;
+import com.github.tomakehurst.wiremock.matching.EqualToPattern;
+
+import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import static 
com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
+
+public class OperationsMockServiceError implements 
QuarkusTestResourceLifecycleManager {
+
+private static WireMockServer subtractionService;
+private static WireMockServer multiplicationService;

Review Comment:
   this was a copy-paste, but you are probably right



-- 
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]



Re: [PR] [Fix #4075] Generate message error from server response [incubator-kie-kogito-runtimes]

2025-10-03 Thread via GitHub


gmunozfe commented on code in PR #4076:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/4076#discussion_r2401581492


##
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/OperationsMockServiceError.java:
##
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.quarkus.workflows;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.UnaryOperator;
+
+import com.github.tomakehurst.wiremock.WireMockServer;
+import com.github.tomakehurst.wiremock.client.MappingBuilder;
+import com.github.tomakehurst.wiremock.matching.EqualToPattern;
+
+import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import static 
com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
+
+public class OperationsMockServiceError implements 
QuarkusTestResourceLifecycleManager {
+
+private static WireMockServer subtractionService;
+private static WireMockServer multiplicationService;
+
+public static final String SUBTRACTION_SERVICE_MOCK_URL = 
"subtraction-service-mock.url";
+public static final String MULTIPLICATION_SERVICE_MOCK_URL = 
"multiplication-service-mock.url";
+
+@Override
+public Map start() {
+multiplicationService =
+startServer("{  \"product\": 37.808 }", p -> 
p.withHeader("pepe", new EqualToPattern("pepa")));
+subtractionService =
+startServer("{ \"difference\": 68.0 }", p -> p);
+
+Map result = new HashMap<>();
+result.put(MULTIPLICATION_SERVICE_MOCK_URL, 
multiplicationService.baseUrl());
+result.put(SUBTRACTION_SERVICE_MOCK_URL, subtractionService.baseUrl());
+return result;
+}
+
+@Override
+public void stop() {
+if (multiplicationService != null) {
+multiplicationService.stop();
+}
+if (subtractionService != null) {
+subtractionService.stop();

Review Comment:
   Same here



##
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/OperationsMockServiceError.java:
##
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.quarkus.workflows;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.UnaryOperator;
+
+import com.github.tomakehurst.wiremock.WireMockServer;
+import com.github.tomakehurst.wiremock.client.MappingBuilder;
+import com.github.tomakehurst.wiremock.matching.EqualToPattern;
+
+import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import static 
com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
+
+public class OperationsMockServiceError implements 
QuarkusTestResourceLifecycleManager {
+
+private static WireMockServer subtractionService;

[PR] [Fix #4075] Generate message error from server response [incubator-kie-kogito-runtimes]

2025-10-02 Thread via GitHub


fjtirado opened a new pull request, #4076:
URL: https://github.com/apache/incubator-kie-kogito-runtimes/pull/4076

   Fix https://github.com/apache/incubator-kie-kogito-runtimes/issues/4075


-- 
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]