This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new ff68eeb CAMEL-16758: Base commit for Huawei Cloud OBS Component
(#5753)
ff68eeb is described below
commit ff68eeb5fd860bfe902363c00f4e693515a6398c
Author: Hokutor <[email protected]>
AuthorDate: Thu Jul 1 00:27:16 2021 -0400
CAMEL-16758: Base commit for Huawei Cloud OBS Component (#5753)
* CAMEL-16758: Base commit for Huawei Cloud OBS component
* CAMEL-16758: Fixing warning messages
* CAMEL-16758: Update documentation
* CAMEL-16758: Update firstVersion and pom version
* CAMEL-16758: Resolving review comments
* CAMEL-16758: Update indentation in parent/pom file
* CAMEL-16758: Resolving review comments
* CAMEL-16758 - making OBSRegion key case insensitive to user inputs
making OBSRegion key case insensitive to user inputs
* CAMEL-16758 - making OBSRegion key case insensitive to user inputs
making OBSRegion key case insensitive to user inputs
* CAMEL-16758: Update title
* Update doc title
* CAMEL-16758: Update title
---
bom/camel-bom/pom.xml | 5 +
.../camel-huawei/camel-huaweicloud-obs/pom.xml | 83 ++++++
.../huaweicloud/obs/OBSComponentConfigurer.java | 61 +++++
.../huaweicloud/obs/OBSEndpointConfigurer.java | 133 ++++++++++
.../huaweicloud/obs/OBSEndpointUriFactory.java | 83 ++++++
.../apache/camel/configurer/hwcloud-obs-component | 2 +
.../apache/camel/configurer/hwcloud-obs-endpoint | 2 +
.../apache/camel/urifactory/hwcloud-obs-endpoint | 2 +
.../component/huaweicloud/obs/hwcloud-obs.json | 48 ++++
.../src/main/docs/hwcloud-obs-component.adoc | 142 +++++++++++
.../component/huaweicloud/obs/OBSComponent.java | 32 +++
.../component/huaweicloud/obs/OBSEndpoint.java | 277 +++++++++++++++++++++
.../component/huaweicloud/obs/OBSProducer.java | 203 +++++++++++++++
.../huaweicloud/obs/constants/OBSConstants.java | 27 ++
.../huaweicloud/obs/constants/OBSOperations.java | 29 +++
.../huaweicloud/obs/constants/OBSProperties.java | 29 +++
.../obs/models/ClientConfigurations.java | 54 ++++
.../huaweicloud/obs/models/OBSRegion.java | 88 +++++++
.../huaweicloud/obs/models/ServiceKeys.java | 54 ++++
.../org/apache/camel/component/hwcloud-obs | 1 +
.../huaweicloud/obs/CreateBucketJsonTest.java | 79 ++++++
.../huaweicloud/obs/CreateBucketPojoTest.java | 79 ++++++
.../huaweicloud/obs/CreateBucketTest.java | 79 ++++++
.../huaweicloud/obs/DeleteBucketTest.java | 85 +++++++
.../component/huaweicloud/obs/ListBucketsTest.java | 88 +++++++
.../huaweicloud/obs/TestConfiguration.java | 49 ++++
.../obs/constants/OBSConstantsTest.java | 28 +++
.../obs/constants/OBSOperationsTest.java | 30 +++
.../obs/constants/OBSPropertiesTest.java | 30 +++
.../huaweicloud/obs/models/OBSRegionTest.java | 41 +++
.../src/test/resources/log4j2.properties | 28 +++
components/camel-huawei/pom.xml | 1 +
parent/pom.xml | 6 +
33 files changed, 1978 insertions(+)
diff --git a/bom/camel-bom/pom.xml b/bom/camel-bom/pom.xml
index 6e85f08..f3500fe 100644
--- a/bom/camel-bom/pom.xml
+++ b/bom/camel-bom/pom.xml
@@ -942,6 +942,11 @@
<artifactId>camel-huaweicloud-iam</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-huaweicloud-obs</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-huaweicloud-smn</artifactId>
diff --git a/components/camel-huawei/camel-huaweicloud-obs/pom.xml
b/components/camel-huawei/camel-huaweicloud-obs/pom.xml
new file mode 100644
index 0000000..bd1cafd
--- /dev/null
+++ b/components/camel-huawei/camel-huaweicloud-obs/pom.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-huawei-parent</artifactId>
+ <version>3.12.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>camel-huaweicloud-obs</artifactId>
+ <packaging>jar</packaging>
+ <name>Camel :: Huawei Cloud :: OBS Component</name>
+ <description>To provide stable, secure, efficient, and easy-to-use cloud
storage service on Huawei Cloud</description>
+
+ <dependencies>
+
+ <!-- camel -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-support</artifactId>
+ </dependency>
+
+ <!-- HuaweiCloud OBS SDK -->
+ <dependency>
+ <groupId>com.huaweicloud</groupId>
+ <artifactId>esdk-obs-java</artifactId>
+ <version>${huaweicloud-obs-version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>${gson-version}</version>
+ </dependency>
+
+ <!-- logging -->
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ <version>${log4j2-version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- testing -->
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <version>${junit-jupiter-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>${mockito-version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/generated/java/org/apache/camel/component/huaweicloud/obs/OBSComponentConfigurer.java
b/components/camel-huawei/camel-huaweicloud-obs/src/generated/java/org/apache/camel/component/huaweicloud/obs/OBSComponentConfigurer.java
new file mode 100644
index 0000000..f7417e4
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/generated/java/org/apache/camel/component/huaweicloud/obs/OBSComponentConfigurer.java
@@ -0,0 +1,61 @@
+/* Generated by camel build tools - do NOT edit this file! */
+package org.apache.camel.component.huaweicloud.obs;
+
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spi.ExtendedPropertyConfigurerGetter;
+import org.apache.camel.spi.PropertyConfigurerGetter;
+import org.apache.camel.spi.ConfigurerStrategy;
+import org.apache.camel.spi.GeneratedPropertyConfigurer;
+import org.apache.camel.util.CaseInsensitiveMap;
+import org.apache.camel.support.component.PropertyConfigurerSupport;
+
+/**
+ * Generated by camel build tools - do NOT edit this file!
+ */
+@SuppressWarnings("unchecked")
+public class OBSComponentConfigurer extends PropertyConfigurerSupport
implements GeneratedPropertyConfigurer, PropertyConfigurerGetter {
+
+ @Override
+ public boolean configure(CamelContext camelContext, Object obj, String
name, Object value, boolean ignoreCase) {
+ OBSComponent target = (OBSComponent) obj;
+ switch (ignoreCase ? name.toLowerCase() : name) {
+ case "autowiredenabled":
+ case "autowiredEnabled":
target.setAutowiredEnabled(property(camelContext, boolean.class, value));
return true;
+ case "bridgeerrorhandler":
+ case "bridgeErrorHandler":
target.setBridgeErrorHandler(property(camelContext, boolean.class, value));
return true;
+ case "lazystartproducer":
+ case "lazyStartProducer":
target.setLazyStartProducer(property(camelContext, boolean.class, value));
return true;
+ default: return false;
+ }
+ }
+
+ @Override
+ public Class<?> getOptionType(String name, boolean ignoreCase) {
+ switch (ignoreCase ? name.toLowerCase() : name) {
+ case "autowiredenabled":
+ case "autowiredEnabled": return boolean.class;
+ case "bridgeerrorhandler":
+ case "bridgeErrorHandler": return boolean.class;
+ case "lazystartproducer":
+ case "lazyStartProducer": return boolean.class;
+ default: return null;
+ }
+ }
+
+ @Override
+ public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
+ OBSComponent target = (OBSComponent) obj;
+ switch (ignoreCase ? name.toLowerCase() : name) {
+ case "autowiredenabled":
+ case "autowiredEnabled": return target.isAutowiredEnabled();
+ case "bridgeerrorhandler":
+ case "bridgeErrorHandler": return target.isBridgeErrorHandler();
+ case "lazystartproducer":
+ case "lazyStartProducer": return target.isLazyStartProducer();
+ default: return null;
+ }
+ }
+}
+
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/generated/java/org/apache/camel/component/huaweicloud/obs/OBSEndpointConfigurer.java
b/components/camel-huawei/camel-huaweicloud-obs/src/generated/java/org/apache/camel/component/huaweicloud/obs/OBSEndpointConfigurer.java
new file mode 100644
index 0000000..6006444
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/generated/java/org/apache/camel/component/huaweicloud/obs/OBSEndpointConfigurer.java
@@ -0,0 +1,133 @@
+/* Generated by camel build tools - do NOT edit this file! */
+package org.apache.camel.component.huaweicloud.obs;
+
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spi.ExtendedPropertyConfigurerGetter;
+import org.apache.camel.spi.PropertyConfigurerGetter;
+import org.apache.camel.spi.ConfigurerStrategy;
+import org.apache.camel.spi.GeneratedPropertyConfigurer;
+import org.apache.camel.util.CaseInsensitiveMap;
+import org.apache.camel.support.component.PropertyConfigurerSupport;
+
+/**
+ * Generated by camel build tools - do NOT edit this file!
+ */
+@SuppressWarnings("unchecked")
+public class OBSEndpointConfigurer extends PropertyConfigurerSupport
implements GeneratedPropertyConfigurer, PropertyConfigurerGetter {
+
+ @Override
+ public boolean configure(CamelContext camelContext, Object obj, String
name, Object value, boolean ignoreCase) {
+ OBSEndpoint target = (OBSEndpoint) obj;
+ switch (ignoreCase ? name.toLowerCase() : name) {
+ case "authenticationkey":
+ case "authenticationKey":
target.setAuthenticationKey(property(camelContext, java.lang.String.class,
value)); return true;
+ case "bridgeerrorhandler":
+ case "bridgeErrorHandler":
target.setBridgeErrorHandler(property(camelContext, boolean.class, value));
return true;
+ case "bucketlocation":
+ case "bucketLocation": target.setBucketLocation(property(camelContext,
java.lang.String.class, value)); return true;
+ case "bucketname":
+ case "bucketName": target.setBucketName(property(camelContext,
java.lang.String.class, value)); return true;
+ case "endpoint": target.setEndpoint(property(camelContext,
java.lang.String.class, value)); return true;
+ case "exceptionhandler":
+ case "exceptionHandler":
target.setExceptionHandler(property(camelContext,
org.apache.camel.spi.ExceptionHandler.class, value)); return true;
+ case "exchangepattern":
+ case "exchangePattern":
target.setExchangePattern(property(camelContext,
org.apache.camel.ExchangePattern.class, value)); return true;
+ case "ignoresslverification":
+ case "ignoreSslVerification":
target.setIgnoreSslVerification(property(camelContext, boolean.class, value));
return true;
+ case "lazystartproducer":
+ case "lazyStartProducer":
target.setLazyStartProducer(property(camelContext, boolean.class, value));
return true;
+ case "proxyhost":
+ case "proxyHost": target.setProxyHost(property(camelContext,
java.lang.String.class, value)); return true;
+ case "proxypassword":
+ case "proxyPassword": target.setProxyPassword(property(camelContext,
java.lang.String.class, value)); return true;
+ case "proxyport":
+ case "proxyPort": target.setProxyPort(property(camelContext,
int.class, value)); return true;
+ case "proxyuser":
+ case "proxyUser": target.setProxyUser(property(camelContext,
java.lang.String.class, value)); return true;
+ case "region": target.setRegion(property(camelContext,
java.lang.String.class, value)); return true;
+ case "secretkey":
+ case "secretKey": target.setSecretKey(property(camelContext,
java.lang.String.class, value)); return true;
+ case "servicekeys":
+ case "serviceKeys": target.setServiceKeys(property(camelContext,
org.apache.camel.component.huaweicloud.obs.models.ServiceKeys.class, value));
return true;
+ default: return false;
+ }
+ }
+
+ @Override
+ public Class<?> getOptionType(String name, boolean ignoreCase) {
+ switch (ignoreCase ? name.toLowerCase() : name) {
+ case "authenticationkey":
+ case "authenticationKey": return java.lang.String.class;
+ case "bridgeerrorhandler":
+ case "bridgeErrorHandler": return boolean.class;
+ case "bucketlocation":
+ case "bucketLocation": return java.lang.String.class;
+ case "bucketname":
+ case "bucketName": return java.lang.String.class;
+ case "endpoint": return java.lang.String.class;
+ case "exceptionhandler":
+ case "exceptionHandler": return
org.apache.camel.spi.ExceptionHandler.class;
+ case "exchangepattern":
+ case "exchangePattern": return org.apache.camel.ExchangePattern.class;
+ case "ignoresslverification":
+ case "ignoreSslVerification": return boolean.class;
+ case "lazystartproducer":
+ case "lazyStartProducer": return boolean.class;
+ case "proxyhost":
+ case "proxyHost": return java.lang.String.class;
+ case "proxypassword":
+ case "proxyPassword": return java.lang.String.class;
+ case "proxyport":
+ case "proxyPort": return int.class;
+ case "proxyuser":
+ case "proxyUser": return java.lang.String.class;
+ case "region": return java.lang.String.class;
+ case "secretkey":
+ case "secretKey": return java.lang.String.class;
+ case "servicekeys":
+ case "serviceKeys": return
org.apache.camel.component.huaweicloud.obs.models.ServiceKeys.class;
+ default: return null;
+ }
+ }
+
+ @Override
+ public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
+ OBSEndpoint target = (OBSEndpoint) obj;
+ switch (ignoreCase ? name.toLowerCase() : name) {
+ case "authenticationkey":
+ case "authenticationKey": return target.getAuthenticationKey();
+ case "bridgeerrorhandler":
+ case "bridgeErrorHandler": return target.isBridgeErrorHandler();
+ case "bucketlocation":
+ case "bucketLocation": return target.getBucketLocation();
+ case "bucketname":
+ case "bucketName": return target.getBucketName();
+ case "endpoint": return target.getEndpoint();
+ case "exceptionhandler":
+ case "exceptionHandler": return target.getExceptionHandler();
+ case "exchangepattern":
+ case "exchangePattern": return target.getExchangePattern();
+ case "ignoresslverification":
+ case "ignoreSslVerification": return target.isIgnoreSslVerification();
+ case "lazystartproducer":
+ case "lazyStartProducer": return target.isLazyStartProducer();
+ case "proxyhost":
+ case "proxyHost": return target.getProxyHost();
+ case "proxypassword":
+ case "proxyPassword": return target.getProxyPassword();
+ case "proxyport":
+ case "proxyPort": return target.getProxyPort();
+ case "proxyuser":
+ case "proxyUser": return target.getProxyUser();
+ case "region": return target.getRegion();
+ case "secretkey":
+ case "secretKey": return target.getSecretKey();
+ case "servicekeys":
+ case "serviceKeys": return target.getServiceKeys();
+ default: return null;
+ }
+ }
+}
+
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/generated/java/org/apache/camel/component/huaweicloud/obs/OBSEndpointUriFactory.java
b/components/camel-huawei/camel-huaweicloud-obs/src/generated/java/org/apache/camel/component/huaweicloud/obs/OBSEndpointUriFactory.java
new file mode 100644
index 0000000..c8cbdfd
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/generated/java/org/apache/camel/component/huaweicloud/obs/OBSEndpointUriFactory.java
@@ -0,0 +1,83 @@
+/* Generated by camel build tools - do NOT edit this file! */
+package org.apache.camel.component.huaweicloud.obs;
+
+import java.net.URISyntaxException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.camel.spi.EndpointUriFactory;
+
+/**
+ * Generated by camel build tools - do NOT edit this file!
+ */
+public class OBSEndpointUriFactory extends
org.apache.camel.support.component.EndpointUriFactorySupport implements
EndpointUriFactory {
+
+ private static final String BASE = ":operation";
+
+ private static final Set<String> PROPERTY_NAMES;
+ private static final Set<String> SECRET_PROPERTY_NAMES;
+ static {
+ Set<String> props = new HashSet<>(17);
+ props.add("bucketName");
+ props.add("serviceKeys");
+ props.add("secretKey");
+ props.add("bucketLocation");
+ props.add("proxyPassword");
+ props.add("exchangePattern");
+ props.add("ignoreSslVerification");
+ props.add("authenticationKey");
+ props.add("proxyHost");
+ props.add("proxyPort");
+ props.add("endpoint");
+ props.add("lazyStartProducer");
+ props.add("bridgeErrorHandler");
+ props.add("proxyUser");
+ props.add("region");
+ props.add("operation");
+ props.add("exceptionHandler");
+ PROPERTY_NAMES = Collections.unmodifiableSet(props);
+ Set<String> secretProps = new HashSet<>(5);
+ secretProps.add("serviceKeys");
+ secretProps.add("secretKey");
+ secretProps.add("proxyPassword");
+ secretProps.add("proxyUser");
+ secretProps.add("authenticationKey");
+ SECRET_PROPERTY_NAMES = Collections.unmodifiableSet(secretProps);
+ }
+
+ @Override
+ public boolean isEnabled(String scheme) {
+ return "hwcloud-obs".equals(scheme);
+ }
+
+ @Override
+ public String buildUri(String scheme, Map<String, Object> properties,
boolean encode) throws URISyntaxException {
+ String syntax = scheme + BASE;
+ String uri = syntax;
+
+ Map<String, Object> copy = new HashMap<>(properties);
+
+ uri = buildPathParameter(syntax, uri, "operation", null, true, copy);
+ uri = buildQueryParameters(uri, copy, encode);
+ return uri;
+ }
+
+ @Override
+ public Set<String> propertyNames() {
+ return PROPERTY_NAMES;
+ }
+
+ @Override
+ public Set<String> secretPropertyNames() {
+ return SECRET_PROPERTY_NAMES;
+ }
+
+ @Override
+ public boolean isLenientProperties() {
+ return false;
+ }
+}
+
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/generated/resources/META-INF/services/org/apache/camel/configurer/hwcloud-obs-component
b/components/camel-huawei/camel-huaweicloud-obs/src/generated/resources/META-INF/services/org/apache/camel/configurer/hwcloud-obs-component
new file mode 100644
index 0000000..95a0409
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/generated/resources/META-INF/services/org/apache/camel/configurer/hwcloud-obs-component
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.component.huaweicloud.obs.OBSComponentConfigurer
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/generated/resources/META-INF/services/org/apache/camel/configurer/hwcloud-obs-endpoint
b/components/camel-huawei/camel-huaweicloud-obs/src/generated/resources/META-INF/services/org/apache/camel/configurer/hwcloud-obs-endpoint
new file mode 100644
index 0000000..566c3e5
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/generated/resources/META-INF/services/org/apache/camel/configurer/hwcloud-obs-endpoint
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.component.huaweicloud.obs.OBSEndpointConfigurer
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/generated/resources/META-INF/services/org/apache/camel/urifactory/hwcloud-obs-endpoint
b/components/camel-huawei/camel-huaweicloud-obs/src/generated/resources/META-INF/services/org/apache/camel/urifactory/hwcloud-obs-endpoint
new file mode 100644
index 0000000..ef084c6
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/generated/resources/META-INF/services/org/apache/camel/urifactory/hwcloud-obs-endpoint
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.component.huaweicloud.obs.OBSEndpointUriFactory
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/generated/resources/org/apache/camel/component/huaweicloud/obs/hwcloud-obs.json
b/components/camel-huawei/camel-huaweicloud-obs/src/generated/resources/org/apache/camel/component/huaweicloud/obs/hwcloud-obs.json
new file mode 100644
index 0000000..8ea97ee
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/generated/resources/org/apache/camel/component/huaweicloud/obs/hwcloud-obs.json
@@ -0,0 +1,48 @@
+{
+ "component": {
+ "kind": "component",
+ "name": "hwcloud-obs",
+ "title": "Huawei Cloud Object Storage Service (OBS)",
+ "description": "To provide stable, secure, efficient, and easy-to-use
cloud storage service on Huawei Cloud",
+ "deprecated": false,
+ "firstVersion": "3.11.0",
+ "label": "cloud",
+ "javaType": "org.apache.camel.component.huaweicloud.obs.OBSComponent",
+ "supportLevel": "Preview",
+ "groupId": "org.apache.camel",
+ "artifactId": "camel-huaweicloud-obs",
+ "version": "3.11.0-SNAPSHOT",
+ "scheme": "hwcloud-obs",
+ "extendsScheme": "",
+ "syntax": "hwcloud-obs:operation",
+ "async": false,
+ "api": false,
+ "consumerOnly": false,
+ "producerOnly": false,
+ "lenientProperties": false
+ },
+ "componentProperties": {
+ "bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error
Handler", "group": "consumer", "label": "consumer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "Allows for bridging the
consumer to the Camel routing Error Handler, which mean any exceptions occurred
while the consumer is trying to pickup incoming messages, or the likes, will
now be processed as a me [...]
+ "lazyStartProducer": { "kind": "property", "displayName": "Lazy Start
Producer", "group": "producer", "label": "producer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "Whether the producer
should be started lazy (on the first message). By starting lazy you can use
this to allow CamelContext and routes to startup in situations where a producer
may otherwise fail during star [...]
+ "autowiredEnabled": { "kind": "property", "displayName": "Autowired
Enabled", "group": "advanced", "label": "advanced", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Whether autowiring is
enabled. This is used for automatic autowiring options (the option must be
marked as autowired) by looking up in the registry to find if there is a single
instance of matching type, which t [...]
+ },
+ "properties": {
+ "operation": { "kind": "path", "displayName": "Operation", "group":
"producer", "label": "producer", "required": true, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "deprecationNote": "",
"autowired": false, "secret": false, "description": "Operation to be performed"
},
+ "authenticationKey": { "kind": "parameter", "displayName": "API
authentication key (AK)", "group": "common", "label": "", "required": true,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": true, "description":
"Authentication key for the cloud user" },
+ "bucketLocation": { "kind": "parameter", "displayName": "Bucket Location",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "deprecationNote": "",
"autowired": false, "secret": false, "description": "Location of bucket when
creating a new bucket" },
+ "bucketName": { "kind": "parameter", "displayName": "Bucket Name",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "deprecationNote": "",
"autowired": false, "secret": false, "description": "Name of bucket to perform
operation on" },
+ "endpoint": { "kind": "parameter", "displayName": "Endpoint url", "group":
"common", "label": "", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "deprecationNote": "", "autowired":
false, "secret": false, "description": "OBS url. Carries higher precedence than
region parameter based client initialization" },
+ "ignoreSslVerification": { "kind": "parameter", "displayName": "SSL
Verification Ignored", "group": "common", "label": "", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false,
"deprecationNote": "", "autowired": false, "secret": false, "defaultValue":
false, "description": "Ignore SSL verification" },
+ "proxyHost": { "kind": "parameter", "displayName": "Proxy server host",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "deprecationNote": "",
"autowired": false, "secret": false, "description": "Proxy server ip\/hostname"
},
+ "proxyPassword": { "kind": "parameter", "displayName": "Proxy password",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "deprecationNote": "",
"autowired": false, "secret": true, "description": "Proxy authentication
password" },
+ "proxyPort": { "kind": "parameter", "displayName": "Proxy server port",
"group": "common", "label": "", "required": false, "type": "integer",
"javaType": "int", "deprecated": false, "deprecationNote": "", "autowired":
false, "secret": false, "description": "Proxy server port" },
+ "proxyUser": { "kind": "parameter", "displayName": "Proxy user", "group":
"common", "label": "", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "deprecationNote": "", "autowired":
false, "secret": true, "description": "Proxy authentication user" },
+ "region": { "kind": "parameter", "displayName": "Service region", "group":
"common", "label": "", "required": true, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "deprecationNote": "", "autowired":
false, "secret": false, "description": "OBS service region. This is lower
precedence than endpoint based configuration" },
+ "secretKey": { "kind": "parameter", "displayName": "API secret key (SK)",
"group": "common", "label": "", "required": true, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "deprecationNote": "", "autowired":
false, "secret": true, "description": "Secret key for the cloud user" },
+ "serviceKeys": { "kind": "parameter", "displayName": "Service
Configuration", "group": "common", "label": "", "required": false, "type":
"object", "javaType":
"org.apache.camel.component.huaweicloud.obs.models.ServiceKeys", "deprecated":
false, "deprecationNote": "", "autowired": false, "secret": true,
"description": "Configuration object for cloud service authentication" },
+ "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error
Handler", "group": "consumer", "label": "consumer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "Allows for bridging the
consumer to the Camel routing Error Handler, which mean any exceptions occurred
while the consumer is trying to pickup incoming messages, or the likes, will
now be processed as a m [...]
+ "exceptionHandler": { "kind": "parameter", "displayName": "Exception
Handler", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.",
"deprecated": false, "autowired": false, "secret": false, "description": "To
let the consumer use a custom ExceptionHandler. Notice if the option
bridgeErrorHandler is enabled then this option is not in use. By default the
con [...]
+ "exchangePattern": { "kind": "parameter", "displayName": "Exchange
Pattern", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut",
"InOptionalOut" ], "deprecated": false, "autowired": false, "secret": false,
"description": "Sets the exchange pattern when the consumer creates an
exchange." },
+ "lazyStartProducer": { "kind": "parameter", "displayName": "Lazy Start
Producer", "group": "producer", "label": "producer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "Whether the producer
should be started lazy (on the first message). By starting lazy you can use
this to allow CamelContext and routes to startup in situations where a producer
may otherwise fail during sta [...]
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/main/docs/hwcloud-obs-component.adoc
b/components/camel-huawei/camel-huaweicloud-obs/src/main/docs/hwcloud-obs-component.adoc
new file mode 100644
index 0000000..f80456d
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/main/docs/hwcloud-obs-component.adoc
@@ -0,0 +1,142 @@
+[[hwcloud-obs-component]]
+= Huawei Object Storage Service (OBS) Component
+:docTitle: Huawei Object Storage Service (OBS)
+:artifactId: camel-huaweicloud-obs
+:description: To provide stable, secure, efficient, and easy-to-use cloud
storage service on Huawei Cloud
+:since: 3.11
+:supportLevel: Preview
+:component-header: Both producer and consumer are supported
+include::{cq-version}@camel-quarkus:ROOT:partial$reference/components/hwcloud-obs.adoc[opts=optional]
+//Manually maintained attributes
+:group: Huawei Cloud
+
+*Since Camel {since}*
+
+*{component-header}*
+
+Huawei Cloud Object Storage Service (OBS) component allows you to integrate
with https://www.huaweicloud.com/intl/en-us/product/obs.html[OBS] provided by
Huawei Cloud.
+
+Maven users will need to add the following dependency to their `pom.xml` for
this component:
+
+[source,xml]
+----
+<dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-huaweicloud-obs</artifactId>
+ <version>x.x.x</version>
+ <!-- use the same version as your Camel core version -->
+</dependency>
+----
+
+== URI Format
+
+[source,text]
+----
+hwcloud-obs:operation[?options]
+----
+
+== URI Options
+
+// component options: START
+The Huawei Object Storage Service (OBS) component supports 2 options, which
are listed below.
+
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *lazyStartProducer* (producer) | Whether the producer should be started lazy
(on the first message). By starting lazy you can use this to allow CamelContext
and routes to startup in situations where a producer may otherwise fail during
starting and cause the route to fail being started. By deferring this startup
to be lazy then the startup failure can be handled during routing messages via
Camel's routing error handlers. Beware that when the first message is processed
then creating and [...]
+| *autowiredEnabled* (advanced) | Whether autowiring is enabled. This is used
for automatic autowiring options (the option must be marked as autowired) by
looking up in the registry to find if there is a single instance of matching
type, which then gets configured on the component. This can be used for
automatic configuring JDBC data sources, JMS connection factories, AWS Clients,
etc. | true | boolean
+|===
+// component options: END
+
+// endpoint options: START
+The Huawei Object Storage Service (OBS) endpoint is configured using URI
syntax:
+
+----
+hwcloud-obs:operation
+----
+
+with the following path and query parameters:
+
+=== Path Parameters (1 parameters):
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *operation* | *Required* Operation to be performed | | String
+|===
+
+
+=== Query Parameters (13 parameters):
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *authenticationKey* (producer) | *Required* Authentication key for the cloud
user | | String
+| *bucketLocation* (producer) | Location of bucket when creating a new bucket
| cn-north-1 | String
+| *bucketName* (producer) | Name of bucket to perform operation on | | String
+| *endpoint* (producer) | OBS url. Carries higher precedence than region
parameter based client initialization | | String
+| *ignoreSslVerification* (producer) | Ignore SSL verification | false |
boolean
+| *lazyStartProducer* (producer) | Whether the producer should be started lazy
(on the first message). By starting lazy you can use this to allow CamelContext
and routes to startup in situations where a producer may otherwise fail during
starting and cause the route to fail being started. By deferring this startup
to be lazy then the startup failure can be handled during routing messages via
Camel's routing error handlers. Beware that when the first message is processed
then creating and [...]
+| *proxyHost* (producer) | Proxy server ip/hostname | | String
+| *proxyPassword* (producer) | Proxy authentication password | | String
+| *proxyPort* (producer) | Proxy server port | | int
+| *proxyUser* (producer) | Proxy authentication user | | String
+| *region* (producer) | *Required* OBS service region. This is lower
precedence than endpoint based configuration | | String
+| *secretKey* (producer) | *Required* Secret key for the cloud user | | String
+| *serviceKeys* (producer) | Configuration object for cloud service
authentication | | ServiceKeys
+|===
+// endpoint options: END
+
+
+== Usage
+
+=== Message properties evaluated by the OBS producer
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Header |Type |Description
+
+|`CamelHwCloudObsOperation` |`String` | Name of operation to invoke
+
+|`CamelHwCloudObsBucketName` |`String` | Bucket name to invoke operation on
+
+|`CamelHwCloudObsBucketLocation` |`String` | Bucket location when creating a
new bucket
+
+|=======================================================================
+
+If any of the above properties are set, they will override their corresponding
query parameter.
+
+== List of Supported OBS Operations
+
+- listBuckets
+- createBucket - `bucketName` parameter is *required*, `bucketLocation`
parameter is optional
+- deleteBucket - `bucketName` parameter is *required*
+
+
+== Using ServiceKey Configuration Bean
+
+Authentication key and secret keys are required to authenticate against the
OBS cloud. You can avoid having them being exposed
+and scattered over in your endpoint uri by wrapping them inside a bean of
class `org.apache.camel.component.huaweicloud.obs.models.ServiceKeys`.
+Add it to the registry and let Camel look it up by referring the object via
endpoint query parameter `serviceKeys`.
+
+Check the following code snippets:
+
+[source,xml]
+----
+<bean id="myServiceKeyConfig"
class="org.apache.camel.component.huaweicloud.obs.models.ServiceKeys">
+ <property name="authenticationKey" value="your_authentication_key" />
+ <property name="secretKey" value="your_secret_key" />
+</bean>
+----
+[source,java]
+----
+from("direct:triggerRoute")
+ .setProperty(OBSPropeties.OPERATION, constant("createBucket"))
+ .setProperty(OBSPropeties.BUCKET_NAME ,constant("your_bucket_name"))
+ .setProperty(OBSPropeties.BUCKET_LOCATION, constant("your_bucket_location))
+
.to("hwcloud-obs:createBucket?region=cn-north-4&serviceKeys=#myServiceKeyConfig")
+----
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/OBSComponent.java
b/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/OBSComponent.java
new file mode 100644
index 0000000..b6c690e
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/OBSComponent.java
@@ -0,0 +1,32 @@
+/*
+ * 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.component.huaweicloud.obs;
+
+import java.util.Map;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.support.DefaultComponent;
+
[email protected]("hwcloud-obs")
+public class OBSComponent extends DefaultComponent {
+
+ protected Endpoint createEndpoint(String uri, String remaining,
Map<String, Object> parameters) throws Exception {
+ Endpoint endpoint = new OBSEndpoint(uri, remaining, this);
+ setProperties(endpoint, parameters);
+ return endpoint;
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/OBSEndpoint.java
b/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/OBSEndpoint.java
new file mode 100644
index 0000000..0246c9f
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/OBSEndpoint.java
@@ -0,0 +1,277 @@
+/*
+ * 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.component.huaweicloud.obs;
+
+import com.obs.services.HttpProxyConfiguration;
+import com.obs.services.ObsClient;
+import com.obs.services.ObsConfiguration;
+import org.apache.camel.Category;
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.component.huaweicloud.obs.models.OBSRegion;
+import org.apache.camel.component.huaweicloud.obs.models.ServiceKeys;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriPath;
+import org.apache.camel.support.DefaultEndpoint;
+import org.apache.camel.util.ObjectHelper;
+
+/**
+ * To provide stable, secure, efficient, and easy-to-use cloud storage service
on Huawei Cloud
+ */
+@UriEndpoint(firstVersion = "3.12.0", scheme = "hwcloud-obs", title = "Huawei
Object Storage Service (OBS)",
+ syntax = "hwcloud-obs:operation",
+ category = { Category.CLOUD })
+public class OBSEndpoint extends DefaultEndpoint {
+
+ @UriPath(description = "Operation to be performed", displayName =
"Operation", label = "producer")
+ @Metadata(required = true)
+ private String operation;
+
+ @UriParam(description = "OBS service region. This is lower precedence than
endpoint based configuration",
+ displayName = "Service region")
+ @Metadata(required = true)
+ private String region;
+
+ @UriParam(description = "OBS url. Carries higher precedence than region
parameter based client initialization",
+ displayName = "Endpoint url")
+ @Metadata(required = false)
+ private String endpoint;
+
+ @UriParam(description = "Proxy server ip/hostname", displayName = "Proxy
server host")
+ @Metadata(required = false)
+ private String proxyHost;
+
+ @UriParam(description = "Proxy server port", displayName = "Proxy server
port")
+ @Metadata(required = false)
+ private int proxyPort;
+
+ @UriParam(description = "Proxy authentication user", displayName = "Proxy
user", secret = true)
+ @Metadata(required = false)
+ private String proxyUser;
+
+ @UriParam(description = "Proxy authentication password", displayName =
"Proxy password", secret = true)
+ @Metadata(required = false)
+ private String proxyPassword;
+
+ @UriParam(description = "Ignore SSL verification", displayName = "SSL
Verification Ignored", defaultValue = "false")
+ @Metadata(required = false)
+ private boolean ignoreSslVerification;
+
+ @UriParam(description = "Configuration object for cloud service
authentication", displayName = "Service Configuration",
+ secret = true)
+ @Metadata(required = false)
+ private ServiceKeys serviceKeys;
+
+ @UriParam(description = "Authentication key for the cloud user",
displayName = "API authentication key (AK)", secret = true)
+ @Metadata(required = true)
+ private String authenticationKey;
+
+ @UriParam(description = "Secret key for the cloud user", displayName =
"API secret key (SK)", secret = true)
+ @Metadata(required = true)
+ private String secretKey;
+
+ @UriParam(description = "Name of bucket to perform operation on",
displayName = "Bucket Name")
+ @Metadata(required = false)
+ private String bucketName;
+
+ @UriParam(description = "Location of bucket when creating a new bucket",
displayName = "Bucket Location")
+ @Metadata(required = false)
+ private String bucketLocation;
+
+ private ObsClient obsClient;
+
+ public OBSEndpoint() {
+ }
+
+ public OBSEndpoint(String uri, String operation, OBSComponent component) {
+ super(uri, component);
+ this.operation = operation;
+ }
+
+ public Producer createProducer() throws Exception {
+ return new OBSProducer(this);
+ }
+
+ public Consumer createConsumer(Processor processor) throws Exception {
+ throw new UnsupportedOperationException("You cannot receive messages
from this endpoint");
+ }
+
+ public String getOperation() {
+ return operation;
+ }
+
+ public void setOperation(String operation) {
+ this.operation = operation;
+ }
+
+ public String getRegion() {
+ return region;
+ }
+
+ public void setRegion(String region) {
+ this.region = region;
+ }
+
+ public String getEndpoint() {
+ return endpoint;
+ }
+
+ public void setEndpoint(String endpoint) {
+ this.endpoint = endpoint;
+ }
+
+ public String getProxyHost() {
+ return proxyHost;
+ }
+
+ public void setProxyHost(String proxyHost) {
+ this.proxyHost = proxyHost;
+ }
+
+ public int getProxyPort() {
+ return proxyPort;
+ }
+
+ public void setProxyPort(int proxyPort) {
+ this.proxyPort = proxyPort;
+ }
+
+ public String getProxyUser() {
+ return proxyUser;
+ }
+
+ public void setProxyUser(String proxyUser) {
+ this.proxyUser = proxyUser;
+ }
+
+ public String getProxyPassword() {
+ return proxyPassword;
+ }
+
+ public void setProxyPassword(String proxyPassword) {
+ this.proxyPassword = proxyPassword;
+ }
+
+ public boolean isIgnoreSslVerification() {
+ return ignoreSslVerification;
+ }
+
+ public void setIgnoreSslVerification(boolean ignoreSslVerification) {
+ this.ignoreSslVerification = ignoreSslVerification;
+ }
+
+ public ServiceKeys getServiceKeys() {
+ return serviceKeys;
+ }
+
+ public void setServiceKeys(ServiceKeys serviceKeys) {
+ this.serviceKeys = serviceKeys;
+ }
+
+ public String getAuthenticationKey() {
+ return authenticationKey;
+ }
+
+ public void setAuthenticationKey(String authenticationKey) {
+ this.authenticationKey = authenticationKey;
+ }
+
+ public String getSecretKey() {
+ return secretKey;
+ }
+
+ public void setSecretKey(String secretKey) {
+ this.secretKey = secretKey;
+ }
+
+ public String getBucketName() {
+ return bucketName;
+ }
+
+ public void setBucketName(String bucketName) {
+ this.bucketName = bucketName;
+ }
+
+ public String getBucketLocation() {
+ return bucketLocation;
+ }
+
+ public void setBucketLocation(String bucketLocation) {
+ this.bucketLocation = bucketLocation;
+ }
+
+ public ObsClient getObsClient() {
+ return obsClient;
+ }
+
+ public void setObsClient(ObsClient obsClient) {
+ this.obsClient = obsClient;
+ }
+
+ /**
+ * Initialize and return a new OBS Client
+ *
+ * @return
+ */
+ public ObsClient initClient() {
+ if (obsClient != null) {
+ return obsClient;
+ }
+
+ // check for mandatory AK/SK in ServiceKeys object or in endpoint
+ if (ObjectHelper.isEmpty(getServiceKeys()) &&
ObjectHelper.isEmpty(getAuthenticationKey())) {
+ throw new IllegalArgumentException("Authentication parameter
'authentication key (AK)' not found");
+ }
+ if (ObjectHelper.isEmpty(getServiceKeys()) &&
ObjectHelper.isEmpty(getSecretKey())) {
+ throw new IllegalArgumentException("Authentication parameter
'secret key (SK)' not found");
+ }
+
+ // build client with mandatory region/endpoint parameter. Endpoint
takes higher precedence than region
+ ObsConfiguration obsConfiguration = new ObsConfiguration();
+ if (ObjectHelper.isNotEmpty(getEndpoint())) {
+ obsConfiguration.setEndPoint(getEndpoint());
+ } else if (ObjectHelper.isNotEmpty(getRegion())) {
+ obsConfiguration.setEndPoint(OBSRegion.valueOf(getRegion()));
+ } else {
+ throw new IllegalArgumentException("Region/endpoint not found");
+ }
+
+ // setup proxy information (if needed)
+ if (ObjectHelper.isNotEmpty(getProxyHost())
+ && ObjectHelper.isNotEmpty(getProxyPort())) {
+ HttpProxyConfiguration httpConfig = new HttpProxyConfiguration();
+ httpConfig.setProxyAddr(getProxyHost());
+ httpConfig.setProxyPort(getProxyPort());
+
+ if (ObjectHelper.isNotEmpty(getProxyUser())) {
+ httpConfig.setProxyUName(getProxyUser());
+ if (ObjectHelper.isNotEmpty(getProxyPassword())) {
+ httpConfig.setUserPaaswd(getProxyPassword());
+ }
+ }
+ obsConfiguration.setHttpProxy(httpConfig);
+ }
+
+ // setup ignore ssl verification
+ obsConfiguration.setValidateCertificate(!isIgnoreSslVerification());
+
+ return new ObsClient(getAuthenticationKey(), getSecretKey(),
obsConfiguration);
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/OBSProducer.java
b/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/OBSProducer.java
new file mode 100644
index 0000000..6b56e00
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/OBSProducer.java
@@ -0,0 +1,203 @@
+/*
+ * 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.component.huaweicloud.obs;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.gson.Gson;
+import com.obs.services.ObsClient;
+import com.obs.services.exception.ObsException;
+import com.obs.services.model.CreateBucketRequest;
+import com.obs.services.model.HeaderResponse;
+import com.obs.services.model.ListBucketsRequest;
+import com.obs.services.model.ListBucketsResult;
+import com.obs.services.model.ObsBucket;
+import org.apache.camel.Exchange;
+import org.apache.camel.component.huaweicloud.obs.constants.OBSConstants;
+import org.apache.camel.component.huaweicloud.obs.constants.OBSOperations;
+import org.apache.camel.component.huaweicloud.obs.constants.OBSProperties;
+import org.apache.camel.component.huaweicloud.obs.models.ClientConfigurations;
+import org.apache.camel.component.huaweicloud.obs.models.OBSRegion;
+import org.apache.camel.support.DefaultProducer;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class OBSProducer extends DefaultProducer {
+ private static final Logger LOG =
LoggerFactory.getLogger(OBSProducer.class);
+ private OBSEndpoint endpoint;
+ private ClientConfigurations clientConfigurations;
+ private ObsClient obsClient;
+ private Gson gson;
+
+ public OBSProducer(OBSEndpoint endpoint) {
+ super(endpoint);
+ this.endpoint = endpoint;
+ }
+
+ @Override
+ protected void doInit() throws Exception {
+ super.doInit();
+ this.clientConfigurations = new ClientConfigurations();
+ this.obsClient = this.endpoint.initClient();
+ this.gson = new Gson();
+ }
+
+ public void process(Exchange exchange) throws Exception {
+ updateClientConfigs(exchange);
+
+ switch (clientConfigurations.getOperation()) {
+ case OBSOperations.LIST_BUCKETS:
+ listBuckets(exchange);
+ break;
+ case OBSOperations.CREATE_BUCKET:
+ createBucket(exchange);
+ break;
+ case OBSOperations.DELETE_BUCKET:
+ deleteBucket(exchange);
+ break;
+ default:
+ throw new UnsupportedOperationException(
+ String.format("%s is not a supported operation",
clientConfigurations.getOperation()));
+ }
+ }
+
+ /**
+ * Perform list buckets operation
+ *
+ * @param exchange
+ */
+ private void listBuckets(Exchange exchange) throws ObsException {
+ // invoke list buckets method and map response object to exchange body
+ ListBucketsRequest request = new ListBucketsRequest();
+ ListBucketsResult response = obsClient.listBucketsV2(request);
+ exchange.getMessage().setBody(gson.toJson(response.getBuckets()));
+ }
+
+ /**
+ * Perform create bucket operation
+ *
+ * @param exchange
+ */
+ private void createBucket(Exchange exchange) throws ObsException {
+ CreateBucketRequest request = null;
+
+ // checking if user inputted exchange body containing bucket
information. Body must be a CreateBucketRequest or a valid JSON string
(Advanced users)
+ Object exchangeBody = exchange.getMessage().getBody();
+ if (exchangeBody instanceof CreateBucketRequest) {
+ request = (CreateBucketRequest) exchangeBody;
+ } else if (exchangeBody instanceof String) {
+ String strBody = (String) exchangeBody;
+ try {
+ request = new ObjectMapper().readValue(strBody,
CreateBucketRequest.class);
+ } catch (JsonProcessingException e) {
+ LOG.warn(
+ "String request body must be a valid JSON
representation of a CreateBucketRequest. Attempting to create a bucket from
endpoint parameters");
+ }
+ }
+
+ // if no CreateBucketRequest was found in the exchange body, then
create one from endpoint parameters (Basic users)
+ if (request == null) {
+ // check for bucket name, which is mandatory to create a new bucket
+ if (ObjectHelper.isEmpty(clientConfigurations.getBucketName())) {
+ LOG.error("No bucket name given");
+ throw new IllegalArgumentException("Bucket name is mandatory
to create bucket");
+ }
+
+ // check for bucket location, which is optional to create a new
bucket
+ if
(ObjectHelper.isEmpty(clientConfigurations.getBucketLocation())) {
+ LOG.warn("No bucket location given, defaulting to '" +
OBSConstants.DEFAULT_LOCATION + "'");
+
clientConfigurations.setBucketLocation(OBSConstants.DEFAULT_LOCATION);
+ }
+ // verify valid bucket location
+
OBSRegion.checkValidRegion(clientConfigurations.getBucketLocation());
+
+ request = new
CreateBucketRequest(clientConfigurations.getBucketName(),
clientConfigurations.getBucketLocation());
+ }
+
+ // invoke create bucket method and map response object to exchange body
+ ObsBucket response = obsClient.createBucket(request);
+ exchange.getMessage().setBody(gson.toJson(response));
+ }
+
+ /**
+ * Perform delete bucket operation
+ *
+ * @param exchange
+ */
+ private void deleteBucket(Exchange exchange) throws ObsException {
+ // check for bucket name, which is mandatory to delete a bucket
+ if (ObjectHelper.isEmpty(clientConfigurations.getBucketName())) {
+ LOG.error("No bucket name given");
+ throw new IllegalArgumentException("Bucket name is mandatory to
delete bucket");
+ }
+
+ // invoke delete bucket method and map response object to exchange body
+ HeaderResponse response =
obsClient.deleteBucket(clientConfigurations.getBucketName());
+
exchange.getMessage().setBody(gson.toJson(response.getResponseHeaders()));
+ }
+
+ /**
+ * Update dynamic client configurations. Some endpoint parameters
(operation, and bucket name and location) can also
+ * be passed via exchange properties, so they can be updated between each
transaction. Since they can change, we
+ * must clear the previous transaction and update these parameters with
their new values
+ *
+ * @param exchange
+ */
+ private void updateClientConfigs(Exchange exchange) {
+ resetDynamicConfigs();
+
+ // checking for required operation (exchange overrides endpoint
operation if both are provided)
+ if (ObjectHelper.isEmpty(exchange.getProperty(OBSProperties.OPERATION))
+ && ObjectHelper.isEmpty(endpoint.getOperation())) {
+ LOG.error("No operation name given. Cannot proceed with OBS
operations.");
+ throw new IllegalArgumentException("Operation name not found");
+ } else {
+ clientConfigurations.setOperation(
+
ObjectHelper.isNotEmpty(exchange.getProperty(OBSProperties.OPERATION))
+ ? (String)
exchange.getProperty(OBSProperties.OPERATION)
+ : endpoint.getOperation());
+ }
+
+ // checking for optional bucketName (exchange overrides endpoint
bucketName if both are provided)
+ if
(ObjectHelper.isNotEmpty(exchange.getProperty(OBSProperties.BUCKET_NAME))
+ || ObjectHelper.isNotEmpty(endpoint.getBucketName())) {
+ clientConfigurations.setBucketName(
+
ObjectHelper.isNotEmpty(exchange.getProperty(OBSProperties.BUCKET_NAME))
+ ? (String)
exchange.getProperty(OBSProperties.BUCKET_NAME)
+ : endpoint.getBucketName());
+ }
+
+ // checking for optional bucketLocation (exchange overrides endpoint
bucketLocation if both are provided)
+ if
(ObjectHelper.isNotEmpty(exchange.getProperty(OBSProperties.BUCKET_LOCATION))
+ || ObjectHelper.isNotEmpty(endpoint.getBucketLocation())) {
+ clientConfigurations.setBucketLocation(
+
ObjectHelper.isNotEmpty(exchange.getProperty(OBSProperties.BUCKET_LOCATION))
+ ? (String)
exchange.getProperty(OBSProperties.BUCKET_LOCATION)
+ : endpoint.getBucketLocation());
+ }
+ }
+
+ /**
+ * Set all dynamic configurations to null
+ */
+ private void resetDynamicConfigs() {
+ clientConfigurations.setOperation(null);
+ clientConfigurations.setBucketName(null);
+ clientConfigurations.setBucketLocation(null);
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/constants/OBSConstants.java
b/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/constants/OBSConstants.java
new file mode 100644
index 0000000..4214bc3
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/constants/OBSConstants.java
@@ -0,0 +1,27 @@
+/*
+ * 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.component.huaweicloud.obs.constants;
+
+/**
+ * Constants for OBS
+ */
+public final class OBSConstants {
+ public static final String DEFAULT_LOCATION = "cn-north-1";
+
+ private OBSConstants() {
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/constants/OBSOperations.java
b/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/constants/OBSOperations.java
new file mode 100644
index 0000000..00b4fc9
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/constants/OBSOperations.java
@@ -0,0 +1,29 @@
+/*
+ * 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.component.huaweicloud.obs.constants;
+
+/**
+ * Constants for all the supported OBS operations
+ */
+public final class OBSOperations {
+ public static final String LIST_BUCKETS = "listBuckets";
+ public static final String CREATE_BUCKET = "createBucket";
+ public static final String DELETE_BUCKET = "deleteBucket";
+
+ private OBSOperations() {
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/constants/OBSProperties.java
b/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/constants/OBSProperties.java
new file mode 100644
index 0000000..9aa0070
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/constants/OBSProperties.java
@@ -0,0 +1,29 @@
+/*
+ * 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.component.huaweicloud.obs.constants;
+
+/**
+ * Constants for properties set on the exchange object
+ */
+public final class OBSProperties {
+ public static final String OPERATION = "CamelHwCloudObsOperation";
+ public static final String BUCKET_NAME = "CamelHwCloudObsBucketName";
+ public static final String BUCKET_LOCATION =
"CamelHwCloudObsBucketLocation";
+
+ private OBSProperties() {
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/models/ClientConfigurations.java
b/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/models/ClientConfigurations.java
new file mode 100644
index 0000000..beecb20
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/models/ClientConfigurations.java
@@ -0,0 +1,54 @@
+/*
+ * 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.component.huaweicloud.obs.models;
+
+/**
+ * Class to combine parameters which can be passed through exchange properties
and endpoint parameters to avoid checking
+ * both each time they are used
+ */
+public class ClientConfigurations {
+ private String operation;
+ private String bucketName;
+ private String bucketLocation;
+
+ public ClientConfigurations() {
+ }
+
+ public String getOperation() {
+ return operation;
+ }
+
+ public void setOperation(String operation) {
+ this.operation = operation;
+ }
+
+ public String getBucketName() {
+ return bucketName;
+ }
+
+ public void setBucketName(String bucketName) {
+ this.bucketName = bucketName;
+ }
+
+ public String getBucketLocation() {
+ return bucketLocation;
+ }
+
+ public void setBucketLocation(String bucketLocation) {
+ this.bucketLocation = bucketLocation;
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/models/OBSRegion.java
b/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/models/OBSRegion.java
new file mode 100644
index 0000000..27f5cdc
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/models/OBSRegion.java
@@ -0,0 +1,88 @@
+/*
+ * 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.component.huaweicloud.obs.models;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.camel.util.ObjectHelper;
+
+/**
+ * Class containing Huawei Cloud OBS regions and endpoints
+ */
+public final class OBSRegion {
+ private static final Map<String, String> REGIONS = createRegions();
+
+ private OBSRegion() {
+ }
+
+ /**
+ * Create map of all OBS regions and endpoints
+ *
+ * @return
+ */
+ private static Map<String, String> createRegions() {
+ Map<String, String> map = new HashMap<>();
+ map.put("af-south-1", "obs.af-south-1.myhuaweicloud.com");
+ map.put("ap-southeast-2", "obs.ap-southeast-2.myhuaweicloud.com");
+ map.put("ap-southeast-3", "obs.ap-southeast-3.myhuaweicloud.com");
+ map.put("cn-east-3", "obs.cn-east-3.myhuaweicloud.com");
+ map.put("cn-east-2", "obs.cn-east-2.myhuaweicloud.com");
+ map.put("cn-north-1", "obs.cn-north-1.myhuaweicloud.com");
+ map.put("cn-south-1", "obs.cn-south-1.myhuaweicloud.com");
+ map.put("ap-southeast-1", "obs.ap-southeast-1.myhuaweicloud.com");
+ map.put("sa-argentina-1", "obs.sa-argentina-1.myhuaweicloud.com");
+ map.put("sa-peru-1", "obs.sa-peru-1.myhuaweicloud.com");
+ map.put("na-mexico-1", "obs.na-mexico-1.myhuaweicloud.com");
+ map.put("la-south-2", "obs.la-south-2.myhuaweicloud.com");
+ map.put("sa-chile-1", "obs.sa-chile-1.myhuaweicloud.com");
+ map.put("sa-brazil-1", "obs.sa-brazil-1.myhuaweicloud.com");
+ return map;
+ }
+
+ /**
+ * Determine endpoint based on regionId
+ *
+ * @param regionId
+ * @return
+ */
+ public static String valueOf(String regionId) {
+ if (ObjectHelper.isEmpty(regionId)) {
+ throw new IllegalArgumentException("Unexpected empty parameter:
regionId.");
+ } else {
+ String endpoint = REGIONS.get(regionId.toLowerCase());
+ if (ObjectHelper.isNotEmpty(endpoint)) {
+ return endpoint;
+ } else {
+ throw new IllegalArgumentException("Unexpected regionId: " +
regionId);
+ }
+ }
+ }
+
+ /**
+ * Check if regionId is a valid region
+ *
+ * @param regionId
+ */
+ public static void checkValidRegion(String regionId) {
+ if (ObjectHelper.isEmpty(regionId)) {
+ throw new IllegalArgumentException("Unexpected empty parameter:
regionId.");
+ } else if (ObjectHelper.isEmpty(REGIONS.get(regionId.toLowerCase()))) {
+ throw new IllegalArgumentException("Unexpected regionId: " +
regionId);
+ }
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/models/ServiceKeys.java
b/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/models/ServiceKeys.java
new file mode 100644
index 0000000..b8be1f7
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/main/java/org/apache/camel/component/huaweicloud/obs/models/ServiceKeys.java
@@ -0,0 +1,54 @@
+/*
+ * 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.component.huaweicloud.obs.models;
+
+/**
+ * Class containing authentication and secret keys if the user does not want
to expose these in the endpoint
+ */
+public class ServiceKeys {
+ private String authenticationKey;
+ private String secretKey;
+
+ public ServiceKeys() {
+ }
+
+ public ServiceKeys(String authenticationKey, String secretKey) {
+ this.authenticationKey = authenticationKey;
+ this.secretKey = secretKey;
+ }
+
+ public ServiceKeys(String authenticationKey, String secretKey, String
projectId) {
+ this.authenticationKey = authenticationKey;
+ this.secretKey = secretKey;
+ }
+
+ public String getAuthenticationKey() {
+ return authenticationKey;
+ }
+
+ public void setAuthenticationKey(String authenticationKey) {
+ this.authenticationKey = authenticationKey;
+ }
+
+ public String getSecretKey() {
+ return secretKey;
+ }
+
+ public void setSecretKey(String secretKey) {
+ this.secretKey = secretKey;
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/main/resources/META-INF/services/org/apache/camel/component/hwcloud-obs
b/components/camel-huawei/camel-huaweicloud-obs/src/main/resources/META-INF/services/org/apache/camel/component/hwcloud-obs
new file mode 100644
index 0000000..f9c0f1a
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/main/resources/META-INF/services/org/apache/camel/component/hwcloud-obs
@@ -0,0 +1 @@
+class=org.apache.camel.component.huaweicloud.obs.OBSComponent
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/CreateBucketJsonTest.java
b/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/CreateBucketJsonTest.java
new file mode 100644
index 0000000..f3630a3
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/CreateBucketJsonTest.java
@@ -0,0 +1,79 @@
+/*
+ * 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.component.huaweicloud.obs;
+
+import com.obs.services.ObsClient;
+import com.obs.services.model.CreateBucketRequest;
+import com.obs.services.model.ObsBucket;
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.huaweicloud.obs.models.ServiceKeys;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class CreateBucketJsonTest extends CamelTestSupport {
+ private static final Logger LOG =
LoggerFactory.getLogger(CreateBucketJsonTest.class.getName());
+
+ TestConfiguration testConfiguration = new TestConfiguration();
+
+ @BindToRegistry("obsClient")
+ ObsClient mockClient = Mockito.mock(ObsClient.class);
+
+ @BindToRegistry("serviceKeys")
+ ServiceKeys serviceKeys = new ServiceKeys(
+ testConfiguration.getProperty("authenticationKey"),
+ testConfiguration.getProperty("secretKey"));
+
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:create_bucket")
+ .to("hwcloud-obs:createBucket?" +
+ "serviceKeys=#serviceKeys" +
+ "®ion=" +
testConfiguration.getProperty("region") +
+ "&ignoreSslVerification=true" +
+ "&obsClient=#obsClient")
+ .log("Create bucket successful")
+ .to("mock:create_bucket_result");
+ }
+ };
+ }
+
+ @Test
+ public void testCreateBucket() throws Exception {
+ ObsBucket bucket = new ObsBucket("New bucket", "location-3");
+
Mockito.when(mockClient.createBucket(Mockito.any(CreateBucketRequest.class))).thenReturn(bucket);
+
+ MockEndpoint mock = getMockEndpoint("mock:create_bucket_result");
+ mock.expectedMinimumMessageCount(1);
+ String newBucket = "{\"bucketName\":\"" +
testConfiguration.getProperty("bucketName") + "\",\"location\":\""
+ + testConfiguration.getProperty("bucketLocation") +
"\"}";
+ template.sendBody("direct:create_bucket", newBucket);
+ Exchange responseExchange = mock.getExchanges().get(0);
+
+ mock.assertIsSatisfied();
+
+ assertEquals("{\"bucketName\":\"New
bucket\",\"location\":\"location-3\",\"metadata\":{},\"statusCode\":0}",
+ responseExchange.getIn().getBody(String.class));
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/CreateBucketPojoTest.java
b/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/CreateBucketPojoTest.java
new file mode 100644
index 0000000..c6d4dc7e
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/CreateBucketPojoTest.java
@@ -0,0 +1,79 @@
+/*
+ * 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.component.huaweicloud.obs;
+
+import com.obs.services.ObsClient;
+import com.obs.services.model.CreateBucketRequest;
+import com.obs.services.model.ObsBucket;
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.huaweicloud.obs.models.ServiceKeys;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class CreateBucketPojoTest extends CamelTestSupport {
+ private static final Logger LOG =
LoggerFactory.getLogger(CreateBucketPojoTest.class.getName());
+
+ TestConfiguration testConfiguration = new TestConfiguration();
+
+ @BindToRegistry("obsClient")
+ ObsClient mockClient = Mockito.mock(ObsClient.class);
+
+ @BindToRegistry("serviceKeys")
+ ServiceKeys serviceKeys = new ServiceKeys(
+ testConfiguration.getProperty("authenticationKey"),
+ testConfiguration.getProperty("secretKey"));
+
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:create_bucket")
+ .to("hwcloud-obs:createBucket?" +
+ "serviceKeys=#serviceKeys" +
+ "®ion=" +
testConfiguration.getProperty("region") +
+ "&ignoreSslVerification=true" +
+ "&obsClient=#obsClient")
+ .log("Create bucket successful")
+ .to("mock:create_bucket_result");
+ }
+ };
+ }
+
+ @Test
+ public void testCreateBucket() throws Exception {
+ ObsBucket bucket = new ObsBucket("New bucket", "location-3");
+
Mockito.when(mockClient.createBucket(Mockito.any(CreateBucketRequest.class))).thenReturn(bucket);
+
+ MockEndpoint mock = getMockEndpoint("mock:create_bucket_result");
+ mock.expectedMinimumMessageCount(1);
+ CreateBucketRequest newBucket = new CreateBucketRequest(
+ testConfiguration.getProperty("bucketName"),
testConfiguration.getProperty("bucketLocation"));
+ template.sendBody("direct:create_bucket", newBucket);
+ Exchange responseExchange = mock.getExchanges().get(0);
+
+ mock.assertIsSatisfied();
+
+ assertEquals("{\"bucketName\":\"New
bucket\",\"location\":\"location-3\",\"metadata\":{},\"statusCode\":0}",
+ responseExchange.getIn().getBody(String.class));
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/CreateBucketTest.java
b/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/CreateBucketTest.java
new file mode 100644
index 0000000..4181ba8
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/CreateBucketTest.java
@@ -0,0 +1,79 @@
+/*
+ * 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.component.huaweicloud.obs;
+
+import com.obs.services.ObsClient;
+import com.obs.services.model.CreateBucketRequest;
+import com.obs.services.model.ObsBucket;
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.huaweicloud.obs.models.ServiceKeys;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class CreateBucketTest extends CamelTestSupport {
+ private static final Logger LOG =
LoggerFactory.getLogger(CreateBucketTest.class.getName());
+
+ TestConfiguration testConfiguration = new TestConfiguration();
+
+ @BindToRegistry("obsClient")
+ ObsClient mockClient = Mockito.mock(ObsClient.class);
+
+ @BindToRegistry("serviceKeys")
+ ServiceKeys serviceKeys = new ServiceKeys(
+ testConfiguration.getProperty("authenticationKey"),
+ testConfiguration.getProperty("secretKey"));
+
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:create_bucket")
+ .to("hwcloud-obs:createBucket?" +
+ "serviceKeys=#serviceKeys" +
+ "&bucketName=" +
testConfiguration.getProperty("bucketName") +
+ "&bucketLocation=" +
testConfiguration.getProperty("bucketLocation") +
+ "®ion=" +
testConfiguration.getProperty("region") +
+ "&ignoreSslVerification=true" +
+ "&obsClient=#obsClient")
+ .log("Create bucket successful")
+ .to("mock:create_bucket_result");
+ }
+ };
+ }
+
+ @Test
+ public void testCreateBucket() throws Exception {
+ ObsBucket bucket = new ObsBucket("New bucket", "location-3");
+
Mockito.when(mockClient.createBucket(Mockito.any(CreateBucketRequest.class))).thenReturn(bucket);
+
+ MockEndpoint mock = getMockEndpoint("mock:create_bucket_result");
+ mock.expectedMinimumMessageCount(1);
+ template.sendBody("direct:create_bucket", null);
+ Exchange responseExchange = mock.getExchanges().get(0);
+
+ mock.assertIsSatisfied();
+
+ assertEquals("{\"bucketName\":\"New
bucket\",\"location\":\"location-3\",\"metadata\":{},\"statusCode\":0}",
+ responseExchange.getIn().getBody(String.class));
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/DeleteBucketTest.java
b/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/DeleteBucketTest.java
new file mode 100644
index 0000000..3b6db67
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/DeleteBucketTest.java
@@ -0,0 +1,85 @@
+/*
+ * 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.component.huaweicloud.obs;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.obs.services.ObsClient;
+import com.obs.services.model.HeaderResponse;
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.huaweicloud.obs.models.ServiceKeys;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DeleteBucketTest extends CamelTestSupport {
+ private static final Logger LOG =
LoggerFactory.getLogger(DeleteBucketTest.class.getName());
+
+ TestConfiguration testConfiguration = new TestConfiguration();
+
+ @BindToRegistry("obsClient")
+ ObsClient mockClient = Mockito.mock(ObsClient.class);
+
+ @BindToRegistry("serviceKeys")
+ ServiceKeys serviceKeys = new ServiceKeys(
+ testConfiguration.getProperty("authenticationKey"),
+ testConfiguration.getProperty("secretKey"));
+
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:delete_bucket")
+ .setProperty("CamelHwCloudObsBucketName",
constant(testConfiguration.getProperty("bucketName")))
+ .to("hwcloud-obs:deleteBucket?" +
+ "serviceKeys=#serviceKeys" +
+ "®ion=" +
testConfiguration.getProperty("region") +
+ "&ignoreSslVerification=true" +
+ "&obsClient=#obsClient")
+ .log("Delete bucket successful")
+ .to("mock:delete_bucket_result");
+ }
+ };
+ }
+
+ @Test
+ public void testDeleteBucket() throws Exception {
+ HeaderResponse response = new HeaderResponse();
+ Map<String, Object> headers = new HashMap<>();
+ headers.put("connection", "Keep-Alive");
+ headers.put("date", "Day-of-week Month Day Time Year");
+ headers.put("id", "123ABC");
+ response.setResponseHeaders(headers);
+
Mockito.when(mockClient.deleteBucket(Mockito.anyString())).thenReturn(response);
+
+ MockEndpoint mock = getMockEndpoint("mock:delete_bucket_result");
+ mock.expectedMinimumMessageCount(1);
+ template.sendBody("direct:delete_bucket", "sample_body");
+ Exchange responseExchange = mock.getExchanges().get(0);
+
+ mock.assertIsSatisfied();
+
+ assertEquals("{\"date\":\"Day-of-week Month Day Time
Year\",\"connection\":\"Keep-Alive\",\"id\":\"123ABC\"}",
+ responseExchange.getIn().getBody(String.class));
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/ListBucketsTest.java
b/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/ListBucketsTest.java
new file mode 100644
index 0000000..626190e
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/ListBucketsTest.java
@@ -0,0 +1,88 @@
+/*
+ * 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.component.huaweicloud.obs;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.obs.services.ObsClient;
+import com.obs.services.model.ListBucketsRequest;
+import com.obs.services.model.ListBucketsResult;
+import com.obs.services.model.ObsBucket;
+import com.obs.services.model.Owner;
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.huaweicloud.obs.models.ServiceKeys;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ListBucketsTest extends CamelTestSupport {
+ private static final Logger LOG =
LoggerFactory.getLogger(ListBucketsTest.class.getName());
+
+ TestConfiguration testConfiguration = new TestConfiguration();
+
+ @BindToRegistry("obsClient")
+ ObsClient mockClient = Mockito.mock(ObsClient.class);
+
+ @BindToRegistry("serviceKeys")
+ ServiceKeys serviceKeys = new ServiceKeys(
+ testConfiguration.getProperty("authenticationKey"),
+ testConfiguration.getProperty("secretKey"));
+
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ from("direct:list_buckets")
+ .to("hwcloud-obs:listBuckets?" +
+ "authenticationKey=" +
testConfiguration.getProperty("authenticationKey") +
+ "&secretKey=" +
testConfiguration.getProperty("secretKey") +
+ "®ion=" +
testConfiguration.getProperty("region") +
+ "&ignoreSslVerification=true" +
+ "&obsClient=#obsClient")
+ .log("List buckets successful")
+ .to("mock:list_buckets_result");
+ }
+ };
+ }
+
+ @Test
+ public void testListBuckets() throws Exception {
+ List<ObsBucket> buckets = new ArrayList<>();
+ buckets.add(new ObsBucket("bucket1", "location-1"));
+ buckets.add(new ObsBucket("bucket2", "location-2"));
+ Owner owner = new Owner();
+ ListBucketsResult response = new ListBucketsResult(buckets, owner);
+
Mockito.when(mockClient.listBucketsV2(Mockito.any(ListBucketsRequest.class))).thenReturn(response);
+
+ MockEndpoint mock = getMockEndpoint("mock:list_buckets_result");
+ mock.expectedMinimumMessageCount(1);
+ template.sendBody("direct:list_buckets", "sample_body");
+ Exchange responseExchange = mock.getExchanges().get(0);
+
+ mock.assertIsSatisfied();
+
+ assertEquals(
+
"[{\"bucketName\":\"bucket1\",\"location\":\"location-1\",\"metadata\":{},\"statusCode\":0},{\"bucketName\":\"bucket2\",\"location\":\"location-2\",\"metadata\":{},\"statusCode\":0}]",
+ responseExchange.getIn().getBody(String.class));
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/TestConfiguration.java
b/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/TestConfiguration.java
new file mode 100644
index 0000000..088074b
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/TestConfiguration.java
@@ -0,0 +1,49 @@
+/*
+ * 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.component.huaweicloud.obs;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TestConfiguration {
+ private static final Logger LOG =
LoggerFactory.getLogger(TestConfiguration.class.getName());
+ private static Map<String, String> propertyMap;
+
+ public TestConfiguration() {
+ initPropertyMap();
+ }
+
+ private void initPropertyMap() {
+ propertyMap = new HashMap<>();
+ propertyMap.put("authenticationKey", "dummy_authentication_key");
+ propertyMap.put("secretKey", "dummy_secret_key");
+ propertyMap.put("region", "dummy_region");
+ propertyMap.put("endpoint", "dummy_endpoint");
+ propertyMap.put("bucketName", "dummy_bucket_name");
+ propertyMap.put("bucketLocation", "cn-north-1");
+ }
+
+ public String getProperty(String key) {
+ if (propertyMap == null) {
+ initPropertyMap();
+ }
+ return propertyMap.get(key);
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/constants/OBSConstantsTest.java
b/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/constants/OBSConstantsTest.java
new file mode 100644
index 0000000..796da28
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/constants/OBSConstantsTest.java
@@ -0,0 +1,28 @@
+/*
+ * 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.component.huaweicloud.obs.constants;
+
+import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class OBSConstantsTest {
+ @Test
+ public void testConstants() {
+ assertEquals("cn-north-1", OBSConstants.DEFAULT_LOCATION);
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/constants/OBSOperationsTest.java
b/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/constants/OBSOperationsTest.java
new file mode 100644
index 0000000..a6e4237
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/constants/OBSOperationsTest.java
@@ -0,0 +1,30 @@
+/*
+ * 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.component.huaweicloud.obs.constants;
+
+import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class OBSOperationsTest {
+ @Test
+ public void testOperations() {
+ assertEquals("listBuckets", OBSOperations.LIST_BUCKETS);
+ assertEquals("createBucket", OBSOperations.CREATE_BUCKET);
+ assertEquals("deleteBucket", OBSOperations.DELETE_BUCKET);
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/constants/OBSPropertiesTest.java
b/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/constants/OBSPropertiesTest.java
new file mode 100644
index 0000000..4a233ba
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/constants/OBSPropertiesTest.java
@@ -0,0 +1,30 @@
+/*
+ * 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.component.huaweicloud.obs.constants;
+
+import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class OBSPropertiesTest {
+ @Test
+ public void testProperties() {
+ assertEquals("CamelHwCloudObsOperation", OBSProperties.OPERATION);
+ assertEquals("CamelHwCloudObsBucketName", OBSProperties.BUCKET_NAME);
+ assertEquals("CamelHwCloudObsBucketLocation",
OBSProperties.BUCKET_LOCATION);
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/models/OBSRegionTest.java
b/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/models/OBSRegionTest.java
new file mode 100644
index 0000000..7234d57
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/test/java/org/apache/camel/component/huaweicloud/obs/models/OBSRegionTest.java
@@ -0,0 +1,41 @@
+/*
+ * 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.component.huaweicloud.obs.models;
+
+import org.junit.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class OBSRegionTest {
+ @Test
+ public void testRegions() {
+ assertEquals("obs.af-south-1.myhuaweicloud.com",
OBSRegion.valueOf("af-south-1"));
+ assertEquals("obs.ap-southeast-2.myhuaweicloud.com",
OBSRegion.valueOf("ap-southeast-2"));
+ assertEquals("obs.ap-southeast-3.myhuaweicloud.com",
OBSRegion.valueOf("ap-southeast-3"));
+ assertEquals("obs.cn-east-3.myhuaweicloud.com",
OBSRegion.valueOf("cn-east-3"));
+ assertEquals("obs.cn-east-2.myhuaweicloud.com",
OBSRegion.valueOf("cn-east-2"));
+ assertEquals("obs.cn-north-1.myhuaweicloud.com",
OBSRegion.valueOf("cn-north-1"));
+ assertEquals("obs.cn-south-1.myhuaweicloud.com",
OBSRegion.valueOf("cn-south-1"));
+ assertEquals("obs.ap-southeast-1.myhuaweicloud.com",
OBSRegion.valueOf("ap-southeast-1"));
+ assertEquals("obs.sa-argentina-1.myhuaweicloud.com",
OBSRegion.valueOf("sa-argentina-1"));
+ assertEquals("obs.sa-peru-1.myhuaweicloud.com",
OBSRegion.valueOf("sa-peru-1"));
+ assertEquals("obs.na-mexico-1.myhuaweicloud.com",
OBSRegion.valueOf("na-mexico-1"));
+ assertEquals("obs.la-south-2.myhuaweicloud.com",
OBSRegion.valueOf("la-south-2"));
+ assertEquals("obs.sa-chile-1.myhuaweicloud.com",
OBSRegion.valueOf("sa-chile-1"));
+ assertEquals("obs.sa-brazil-1.myhuaweicloud.com",
OBSRegion.valueOf("sa-brazil-1"));
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-obs/src/test/resources/log4j2.properties
b/components/camel-huawei/camel-huaweicloud-obs/src/test/resources/log4j2.properties
new file mode 100644
index 0000000..0c6d71c
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-obs/src/test/resources/log4j2.properties
@@ -0,0 +1,28 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+appender.file.type = File
+appender.file.name = file
+appender.file.fileName = target/camel-huaweicloud-obs-test.log
+appender.file.layout.type = PatternLayout
+appender.file.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+appender.stdout.type = Console
+appender.stdout.name = stdout
+appender.stdout.layout.type = PatternLayout
+appender.stdout.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n
+rootLogger.level = INFO
+rootLogger.appenderRef.file.ref = file
diff --git a/components/camel-huawei/pom.xml b/components/camel-huawei/pom.xml
index 4e08345..c262c8d 100644
--- a/components/camel-huawei/pom.xml
+++ b/components/camel-huawei/pom.xml
@@ -35,6 +35,7 @@
<modules>
<module>camel-huaweicloud-functiongraph</module>
<module>camel-huaweicloud-iam</module>
+ <module>camel-huaweicloud-obs</module>
<module>camel-huaweicloud-smn</module>
</modules>
diff --git a/parent/pom.xml b/parent/pom.xml
index f48f933..91f96fd 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -239,6 +239,7 @@
<httpcore4-version>4.4.14</httpcore4-version>
<httpclient4-version>4.5.13</httpclient4-version>
<httpasyncclient-version>4.1.4</httpasyncclient-version>
+ <huaweicloud-obs-version>3.21.4.1</huaweicloud-obs-version>
<huaweicloud-sdk-version>3.0.32-rc</huaweicloud-sdk-version>
<hystrix-version>1.5.18</hystrix-version>
<ical4j-version>1.0.7</ical4j-version>
@@ -1555,6 +1556,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-huaweicloud-obs</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-huaweicloud-smn</artifactId>
<version>${project.version}</version>
</dependency>