camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [camel] 03/04: CAMEL-13035 - fix sc reported
Date Mon, 07 Jan 2019 14:03:50 GMT
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit a53138ae136cd13b43bb56c2a7cf9401dcd5aa01
Author: Gandhi <vgandhi1@LAMU02W82E9HTD6.uhc.com>
AuthorDate: Mon Jan 7 15:27:19 2019 +0530

    CAMEL-13035 - fix sc reported
---
 .../camel/component/telegram/TelegramEndpoint.java |  6 ++---
 .../camel/component/telegram/model/Update.java     | 17 +++++-------
 .../telegram/TelegramConsumerChannelPostTest.java  | 31 ++++++++++++++++++----
 3 files changed, 36 insertions(+), 18 deletions(-)

diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramEndpoint.java
b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramEndpoint.java
index db670e4..3871b91 100644
--- a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramEndpoint.java
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramEndpoint.java
@@ -22,9 +22,9 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.component.telegram.model.Update;
-import org.apache.camel.support.ScheduledPollEndpoint;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
+import org.apache.camel.support.ScheduledPollEndpoint;
 
 /**
  * The telegram component provides access to the <a href="https://core.telegram.org/bots/api">Telegram
Bot API</a>.
@@ -61,8 +61,8 @@ public class TelegramEndpoint extends ScheduledPollEndpoint {
             if (update.getMessage().getChat() != null) {
                 exchange.getIn().setHeader(TelegramConstants.TELEGRAM_CHAT_ID, update.getMessage().getChat().getId());
             }
-        }else if(update.getChannelPost() != null) {
-        	exchange.getIn().setBody(update.getChannelPost());
+        } else if (update.getChannelPost() != null) {
+            exchange.getIn().setBody(update.getChannelPost());
 
             if (update.getChannelPost().getChat() != null) {
                 exchange.getIn().setHeader(TelegramConstants.TELEGRAM_CHAT_ID, update.getChannelPost().getChat().getId());
diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/Update.java
b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/Update.java
index ba0b392..d436bbb 100644
--- a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/Update.java
+++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/Update.java
@@ -32,10 +32,8 @@ public class Update implements Serializable {
     @JsonProperty("update_id")
     private Long updateId;
 
-
     private IncomingMessage message;
-    
-    
+
     @JsonProperty("channel_post")
     private IncomingMessage channelpost;
 
@@ -57,15 +55,14 @@ public class Update implements Serializable {
     public void setMessage(IncomingMessage message) {
         this.message = message;
     }
-    
-    public IncomingMessage getChannelPost() {
-		return channelpost;
-	}
 
-	public void setChannelpost(IncomingMessage channelpost) {
-		this.channelpost = channelpost;
-	}
+    public IncomingMessage getChannelPost() {
+        return channelpost;
+    }
 
+    public void setChannelpost(IncomingMessage channelpost) {
+        this.channelpost = channelpost;
+    }
 
     @Override
     public String toString() {
diff --git a/components/camel-telegram/src/test/java/org/apache/camel/component/telegram/TelegramConsumerChannelPostTest.java
b/components/camel-telegram/src/test/java/org/apache/camel/component/telegram/TelegramConsumerChannelPostTest.java
index 22d15e7..124deb2 100644
--- a/components/camel-telegram/src/test/java/org/apache/camel/component/telegram/TelegramConsumerChannelPostTest.java
+++ b/components/camel-telegram/src/test/java/org/apache/camel/component/telegram/TelegramConsumerChannelPostTest.java
@@ -1,8 +1,21 @@
+/**
+ * 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.telegram;
 
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.when;
-
 import java.time.Instant;
 
 import org.apache.camel.EndpointInject;
@@ -16,10 +29,18 @@ import org.apache.camel.component.telegram.model.UpdateResult;
 import org.apache.camel.component.telegram.util.TelegramTestSupport;
 import org.junit.Before;
 import org.junit.Test;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
+
 
-public class TelegramConsumerChannelPostTest extends TelegramTestSupport{
+/**
+ * 
+ * Test channel data updates are converted by camel application.
+ *
+ */
+public class TelegramConsumerChannelPostTest extends TelegramTestSupport {
 
-	@EndpointInject(uri = "mock:telegram")
+    @EndpointInject(uri = "mock:telegram")
     private MockEndpoint endpoint;
 
     @Before


Mime
View raw message