You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2024/06/10 09:47:22 UTC

(camel) branch openapi-validator-complete created (now e149526ae48)

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a change to branch openapi-validator-complete
in repository https://gitbox.apache.org/repos/asf/camel.git


      at e149526ae48 Added Camel-Openapi-validator to kit

This branch includes the following new commits:

     new a84547cec3d CAMEL-20798: EndpointServiceLocation on components to make it possible to know which remote system Camel connects to to assist for monitoring and observability - AWS SES
     new e149526ae48 Added Camel-Openapi-validator to kit

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(camel) 01/02: CAMEL-20798: EndpointServiceLocation on components to make it possible to know which remote system Camel connects to to assist for monitoring and observability - AWS SES

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch openapi-validator-complete
in repository https://gitbox.apache.org/repos/asf/camel.git

commit a84547cec3da7e8cbe3b5e8c1226026f176a4682
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Jun 10 11:08:16 2024 +0200

    CAMEL-20798: EndpointServiceLocation on components to make it possible to know which remote system Camel connects to to assist for monitoring and observability - AWS SES
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../org/apache/camel/catalog/others.properties     |  1 -
 .../camel/catalog/others/openapi-validator.json    | 15 ---------------
 .../camel/component/aws2/ses/Ses2Endpoint.java     | 22 +++++++++++++++++++++-
 .../DefaultRestOpenapiProcessorStrategy.java       |  3 ++-
 .../rest/openapi/RestOpenapiProcessorStrategy.java |  3 ++-
 .../camel/component/smb/SmbConfiguration.java      |  3 ++-
 .../apache/camel/component/smb/SmbConsumer.java    |  1 -
 .../camel/support/processor/RestBindingAdvice.java |  2 --
 8 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others.properties b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others.properties
index 15e1b4bcb33..9b64a3dd84a 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others.properties
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others.properties
@@ -35,7 +35,6 @@ microprofile-fault-tolerance
 microprofile-health
 observation
 openapi-java
-openapi-validator
 opentelemetry
 platform-http-jolokia
 platform-http-main
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others/openapi-validator.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others/openapi-validator.json
deleted file mode 100644
index 4439b1cdd95..00000000000
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others/openapi-validator.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-  "other": {
-    "kind": "other",
-    "name": "openapi-validator",
-    "title": "Openapi Validator",
-    "description": "OpenAPI validator for Camel Rest DSL",
-    "deprecated": false,
-    "firstVersion": "4.7.0",
-    "label": "rest,api",
-    "supportLevel": "Preview",
-    "groupId": "org.apache.camel",
-    "artifactId": "camel-openapi-validator",
-    "version": "4.7.0-SNAPSHOT"
-  }
-}
diff --git a/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Endpoint.java b/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Endpoint.java
index ae0229fff1f..322d15ac967 100644
--- a/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Endpoint.java
+++ b/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Endpoint.java
@@ -22,18 +22,21 @@ import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.component.aws2.ses.client.Ses2ClientFactory;
+import org.apache.camel.spi.EndpointServiceLocation;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.support.DefaultEndpoint;
 import org.apache.camel.util.ObjectHelper;
 import software.amazon.awssdk.services.ses.SesClient;
 
+import java.util.Map;
+
 /**
  * Send e-mails through AWS SES service.
  */
 @UriEndpoint(firstVersion = "3.1.0", scheme = "aws2-ses", title = "AWS Simple Email Service (SES)", syntax = "aws2-ses:from",
              producerOnly = true, category = { Category.CLOUD, Category.MAIL }, headersClass = Ses2Constants.class)
