gabriel-farache commented on code in PR #3928:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3928#discussion_r2248186462


##########
quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-integration-test/src/test/java/org/kie/kogito/quarkus/workflows/TokenExchangeIT.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * 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 org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+import io.restassured.path.json.JsonPath;
+
+import jakarta.ws.rs.core.HttpHeaders;
+
+import static 
org.kie.kogito.quarkus.workflows.ExternalServiceMock.SUCCESSFUL_QUERY;
+import static 
org.kie.kogito.quarkus.workflows.TokenExchangeExternalServicesMock.BASE_AND_PROPAGATED_AUTHORIZATION_TOKEN;
+import static 
org.kie.kogito.test.utils.ProcessInstancesRESTTestUtils.newProcessInstance;
+
+@QuarkusTestResource(TokenExchangeExternalServicesMock.class)
+@QuarkusTestResource(KeycloakServiceMock.class)
+@QuarkusIntegrationTest
+class TokenExchangeIT {
+
+    @Test
+    void tokenExchange() {
+        // start a new process instance by sending the post query and collect 
the process instance id.
+        String processInput = buildProcessInput(SUCCESSFUL_QUERY);
+        Map<String, String> headers = new HashMap<>();
+        // prepare the headers to pass to the token_propagation SW.
+        // service token-propagation-external-service1 and 
token-propagation-external-service2 will receive the AUTHORIZATION_TOKEN 
+        headers.put(HttpHeaders.AUTHORIZATION, 
BASE_AND_PROPAGATED_AUTHORIZATION_TOKEN);
+
+        JsonPath jsonPath = newProcessInstance("/token_exchange", 
processInput, headers);
+        Assertions.assertThat(jsonPath.getString("id")).isNotBlank();
+    }
+

Review Comment:
   @fjtirado Yep I understood that the 404 meant completed but I do not know if 
it was with no error or if it had some error. In this case there was an 
exception as expected but I do not know how to check that. Maybe the 
`/management/processes` endpoint can give me that info?



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