jamesnetherton commented on code in PR #8625:
URL: https://github.com/apache/camel-quarkus/pull/8625#discussion_r3199745927


##########
integration-tests/google/src/main/java/org/apache/camel/quarkus/component/google/it/GoogleMailResource.java:
##########
@@ -99,6 +104,63 @@ public Response readMail(@QueryParam("messageId") String 
messageId) {
         }
     }
 
+    @Path("/thread-id")
+    @GET
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response getThreadId(@QueryParam("messageId") String messageId) {
+        Map<String, Object> headers = new HashMap<>();
+        headers.put("CamelGoogleMail.userId", USER_ID);
+        headers.put("CamelGoogleMail.id", messageId);
+
+        try {
+            Message response = 
producerTemplate.requestBodyAndHeaders("google-mail://messages/get", null, 
headers,
+                    Message.class);
+            if (response != null && response.getThreadId() != null) {
+                return Response.ok(response.getThreadId()).build();
+            } else {
+                return Response.status(Response.Status.NOT_FOUND).build();
+            }
+        } catch (CamelExecutionException e) {
+            Exception exchangeException = e.getExchange().getException();
+            if (exchangeException != null && exchangeException.getCause() 
instanceof GoogleJsonResponseException) {
+                GoogleJsonResponseException originalException = 
(GoogleJsonResponseException) exchangeException.getCause();
+                return 
Response.status(originalException.getStatusCode()).build();
+            }
+            throw e;
+        }
+    }
+
+    @Path("/message-id-header")
+    @GET
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response getMessageIdHeader(@QueryParam("messageId") String 
messageId) {
+        Map<String, Object> headers = new HashMap<>();
+        headers.put("CamelGoogleMail.userId", USER_ID);
+        headers.put("CamelGoogleMail.id", messageId);
+
+        try {
+            Message response = 
producerTemplate.requestBodyAndHeaders("google-mail://messages/get", null, 
headers,
+                    Message.class);
+            if (response != null && response.getPayload() != null && 
response.getPayload().getHeaders() != null) {
+                for (com.google.api.services.gmail.model.MessagePartHeader 
header : response.getPayload().getHeaders()) {

Review Comment:
   Please use imports in all cases and avoid FQCN references where possible.



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