-public class Ses2Endpoint extends DefaultEndpoint {
+public class Ses2Endpoint extends DefaultEndpoint implements EndpointServiceLocation {
 
     private SesClient sesClient;
 
@@ -85,4 +88,21 @@ public class Ses2Endpoint extends DefaultEndpoint {
     public SesClient getSESClient() {
         return sesClient;
     }
+
+    @Override
+    public String getServiceUrl() {
+        if (!configuration.isOverrideEndpoint()) {
+            if (ObjectHelper.isNotEmpty(configuration.getRegion())) {
+                return configuration.getRegion();
+            }
+        } else if (ObjectHelper.isNotEmpty(configuration.getUriEndpointOverride())) {
+            return configuration.getUriEndpointOverride();
+        }
+        return null;
+    }
+
+    @Override
+    public String getServiceProtocol() {
+        return "ses";
+    }
 }
diff --git a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/DefaultRestOpenapiProcessorStrategy.java b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/DefaultRestOpenapiProcessorStrategy.java
index 8539d865dac..5021ca826b0 100644
--- a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/DefaultRestOpenapiProcessorStrategy.java
+++ b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/DefaultRestOpenapiProcessorStrategy.java
@@ -168,7 +168,8 @@ public class DefaultRestOpenapiProcessorStrategy extends ServiceSupport
     }
 
     @Override
-    public boolean process(OpenAPI openAPI,
+    public boolean process(
+            OpenAPI openAPI,
             Operation operation, String verb, String path,
             RestBindingAdvice binding,
             Exchange exchange, AsyncCallback callback) {
diff --git a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenapiProcessorStrategy.java b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenapiProcessorStrategy.java
index d93d0a79557..7c639071633 100644
--- a/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenapiProcessorStrategy.java
+++ b/components/camel-rest-openapi/src/main/java/org/apache/camel/component/rest/openapi/RestOpenapiProcessorStrategy.java
@@ -78,7 +78,8 @@ public interface RestOpenapiProcessorStrategy {
      * @return           (doneSync) true to continue execute synchronously, false to continue being executed
      *                   asynchronously
      */
-    boolean process(OpenAPI openAPI,
+    boolean process(
+            OpenAPI openAPI,
             Operation operation, String verb, String path,
             RestBindingAdvice binding,
             Exchange exchange, AsyncCallback callback);
diff --git a/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbConfiguration.java b/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbConfiguration.java
index 3fbffa5d1a9..eb239b21fe3 100644
--- a/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbConfiguration.java
+++ b/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbConfiguration.java
@@ -51,7 +51,8 @@ public class SmbConfiguration {
               description = "An optional SMB client configuration, can be used to configure client specific "
                             + " configurations, like timeouts")
     private SmbConfig smbConfig;
-    @UriParam(label = "consumer", defaultValue="false", description = "If a directory, will look for files in all the sub-directories as well.")
+    @UriParam(label = "consumer", defaultValue = "false",
+              description = "If a directory, will look for files in all the sub-directories as well.")
     protected boolean recursive;
 
     public String getUsername() {
diff --git a/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbConsumer.java b/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbConsumer.java
index 7540022a29d..94741ddc213 100644
--- a/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbConsumer.java
+++ b/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbConsumer.java
@@ -98,7 +98,6 @@ public class SmbConsumer extends ScheduledPollConsumer {
         return polledCount;
     }
 
-
     @Override
     protected int poll() throws Exception {
         int polledCount = 0;
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/processor/RestBindingAdvice.java b/core/camel-support/src/main/java/org/apache/camel/support/processor/RestBindingAdvice.java
index fbf3e256e17..cccd750610b 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/processor/RestBindingAdvice.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/processor/RestBindingAdvice.java
@@ -16,8 +16,6 @@
  */
 package org.apache.camel.support.processor;
 
-import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.Locale;
 import java.util.Map;


(camel) 02/02: Added Camel-Openapi-validator to kit

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch openapi-validator-complete
in repository https://gitbox.apache.org/repos/asf/camel.git

commit e149526ae48abe4d5a27c0e17148af12556cc1a1
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Jun 10 11:35:01 2024 +0200

    Added Camel-Openapi-validator to kit
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .../resources/org/apache/camel/catalog/others.properties  |  1 +
 .../apache/camel/catalog/others/openapi-validator.json    | 15 +++++++++++++++
 .../org/apache/camel/component/aws2/ses/Ses2Endpoint.java |  2 --
 .../client/OpenApiRestClientRequestValidatorTest.java     |  5 +++--
 components/pom.xml                                        |  1 +
 5 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others.properties b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others.properties
index 9b64a3dd84a..15e1b4bcb33 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others.properties
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others.properties
@@ -35,6 +35,7 @@ microprofile-fault-tolerance
 microprofile-health
 observation
 openapi-java
+openapi-validator
 opentelemetry
 platform-http-jolokia
 platform-http-main
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others/openapi-validator.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others/openapi-validator.json
new file mode 100644
index 00000000000..4439b1cdd95
--- /dev/null
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others/openapi-validator.json
@@ -0,0 +1,15 @@
+{
+  "other": {
+    "kind": "other",
+    "name": "openapi-validator",
+    "title": "Openapi Validator",
+    "description": "OpenAPI validator for Camel Rest DSL",
+    "deprecated": false,
+    "firstVersion": "4.7.0",
+    "label": "rest,api",
+    "supportLevel": "Preview",
+    "groupId": "org.apache.camel",
+    "artifactId": "camel-openapi-validator",
+    "version": "4.7.0-SNAPSHOT"
+  }
+}
diff --git a/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Endpoint.java b/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Endpoint.java
index 322d15ac967..c8857fbde77 100644
--- a/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Endpoint.java
+++ b/components/camel-aws/camel-aws2-ses/src/main/java/org/apache/camel/component/aws2/ses/Ses2Endpoint.java
@@ -29,8 +29,6 @@ import org.apache.camel.support.DefaultEndpoint;
 import org.apache.camel.util.ObjectHelper;
 import software.amazon.awssdk.services.ses.SesClient;
 
-import java.util.Map;
-
 /**
  * Send e-mails through AWS SES service.
  */
diff --git a/components/camel-openapi-validator/src/test/java/org/apache/camel/component/rest/openapi/validator/client/OpenApiRestClientRequestValidatorTest.java b/components/camel-openapi-validator/src/test/java/org/apache/camel/component/rest/openapi/validator/client/OpenApiRestClientRequestValidatorTest.java
index 62b2cb883b7..4a70e0b2649 100644
--- a/components/camel-openapi-validator/src/test/java/org/apache/camel/component/rest/openapi/validator/client/OpenApiRestClientRequestValidatorTest.java
+++ b/components/camel-openapi-validator/src/test/java/org/apache/camel/component/rest/openapi/validator/client/OpenApiRestClientRequestValidatorTest.java
@@ -44,8 +44,9 @@ public class OpenApiRestClientRequestValidatorTest extends ExchangeTestSupport {
 
         OpenApiRestClientRequestValidator validator = new OpenApiRestClientRequestValidator();
 
-        RestClientRequestValidator.ValidationError error = validator.validate(exchange, new RestClientRequestValidator.ValidationContext(
-                "application/json", "application/json", true, null, null, null, null));
+        RestClientRequestValidator.ValidationError error
+                = validator.validate(exchange, new RestClientRequestValidator.ValidationContext(
+                        "application/json", "application/json", true, null, null, null, null));
 
         Assertions.assertNotNull(error);
         Assertions.assertTrue(error.body().contains("A request body is required but none found"));
diff --git a/components/pom.xml b/components/pom.xml
index a6e903a87e2..a2029870173 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -295,6 +295,7 @@
         <module>camel-stitch</module>
         <module>camel-swift</module>
         <module>camel-openapi-java</module>
+        <module>camel-openapi-validator</module>
         <module>camel-opensearch</module>
         <module>camel-optaplanner</module>
         <module>camel-syslog</module>