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 2ed67cb CAMEL-16876: Add test cases (#5988)
2ed67cb is described below
commit 2ed67cb28d5ffe43a9d862fbb4e1e0acc3c2ad04
Author: Hokutor <[email protected]>
AuthorDate: Wed Aug 25 11:02:35 2021 -0400
CAMEL-16876: Add test cases (#5988)
---
.../src/main/docs/hwcloud-dms-component.adoc | 2 +-
.../component/huaweicloud/dms/DMSEndpoint.java | 2 +-
.../component/huaweicloud/dms/DMSProducer.java | 6 +-
.../dms/CreateInstanceJsonFunctionalTest.java | 104 +++++++++++++++++++
.../dms/CreateInstanceKafkaFunctionalTest1.java | 111 +++++++++++++++++++++
.../dms/CreateInstanceKafkaFunctionalTest2.java | 111 +++++++++++++++++++++
.../dms/CreateInstancePojoFunctionalTest.java | 109 ++++++++++++++++++++
.../dms/CreateInstanceRmqFunctionalTest1.java | 107 ++++++++++++++++++++
....java => CreateInstanceRmqFunctionalTest2.java} | 80 ++++++++-------
.../huaweicloud/dms/CreateInstanceRmqTest1.java | 1 +
.../huaweicloud/dms/CreateInstanceRmqTest2.java | 1 +
.../dms/DeleteInstanceFunctionalTest.java | 76 ++++++++++++++
.../dms/ListInstancesFunctionalTest.java | 71 +++++++++++++
.../dms/QueryInstanceFunctionalTest.java | 75 ++++++++++++++
.../dms/UpdateInstanceJsonFunctionalTest.java | 86 ++++++++++++++++
.../dms/UpdateInstancePojoFunctionalTest.java | 86 ++++++++++++++++
16 files changed, 987 insertions(+), 41 deletions(-)
diff --git
a/components/camel-huawei/camel-huaweicloud-dms/src/main/docs/hwcloud-dms-component.adoc
b/components/camel-huawei/camel-huaweicloud-dms/src/main/docs/hwcloud-dms-component.adoc
index 3b9b96b..15dd17e 100644
---
a/components/camel-huawei/camel-huaweicloud-dms/src/main/docs/hwcloud-dms-component.adoc
+++
b/components/camel-huawei/camel-huaweicloud-dms/src/main/docs/hwcloud-dms-component.adoc
@@ -118,7 +118,7 @@ with the following path and query parameters:
| *availableZones* (producer) | The ID of an available zone. This option is
mandatory when creating an instance and it cannot be an empty array. | | List
| *endpoint* (producer) | DMS url. Carries higher precedence than region
parameter based client initialization | | String
| *engine* (producer) | The message engine. Either kafka or rabbitmq. If the
parameter is not specified, all instances will be queried. There are 2 enums
and the value can be one of: kafka, rabbitmq | | String
-| *engineVersion* (producer) | The version of the message engine. This option
is mandatory when creating a Kafka instance. | | String
+| *engineVersion* (producer) | The version of the message engine. This option
is mandatory when creating an instance. | | String
| *ignoreSslVerification* (producer) | Ignore SSL verification | false |
boolean
| *instanceId* (producer) | The id of the instance. This option is mandatory
when deleting or querying an instance | | String
| *kafkaManagerPassword* (producer) | The password for logging in to the Kafka
Manager. This option is mandatory when creating a Kafka instance. | | String
diff --git
a/components/camel-huawei/camel-huaweicloud-dms/src/main/java/org/apache/camel/component/huaweicloud/dms/DMSEndpoint.java
b/components/camel-huawei/camel-huaweicloud-dms/src/main/java/org/apache/camel/component/huaweicloud/dms/DMSEndpoint.java
index 40dc7d0..4cc7f90 100644
---
a/components/camel-huawei/camel-huaweicloud-dms/src/main/java/org/apache/camel/component/huaweicloud/dms/DMSEndpoint.java
+++
b/components/camel-huawei/camel-huaweicloud-dms/src/main/java/org/apache/camel/component/huaweicloud/dms/DMSEndpoint.java
@@ -107,7 +107,7 @@ public class DMSEndpoint extends DefaultEndpoint {
@Metadata(required = false)
private String name;
- @UriParam(description = "The version of the message engine. This option is
mandatory when creating a Kafka instance.",
+ @UriParam(description = "The version of the message engine. This option is
mandatory when creating an instance.",
displayName = "Engine version")
@Metadata(required = false)
private String engineVersion;
diff --git
a/components/camel-huawei/camel-huaweicloud-dms/src/main/java/org/apache/camel/component/huaweicloud/dms/DMSProducer.java
b/components/camel-huawei/camel-huaweicloud-dms/src/main/java/org/apache/camel/component/huaweicloud/dms/DMSProducer.java
index bc06246..601ab8c 100644
---
a/components/camel-huawei/camel-huaweicloud-dms/src/main/java/org/apache/camel/component/huaweicloud/dms/DMSProducer.java
+++
b/components/camel-huawei/camel-huaweicloud-dms/src/main/java/org/apache/camel/component/huaweicloud/dms/DMSProducer.java
@@ -117,12 +117,12 @@ public class DMSProducer extends DefaultProducer {
if (ObjectHelper.isEmpty(clientConfigurations.getEngine())) {
throw new IllegalArgumentException("Engine is mandatory to
create an instance");
}
+ if (ObjectHelper.isEmpty(clientConfigurations.getEngineVersion()))
{
+ throw new IllegalArgumentException("Engine version is
mandatory to create an instance");
+ }
if (clientConfigurations.getEngine().equals(DMSConstants.KAFKA)) {
// check for mandatory Kafka values
- if
(ObjectHelper.isEmpty(clientConfigurations.getEngineVersion())) {
- throw new IllegalArgumentException("Engine version is
mandatory to create a Kafka instance");
- }
if
(ObjectHelper.isEmpty(clientConfigurations.getSpecification())) {
throw new IllegalArgumentException("Specification is
mandatory to create a Kafka instance");
}
diff --git
a/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceJsonFunctionalTest.java
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceJsonFunctionalTest.java
new file mode 100644
index 0000000..7bc93c3
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceJsonFunctionalTest.java
@@ -0,0 +1,104 @@
+/*
+ * 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.dms;
+
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.huaweicloud.common.models.ServiceKeys;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class CreateInstanceJsonFunctionalTest extends CamelTestSupport {
+ private static final String AUTHENTICATION_KEY =
"replace_this_with_authentication_key";
+ private static final String SECRET_KEY = "replace_this_with_secret_key";
+ private static final String PROJECT_ID = "replace_this_with_project_id";
+ private static final String REGION = "replace_this_with_region";
+
+ @BindToRegistry("serviceKeys")
+ ServiceKeys serviceKeys = new ServiceKeys(AUTHENTICATION_KEY, SECRET_KEY);
+
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() throws Exception {
+ from("direct:operation")
+ .to("hwcloud-dms:createInstance?" +
+ "serviceKeys=#serviceKeys" +
+ "&projectId=" + PROJECT_ID +
+ "®ion=" + REGION +
+ "&ignoreSslVerification=true")
+ .log("Operation successful")
+ .to("log:LOG?showAll=true")
+ .to("mock:operation_result");
+ }
+ };
+ }
+
+ /**
+ * The following test cases should be manually enabled to perform test
against the actual HuaweiCloud DMS server
+ * with real user credentials. To perform this test, manually comment out
the @Ignore annotation and enter relevant
+ * service parameters in the placeholders above (static variables of this
test class)
+ *
+ * @throws Exception
+ */
+ @Ignore("Manually enable this once you configure the parameters in the
placeholders above")
+ @Test
+ public void testOperation() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:operation_result");
+ mock.expectedMinimumMessageCount(1);
+
+ String sampleBody = "{" +
+ "\"name\":\"" +
"replace_with_instance_information" + "\"," +
+ "\"description\":\"" +
"replace_with_instance_information" + "\"," +
+ "\"engine\":\"" +
"replace_with_instance_information" + "\"," +
+ "\"engine_version\":\"" +
"replace_with_instance_information" + "\"," +
+ "\"specification\":\"" +
"replace_with_instance_information" + "\"," +
+ "\"storage_space\":" +
"replace_with_instance_information" + "," +
+ "\"partition_num\":" +
"replace_with_instance_information" + "," +
+ "\"access_user\":\"" +
"replace_with_instance_information" + "\"," +
+ "\"password\":\"" +
"replace_with_instance_information" + "\"," +
+ "\"vpc_id\":\"" +
"replace_with_instance_information" + "\"," +
+ "\"security_group_id\":\"" +
"replace_with_instance_information" + "\"," +
+ "\"subnet_id\":\"" +
"replace_with_instance_information" + "\"," +
+ "\"available_zones\":[\"" +
"replace_with_instance_information" + "\"]," +
+ "\"product_id\":\"" +
"replace_with_instance_information" + "\"," +
+ "\"kafka_manager_user\":\"" +
"replace_with_instance_information" + "\"," +
+ "\"kafka_manager_password\":\"" +
"replace_with_instance_information" + "\"," +
+ "\"maintain_begin\":\"" +
"replace_with_instance_information" + "\"," +
+ "\"maintain_end\":\"" +
"replace_with_instance_information" + "\"," +
+ "\"enable_publicip\":" +
"replace_with_instance_information" + "," +
+ "\"public_bandwidth\":\"" +
"replace_with_instance_information" + "\"," +
+ "\"publicip_id\":\"" +
"replace_with_instance_information" + "\"," +
+ "\"ssl_enable\":" +
"replace_with_instance_information" + "," +
+ "\"retention_policy\":\"" +
"replace_with_instance_information" + "\"," +
+ "\"connector_enable\":" +
"replace_with_instance_information" + "," +
+ "\"enable_auto_topic\":" +
"replace_with_instance_information" + "," +
+ "\"storage_spec_code\":\"" +
"replace_with_instance_information" + "\"," +
+ "\"enterprise_project_id\":\"" +
"replace_with_instance_information" + "\"" +
+ "}";
+
+ template.sendBody("direct:operation", sampleBody);
+ Exchange responseExchange = mock.getExchanges().get(0);
+
+ mock.assertIsSatisfied();
+
+ assertNotNull(responseExchange.getIn().getBody(String.class));
+ assertTrue(responseExchange.getIn().getBody(String.class).length() >
0);
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceKafkaFunctionalTest1.java
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceKafkaFunctionalTest1.java
new file mode 100644
index 0000000..2dc8be4
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceKafkaFunctionalTest1.java
@@ -0,0 +1,111 @@
+/*
+ * 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.dms;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.huaweicloud.common.models.ServiceKeys;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class CreateInstanceKafkaFunctionalTest1 extends CamelTestSupport {
+ private static final String AUTHENTICATION_KEY =
"replace_this_with_authentication_key";
+ private static final String SECRET_KEY = "replace_this_with_secret_key";
+ private static final String PROJECT_ID = "replace_this_with_project_id";
+ private static final String REGION = "replace_this_with_region";
+
+ private static final String NAME = "replace_this_with_name";
+ private static final String ENGINE_VERSION =
"replace_this_with_engine_version";
+ private static final String SPECIFICATION =
"replace_this_with_specification";
+ private static final String STORAGE_SPACE =
"replace_this_with_storage_space";
+ private static final String PARTITION_NUM =
"replace_this_with_partition_num";
+ private static final String VPC_ID = "replace_this_with_vpc_id";
+ private static final String SECURITY_GROUP_ID =
"replace_this_with_security_group_id";
+ private static final String SUBNET_ID = "replace_this_with_subnet_id";
+ private static final String AVAILABLE_ZONE =
"replace_this_with_available_zone";
+ private static final String PRODUCT_ID = "replace_this_with_product_id";
+ private static final String KAFKA_MANAGER_USER =
"replace_this_with_kafka_manager_user";
+ private static final String KAFKA_MANAGER_PASSWORD =
"replace_this_with_kafka_manager_password";
+ private static final String STORAGE_SPEC_CODE =
"replace_this_with_storage_spec_code";
+
+ @BindToRegistry("serviceKeys")
+ ServiceKeys serviceKeys = new ServiceKeys(AUTHENTICATION_KEY, SECRET_KEY);
+
+ @BindToRegistry("availableZones")
+ List<String> availableZones = new ArrayList<>();
+
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() throws Exception {
+ from("direct:operation")
+ .to("hwcloud-dms:createInstance?" +
+ "serviceKeys=#serviceKeys" +
+ "&projectId=" + PROJECT_ID +
+ "®ion=" + REGION +
+ "&ignoreSslVerification=true" +
+ "&engine=kafka" +
+
+ "&name=" + NAME +
+ "&engineVersion=" + ENGINE_VERSION +
+ "&specification=" + SPECIFICATION +
+ "&storageSpace=" + STORAGE_SPACE +
+ "&partitionNum=" + PARTITION_NUM +
+ "&vpcId=" + VPC_ID +
+ "&securityGroupId=" + SECURITY_GROUP_ID +
+ "&subnetId=" + SUBNET_ID +
+ "&availableZones=#availableZones" +
+ "&productId=" + PRODUCT_ID +
+ "&kafkaManagerUser=" + KAFKA_MANAGER_USER +
+ "&kafkaManagerPassword=" + KAFKA_MANAGER_PASSWORD +
+ "&storageSpecCode=" + STORAGE_SPEC_CODE)
+ .log("Operation successful")
+ .to("log:LOG?showAll=true")
+ .to("mock:operation_result");
+ }
+ };
+ }
+
+ /**
+ * The following test cases should be manually enabled to perform test
against the actual HuaweiCloud DMS server
+ * with real user credentials. To perform this test, manually comment out
the @Ignore annotation and enter relevant
+ * service parameters in the placeholders above (static variables of this
test class)
+ *
+ * @throws Exception
+ */
+ @Ignore("Manually enable this once you configure the parameters in the
placeholders above")
+ @Test
+ public void testOperation() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:operation_result");
+ mock.expectedMinimumMessageCount(1);
+
+ availableZones.add(AVAILABLE_ZONE);
+
+ template.sendBody("direct:operation", null);
+ Exchange responseExchange = mock.getExchanges().get(0);
+
+ mock.assertIsSatisfied();
+
+ assertNotNull(responseExchange.getIn().getBody(String.class));
+ assertTrue(responseExchange.getIn().getBody(String.class).length() >
0);
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceKafkaFunctionalTest2.java
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceKafkaFunctionalTest2.java
new file mode 100644
index 0000000..ad9c8cc
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceKafkaFunctionalTest2.java
@@ -0,0 +1,111 @@
+/*
+ * 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.dms;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.huaweicloud.common.models.ServiceKeys;
+import org.apache.camel.component.huaweicloud.dms.constants.DMSProperties;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class CreateInstanceKafkaFunctionalTest2 extends CamelTestSupport {
+ private static final String AUTHENTICATION_KEY =
"replace_this_with_authentication_key";
+ private static final String SECRET_KEY = "replace_this_with_secret_key";
+ private static final String PROJECT_ID = "replace_this_with_project_id";
+ private static final String REGION = "replace_this_with_region";
+
+ private static final String NAME = "replace_this_with_name";
+ private static final String ENGINE_VERSION =
"replace_this_with_engine_version";
+ private static final String SPECIFICATION =
"replace_this_with_specification";
+ private static final int STORAGE_SPACE =
0/*replace_this_with_storage_space*/;
+ private static final int PARTITION_NUM =
0/*replace_this_with_partition_num*/;
+ private static final String VPC_ID = "replace_this_with_vpc_id";
+ private static final String SECURITY_GROUP_ID =
"replace_this_with_security_group_id";
+ private static final String SUBNET_ID = "replace_this_with_subnet_id";
+ private static final String AVAILABLE_ZONE =
"replace_this_with_available_zone";
+ private static final String PRODUCT_ID = "replace_this_with_product_id";
+ private static final String KAFKA_MANAGER_USER =
"replace_this_with_kafka_manager_user";
+ private static final String KAFKA_MANAGER_PASSWORD =
"replace_this_with_kafka_manager_password";
+ private static final String STORAGE_SPEC_CODE =
"replace_this_with_storage_spec_code";
+
+ @BindToRegistry("serviceKeys")
+ ServiceKeys serviceKeys = new ServiceKeys(AUTHENTICATION_KEY, SECRET_KEY);
+
+ @BindToRegistry("availableZones")
+ List<String> availableZones = new ArrayList<>();
+
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() throws Exception {
+ from("direct:operation")
+ .setProperty(DMSProperties.NAME, constant(NAME))
+ .setProperty(DMSProperties.ENGINE, constant("kafka"))
+ .setProperty(DMSProperties.ENGINE_VERSION,
constant(ENGINE_VERSION))
+ .setProperty(DMSProperties.SPECIFICATION,
constant(SPECIFICATION))
+ .setProperty(DMSProperties.STORAGE_SPACE,
constant(STORAGE_SPACE))
+ .setProperty(DMSProperties.PARTITION_NUM,
constant(PARTITION_NUM))
+ .setProperty(DMSProperties.VPC_ID, constant(VPC_ID))
+ .setProperty(DMSProperties.SECURITY_GROUP_ID,
constant(SECURITY_GROUP_ID))
+ .setProperty(DMSProperties.SUBNET_ID,
constant(SUBNET_ID))
+ .setProperty(DMSProperties.AVAILABLE_ZONES,
constant(availableZones))
+ .setProperty(DMSProperties.PRODUCT_ID,
constant(PRODUCT_ID))
+ .setProperty(DMSProperties.KAFKA_MANAGER_USER,
constant(KAFKA_MANAGER_USER))
+ .setProperty(DMSProperties.KAFKA_MANAGER_PASSWORD,
constant(KAFKA_MANAGER_PASSWORD))
+ .setProperty(DMSProperties.STORAGE_SPEC_CODE,
constant(STORAGE_SPEC_CODE))
+ .to("hwcloud-dms:createInstance?" +
+ "serviceKeys=#serviceKeys" +
+ "&projectId=" + PROJECT_ID +
+ "®ion=" + REGION +
+ "&ignoreSslVerification=true")
+ .log("Operation successful")
+ .to("log:LOG?showAll=true")
+ .to("mock:operation_result");
+ }
+ };
+ }
+
+ /**
+ * The following test cases should be manually enabled to perform test
against the actual HuaweiCloud DMS server
+ * with real user credentials. To perform this test, manually comment out
the @Ignore annotation and enter relevant
+ * service parameters in the placeholders above (static variables of this
test class)
+ *
+ * @throws Exception
+ */
+ @Ignore("Manually enable this once you configure the parameters in the
placeholders above")
+ @Test
+ public void testOperation() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:operation_result");
+ mock.expectedMinimumMessageCount(1);
+
+ availableZones.add(AVAILABLE_ZONE);
+
+ template.sendBody("direct:operation", null);
+ Exchange responseExchange = mock.getExchanges().get(0);
+
+ mock.assertIsSatisfied();
+
+ assertNotNull(responseExchange.getIn().getBody(String.class));
+ assertTrue(responseExchange.getIn().getBody(String.class).length() >
0);
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstancePojoFunctionalTest.java
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstancePojoFunctionalTest.java
new file mode 100644
index 0000000..e836dc3
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstancePojoFunctionalTest.java
@@ -0,0 +1,109 @@
+/*
+ * 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.dms;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.huaweicloud.common.models.ServiceKeys;
+import
org.apache.camel.component.huaweicloud.dms.models.CreateInstanceRequestBody;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class CreateInstancePojoFunctionalTest extends CamelTestSupport {
+ private static final String AUTHENTICATION_KEY =
"replace_this_with_authentication_key";
+ private static final String SECRET_KEY = "replace_this_with_secret_key";
+ private static final String PROJECT_ID = "replace_this_with_project_id";
+ private static final String REGION = "replace_this_with_region";
+
+ @BindToRegistry("serviceKeys")
+ ServiceKeys serviceKeys = new ServiceKeys(AUTHENTICATION_KEY, SECRET_KEY);
+
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() throws Exception {
+ from("direct:operation")
+ .to("hwcloud-dms:createInstance?" +
+ "serviceKeys=#serviceKeys" +
+ "&projectId=" + PROJECT_ID +
+ "®ion=" + REGION +
+ "&ignoreSslVerification=true")
+ .log("Operation successful")
+ .to("log:LOG?showAll=true")
+ .to("mock:operation_result");
+ }
+ };
+ }
+
+ /**
+ * The following test cases should be manually enabled to perform test
against the actual HuaweiCloud DMS server
+ * with real user credentials. To perform this test, manually comment out
the @Ignore annotation and enter relevant
+ * service parameters in the placeholders above (static variables of this
test class)
+ *
+ * @throws Exception
+ */
+ @Ignore("Manually enable this once you configure the parameters in the
placeholders above")
+ @Test
+ public void testOperation() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:operation_result");
+ mock.expectedMinimumMessageCount(1);
+
+ List<String> availableZones = new ArrayList<>();
+ availableZones.add("replace_with_instance_information");
+ CreateInstanceRequestBody sampleBody = new CreateInstanceRequestBody()
+ .withName("replace_with_instance_information")
+ .withDescription("replace_with_instance_information")
+ .withEngine("replace_with_instance_information")
+ .withEngineVersion("replace_with_instance_information")
+ .withSpecification("replace_with_instance_information")
+ .withStorageSpace(0/*replace_with_instance_information*/)
+ .withPartitionNum(0/*replace_with_instance_information*/)
+ .withAccessUser("replace_with_instance_information")
+ .withPassword("replace_with_instance_information")
+ .withVpcId("replace_with_instance_information")
+ .withSecurityGroupId("replace_with_instance_information")
+ .withSubnetId("replace_with_instance_information")
+ .withAvailableZones(availableZones)
+ .withProductId("replace_with_instance_information")
+ .withKafkaManagerUser("replace_with_instance_information")
+ .withKafkaManagerPassword("replace_with_instance_information")
+ .withMaintainBegin("replace_with_instance_information")
+ .withMaintainEnd("replace_with_instance_information")
+ .withEnablePublicip(false/*replace_with_instance_information*/)
+ .withPublicBandwidth("replace_with_instance_information")
+ .withPublicipId("replace_with_instance_information")
+ .withSslEnable(false/*replace_with_instance_information*/)
+ .withRetentionPolicy("replace_with_instance_information")
+
.withConnectorEnable(false/*replace_with_instance_information*/)
+
.withEnableAutoTopic(false/*replace_with_instance_information*/)
+ .withStorageSpecCode("replace_with_instance_information")
+ .withEnterpriseProjectId("replace_with_instance_information");
+
+ template.sendBody("direct:operation", sampleBody);
+ Exchange responseExchange = mock.getExchanges().get(0);
+
+ mock.assertIsSatisfied();
+
+ assertNotNull(responseExchange.getIn().getBody(String.class));
+ assertTrue(responseExchange.getIn().getBody(String.class).length() >
0);
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceRmqFunctionalTest1.java
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceRmqFunctionalTest1.java
new file mode 100644
index 0000000..86a7edf
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceRmqFunctionalTest1.java
@@ -0,0 +1,107 @@
+/*
+ * 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.dms;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.huaweicloud.common.models.ServiceKeys;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class CreateInstanceRmqFunctionalTest1 extends CamelTestSupport {
+ private static final String AUTHENTICATION_KEY =
"replace_this_with_authentication_key";
+ private static final String SECRET_KEY = "replace_this_with_secret_key";
+ private static final String PROJECT_ID = "replace_this_with_project_id";
+ private static final String REGION = "replace_this_with_region";
+
+ private static final String NAME = "replace_this_with_name";
+ private static final String ENGINE_VERSION =
"replace_this_with_engine_version";
+ private static final String STORAGE_SPACE =
"replace_this_with_storage_space";
+ private static final String ACCESS_USER =
"replace_this_with_storage_access_user";
+ private static final String PASSWORD = "replace_this_with_password";
+ private static final String VPC_ID = "replace_this_with_vpc_id";
+ private static final String SECURITY_GROUP_ID =
"replace_this_with_security_group_id";
+ private static final String SUBNET_ID = "replace_this_with_subnet_id";
+ private static final String AVAILABLE_ZONE =
"replace_this_with_available_zone";
+ private static final String PRODUCT_ID = "replace_this_with_product_id";
+ private static final String STORAGE_SPEC_CODE =
"replace_this_with_storage_spec_code";
+
+ @BindToRegistry("serviceKeys")
+ ServiceKeys serviceKeys = new ServiceKeys(AUTHENTICATION_KEY, SECRET_KEY);
+
+ @BindToRegistry("availableZones")
+ List<String> availableZones = new ArrayList<>();
+
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() throws Exception {
+ from("direct:operation")
+ .to("hwcloud-dms:createInstance?" +
+ "serviceKeys=#serviceKeys" +
+ "&projectId=" + PROJECT_ID +
+ "®ion=" + REGION +
+ "&ignoreSslVerification=true" +
+ "&engine=rabbitmq" +
+
+ "&name=" + NAME +
+ "&engineVersion=" + ENGINE_VERSION +
+ "&storageSpace=" + STORAGE_SPACE +
+ "&accessUser=" + ACCESS_USER +
+ "&password=" + PASSWORD +
+ "&vpcId=" + VPC_ID +
+ "&securityGroupId=" + SECURITY_GROUP_ID +
+ "&subnetId=" + SUBNET_ID +
+ "&availableZones=#availableZones" +
+ "&productId=" + PRODUCT_ID +
+ "&storageSpecCode=" + STORAGE_SPEC_CODE)
+ .log("Operation successful")
+ .to("log:LOG?showAll=true")
+ .to("mock:operation_result");
+ }
+ };
+ }
+
+ /**
+ * The following test cases should be manually enabled to perform test
against the actual HuaweiCloud DMS server
+ * with real user credentials. To perform this test, manually comment out
the @Ignore annotation and enter relevant
+ * service parameters in the placeholders above (static variables of this
test class)
+ *
+ * @throws Exception
+ */
+ @Ignore("Manually enable this once you configure the parameters in the
placeholders above")
+ @Test
+ public void testOperation() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:operation_result");
+ mock.expectedMinimumMessageCount(1);
+
+ availableZones.add(AVAILABLE_ZONE);
+
+ template.sendBody("direct:operation", null);
+ Exchange responseExchange = mock.getExchanges().get(0);
+
+ mock.assertIsSatisfied();
+
+ assertNotNull(responseExchange.getIn().getBody(String.class));
+ assertTrue(responseExchange.getIn().getBody(String.class).length() >
0);
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceRmqTest2.java
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceRmqFunctionalTest2.java
similarity index 52%
copy from
components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceRmqTest2.java
copy to
components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceRmqFunctionalTest2.java
index 3098730..75bddbf 100644
---
a/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceRmqTest2.java
+++
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceRmqFunctionalTest2.java
@@ -24,76 +24,84 @@ import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.huaweicloud.common.models.ServiceKeys;
import org.apache.camel.component.huaweicloud.dms.constants.DMSProperties;
-import org.apache.camel.component.huaweicloud.dms.models.CreateInstanceRequest;
-import
org.apache.camel.component.huaweicloud.dms.models.CreateInstanceResponse;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
import org.junit.Test;
-import org.mockito.Mockito;
-public class CreateInstanceRmqTest2 extends CamelTestSupport {
- TestConfiguration testConfiguration = new TestConfiguration();
+public class CreateInstanceRmqFunctionalTest2 extends CamelTestSupport {
+ private static final String AUTHENTICATION_KEY =
"replace_this_with_authentication_key";
+ private static final String SECRET_KEY = "replace_this_with_secret_key";
+ private static final String PROJECT_ID = "replace_this_with_project_id";
+ private static final String REGION = "replace_this_with_region";
- @BindToRegistry("dmsClient")
- DmsClient mockClient = Mockito.mock(DmsClient.class);
+ private static final String NAME = "replace_this_with_name";
+ private static final String ENGINE_VERSION =
"replace_this_with_engine_version";
+ private static final int STORAGE_SPACE = 0; //
replace_this_with_storage_space
+ private static final String ACCESS_USER =
"replace_this_with_storage_access_user";
+ private static final String PASSWORD = "replace_this_with_password";
+ private static final String VPC_ID = "replace_this_with_vpc_id";
+ private static final String SECURITY_GROUP_ID =
"replace_this_with_security_group_id";
+ private static final String SUBNET_ID = "replace_this_with_subnet_id";
+ private static final String AVAILABLE_ZONE =
"replace_this_with_available_zone";
+ private static final String PRODUCT_ID = "replace_this_with_product_id";
+ private static final String STORAGE_SPEC_CODE =
"replace_this_with_storage_spec_code";
@BindToRegistry("serviceKeys")
- ServiceKeys serviceKeys = new ServiceKeys(
- testConfiguration.getProperty("authenticationKey"),
- testConfiguration.getProperty("secretKey"));
+ ServiceKeys serviceKeys = new ServiceKeys(AUTHENTICATION_KEY, SECRET_KEY);
@BindToRegistry("availableZones")
List<String> availableZones = new ArrayList<>();
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
- @Override
public void configure() throws Exception {
from("direct:operation")
- .setProperty(DMSProperties.NAME,
constant(testConfiguration.getProperty("name")))
+ .setProperty(DMSProperties.NAME, constant(NAME))
.setProperty(DMSProperties.ENGINE,
constant("rabbitmq"))
- .setProperty(DMSProperties.STORAGE_SPACE,
constant(1000))
- .setProperty(DMSProperties.ACCESS_USER,
constant(testConfiguration.getProperty("accessUser")))
- .setProperty(DMSProperties.PASSWORD,
constant(testConfiguration.getProperty("password")))
- .setProperty(DMSProperties.VPC_ID,
constant(testConfiguration.getProperty("vpcId")))
- .setProperty(DMSProperties.SECURITY_GROUP_ID,
-
constant(testConfiguration.getProperty("securityGroupId")))
- .setProperty(DMSProperties.SUBNET_ID,
constant(testConfiguration.getProperty("subnetId")))
+ .setProperty(DMSProperties.ENGINE_VERSION,
constant(ENGINE_VERSION))
+ .setProperty(DMSProperties.STORAGE_SPACE,
constant(STORAGE_SPACE))
+ .setProperty(DMSProperties.ACCESS_USER,
constant(ACCESS_USER))
+ .setProperty(DMSProperties.PASSWORD,
constant(PASSWORD))
+ .setProperty(DMSProperties.VPC_ID, constant(VPC_ID))
+ .setProperty(DMSProperties.SECURITY_GROUP_ID,
constant(SECURITY_GROUP_ID))
+ .setProperty(DMSProperties.SUBNET_ID,
constant(SUBNET_ID))
.setProperty(DMSProperties.AVAILABLE_ZONES,
constant(availableZones))
- .setProperty(DMSProperties.PRODUCT_ID,
constant(testConfiguration.getProperty("productId")))
- .setProperty(DMSProperties.STORAGE_SPEC_CODE,
-
constant(testConfiguration.getProperty("storageSpecCode")))
+ .setProperty(DMSProperties.PRODUCT_ID,
constant(PRODUCT_ID))
+ .setProperty(DMSProperties.STORAGE_SPEC_CODE,
constant(STORAGE_SPEC_CODE))
.to("hwcloud-dms:createInstance?" +
"serviceKeys=#serviceKeys" +
- "&projectId=" +
testConfiguration.getProperty("projectId") +
- "®ion=" +
testConfiguration.getProperty("region") +
- "&instanceId=" +
testConfiguration.getProperty("instanceId") +
- "&ignoreSslVerification=true" +
- "&dmsClient=#dmsClient")
+ "&projectId=" + PROJECT_ID +
+ "®ion=" + REGION +
+ "&ignoreSslVerification=true")
.log("Operation successful")
+ .to("log:LOG?showAll=true")
.to("mock:operation_result");
}
};
}
+ /**
+ * The following test cases should be manually enabled to perform test
against the actual HuaweiCloud DMS server
+ * with real user credentials. To perform this test, manually comment out
the @Ignore annotation and enter relevant
+ * service parameters in the placeholders above (static variables of this
test class)
+ *
+ * @throws Exception
+ */
+ @Ignore("Manually enable this once you configure the parameters in the
placeholders above")
@Test
public void testOperation() throws Exception {
- CreateInstanceResponse response = new CreateInstanceResponse()
- .withInstanceId("test-instance-id");
-
-
Mockito.when(mockClient.createInstance(Mockito.any(CreateInstanceRequest.class))).thenReturn(response);
-
MockEndpoint mock = getMockEndpoint("mock:operation_result");
mock.expectedMinimumMessageCount(1);
- availableZones.add(testConfiguration.getProperty("availableZone"));
+ availableZones.add(AVAILABLE_ZONE);
- template.sendBody("direct:operation", "sample_body");
+ template.sendBody("direct:operation", null);
Exchange responseExchange = mock.getExchanges().get(0);
mock.assertIsSatisfied();
- assertEquals("{\"instance_id\":\"test-instance-id\"}",
- responseExchange.getIn().getBody(String.class));
+ assertNotNull(responseExchange.getIn().getBody(String.class));
+ assertTrue(responseExchange.getIn().getBody(String.class).length() >
0);
}
}
diff --git
a/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceRmqTest1.java
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceRmqTest1.java
index f94a5bc..d974182 100644
---
a/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceRmqTest1.java
+++
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceRmqTest1.java
@@ -59,6 +59,7 @@ public class CreateInstanceRmqTest1 extends CamelTestSupport {
"&name=" + testConfiguration.getProperty("name") +
"&engine=rabbitmq" +
+ "&engineVersion=" +
testConfiguration.getProperty("engineVersion") +
"&storageSpace=1000" +
"&accessUser=" +
testConfiguration.getProperty("accessUser") +
"&password=" +
testConfiguration.getProperty("password") +
diff --git
a/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceRmqTest2.java
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceRmqTest2.java
index 3098730..f62db7a 100644
---
a/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceRmqTest2.java
+++
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/CreateInstanceRmqTest2.java
@@ -52,6 +52,7 @@ public class CreateInstanceRmqTest2 extends CamelTestSupport {
from("direct:operation")
.setProperty(DMSProperties.NAME,
constant(testConfiguration.getProperty("name")))
.setProperty(DMSProperties.ENGINE,
constant("rabbitmq"))
+ .setProperty(DMSProperties.ENGINE_VERSION,
constant(testConfiguration.getProperty("engineVersion")))
.setProperty(DMSProperties.STORAGE_SPACE,
constant(1000))
.setProperty(DMSProperties.ACCESS_USER,
constant(testConfiguration.getProperty("accessUser")))
.setProperty(DMSProperties.PASSWORD,
constant(testConfiguration.getProperty("password")))
diff --git
a/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/DeleteInstanceFunctionalTest.java
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/DeleteInstanceFunctionalTest.java
new file mode 100644
index 0000000..681a4f7
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/DeleteInstanceFunctionalTest.java
@@ -0,0 +1,76 @@
+/*
+ * 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.dms;
+
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.huaweicloud.common.models.ServiceKeys;
+import org.apache.camel.component.huaweicloud.dms.constants.DMSProperties;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class DeleteInstanceFunctionalTest extends CamelTestSupport {
+ private static final String AUTHENTICATION_KEY =
"replace_this_with_authentication_key";
+ private static final String SECRET_KEY = "replace_this_with_secret_key";
+ private static final String PROJECT_ID = "replace_this_with_project_id";
+ private static final String REGION = "replace_this_with_region";
+ private static final String INSTANCE_ID = "replace_this_with_instance_id";
+
+ @BindToRegistry("serviceKeys")
+ ServiceKeys serviceKeys = new ServiceKeys(AUTHENTICATION_KEY, SECRET_KEY);
+
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() throws Exception {
+ from("direct:operation")
+ .setProperty(DMSProperties.OPERATION,
constant("deleteInstance"))
+ .setProperty(DMSProperties.INSTANCE_ID,
constant(INSTANCE_ID))
+ .to("hwcloud-dms:?" +
+ "serviceKeys=#serviceKeys" +
+ "&projectId=" + PROJECT_ID +
+ "®ion=" + REGION +
+ "&ignoreSslVerification=true")
+ .log("Operation successful")
+ .to("log:LOG?showAll=true")
+ .to("mock:operation_result");
+ }
+ };
+ }
+
+ /**
+ * The following test cases should be manually enabled to perform test
against the actual HuaweiCloud DMS server
+ * with real user credentials. To perform this test, manually comment out
the @Ignore annotation and enter relevant
+ * service parameters in the placeholders above (static variables of this
test class)
+ *
+ * @throws Exception
+ */
+ @Ignore("Manually enable this once you configure the parameters in the
placeholders above")
+ @Test
+ public void testOperation() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:operation_result");
+ mock.expectedMinimumMessageCount(1);
+ template.sendBody("direct:operation", "sampleBody");
+ Exchange responseExchange = mock.getExchanges().get(0);
+
+ mock.assertIsSatisfied();
+
+
assertTrue(responseExchange.getProperty(DMSProperties.INSTANCE_DELETED,
boolean.class));
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/ListInstancesFunctionalTest.java
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/ListInstancesFunctionalTest.java
new file mode 100644
index 0000000..bfabaa4
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/ListInstancesFunctionalTest.java
@@ -0,0 +1,71 @@
+/*
+ * 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.dms;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class ListInstancesFunctionalTest extends CamelTestSupport {
+ private static final String AUTHENTICATION_KEY =
"replace_this_with_authentication_key";
+ private static final String SECRET_KEY = "replace_this_with_secret_key";
+ private static final String PROJECT_ID = "replace_this_with_project_id";
+ private static final String REGION = "replace_this_with_region";
+ private static final String ENGINE = "replace_this_with_engine";
+
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() throws Exception {
+ from("direct:operation")
+ .to("hwcloud-dms:listInstances?" +
+ "authenticationKey=" + AUTHENTICATION_KEY +
+ "&secretKey=" + SECRET_KEY +
+ "&projectId=" + PROJECT_ID +
+ "®ion=" + REGION +
+ "&engine=" + ENGINE +
+ "&ignoreSslVerification=true")
+ .log("Operation successful")
+ .to("log:LOG?showAll=true")
+ .to("mock:operation_result");
+ }
+ };
+ }
+
+ /**
+ * The following test cases should be manually enabled to perform test
against the actual HuaweiCloud DMS server
+ * with real user credentials. To perform this test, manually comment out
the @Ignore annotation and enter relevant
+ * service parameters in the placeholders above (static variables of this
test class)
+ *
+ * @throws Exception
+ */
+ @Ignore("Manually enable this once you configure the parameters in the
placeholders above")
+ @Test
+ public void testOperation() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:operation_result");
+ mock.expectedMinimumMessageCount(1);
+ template.sendBody("direct:operation", "sampleBody");
+ Exchange responseExchange = mock.getExchanges().get(0);
+
+ mock.assertIsSatisfied();
+
+ assertNotNull(responseExchange.getIn().getBody(String.class));
+ assertTrue(responseExchange.getIn().getBody(String.class).length() >
0);
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/QueryInstanceFunctionalTest.java
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/QueryInstanceFunctionalTest.java
new file mode 100644
index 0000000..1d8bfc4
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/QueryInstanceFunctionalTest.java
@@ -0,0 +1,75 @@
+/*
+ * 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.dms;
+
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.huaweicloud.common.models.ServiceKeys;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class QueryInstanceFunctionalTest extends CamelTestSupport {
+ private static final String AUTHENTICATION_KEY =
"replace_this_with_authentication_key";
+ private static final String SECRET_KEY = "replace_this_with_secret_key";
+ private static final String PROJECT_ID = "replace_this_with_project_id";
+ private static final String REGION = "replace_this_with_region";
+ private static final String INSTANCE_ID = "replace_this_with_instance_id";
+
+ @BindToRegistry("serviceKeys")
+ ServiceKeys serviceKeys = new ServiceKeys(AUTHENTICATION_KEY, SECRET_KEY);
+
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() throws Exception {
+ from("direct:operation")
+ .to("hwcloud-dms:queryInstance?" +
+ "serviceKeys=#serviceKeys" +
+ "&projectId=" + PROJECT_ID +
+ "®ion=" + REGION +
+ "&instanceId=" + INSTANCE_ID +
+ "&ignoreSslVerification=true")
+ .log("Operation successful")
+ .to("log:LOG?showAll=true")
+ .to("mock:operation_result");
+ }
+ };
+ }
+
+ /**
+ * The following test cases should be manually enabled to perform test
against the actual HuaweiCloud DMS server
+ * with real user credentials. To perform this test, manually comment out
the @Ignore annotation and enter relevant
+ * service parameters in the placeholders above (static variables of this
test class)
+ *
+ * @throws Exception
+ */
+ @Ignore("Manually enable this once you configure the parameters in the
placeholders above")
+ @Test
+ public void testOperation() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:operation_result");
+ mock.expectedMinimumMessageCount(1);
+ template.sendBody("direct:operation", "sampleBody");
+ Exchange responseExchange = mock.getExchanges().get(0);
+
+ mock.assertIsSatisfied();
+
+ assertNotNull(responseExchange.getIn().getBody(String.class));
+ assertTrue(responseExchange.getIn().getBody(String.class).length() >
0);
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/UpdateInstanceJsonFunctionalTest.java
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/UpdateInstanceJsonFunctionalTest.java
new file mode 100644
index 0000000..c27ba75
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/UpdateInstanceJsonFunctionalTest.java
@@ -0,0 +1,86 @@
+/*
+ * 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.dms;
+
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.huaweicloud.common.models.ServiceKeys;
+import org.apache.camel.component.huaweicloud.dms.constants.DMSProperties;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class UpdateInstanceJsonFunctionalTest extends CamelTestSupport {
+ private static final String AUTHENTICATION_KEY =
"replace_this_with_authentication_key";
+ private static final String SECRET_KEY = "replace_this_with_secret_key";
+ private static final String PROJECT_ID = "replace_this_with_project_id";
+ private static final String REGION = "replace_this_with_region";
+ private static final String INSTANCE_ID = "replace_this_with_instance_id";
+
+ @BindToRegistry("serviceKeys")
+ ServiceKeys serviceKeys = new ServiceKeys(AUTHENTICATION_KEY, SECRET_KEY);
+
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() throws Exception {
+ from("direct:operation")
+ .to("hwcloud-dms:updateInstance?" +
+ "serviceKeys=#serviceKeys" +
+ "&projectId=" + PROJECT_ID +
+ "®ion=" + REGION +
+ "&instanceId=" + INSTANCE_ID +
+ "&ignoreSslVerification=true")
+ .log("Operation successful")
+ .to("log:LOG?showAll=true")
+ .to("mock:operation_result");
+ }
+ };
+ }
+
+ /**
+ * The following test cases should be manually enabled to perform test
against the actual HuaweiCloud DMS server
+ * with real user credentials. To perform this test, manually comment out
the @Ignore annotation and enter relevant
+ * service parameters in the placeholders above (static variables of this
test class)
+ *
+ * @throws Exception
+ */
+ @Ignore("Manually enable this once you configure the parameters in the
placeholders above")
+ @Test
+ public void testOperation() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:operation_result");
+ mock.expectedMinimumMessageCount(1);
+
+ String sampleBody = "{" +
+ "\"name\":\"" + "replace_with_new_information" +
"\"," +
+ "\"description\":\"" +
"replace_with_new_information" + "\"," +
+ "\"maintain_begin\":\"" +
"replace_with_new_information" + "\"," +
+ "\"maintain_end\":\"" +
"replace_with_new_information" + "\"," +
+ "\"security_group_id\":\"" +
"replace_with_new_information" + "\"," +
+ "\"enable_publicip\":\"" +
"replace_with_new_information" + "\"," +
+ "\"publicip_id\":\"" +
"replace_with_new_information" + "\"" +
+ "}";
+
+ template.sendBody("direct:operation", sampleBody);
+ Exchange responseExchange = mock.getExchanges().get(0);
+
+ mock.assertIsSatisfied();
+
+
assertTrue(responseExchange.getProperty(DMSProperties.INSTANCE_UPDATED,
boolean.class));
+ }
+}
diff --git
a/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/UpdateInstancePojoFunctionalTest.java
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/UpdateInstancePojoFunctionalTest.java
new file mode 100644
index 0000000..f4f9a78
--- /dev/null
+++
b/components/camel-huawei/camel-huaweicloud-dms/src/test/java/org/apache/camel/component/huaweicloud/dms/UpdateInstancePojoFunctionalTest.java
@@ -0,0 +1,86 @@
+/*
+ * 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.dms;
+
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.huaweicloud.common.models.ServiceKeys;
+import org.apache.camel.component.huaweicloud.dms.constants.DMSProperties;
+import
org.apache.camel.component.huaweicloud.dms.models.UpdateInstanceRequestBody;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class UpdateInstancePojoFunctionalTest extends CamelTestSupport {
+ private static final String AUTHENTICATION_KEY =
"replace_this_with_authentication_key";
+ private static final String SECRET_KEY = "replace_this_with_secret_key";
+ private static final String PROJECT_ID = "replace_this_with_project_id";
+ private static final String REGION = "replace_this_with_region";
+ private static final String INSTANCE_ID = "replace_this_with_instance_id";
+
+ @BindToRegistry("serviceKeys")
+ ServiceKeys serviceKeys = new ServiceKeys(AUTHENTICATION_KEY, SECRET_KEY);
+
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() throws Exception {
+ from("direct:operation")
+ .to("hwcloud-dms:updateInstance?" +
+ "serviceKeys=#serviceKeys" +
+ "&projectId=" + PROJECT_ID +
+ "®ion=" + REGION +
+ "&instanceId=" + INSTANCE_ID +
+ "&ignoreSslVerification=true")
+ .log("Operation successful")
+ .to("log:LOG?showAll=true")
+ .to("mock:operation_result");
+ }
+ };
+ }
+
+ /**
+ * The following test cases should be manually enabled to perform test
against the actual HuaweiCloud DMS server
+ * with real user credentials. To perform this test, manually comment out
the @Ignore annotation and enter relevant
+ * service parameters in the placeholders above (static variables of this
test class)
+ *
+ * @throws Exception
+ */
+ @Ignore("Manually enable this once you configure the parameters in the
placeholders above")
+ @Test
+ public void testOperation() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:operation_result");
+ mock.expectedMinimumMessageCount(1);
+
+ UpdateInstanceRequestBody sampleBody = new UpdateInstanceRequestBody()
+ .withName("replace_with_new_information")
+ .withDescription("replace_with_new_information")
+ .withSecurityGroupId("replace_with_new_information")
+ .withMaintainBegin("replace_with_new_information")
+ .withMaintainEnd("replace_with_new_information")
+ .withEnablePublicip(false/*replace_with_new_information*/)
+ .withPublicipId("replace_with_new_information");
+
+ template.sendBody("direct:operation", sampleBody);
+ Exchange responseExchange = mock.getExchanges().get(0);
+
+ mock.assertIsSatisfied();
+
+
assertTrue(responseExchange.getProperty(DMSProperties.INSTANCE_UPDATED,
boolean.class));
+ }
+}