CAMEL-8265: Polished
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/cac2dc7f Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/cac2dc7f Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/cac2dc7f Branch: refs/heads/master Commit: cac2dc7f068c72f5310d990716e221e4026a12c8 Parents: 1028f3c Author: Claus Ibsen <[email protected]> Authored: Thu Jan 29 08:13:18 2015 +0100 Committer: Claus Ibsen <[email protected]> Committed: Thu Jan 29 08:13:18 2015 +0100 ---------------------------------------------------------------------- .../component/hipchat/HipchatConfiguration.java | 21 ++++++++++-- .../component/hipchat/HipchatEndpoint.java | 2 ++ .../component/hipchat/HipchatComponentTest.java | 12 ------- .../src/test/resources/log4j.properties | 35 ++++++++++++++++---- 4 files changed, 49 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/cac2dc7f/components/camel-hipchat/src/main/java/org/apache/camel/component/hipchat/HipchatConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-hipchat/src/main/java/org/apache/camel/component/hipchat/HipchatConfiguration.java b/components/camel-hipchat/src/main/java/org/apache/camel/component/hipchat/HipchatConfiguration.java index 6f5e97b..151774b 100644 --- a/components/camel-hipchat/src/main/java/org/apache/camel/component/hipchat/HipchatConfiguration.java +++ b/components/camel-hipchat/src/main/java/org/apache/camel/component/hipchat/HipchatConfiguration.java @@ -23,12 +23,12 @@ import org.apache.camel.spi.UriPath; @UriParams public class HipchatConfiguration { @UriPath + private String protocol = HipchatConstants.DEFAULT_PROTOCOL; + @UriPath private String host = HipchatConstants.DEFAULT_HOST; @UriPath private Integer port = HipchatConstants.DEFAULT_PORT; @UriParam - private String protocol = HipchatConstants.DEFAULT_PROTOCOL; - @UriParam private String authToken; @UriParam private String consumeUsers; @@ -37,6 +37,9 @@ public class HipchatConfiguration { return host; } + /** + * The host for the hipchat server. Is by default api.hipchat.com + */ public void setHost(String host) { this.host = host; } @@ -45,6 +48,9 @@ public class HipchatConfiguration { return port; } + /** + * The port for the hipchat server. Is by default 80. + */ public void setPort(Integer port) { this.port = port; } @@ -53,6 +59,9 @@ public class HipchatConfiguration { return protocol; } + /** + * The protocol for the hipchat server. Is by default http. + */ public void setProtocol(String protocol) { this.protocol = protocol; } @@ -61,6 +70,9 @@ public class HipchatConfiguration { return authToken; } + /** + * OAuth 2 auth token + */ public void setAuthToken(String authToken) { this.authToken = authToken; } @@ -69,6 +81,11 @@ public class HipchatConfiguration { return consumeUsers; } + /** + * Username(s) when consuming messages from the hiptchat server. + * <p/> + * Multiple user names can be separated by comma. + */ public void setConsumeUsers(String consumeUsers) { this.consumeUsers = consumeUsers; } http://git-wip-us.apache.org/repos/asf/camel/blob/cac2dc7f/components/camel-hipchat/src/main/java/org/apache/camel/component/hipchat/HipchatEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-hipchat/src/main/java/org/apache/camel/component/hipchat/HipchatEndpoint.java b/components/camel-hipchat/src/main/java/org/apache/camel/component/hipchat/HipchatEndpoint.java index 9197848..51150da 100644 --- a/components/camel-hipchat/src/main/java/org/apache/camel/component/hipchat/HipchatEndpoint.java +++ b/components/camel-hipchat/src/main/java/org/apache/camel/component/hipchat/HipchatEndpoint.java @@ -22,6 +22,7 @@ import org.apache.camel.Producer; import org.apache.camel.impl.DefaultEndpoint; import org.apache.camel.impl.ScheduledPollEndpoint; import org.apache.camel.spi.UriEndpoint; +import org.apache.camel.spi.UriParam; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -31,6 +32,7 @@ import org.slf4j.LoggerFactory; @UriEndpoint(scheme = "hipchat", consumerClass = HipchatConsumer.class, label = "api,cloud") public class HipchatEndpoint extends ScheduledPollEndpoint { + @UriParam private HipchatConfiguration configuration; public HipchatEndpoint(String uri, HipchatComponent component) { http://git-wip-us.apache.org/repos/asf/camel/blob/cac2dc7f/components/camel-hipchat/src/test/java/org/apache/camel/component/hipchat/HipchatComponentTest.java ---------------------------------------------------------------------- diff --git a/components/camel-hipchat/src/test/java/org/apache/camel/component/hipchat/HipchatComponentTest.java b/components/camel-hipchat/src/test/java/org/apache/camel/component/hipchat/HipchatComponentTest.java index 3baea33..e9891f9 100644 --- a/components/camel-hipchat/src/test/java/org/apache/camel/component/hipchat/HipchatComponentTest.java +++ b/components/camel-hipchat/src/test/java/org/apache/camel/component/hipchat/HipchatComponentTest.java @@ -20,9 +20,7 @@ import java.util.Arrays; import java.util.HashMap; import org.apache.camel.CamelContext; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import org.mockito.Mockito; import static org.junit.Assert.assertEquals; @@ -30,16 +28,6 @@ import static org.junit.Assert.assertTrue; public class HipchatComponentTest { - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - @Test - public void testAuthTokenMandatory() throws Exception { - HipchatComponent component = new HipchatComponent(Mockito.mock(CamelContext.class)); - expectedException.expect(IllegalArgumentException.class); - component.createEndpoint("", "", new HashMap<String, Object>()); - } - @Test public void testUriParseNoPort() throws Exception { HipchatComponent component = new HipchatComponent(Mockito.mock(CamelContext.class)); http://git-wip-us.apache.org/repos/asf/camel/blob/cac2dc7f/components/camel-hipchat/src/test/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/components/camel-hipchat/src/test/resources/log4j.properties b/components/camel-hipchat/src/test/resources/log4j.properties index 906250b..018f6e6 100644 --- a/components/camel-hipchat/src/test/resources/log4j.properties +++ b/components/camel-hipchat/src/test/resources/log4j.properties @@ -1,15 +1,36 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- + # -# The logging properties used +# The logging properties used during tests.. # -log4j.rootLogger=INFO, out +log4j.rootLogger=INFO, file + +#log4j.logger.org.apache.camel.component.hipchat=DEBUG -# uncomment the following line to turn on Camel debugging -#log4j.logger.org.apache.camel=DEBUG -log4j.logger.org.apache.camel.component.hipchat=DEBUG # CONSOLE appender not used by default log4j.appender.out=org.apache.log4j.ConsoleAppender log4j.appender.out.layout=org.apache.log4j.PatternLayout -log4j.appender.out.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n -#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n +log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n +# File appender +log4j.appender.file=org.apache.log4j.FileAppender +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n +log4j.appender.file.file=target/camel-hipchat-test.log +log4j.appender.file.append=false
