CAMEL-8038: Fixed @UriPath
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/aeacbfe4 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/aeacbfe4 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/aeacbfe4 Branch: refs/heads/master Commit: aeacbfe4f2504d1e6da818e7d6c27db3331158ea Parents: 39010f4 Author: Claus Ibsen <davscl...@apache.org> Authored: Tue Nov 25 07:35:13 2014 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Tue Nov 25 07:35:13 2014 +0100 ---------------------------------------------------------------------- .../camel/component/mail/MailComponent.java | 3 -- .../camel/component/mail/MailConfiguration.java | 41 ++++++++++---------- .../services/org/apache/camel/component/nntp | 18 --------- .../mail/InvalidConfigurationTest.java | 12 ------ ...ponentConfigurationAndDocumentationTest.java | 1 + 5 files changed, 22 insertions(+), 53 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/aeacbfe4/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailComponent.java b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailComponent.java index ace627e..38b8f9f 100644 --- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailComponent.java +++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailComponent.java @@ -56,9 +56,6 @@ public class MailComponent extends UriEndpointComponent { @Override protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { URI url = new URI(uri); - if ("nntp".equalsIgnoreCase(url.getScheme())) { - throw new UnsupportedOperationException("nntp protocol is not supported"); - } // must use copy as each endpoint can have different options ObjectHelper.notNull(configuration, "configuration"); http://git-wip-us.apache.org/repos/asf/camel/blob/aeacbfe4/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java index 084a153..503e359 100644 --- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java +++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConfiguration.java @@ -27,6 +27,7 @@ import javax.net.ssl.SSLContext; import org.apache.camel.RuntimeCamelException; import org.apache.camel.spi.UriParam; import org.apache.camel.spi.UriParams; +import org.apache.camel.spi.UriPath; import org.apache.camel.util.jsse.SSLContextParameters; /** @@ -40,11 +41,11 @@ public class MailConfiguration implements Cloneable { private JavaMailSender javaMailSender; private Properties javaMailProperties; private Properties additionalJavaMailProperties; - @UriParam + // protocol is implied by component name so it should not be in UriPath private String protocol; - @UriParam + @UriPath private String host; - @UriParam + @UriPath private int port = -1; @UriParam private String username; @@ -53,44 +54,44 @@ public class MailConfiguration implements Cloneable { @UriParam private String subject; private Session session; - @UriParam + @UriParam(defaultValue = "true") private boolean mapMailMessage = true; - @UriParam + @UriParam(defaultValue = MailConstants.MAIL_DEFAULT_FROM) private String from = MailConstants.MAIL_DEFAULT_FROM; - @UriParam + @UriParam(defaultValue = MailConstants.MAIL_DEFAULT_FOLDER) private String folderName = MailConstants.MAIL_DEFAULT_FOLDER; - @UriParam + @UriParam(defaultValue = "false") private boolean delete; @UriParam private String copyTo; - @UriParam + @UriParam(defaultValue = "true") private boolean unseen = true; - @UriParam + @UriParam(defaultValue = "false") private boolean ignoreUriScheme; private Map<Message.RecipientType, String> recipients = new HashMap<Message.RecipientType, String>(); @UriParam private String replyTo; - @UriParam + @UriParam(defaultValue = "-1") private int fetchSize = -1; - @UriParam + @UriParam(defaultValue = "false") private boolean debugMode; - @UriParam + @UriParam(defaultValue = "" + MailConstants.MAIL_DEFAULT_CONNECTION_TIMEOUT) private int connectionTimeout = MailConstants.MAIL_DEFAULT_CONNECTION_TIMEOUT; - @UriParam + @UriParam(defaultValue = "false") private boolean dummyTrustManager; - @UriParam + @UriParam(defaultValue = "text/plain") private String contentType = "text/plain"; - @UriParam + @UriParam(defaultValue = MailConstants.MAIL_ALTERNATIVE_BODY) private String alternativeBodyHeader = MailConstants.MAIL_ALTERNATIVE_BODY; - @UriParam + @UriParam(defaultValue = "false") private boolean useInlineAttachments; - @UriParam + @UriParam(defaultValue = "false") private boolean ignoreUnsupportedCharset; - @UriParam + @UriParam(defaultValue = "false") private boolean disconnect; - @UriParam + @UriParam(defaultValue = "true") private boolean closeFolder = true; - @UriParam + @UriParam(defaultValue = "true") private boolean peek = true; private SSLContextParameters sslContextParameters; http://git-wip-us.apache.org/repos/asf/camel/blob/aeacbfe4/components/camel-mail/src/main/resources/META-INF/services/org/apache/camel/component/nntp ---------------------------------------------------------------------- diff --git a/components/camel-mail/src/main/resources/META-INF/services/org/apache/camel/component/nntp b/components/camel-mail/src/main/resources/META-INF/services/org/apache/camel/component/nntp deleted file mode 100644 index f3a5187..0000000 --- a/components/camel-mail/src/main/resources/META-INF/services/org/apache/camel/component/nntp +++ /dev/null @@ -1,18 +0,0 @@ -# -# 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. -# - -class=org.apache.camel.component.mail.MailComponent http://git-wip-us.apache.org/repos/asf/camel/blob/aeacbfe4/components/camel-mail/src/test/java/org/apache/camel/component/mail/InvalidConfigurationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-mail/src/test/java/org/apache/camel/component/mail/InvalidConfigurationTest.java b/components/camel-mail/src/test/java/org/apache/camel/component/mail/InvalidConfigurationTest.java index 3ce8654..2f20a4e 100644 --- a/components/camel-mail/src/test/java/org/apache/camel/component/mail/InvalidConfigurationTest.java +++ b/components/camel-mail/src/test/java/org/apache/camel/component/mail/InvalidConfigurationTest.java @@ -18,7 +18,6 @@ package org.apache.camel.component.mail; import org.apache.camel.Endpoint; import org.apache.camel.PollingConsumer; -import org.apache.camel.ResolveEndpointFailedException; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; @@ -51,15 +50,4 @@ public class InvalidConfigurationTest extends CamelTestSupport { } } - @Test - public void testNNTPNotSupported() throws Exception { - try { - context.getEndpoint("nntp://localhost?username=james"); - fail("Should have thrown UnsupportedOperationException"); - } catch (ResolveEndpointFailedException e) { - // expected - assertTrue(e.getCause() instanceof UnsupportedOperationException); - } - } - } http://git-wip-us.apache.org/repos/asf/camel/blob/aeacbfe4/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailComponentConfigurationAndDocumentationTest.java ---------------------------------------------------------------------- diff --git a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailComponentConfigurationAndDocumentationTest.java b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailComponentConfigurationAndDocumentationTest.java index 53be90c..277bc28 100644 --- a/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailComponentConfigurationAndDocumentationTest.java +++ b/components/camel-mail/src/test/java/org/apache/camel/component/mail/MailComponentConfigurationAndDocumentationTest.java @@ -42,6 +42,7 @@ public class MailComponentConfigurationAndDocumentationTest extends CamelTestSup String json = compConf.createParameterJsonSchema(); assertNotNull(json); + assertTrue(json.contains("\"host\": { \"kind\": \"path\", \"type\": \"string\"")); assertTrue(json.contains("\"contentType\": { \"kind\": \"parameter\", \"type\": \"string\"")); assertTrue(json.contains("\"debugMode\": { \"kind\": \"parameter\", \"type\": \"boolean\"")); }