aldettinger commented on code in PR #8820:
URL: https://github.com/apache/camel-quarkus/pull/8820#discussion_r3518423342


##########
integration-tests/a2a/src/test/java/org/apache/camel/quarkus/component/a2a/it/A2aTest.java:
##########
@@ -0,0 +1,575 @@
+/*
+ * 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.apache.camel.quarkus.component.a2a.it;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.apache.camel.component.a2a.A2AConstants;
+import org.eclipse.microprofile.config.ConfigProvider;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.greaterThanOrEqualTo;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.notNullValue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+@QuarkusTest
+@QuarkusTestResource(A2aKeycloakTestResource.class)
+class A2aTest {
+
+    @Test
+    void agentCardServed() {
+        RestAssured.get("/.well-known/agent-card.json")
+                .then()
+                .statusCode(200)
+                .body(
+                        "name", is("Test Agent"),
+                        "version", is("1.0.0"),
+                        "description", is("A Quarkus test agent"));
+    }
+
+    @Test
+    void sendMessageJsonRpc() {
+        RestAssured.given()
+                .contentType("application/json")
+                .body(jsonRpcSendMessage("msg-1", "req-1", "{\"text\":\"Hello 
A2A\"}"))
+                .post("/")
+                .then()
+                .statusCode(200)
+                .body(
+                        "jsonrpc", is("2.0"),
+                        "result.task.id", notNullValue(),
+                        "result.task.contextId", notNullValue(),
+                        "id", is("req-1"));
+    }
+
+    @Test
+    void producerSendMessagePojo() {
+        RestAssured.given()
+                .contentType(ContentType.TEXT)
+                .body("Hello from producer")
+                .post("/a2a/send")
+                .then()
+                .statusCode(200)
+                .body(
+                        "taskId", notNullValue(),
+                        "contextId", notNullValue(),
+                        "state", is("COMPLETED"));
+    }
+
+    @Test
+    void producerSendMessagePayloadDataFormat() {
+        String response = RestAssured.given()
+                .contentType(ContentType.TEXT)
+                .body("Hello payload")
+                .post("/a2a/send-payload")
+                .then()
+                .statusCode(200)
+                .extract().asString();
+
+        assertTrue(
+                response.contains("Echo:"),
+                "Expected PAYLOAD response to contain echoed text, got: " + 
response);
+    }
+
+    @Test
+    void producerSendMessageRawDataFormat() {
+        String response = RestAssured.given()
+                .contentType(ContentType.TEXT)
+                .body("Hello raw")
+                .post("/a2a/send-raw")
+                .then()
+                .statusCode(200)
+                .extract().asString();
+
+        assertTrue(
+                response.contains("\"task\"") || 
response.contains("\"result\""),
+                "Expected RAW response to contain JSON structure, got: " + 
response);
+    }
+
+    @Test
+    void producerGetTask() {
+        String taskId = RestAssured.given()
+                .contentType(ContentType.TEXT)
+                .body("Create task for get")
+                .post("/a2a/send")
+                .then()
+                .statusCode(200)
+                .extract()
+                .jsonPath()
+                .getString("taskId");
+
+        RestAssured.given()
+                .queryParam("taskId", taskId)
+                .get("/a2a/get-task")
+                .then()
+                .statusCode(200)
+                .body(
+                        "taskId", is(taskId),
+                        "state", is("COMPLETED"));
+    }
+
+    @Test
+    void producerCancelTask() {
+        String taskId = RestAssured.given()
+                .contentType(ContentType.TEXT)
+                .body("Create task for cancel")
+                .post("/a2a/send")
+                .then()
+                .statusCode(200)
+                .extract()
+                .jsonPath()
+                .getString("taskId");
+
+        RestAssured.given()
+                .queryParam("taskId", taskId)
+                .post("/a2a/cancel-task")
+                .then()
+                .statusCode(200)
+                .body("error", notNullValue());

Review Comment:
   Is it the expected case that cancel returns an error ?



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

Reply via email to