You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/01/15 22:18:22 UTC

[GitHub] [camel] mathewsreji opened a new pull request #4894: CAMEL-16001 - huawecloud camel-smn component

mathewsreji opened a new pull request #4894:
URL: https://github.com/apache/camel/pull/4894


   SMN is one among the Cloud product offering within HuaweiCloud ecosystem which enables cloud application users to broadcast/send out notifications to subscribers. It provides a single unified endpoint aka. topic for the application to push data.
   
   Multiple subscribers can be associated with a given topic. Simple Message Notification (SMN) enables you to broadcast messages to subscribers who can chose to receive the notifications via an email addresses, phone numbers, serverless functions and HTTP/HTTPS servers and connect cloud services through notifications, reducing system complexity and developmental efforts to the publishing app.
   
   - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it).  Trivial changes like typos do not require a JIRA issue.  Your pull request should address just this issue, without pulling in other changes.
   - [ ] Each commit in the pull request should have a meaningful subject line and body.
   - [ ] If you're unsure, you can format the pull request title like `[CAMEL-XXX] Fixes bug in camel-file component`, where you replace `CAMEL-XXX` with the appropriate JIRA issue.
   - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [ ] Run `mvn clean install -Psourcecheck` in your module with source check enabled to make sure basic checks pass and there are no checkstyle violations. A more thorough check will be performed on your pull request automatically.
   Below are the contribution guidelines:
   https://github.com/apache/camel/blob/master/CONTRIBUTING.md


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] oscerd commented on pull request #4894: CAMEL-16001 - huawecloud camel-smn component

Posted by GitBox <gi...@apache.org>.
oscerd commented on pull request #4894:
URL: https://github.com/apache/camel/pull/4894#issuecomment-761234707


   This is a new component. It can only be merged on master


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] oscerd commented on pull request #4894: CAMEL-16001 - huawecloud camel-smn component

Posted by GitBox <gi...@apache.org>.
oscerd commented on pull request #4894:
URL: https://github.com/apache/camel/pull/4894#issuecomment-761235021


   Please open a PR against master branch


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] mathewsreji commented on pull request #4894: CAMEL-16001 - huawecloud camel-smn component

Posted by GitBox <gi...@apache.org>.
mathewsreji commented on pull request #4894:
URL: https://github.com/apache/camel/pull/4894#issuecomment-762425157


   Fresh PR raised at https://github.com/apache/camel/pull/4900


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] oscerd closed pull request #4894: CAMEL-16001 - huawecloud camel-smn component

Posted by GitBox <gi...@apache.org>.
oscerd closed pull request #4894:
URL: https://github.com/apache/camel/pull/4894


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] WillemJiang commented on a change in pull request #4894: CAMEL-16001 - huawecloud camel-smn component

Posted by GitBox <gi...@apache.org>.
WillemJiang commented on a change in pull request #4894:
URL: https://github.com/apache/camel/pull/4894#discussion_r558776067



