This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch camel-2.22.x in repository https://gitbox.apache.org/repos/asf/camel.git
commit 234bbf709e69901de0a789b4f013d0dd0bddb60c Author: Gandhi <vgand...@lamu02w82e9htd6.uhc.com> AuthorDate: Mon Jan 7 15:27:19 2019 +0530 CAMEL-13035 - fix sc reported Conflicts: components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramEndpoint.java --- .../camel/component/telegram/TelegramEndpoint.java | 4 +-- .../camel/component/telegram/model/Update.java | 17 +++++------- .../telegram/TelegramConsumerChannelPostTest.java | 31 ++++++++++++++++++---- 3 files changed, 35 insertions(+), 17 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 d90702d..d901acf 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 @@ -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