You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2009/12/07 18:46:50 UTC
svn commit: r888048 [2/2] - in /camel/trunk/components/camel-ftp: ./
src/main/java/org/apache/camel/component/file/remote/
src/main/resources/META-INF/services/org/apache/camel/component/
src/test/java/org/apache/camel/component/file/remote/ src/test/r...
Added: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerExplicitTLSWithClientAuthTestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerExplicitTLSWithClientAuthTestSupport.java?rev=888048&view=auto
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerExplicitTLSWithClientAuthTestSupport.java (added)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerExplicitTLSWithClientAuthTestSupport.java Mon Dec 7 17:46:49 2009
@@ -0,0 +1,49 @@
+/**
+ * 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.file.remote;
+
+
+/**
+ * Abstract base class for unit testing using a secure FTP Server over TLS (explicit)
+ * and with client authentication.
+ *
+ * @version $Revision$
+ * @author muellerc
+ */
+public abstract class FtpsServerExplicitTLSWithClientAuthTestSupport extends FtpsServerTestSupport {
+
+ /*
+ * @see org.apache.camel.component.file.remote.FtpServerSecureTestSupport#getClientAuth()
+ */
+ protected String getClientAuth() {
+ return "true";
+ }
+
+ /*
+ * @see org.apache.camel.component.file.remote.FtpServerSecureTestSupport#useImplicit()
+ */
+ protected boolean useImplicit() {
+ return false;
+ }
+
+ /*
+ * @see org.apache.camel.component.file.remote.FtpServerSecureTestSupport#getAuthValue()
+ */
+ protected String getAuthValue() {
+ return AUTH_VALUE_TLS;
+ }
+}
\ No newline at end of file
Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerExplicitTLSWithClientAuthTestSupport.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerExplicitTLSWithClientAuthTestSupport.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerExplicitTLSWithoutClientAuthTestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerExplicitTLSWithoutClientAuthTestSupport.java?rev=888048&view=auto
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerExplicitTLSWithoutClientAuthTestSupport.java (added)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerExplicitTLSWithoutClientAuthTestSupport.java Mon Dec 7 17:46:49 2009
@@ -0,0 +1,49 @@
+/**
+ * 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.file.remote;
+
+
+/**
+ * Abstract base class for unit testing using a secure FTP Server over TLS (explicit)
+ * and without client authentication.
+ *
+ * @version $Revision$
+ * @author muellerc
+ */
+public abstract class FtpsServerExplicitTLSWithoutClientAuthTestSupport extends FtpsServerTestSupport {
+
+ /*
+ * @see org.apache.camel.component.file.remote.FtpServerSecureTestSupport#getClientAuth()
+ */
+ protected String getClientAuth() {
+ return "false";
+ }
+
+ /*
+ * @see org.apache.camel.component.file.remote.FtpServerSecureTestSupport#useImplicit()
+ */
+ protected boolean useImplicit() {
+ return false;
+ }
+
+ /*
+ * @see org.apache.camel.component.file.remote.FtpServerSecureTestSupport#getAuthValue()
+ */
+ protected String getAuthValue() {
+ return AUTH_VALUE_TLS;
+ }
+}
\ No newline at end of file
Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerExplicitTLSWithoutClientAuthTestSupport.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerExplicitTLSWithoutClientAuthTestSupport.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerImplicitSSLWithClientAuthTestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerImplicitSSLWithClientAuthTestSupport.java?rev=888048&view=auto
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerImplicitSSLWithClientAuthTestSupport.java (added)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerImplicitSSLWithClientAuthTestSupport.java Mon Dec 7 17:46:49 2009
@@ -0,0 +1,49 @@
+/**
+ * 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.file.remote;
+
+
+/**
+ * Abstract base class for unit testing using a secure FTP Server over SSL (implicit)
+ * and with client authentication.
+ *
+ * @version $Revision$
+ * @author muellerc
+ */
+public abstract class FtpsServerImplicitSSLWithClientAuthTestSupport extends FtpsServerTestSupport {
+
+ /*
+ * @see org.apache.camel.component.file.remote.FtpServerSecureTestSupport#getClientAuth()
+ */
+ protected String getClientAuth() {
+ return "true";
+ }
+
+ /*
+ * @see org.apache.camel.component.file.remote.FtpServerSecureTestSupport#useImplicit()
+ */
+ protected boolean useImplicit() {
+ return true;
+ }
+
+ /*
+ * @see org.apache.camel.component.file.remote.FtpServerSecureTestSupport#getAuthValue()
+ */
+ protected String getAuthValue() {
+ return AUTH_VALUE_SSL;
+ }
+}
\ No newline at end of file
Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerImplicitSSLWithClientAuthTestSupport.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerImplicitSSLWithClientAuthTestSupport.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerImplicitSSLWithoutClientAuthTestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerImplicitSSLWithoutClientAuthTestSupport.java?rev=888048&view=auto
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerImplicitSSLWithoutClientAuthTestSupport.java (added)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerImplicitSSLWithoutClientAuthTestSupport.java Mon Dec 7 17:46:49 2009
@@ -0,0 +1,49 @@
+/**
+ * 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.file.remote;
+
+
+/**
+ * Abstract base class for unit testing using a secure FTP Server over SSL (implicit)
+ * and without client authentication.
+ *
+ * @version $Revision$
+ * @author muellerc
+ */
+public abstract class FtpsServerImplicitSSLWithoutClientAuthTestSupport extends FtpsServerTestSupport {
+
+ /*
+ * @see org.apache.camel.component.file.remote.FtpServerSecureTestSupport#getClientAuth()
+ */
+ protected String getClientAuth() {
+ return "false";
+ }
+
+ /*
+ * @see org.apache.camel.component.file.remote.FtpServerSecureTestSupport#useImplicit()
+ */
+ protected boolean useImplicit() {
+ return true;
+ }
+
+ /*
+ * @see org.apache.camel.component.file.remote.FtpServerSecureTestSupport#getAuthValue()
+ */
+ protected String getAuthValue() {
+ return AUTH_VALUE_SSL;
+ }
+}
\ No newline at end of file
Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerImplicitSSLWithoutClientAuthTestSupport.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerImplicitSSLWithoutClientAuthTestSupport.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerImplicitTLSWithClientAuthTestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerImplicitTLSWithClientAuthTestSupport.java?rev=888048&view=auto
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerImplicitTLSWithClientAuthTestSupport.java (added)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerImplicitTLSWithClientAuthTestSupport.java Mon Dec 7 17:46:49 2009
@@ -0,0 +1,49 @@
+/**
+ * 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.file.remote;
+
+
+/**
+ * Abstract base class for unit testing using a secure FTP Server over TLS (implicit)
+ * and with client authentication.
+ *
+ * @version $Revision$
+ * @author muellerc
+ */
+public abstract class FtpsServerImplicitTLSWithClientAuthTestSupport extends FtpsServerTestSupport {
+
+ /*
+ * @see org.apache.camel.component.file.remote.FtpServerSecureTestSupport#getClientAuth()
+ */
+ protected String getClientAuth() {
+ return "true";
+ }
+
+ /*
+ * @see org.apache.camel.component.file.remote.FtpServerSecureTestSupport#useImplicit()
+ */
+ protected boolean useImplicit() {
+ return true;
+ }
+
+ /*
+ * @see org.apache.camel.component.file.remote.FtpServerSecureTestSupport#getAuthValue()
+ */
+ protected String getAuthValue() {
+ return AUTH_VALUE_TLS;
+ }
+}
\ No newline at end of file
Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerImplicitTLSWithClientAuthTestSupport.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerImplicitTLSWithClientAuthTestSupport.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerImplicitTLSWithoutClientAuthTestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerImplicitTLSWithoutClientAuthTestSupport.java?rev=888048&view=auto
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerImplicitTLSWithoutClientAuthTestSupport.java (added)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerImplicitTLSWithoutClientAuthTestSupport.java Mon Dec 7 17:46:49 2009
@@ -0,0 +1,49 @@
+/**
+ * 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.file.remote;
+
+
+/**
+ * Abstract base class for unit testing using a secure FTP Server over TLS (implicit)
+ * and without client authentication.
+ *
+ * @version $Revision$
+ * @author muellerc
+ */
+public abstract class FtpsServerImplicitTLSWithoutClientAuthTestSupport extends FtpsServerTestSupport {
+
+ /*
+ * @see org.apache.camel.component.file.remote.FtpServerSecureTestSupport#getClientAuth()
+ */
+ protected String getClientAuth() {
+ return "false";
+ }
+
+ /*
+ * @see org.apache.camel.component.file.remote.FtpServerSecureTestSupport#useImplicit()
+ */
+ protected boolean useImplicit() {
+ return true;
+ }
+
+ /*
+ * @see org.apache.camel.component.file.remote.FtpServerSecureTestSupport#getAuthValue()
+ */
+ protected String getAuthValue() {
+ return AUTH_VALUE_TLS;
+ }
+}
\ No newline at end of file
Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerImplicitTLSWithoutClientAuthTestSupport.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerImplicitTLSWithoutClientAuthTestSupport.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerTestSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerTestSupport.java?rev=888048&view=auto
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerTestSupport.java (added)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerTestSupport.java Mon Dec 7 17:46:49 2009
@@ -0,0 +1,98 @@
+/**
+ * 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.file.remote;
+
+import java.io.File;
+
+import org.apache.ftpserver.FtpServerFactory;
+import org.apache.ftpserver.listener.ListenerFactory;
+import org.apache.ftpserver.ssl.SslConfigurationFactory;
+
+/**
+ * Abstract base class for unit testing using a secure FTP Server (over SSL/TLS)
+ *
+ * @version $Revision$
+ * @author muellerc
+ */
+public abstract class FtpsServerTestSupport extends FtpServerTestSupport {
+
+ protected static final String AUTH_VALUE_SSL = "SSL";
+ protected static final String AUTH_VALUE_TLS = "TLS";
+
+ protected static final File FTPSERVER_KEYSTORE = new File("./src/test/resources/server.jks");
+ protected static final String FTPSERVER_KEYSTORE_PASSWORD = "password";
+
+ protected FtpServerFactory createFtpServerFactory() throws Exception {
+ assertTrue(FTPSERVER_KEYSTORE.exists());
+
+ FtpServerFactory serverFactory = super.createFtpServerFactory();
+
+ ListenerFactory listenerFactory = new ListenerFactory(serverFactory.getListener(DEFAULT_LISTENER));
+ listenerFactory.setImplicitSsl(useImplicit());
+ listenerFactory.setSslConfiguration(createSslConfiguration().createSslConfiguration());
+
+ serverFactory.addListener(DEFAULT_LISTENER, listenerFactory.createListener());
+
+ return serverFactory;
+ }
+
+ protected SslConfigurationFactory createSslConfiguration() {
+ // comment in, if you have trouble with SSL
+ // System.setProperty("javax.net.debug", "all");
+
+ SslConfigurationFactory sslConfigFactory = new SslConfigurationFactory();
+ sslConfigFactory.setSslProtocol(getAuthValue());
+
+ sslConfigFactory.setKeystoreFile(FTPSERVER_KEYSTORE);
+ sslConfigFactory.setKeystoreType("JKS");
+ sslConfigFactory.setKeystoreAlgorithm("SunX509");
+ sslConfigFactory.setKeystorePassword(FTPSERVER_KEYSTORE_PASSWORD);
+ sslConfigFactory.setKeyPassword(FTPSERVER_KEYSTORE_PASSWORD);
+
+ sslConfigFactory.setClientAuthentication(getClientAuth());
+
+ if (Boolean.valueOf(getClientAuth()).booleanValue() == true) {
+ sslConfigFactory.setTruststoreFile(FTPSERVER_KEYSTORE);
+ sslConfigFactory.setTruststoreType("JKS");
+ sslConfigFactory.setTruststoreAlgorithm("SunX509");
+ sslConfigFactory.setTruststorePassword(FTPSERVER_KEYSTORE_PASSWORD);
+ }
+
+ return sslConfigFactory;
+ }
+
+ /**
+ * Set what client authentication level to use, supported values are "yes"
+ * or "true" for required authentication, "want" for wanted authentication
+ * and "false" or "none" for no authentication. Defaults to "none".
+ *
+ * @return clientAuthReqd
+ */
+ protected abstract String getClientAuth();
+
+ /**
+ * Should listeners created by this factory automatically be in SSL mode
+ * automatically or must the client explicitly request to use SSL
+ */
+ protected abstract boolean useImplicit();
+
+ /**
+ * Set the SSL protocol used for this channel. Supported values are "SSL"
+ * and "TLS".
+ */
+ protected abstract String getAuthValue();
+}
\ No newline at end of file
Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerTestSupport.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpsServerTestSupport.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/UriConfigurationTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/UriConfigurationTest.java?rev=888048&r1=888047&r2=888048&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/UriConfigurationTest.java (original)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/UriConfigurationTest.java Mon Dec 7 17:46:49 2009
@@ -60,6 +60,23 @@
assertNull(config.getPassword());
assertEquals(false, config.isBinary());
}
+
+ @Test
+ public void testFtpsConfigurationDefaults() {
+ Endpoint endpoint = context.getEndpoint("ftps://hostname");
+ assertIsInstanceOf(FtpsEndpoint.class, endpoint);
+ FtpsEndpoint ftpsEndpoint = (FtpsEndpoint) endpoint;
+ FtpsConfiguration config = (FtpsConfiguration) ftpsEndpoint.getConfiguration();
+
+ assertEquals("ftps", config.getProtocol());
+ assertEquals("hostname", config.getHost());
+ assertEquals(2222, config.getPort());
+ assertNull(config.getUsername());
+ assertNull(config.getPassword());
+ assertEquals(false, config.isBinary());
+ assertEquals(false, config.isImplicit());
+ assertEquals("TLS", config.getSecurityProtocol());
+ }
@Test
public void testFtpExplicitConfiguration() {
@@ -92,6 +109,23 @@
}
@Test
+ public void testFtpsExplicitConfiguration() {
+ Endpoint endpoint = context.getEndpoint("ftps://user@hostname:1021/some/file?password=secret&binary=true&securityProtocol=SSL&isImplicit=true");
+ assertIsInstanceOf(FtpsEndpoint.class, endpoint);
+ FtpsEndpoint sftpEndpoint = (FtpsEndpoint) endpoint;
+ FtpsConfiguration config = (FtpsConfiguration) sftpEndpoint.getConfiguration();
+
+ assertEquals("ftps", config.getProtocol());
+ assertEquals("hostname", config.getHost());
+ assertEquals(1021, config.getPort());
+ assertEquals("user", config.getUsername());
+ assertEquals("secret", config.getPassword());
+ assertEquals(true, config.isBinary());
+ assertEquals(true, config.isImplicit());
+ assertEquals("SSL", config.getSecurityProtocol());
+ }
+
+ @Test
public void testRemoteFileEndpointFiles() {
assertRemoteFileEndpointFile("ftp://hostname/foo/bar", "foo/bar");
assertRemoteFileEndpointFile("ftp://hostname/foo/bar/", "foo/bar");
@@ -113,6 +147,17 @@
assertRemoteFileEndpointFile("sftp://hostname//", "");
assertRemoteFileEndpointFile("sftp://hostname//foo/bar", "foo/bar");
assertRemoteFileEndpointFile("sftp://hostname//foo/bar/", "foo/bar");
+ assertRemoteFileEndpointFile("ftps://user@hostname:123//foo/bar?password=secret", "foo/bar");
+ assertRemoteFileEndpointFile("ftps://user@hostname:123?password=secret", "");
+ assertRemoteFileEndpointFile("ftps://hostname/foo/bar", "foo/bar");
+ assertRemoteFileEndpointFile("ftps://hostname/foo/bar/", "foo/bar");
+ assertRemoteFileEndpointFile("ftps://hostname/foo/", "foo");
+ assertRemoteFileEndpointFile("ftps://hostname/foo", "foo");
+ assertRemoteFileEndpointFile("ftps://hostname/", "");
+ assertRemoteFileEndpointFile("ftps://hostname", "");
+ assertRemoteFileEndpointFile("ftps://hostname//", "");
+ assertRemoteFileEndpointFile("ftps://hostname//foo/bar", "foo/bar");
+ assertRemoteFileEndpointFile("ftps://hostname//foo/bar/", "foo/bar");
}
private void assertRemoteFileEndpointFile(String endpointUri, String expectedFile) {
@@ -157,5 +202,4 @@
assertEquals("Only directory is supported. Endpoint must be configured with a valid directory: some/file.txt", e.getMessage());
}
}
-
-}
+}
\ No newline at end of file
Added: camel/trunk/components/camel-ftp/src/test/resources/client.jks
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/resources/client.jks?rev=888048&view=auto
==============================================================================
Binary file - no diff available.
Propchange: camel/trunk/components/camel-ftp/src/test/resources/client.jks
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: camel/trunk/components/camel-ftp/src/test/resources/server.jks
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/resources/server.jks?rev=888048&view=auto
==============================================================================
Binary file - no diff available.
Propchange: camel/trunk/components/camel-ftp/src/test/resources/server.jks
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream