Repository: camel Updated Branches: refs/heads/master f3f2f34e0 -> 6fb84cfb7
Fix checkstyle warnings. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6fb84cfb Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6fb84cfb Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6fb84cfb Branch: refs/heads/master Commit: 6fb84cfb700f04f41bcd6a075ae5c6571db8d50d Parents: abfae23 Author: Wladislaw Mitzel <mit...@tawadi.de> Authored: Sun May 1 14:30:24 2016 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Mon May 2 08:24:59 2016 +0200 ---------------------------------------------------------------------- .../camel/component/irc/IrcConfiguration.java | 27 +++--- .../apache/camel/component/irc/IrcEndpoint.java | 4 +- .../irc/IrcsListUsersIntegrationTest.java | 90 ++++++++++---------- 3 files changed, 62 insertions(+), 59 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/6fb84cfb/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConfiguration.java b/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConfiguration.java index 8b107ad..0731ce7 100644 --- a/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConfiguration.java +++ b/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConfiguration.java @@ -83,13 +83,13 @@ public class IrcConfiguration implements Cloneable { private boolean onPrivmsg = true; @UriParam(defaultValue = "true") private boolean autoRejoin = true; - /** - * Sends <code>NAMES</code> command to channel after joining it.<br> - * {@link #onReply} has to be <code>true</code> in order to process the - * result which will have the header value <code>irc.num = '353'</code>. - */ + /** + * Sends <code>NAMES</code> command to channel after joining it.<br> + * {@link #onReply} has to be <code>true</code> in order to process the + * result which will have the header value <code>irc.num = '353'</code>. + */ @UriParam(defaultValue = "false") - private boolean namesOnJoin = false; + private boolean namesOnJoin; private SSLContextParameters sslContextParameters; @UriParam private String nickPassword; @@ -462,15 +462,16 @@ public class IrcConfiguration implements Cloneable { } public boolean isNamesOnJoin() { - return namesOnJoin; - } + return namesOnJoin; + } - public void setNamesOnJoin(boolean namesOnJoin) { - this.namesOnJoin = namesOnJoin; - } + public void setNamesOnJoin(boolean namesOnJoin) { + this.namesOnJoin = namesOnJoin; + } - public String toString() { - return "IrcConfiguration[hostname: " + hostname + ", ports=" + Arrays.toString(ports) + ", username=" + username + "]"; + public String toString() { + return "IrcConfiguration[hostname: " + hostname + ", ports=" + Arrays.toString(ports) + ", username=" + username + + "]"; } private static IrcChannel createChannel(String channelInfo) { http://git-wip-us.apache.org/repos/asf/camel/blob/6fb84cfb/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcEndpoint.java b/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcEndpoint.java index 5ddef4a..1f88cc0 100644 --- a/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcEndpoint.java +++ b/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcEndpoint.java @@ -205,8 +205,8 @@ public class IrcEndpoint extends DefaultEndpoint { connection.doJoin(chn); } if (configuration.isNamesOnJoin()) { - connection.doNames(chn); - } + connection.doNames(chn); + } } } http://git-wip-us.apache.org/repos/asf/camel/blob/6fb84cfb/components/camel-irc/src/test/java/org/apache/camel/component/irc/IrcsListUsersIntegrationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-irc/src/test/java/org/apache/camel/component/irc/IrcsListUsersIntegrationTest.java b/components/camel-irc/src/test/java/org/apache/camel/component/irc/IrcsListUsersIntegrationTest.java index 7bb34db..fc3241d 100644 --- a/components/camel-irc/src/test/java/org/apache/camel/component/irc/IrcsListUsersIntegrationTest.java +++ b/components/camel-irc/src/test/java/org/apache/camel/component/irc/IrcsListUsersIntegrationTest.java @@ -35,56 +35,58 @@ import org.slf4j.LoggerFactory; * listed for the channel. */ public class IrcsListUsersIntegrationTest extends CamelTestSupport { - - private static final Logger LOGGER = LoggerFactory.getLogger(IrcsListUsersIntegrationTest.class); - /** message code for a reply to a <code>NAMES</code> command. */ - public static final String IRC_RPL_NAMREPLY = "353"; + private static final Logger LOGGER = LoggerFactory.getLogger(IrcsListUsersIntegrationTest.class); - /** irc component uri. configured by properties */ - private static final String PRODUCER_URI = "ircs:{{test.user}}@{{test.server}}/{{test.room}}"; + /** message code for a reply to a <code>NAMES</code> command. */ + private static final String IRC_RPL_NAMREPLY = "353"; - @EndpointInject(uri = "mock:result") - protected MockEndpoint resultEndpoint; + /** irc component uri. configured by properties */ + private static final String PRODUCER_URI = "ircs:{{test.user}}@{{test.server}}/{{test.room}}"; - protected Properties properties; - - public IrcsListUsersIntegrationTest() throws IOException { - super(); - properties = new Properties(); - InputStream resourceAsStream = this.getClass().getResourceAsStream("/it-list-users.properties"); - properties.load(resourceAsStream); - } - - @Override - protected RoutesBuilder createRouteBuilder() throws Exception { + @EndpointInject(uri = "mock:result") + protected MockEndpoint resultEndpoint; - return new RouteBuilder() { + protected Properties properties; - @Override - public void configure() throws Exception { - LOGGER.debug("Creating new test route"); - from(PRODUCER_URI + "?listOnJoin=true&onReply=true") - .choice() - .when(header("irc.messageType").isEqualToIgnoreCase("REPLY")) - .filter(header("irc.num").isEqualTo(IRC_RPL_NAMREPLY)).to("mock:result").stop(); - } - }; - } + public IrcsListUsersIntegrationTest() throws IOException { + super(); + properties = new Properties(); + InputStream resourceAsStream = this.getClass().getResourceAsStream("/it-list-users.properties"); + properties.load(resourceAsStream); + } - @Test - public void test() throws Exception { - resultEndpoint.setMinimumExpectedMessageCount(1); - resultEndpoint.assertIsSatisfied(); - String body = resultEndpoint.getExchanges().get(0).getIn().getBody(String.class); - LOGGER.debug("Received usernames: [{}]", body); - String username = properties.getProperty("test.user"); - assertTrue("userlist does not contain test user", body.contains(username)); - } - - @Override - protected Properties useOverridePropertiesWithPropertiesComponent() { - return properties; - } + @Override + protected RoutesBuilder createRouteBuilder() throws Exception { + + return new RouteBuilder() { + + @Override + public void configure() throws Exception { + LOGGER.debug("Creating new test route"); + + from(PRODUCER_URI + "?listOnJoin=true&onReply=true") + .choice() + .when(header("irc.messageType").isEqualToIgnoreCase("REPLY")) + .filter(header("irc.num").isEqualTo(IRC_RPL_NAMREPLY)) + .to("mock:result").stop(); + } + }; + } + + @Test + public void test() throws Exception { + resultEndpoint.setMinimumExpectedMessageCount(1); + resultEndpoint.assertIsSatisfied(); + String body = resultEndpoint.getExchanges().get(0).getIn().getBody(String.class); + LOGGER.debug("Received usernames: [{}]", body); + String username = properties.getProperty("test.user"); + assertTrue("userlist does not contain test user", body.contains(username)); + } + + @Override + protected Properties useOverridePropertiesWithPropertiesComponent() { + return properties; + } }