##########
File path: components/camel-huaweicloud-smn/src/test/java/org/apache/camel/component/huaweicloud/smn/PublishTemplatedMessageTest.java
##########
@@ -0,0 +1,118 @@
+package org.apache.camel.component.huaweicloud.smn;
+
+import com.github.tomakehurst.wiremock.WireMockServer;
+import com.github.tomakehurst.wiremock.verification.LoggedRequest;
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.huaweicloud.smn.models.ServiceKeys;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.mockito.exceptions.base.MockitoException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.*;
+
+public class PublishTemplatedMessageTest extends CamelTestSupport {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(PublishTemplatedMessageTest.class.getName());
+    private static int wiremockServerPort = 8080;

Review comment:
       It may cause some trouble in CI if the test port is used. 
   There is a port lookup util method in Camel that you can take a look.
   

##########
File path: components/camel-huaweicloud-smn/src/test/java/org/apache/camel/component/huaweicloud/smn/PublishTemplatedMessageTest.java
##########
@@ -0,0 +1,118 @@
+package org.apache.camel.component.huaweicloud.smn;
+
+import com.github.tomakehurst.wiremock.WireMockServer;
+import com.github.tomakehurst.wiremock.verification.LoggedRequest;
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.huaweicloud.smn.models.ServiceKeys;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.mockito.exceptions.base.MockitoException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.*;
+
+public class PublishTemplatedMessageTest extends CamelTestSupport {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(PublishTemplatedMessageTest.class.getName());
+    private static int wiremockServerPort = 8080;
+
+    TestConfiguration testConfiguration = new TestConfiguration();
+
+    WireMockServer wireMockServer;
+
+    @BindToRegistry("serviceKeys")
+    ServiceKeys serviceKeys = new ServiceKeys(testConfiguration.getProperty("authKey"), testConfiguration.getProperty("secretKey"));
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+
+        // populating tag values. user has to adjust the map entries according to the structure of their respective templates
+        Map<String, String> tags = new HashMap<>();
+        tags.put("name", "reji");
+        tags.put("phone", "1234567890");
+
+        return new RouteBuilder() {
+            public void configure() {
+                from("direct:publish_templated_message")
+                        .setProperty("CamelHwCloudSmnSubject", constant("This is my subjectline"))
+                        .setProperty("CamelHwCloudSmnTopic", constant(testConfiguration.getProperty("topic")))
+                        .setProperty("CamelHwCloudSmnMessageTtl", constant(60))
+                        .setProperty("CamelHwCloudSmnTemplateTags", constant(tags))
+                        .setProperty("CamelHwCloudSmnTemplateName", constant("hello-template"))
+                        //.to("hwcloud-smn:publishMessageService?serviceKeys=#serviceKeys&operation=publishAsTemplatedMessage"+"&projectId="+testConfiguration.getProperty("projectId")+"&region="+testConfiguration.getProperty("region")+"&proxyHost=localhost&proxyPort=3128&ignoreSslVerification=true")
+                        .to("hwcloud-smn:publishMessageService?serviceKeys=#serviceKeys&operation=publishAsTemplatedMessage"+"&projectId="+testConfiguration.getProperty("projectId")+"&region="+testConfiguration.getProperty("region")+"&ignoreSslVerification=true")
+                        .log("templated notification sent")
+                        .to("mock:publish_templated_message_result");
+            }
+        };
+    }
+
+    private void setupSimpleNotificationsUtilsMock() {
+        try {
+            Mockito.mockStatic(SimpleNotificationUtils.class);
+            Mockito.when(SimpleNotificationUtils.resolveSmnServiceEndpoint("unit-test")).thenReturn("http://localhost:" + wiremockServerPort);
+        }catch (MockitoException e) {
+            LOGGER.info("Mock already registered. Using existing registration");

Review comment:
       I doubt about this Information.

##########
File path: components/camel-huaweicloud-smn/src/test/java/org/apache/camel/component/huaweicloud/smn/PublishTemplatedMessageTest.java
##########
@@ -0,0 +1,118 @@
+package org.apache.camel.component.huaweicloud.smn;
+
+import com.github.tomakehurst.wiremock.WireMockServer;
+import com.github.tomakehurst.wiremock.verification.LoggedRequest;
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.huaweicloud.smn.models.ServiceKeys;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.mockito.exceptions.base.MockitoException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.*;
+
+public class PublishTemplatedMessageTest extends CamelTestSupport {

Review comment:
       we can consider to reuse the WireMock setup code across PublishTemplatedMessageTest and PublishTextMessageTest.

##########
File path: components/camel-huaweicloud-smn/src/test/java/org/apache/camel/component/huaweicloud/smn/PublishTextMessageTest.java
##########
@@ -0,0 +1,108 @@
+package org.apache.camel.component.huaweicloud.smn;
+
+import com.github.tomakehurst.wiremock.WireMockServer;
+import com.github.tomakehurst.wiremock.verification.LoggedRequest;
+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.Assert;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.mockito.exceptions.base.MockitoException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.*;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+
+public class PublishTextMessageTest extends CamelTestSupport {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(PublishTextMessageTest.class.getName());
+    private static int wiremockServerPort = 8080;
+
+    TestConfiguration testConfiguration = new TestConfiguration();
+
+    WireMockServer wireMockServer;
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() {
+                from("direct:publish_text_message")
+                        .setProperty("CamelHwCloudSmnSubject", constant("Dummy Subject Line"))
+                        .setProperty("CamelHwCloudSmnTopic", constant(testConfiguration.getProperty("topic")))
+                        .setProperty("CamelHwCloudSmnMessageTtl", constant(60))
+                        //.to("hwcloud-smn:publishMessageService?operation=publishAsTextMessage&authKey="+testConfiguration.getProperty("authKey")+"&secretKey="+testConfiguration.getProperty("secretKey")+"&projectId="+testConfiguration.getProperty("projectId")+"&region="+testConfiguration.getProperty("region")+"&proxyHost=localhost&proxyPort=3128&ignoreSslVerification=true")
+                        .to("hwcloud-smn:publishMessageService?operation=publishAsTextMessage&authKey="+testConfiguration.getProperty("authKey")+"&secretKey="+testConfiguration.getProperty("secretKey")+"&projectId="+testConfiguration.getProperty("projectId")+"&region="+testConfiguration.getProperty("region")+"&ignoreSslVerification=true")
+                        .log("publish message successful")
+                        .to("log:LOG?showAll=true")
+                        .to("mock:publish_text_message_result");
+            }
+        };
+    }
+
+    @Test
+    public void testTextNotificationSend() throws Exception {
+
+        boolean isMockedServerTest = testConfiguration.getProperty("region").equals("unit-test");
+        if(isMockedServerTest) {
+            LOGGER.info("region is unit-test. Starting up wiremock stubs");
+            initWireMock();
+            setupSimpleNotificationsUtilsMock();
+        }
+
+        MockEndpoint mock = getMockEndpoint("mock:publish_text_message_result");
+        mock.expectedMinimumMessageCount(1);
+        template.sendBody("direct:publish_text_message", "message content");
+        Exchange responseExchange = mock.getExchanges().get(0);
+
+        mock.assertIsSatisfied();
+
+        Assert.assertNotNull(responseExchange.getProperty("CamelSmnMesssageId"));
+        Assert.assertNotNull(responseExchange.getProperty("CamelSmnRequestId"));
+        Assert.assertTrue(responseExchange.getProperty("CamelSmnMesssageId").toString().length() > 0);
+        Assert.assertTrue(responseExchange.getProperty("CamelSmnRequestId").toString().length() > 0);
+
+
+        if(isMockedServerTest) {
+            Assert.assertEquals("bf94b63a5dfb475994d3ac34664e24f2", responseExchange.getProperty("CamelSmnMesssageId"));
+            Assert.assertEquals("6a63a18b8bab40ffb71ebd9cb80d0085", responseExchange.getProperty("CamelSmnRequestId"));
+
+            LoggedRequest loggedRequest = TestUtils.retrieveTextNotificationRequest(getAllServeEvents());;
+            LOGGER.info("Verifying wiremock request");
+            Assert.assertEquals("http://localhost:8080/v2/9071a38e7f6a4ba7b7bcbeb7d4ea6efc/notifications/topics/urn:smn:unit-test:9071a38e7f6a4ba7b7bcbeb7d4ea6efc:reji-test/publish", loggedRequest.getAbsoluteUrl());
+            Assert.assertEquals("eyJzdWJqZWN0IjoiRHVtbXkgU3ViamVjdCBMaW5lIiwibWVzc2FnZSI6Im1lc3NhZ2UgY29udGVudCIsInRpbWVfdG9fbGl2ZSI6IjYwIn0=", loggedRequest.getBodyAsBase64());
+            Assert.assertEquals("{\"subject\":\"Dummy Subject Line\",\"message\":\"message content\",\"time_to_live\":\"60\"}", loggedRequest.getBodyAsString());
+        }
+    }
+
+
+    private void setupSimpleNotificationsUtilsMock() {
+        Mockito.reset();
+        try {
+            Mockito.mockStatic(SimpleNotificationUtils.class);
+            Mockito.when(SimpleNotificationUtils.resolveSmnServiceEndpoint("unit-test")).thenReturn("http://localhost:" + wiremockServerPort);

Review comment:
       It's not a good practice to mock the static utils method. 

##########
File path: components/camel-huaweicloud-smn/src/test/java/org/apache/camel/component/huaweicloud/smn/PublishTemplatedMessageTest.java
##########
@@ -0,0 +1,118 @@
+package org.apache.camel.component.huaweicloud.smn;
+
+import com.github.tomakehurst.wiremock.WireMockServer;
+import com.github.tomakehurst.wiremock.verification.LoggedRequest;
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.huaweicloud.smn.models.ServiceKeys;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.mockito.exceptions.base.MockitoException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.*;
+
+public class PublishTemplatedMessageTest extends CamelTestSupport {
+
+    private static final Logger LOGGER = LoggerFactory.getLogger(PublishTemplatedMessageTest.class.getName());
+    private static int wiremockServerPort = 8080;
+
+    TestConfiguration testConfiguration = new TestConfiguration();
+
+    WireMockServer wireMockServer;
+
+    @BindToRegistry("serviceKeys")
+    ServiceKeys serviceKeys = new ServiceKeys(testConfiguration.getProperty("authKey"), testConfiguration.getProperty("secretKey"));
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+
+        // populating tag values. user has to adjust the map entries according to the structure of their respective templates
+        Map<String, String> tags = new HashMap<>();
+        tags.put("name", "reji");
+        tags.put("phone", "1234567890");
+
+        return new RouteBuilder() {
+            public void configure() {
+                from("direct:publish_templated_message")
+                        .setProperty("CamelHwCloudSmnSubject", constant("This is my subjectline"))
+                        .setProperty("CamelHwCloudSmnTopic", constant(testConfiguration.getProperty("topic")))
+                        .setProperty("CamelHwCloudSmnMessageTtl", constant(60))
+                        .setProperty("CamelHwCloudSmnTemplateTags", constant(tags))
+                        .setProperty("CamelHwCloudSmnTemplateName", constant("hello-template"))
+                        //.to("hwcloud-smn:publishMessageService?serviceKeys=#serviceKeys&operation=publishAsTemplatedMessage"+"&projectId="+testConfiguration.getProperty("projectId")+"&region="+testConfiguration.getProperty("region")+"&proxyHost=localhost&proxyPort=3128&ignoreSslVerification=true")
+                        .to("hwcloud-smn:publishMessageService?serviceKeys=#serviceKeys&operation=publishAsTemplatedMessage"+"&projectId="+testConfiguration.getProperty("projectId")+"&region="+testConfiguration.getProperty("region")+"&ignoreSslVerification=true")
+                        .log("templated notification sent")
+                        .to("mock:publish_templated_message_result");
+            }
+        };
+    }
+
+    private void setupSimpleNotificationsUtilsMock() {
+        try {
+            Mockito.mockStatic(SimpleNotificationUtils.class);
+            Mockito.when(SimpleNotificationUtils.resolveSmnServiceEndpoint("unit-test")).thenReturn("http://localhost:" + wiremockServerPort);
+        }catch (MockitoException e) {
+            LOGGER.info("Mock already registered. Using existing registration");
+        }
+    }
+
+    @Test
+    public void testTemplatedNotificationSend() throws Exception {
+        boolean isMockedServerTest = testConfiguration.getProperty("region").equals("unit-test");
+        if(isMockedServerTest) {
+            LOGGER.info("region is unit-test. Starting up wiremock stubs");
+            initWireMock();
+            setupSimpleNotificationsUtilsMock();
+        }
+
+        MockEndpoint mock = getMockEndpoint("mock:publish_templated_message_result");
+        mock.expectedMinimumMessageCount(1);
+        template.sendBody("direct:publish_templated_message",null);
+        Exchange responseExchange = mock.getExchanges().get(0);
+
+        mock.assertIsSatisfied();
+
+        Assert.assertNotNull(responseExchange.getProperty("CamelSmnMesssageId"));
+        Assert.assertNotNull(responseExchange.getProperty("CamelSmnRequestId"));
+        Assert.assertTrue(responseExchange.getProperty("CamelSmnMesssageId").toString().length() > 0);
+        Assert.assertTrue(responseExchange.getProperty("CamelSmnRequestId").toString().length() > 0);
+
+        if(isMockedServerTest) {
+            Assert.assertEquals("bf94b63a5dfb475994d3ac34664e24f2", responseExchange.getProperty("CamelSmnMesssageId"));
+            Assert.assertEquals("6a63a18b8bab40ffb71ebd9cb80d0085", responseExchange.getProperty("CamelSmnRequestId"));
+
+            LoggedRequest loggedRequest = TestUtils.retrieveTemplatedNotificationRequest(getAllServeEvents());
+            LOGGER.info("Verifying wiremock request");
+            Assert.assertEquals("http://localhost:8080/v2/9071a38e7f6a4ba7b7bcbeb7d4ea6efc/notifications/topics/urn:smn:unit-test:9071a38e7f6a4ba7b7bcbeb7d4ea6efc:reji-test/publish", loggedRequest.getAbsoluteUrl());
+            Assert.assertEquals("eyJzdWJqZWN0IjoiVGhpcyBpcyBteSBzdWJqZWN0bGluZSIsIm1lc3NhZ2VfdGVtcGxhdGVfbmFtZSI6ImhlbGxvLXRlbXBsYXRlIiwidGFncyI6eyJwaG9uZSI6IjEyMzQ1Njc4OTAiLCJuYW1lIjoicmVqaSJ9LCJ0aW1lX3RvX2xpdmUiOiI2MCJ9", loggedRequest.getBodyAsBase64());
+            Assert.assertEquals("{\"subject\":\"This is my subjectline\",\"message_template_name\":\"hello-template\",\"tags\":{\"phone\":\"1234567890\",\"name\":\"reji\"},\"time_to_live\":\"60\"}", loggedRequest.getBodyAsString());
+        }
+    }
+
+    private void initWireMock() throws Exception {
+        try {
+            wireMockServer = new WireMockServer(wiremockServerPort);
+            wireMockServer.start();
+        }catch (Exception e) {
+            LOGGER.info("wiremock server already registered in test context. using the same");

Review comment:
       We should throw the exception beside print a log.

##########
File path: components/camel-huaweicloud-smn/src/main/java/org/apache/camel/component/huaweicloud/smn/SimpleNotificationUtils.java
##########
@@ -0,0 +1,67 @@
+/*
+ * 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.smn;
+
+import com.huaweicloud.sdk.core.region.Region;
+import com.huaweicloud.sdk.smn.v2.region.SmnRegion;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * utility functions for the component
+ */
+public class SimpleNotificationUtils {
+    private static final Logger LOG = LoggerFactory.getLogger(SimpleNotificationUtils.class.getName());
+
+    /**
+     * resolves endpoint url for the given region
+     * @param region
+     * @return
+     */
+    public static String resolveSmnServiceEndpoint(String region) {

Review comment:
       As we didn't test this method due to mocking the static method,  could you explain why do you create this method?
   

##########
File path: components/camel-huaweicloud-smn/src/test/java/org/apache/camel/component/huaweicloud/smn/PublishTemplatedMessageTest.java
##########
@@ -0,0 +1,118 @@
+package org.apache.camel.component.huaweicloud.smn;

Review comment:
       Please add the License header on all the test java files.

##########
File path: components/camel-huaweicloud-smn/src/main/java/org/apache/camel/component/huaweicloud/smn/SimpleNotificationUtils.java
##########
@@ -0,0 +1,67 @@
+/*
+ * 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.smn;
+
+import com.huaweicloud.sdk.core.region.Region;
+import com.huaweicloud.sdk.smn.v2.region.SmnRegion;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * utility functions for the component
+ */
+public class SimpleNotificationUtils {
+    private static final Logger LOG = LoggerFactory.getLogger(SimpleNotificationUtils.class.getName());
+
+    /**
+     * resolves endpoint url for the given region
+     * @param region
+     * @return
+     */
+    public static String resolveSmnServiceEndpoint(String region) {
+        if(region == null) {
+            return null;
+        }
+
+        String result = null;
+
+        try {
+            String formattedEndpointKey = formatEndpointKey(region);
+            result = ((Region) SmnRegion.class.getField(formattedEndpointKey)

Review comment:
       I'm not sure if we can still use reflection in Camel 3.0 to support camel-quarkus.
   Please double check it with the community.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel] mathewsreji commented on pull request #4894: CAMEL-16001 - huawecloud camel-smn component

Posted by GitBox <gi...@apache.org>.
mathewsreji commented on pull request #4894:
URL: https://github.com/apache/camel/pull/4894#issuecomment-761239457


   @oscerd - thanks for the comment. I will raise a fresh PR shortly against the master branch. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org