Author: ggregory
Date: Wed Apr 25 19:43:34 2012
New Revision: 1330514

URL: http://svn.apache.org/viewvc?rev=1330514&view=rev
Log:
- Add test suite for FTPS BUT this is disabled because we cannot read from more 
than one stream at a time! This works fine with plain FTP. Some tests pass and 
others fail but there is no way to disable individual tests with the current 
test framework.
- The goal is to be able to test FTPS now, with VFS-412 commented in, and any 
other FTPS changes.
- Add commented out code for VFS-412.
- Refactor magic strings into constants.
- Minor Javadoc changes. 

Added:
    
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftps/
    
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftps/test/
    
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftps/test/FtpsProviderPROTTestCase_Disabled.java
   (with props)
    
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftps/test/FtpsProviderTestCase_Disabled.java
   (with props)
    
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftps/test/MultipleConnectionTestCase.java
   (with props)
    commons/proper/vfs/trunk/core/src/test/resources/org.apache.ftpsserver/
    
commons/proper/vfs/trunk/core/src/test/resources/org.apache.ftpsserver/ftpserver.jks
   (with props)
    
commons/proper/vfs/trunk/core/src/test/resources/org.apache.ftpsserver/users.properties
   (with props)
Modified:
    
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java
    
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsClientFactory.java
    
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileSystemConfigBuilder.java
    
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/RunTest.java

Modified: 
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java
URL: 
http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java?rev=1330514&r1=1330513&r2=1330514&view=diff
==============================================================================
--- 
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java
 (original)
+++ 
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java
 Wed Apr 25 19:43:34 2012
@@ -26,6 +26,7 @@ import java.util.TreeMap;
  *
  * @see org.apache.commons.vfs2.provider.sftp.SftpFileSystemConfigBuilder
  * @see org.apache.commons.vfs2.provider.ftp.FtpFileSystemConfigBuilder
+ * @see org.apache.commons.vfs2.provider.ftps.FtpsFileSystemConfigBuilder
  */
 public final class FileSystemOptions implements Cloneable
 {

Modified: 
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsClientFactory.java
URL: 
http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsClientFactory.java?rev=1330514&r1=1330513&r2=1330514&view=diff
==============================================================================
--- 
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsClientFactory.java
 (original)
+++ 
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsClientFactory.java
 Wed Apr 25 19:43:34 2012
@@ -71,11 +71,11 @@ public final class FtpsClientFactory
 
             final FTPSClient client;
 
-            if 
(FtpsFileSystemConfigBuilder.getInstance().getFtpsType(fileSystemOptions).equals("explicit"))
+            if 
(FtpsFileSystemConfigBuilder.getInstance().getFtpsType(fileSystemOptions).equals(FtpsFileSystemConfigBuilder.FTPS_TYPE_EXPLICIT))
             {
                 client = new FTPSClient();
             }
-            else if 
(FtpsFileSystemConfigBuilder.getInstance().getFtpsType(fileSystemOptions).equals("implicit"))
+            else if 
(FtpsFileSystemConfigBuilder.getInstance().getFtpsType(fileSystemOptions).equals(FtpsFileSystemConfigBuilder.FTPS_TYPE_IMPLICIT))
             {
                 client = new FTPSClient(true);
             }
@@ -145,6 +145,13 @@ public final class FtpsClientFactory
                 {
                     client.connect(hostname, port);
 
+// For VFS-412                    
+//                    String execPROT = 
FtpsFileSystemConfigBuilder.getInstance().getDataChannelProtectionLevel(fileSystemOptions);
 
+//                    if (execPROT != null)
+//                    {
+//                        client.execPROT(execPROT);
+//                    }
+
                     int reply = client.getReplyCode();
                     if (!FTPReply.isPositiveCompletion(reply))
                     {

Modified: 
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileSystemConfigBuilder.java
URL: 
http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileSystemConfigBuilder.java?rev=1330514&r1=1330513&r2=1330514&view=diff
==============================================================================
--- 
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileSystemConfigBuilder.java
 (original)
+++ 
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ftps/FtpsFileSystemConfigBuilder.java
 Wed Apr 25 19:43:34 2012
@@ -42,7 +42,6 @@ public final class FtpsFileSystemConfigB
         FtpsFileSystemConfigBuilder.class.getName() + ".DATA_TIMEOUT";
     private static final String FTPS_TYPE =
         FtpsFileSystemConfigBuilder.class.getName() + ".FTPS_TYPE";
-
     private static final String SERVER_LANGUAGE_CODE =
         FtpsFileSystemConfigBuilder.class.getName() + ".SERVER_LANGUAGE_CODE";
     private static final String DEFAULT_DATE_FORMAT =
@@ -53,6 +52,11 @@ public final class FtpsFileSystemConfigB
         FtpsFileSystemConfigBuilder.class.getName() + ".SERVER_TIME_ZONE_ID";
     private static final String SHORT_MONTH_NAMES =
         FtpsFileSystemConfigBuilder.class.getName() + ".SHORT_MONTH_NAMES";
+    public static final String FTPS_TYPE_IMPLICIT = "implicit";
+    public static final String FTPS_TYPE_EXPLICIT = "explicit";
+// For VFS-412                    
+//  private static final String PROT = 
+//          FtpsFileSystemConfigBuilder.class.getName() + ".PROT";
 
     private FtpsFileSystemConfigBuilder()
     {
@@ -178,7 +182,7 @@ public final class FtpsFileSystemConfigB
      */
     public String getFtpsType(FileSystemOptions opts)
     {
-        return getString(opts, FTPS_TYPE, "explicit");
+        return getString(opts, FTPS_TYPE, 
FtpsFileSystemConfigBuilder.FTPS_TYPE_EXPLICIT);
     }
 
     /**
@@ -319,4 +323,32 @@ public final class FtpsFileSystemConfigB
 
         setParam(opts, SHORT_MONTH_NAMES, clone);
     }
+
+    
+// For VFS-412                    
+//    /**
+//     * Gets the data channel protection level (PROT).
+//     * 
+//     * @param opts The FileSystemOptions.
+//     * @return The PROT value.
+//     * @see org.apache.commons.net.ftp.FTPSClient#execPROT(String)
+//     * @since 2.1
+//     */
+//    public String getDataChannelProtectionLevel(FileSystemOptions opts)
+//    {
+//        return (String) getParam(opts, PROT);
+//    }
+//
+//    /**
+//     * Sets the data channel protection level (PROT).
+//     *
+//     * @param opts  The FileSystemOptions.
+//     * @param prot The PROT value, {@code null} has no effect.
+//     * @see org.apache.commons.net.ftp.FTPSClient#execPROT(String)
+//     * @since 2.1
+//     */
+//    public void setDataChannelProtectionLevel(FileSystemOptions opts, String 
prot)
+//    {
+//        setParam(opts, PROT, prot);
+//    }
 }

Modified: 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/RunTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/RunTest.java?rev=1330514&r1=1330513&r2=1330514&view=diff
==============================================================================
--- 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/RunTest.java
 (original)
+++ 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/RunTest.java
 Wed Apr 25 19:43:34 2012
@@ -38,6 +38,9 @@ public class RunTest
                 "smb://HOME\\vfsusr:vfs%2f%25\\te:st@" + ip  + 
"/vfsusr/vfstest");
         props.setProperty("test.ftp.uri",
                 "ftp://vfsusr:vfs%2f%25\\te:st@"; + ip + "/vfstest");
+        props.setProperty("test.ftps.uri",
+                "ftps://vfsusr:vfs%2f%25\\te:st@" + ip + "/vfstest");        
+        
         props.setProperty("test.http.uri", "http://"; + ip + "/vfstest");
         props.setProperty("test.webdav.uri",
                 "webdav://vfsusr:vfs%2f%25\\te:st@" + ip + "/vfstest");

Added: 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftps/test/FtpsProviderPROTTestCase_Disabled.java
URL: 
http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftps/test/FtpsProviderPROTTestCase_Disabled.java?rev=1330514&view=auto
==============================================================================
--- 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftps/test/FtpsProviderPROTTestCase_Disabled.java
 (added)
+++ 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftps/test/FtpsProviderPROTTestCase_Disabled.java
 Wed Apr 25 19:43:34 2012
@@ -0,0 +1,44 @@
+/*
+ * 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.commons.vfs2.provider.ftps.test;
+
+import org.apache.commons.vfs2.FileSystemOptions;
+import org.apache.commons.vfs2.provider.ftps.FtpsFileSystemConfigBuilder;
+
+/**
+ * Tests VFS-412.
+ */
+public class FtpsProviderPROTTestCase_Disabled extends 
FtpsProviderTestCase_Disabled
+{
+
+    @Override
+    protected FileSystemOptions getFileSystemOptions()
+    {
+        if (fileSystemOptions == null)
+        {
+            fileSystemOptions = new FileSystemOptions();
+            final FtpsFileSystemConfigBuilder builder = 
FtpsFileSystemConfigBuilder.getInstance();
+            builder.setPassiveMode(fileSystemOptions, true);
+            builder.setDataTimeout(fileSystemOptions, Integer.valueOf(2000));
+            builder.setFtpsType(fileSystemOptions, 
FtpsFileSystemConfigBuilder.FTPS_TYPE_IMPLICIT);
+            // For VFS-412
+            // builder.setDataChannelProtectionLevel(fileSystemOptions, "P");
+        }
+        return fileSystemOptions;
+    }
+
+}

Propchange: 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftps/test/FtpsProviderPROTTestCase_Disabled.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftps/test/FtpsProviderPROTTestCase_Disabled.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftps/test/FtpsProviderTestCase_Disabled.java
URL: 
http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftps/test/FtpsProviderTestCase_Disabled.java?rev=1330514&view=auto
==============================================================================
--- 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftps/test/FtpsProviderTestCase_Disabled.java
 (added)
+++ 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftps/test/FtpsProviderTestCase_Disabled.java
 Wed Apr 25 19:43:34 2012
@@ -0,0 +1,216 @@
+/*
+ * 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.commons.vfs2.provider.ftps.test;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+import junit.framework.Test;
+
+import org.apache.commons.vfs2.FileObject;
+import org.apache.commons.vfs2.FileSystemManager;
+import org.apache.commons.vfs2.FileSystemOptions;
+import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
+import org.apache.commons.vfs2.provider.ftps.FtpsFileProvider;
+import org.apache.commons.vfs2.provider.ftps.FtpsFileSystemConfigBuilder;
+import org.apache.commons.vfs2.test.AbstractProviderTestConfig;
+import org.apache.commons.vfs2.test.ProviderTestConfig;
+import org.apache.commons.vfs2.test.ProviderTestSuite;
+import org.apache.commons.vfs2.util.FreeSocketPortUtil;
+import org.apache.ftpserver.FtpServer;
+import org.apache.ftpserver.FtpServerFactory;
+import org.apache.ftpserver.ftplet.FtpException;
+import org.apache.ftpserver.ftplet.UserManager;
+import org.apache.ftpserver.listener.ListenerFactory;
+import org.apache.ftpserver.ssl.SslConfigurationFactory;
+import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory;
+import org.apache.ftpserver.usermanager.impl.BaseUser;
+import org.junit.Assert;
+
+/**
+ * Tests for FTP file systems.
+ * 
+ * This is test fails because we cannot read from more than two input streams 
at the same time.
+ */
+public class FtpsProviderTestCase_Disabled extends AbstractProviderTestConfig 
implements ProviderTestConfig
+{
+
+    private static int SocketPort;
+
+    /**
+     * Use %40 for @ in URLs
+     */
+    private static String ConnectionUri;
+
+    private static FtpServer Server;
+
+    protected FileSystemOptions fileSystemOptions;
+
+    private static final String TEST_URI = "test.ftps.uri";
+
+    private static final String USER_PROPS_RES = 
"org.apache.ftpsserver/users.properties";
+
+    private static final String SERVER_JKS_RES = 
"org.apache.ftpsserver/ftpserver.jks";
+
+    static String getConnectionUri()
+    {
+        return ConnectionUri;
+    }
+
+    static int getSocketPort()
+    {
+        return SocketPort;
+    }
+
+    private static String getSystemTestUriOverride()
+
+    {
+        return System.getProperty(TEST_URI);
+    }
+
+    static void init() throws IOException
+    {
+        SocketPort = FreeSocketPortUtil.findFreeLocalPort();
+        // Use %40 for @ in a URL
+        ConnectionUri = "ftps://test:test@localhost:" + SocketPort;
+    }
+
+    /**
+     * Creates and starts an embedded Apache FTP Server (MINA).
+     * 
+     * @throws FtpException
+     * @throws IOException
+     */
+    static void setUpClass() throws FtpException, IOException
+    {
+        if (Server != null)
+        {
+            return;
+        }
+        init();
+        final FtpServerFactory serverFactory = new FtpServerFactory();
+        final PropertiesUserManagerFactory propertiesUserManagerFactory = new 
PropertiesUserManagerFactory();
+        final URL userPropsResource = 
ClassLoader.getSystemClassLoader().getResource(USER_PROPS_RES);
+        Assert.assertNotNull(USER_PROPS_RES, userPropsResource);
+        propertiesUserManagerFactory.setUrl(userPropsResource);
+        final UserManager userManager = 
propertiesUserManagerFactory.createUserManager();
+        final BaseUser user = (BaseUser) userManager.getUserByName("test");
+        // Pickup the home dir value at runtime even though we have it set in 
the user prop file
+        // The user prop file requires the "homedirectory" to be set
+        user.setHomeDirectory(getTestDirectory());
+        serverFactory.setUserManager(userManager);
+        ListenerFactory factory = new ListenerFactory();
+        // set the port of the listener
+        factory.setPort(SocketPort);
+
+        // define SSL configuration
+        final URL serverJksResource = 
ClassLoader.getSystemClassLoader().getResource(SERVER_JKS_RES);
+        Assert.assertNotNull(SERVER_JKS_RES, serverJksResource);
+        SslConfigurationFactory ssl = new SslConfigurationFactory();
+        final File keyStoreFile = new File(serverJksResource.getFile());
+        Assert.assertTrue(keyStoreFile.toString(), keyStoreFile.exists());
+        ssl.setKeystoreFile(keyStoreFile);
+        ssl.setKeystorePassword("password");
+
+        // set the SSL configuration for the listener
+        factory.setSslConfiguration(ssl.createSslConfiguration());
+        factory.setImplicitSsl(true);
+
+        // replace the default listener
+        serverFactory.addListener("default", factory.createListener());
+
+        // start the server
+        Server = serverFactory.createServer();
+        Server.start();
+    }
+
+    /**
+     * Creates the test suite for the ftp file system.
+     */
+    public static Test suite() throws Exception
+    {
+        return new ProviderTestSuite(new FtpsProviderTestCase_Disabled())
+        {
+            @Override
+            protected void setUp() throws Exception
+            {
+                if (getSystemTestUriOverride() == null)
+                {
+                    setUpClass();
+                }
+                super.setUp();
+            }
+
+            @Override
+            protected void tearDown() throws Exception
+            {
+                tearDownClass();
+                super.tearDown();
+            }
+        };
+    }
+
+    /**
+     * Stops the embedded Apache FTP Server (MINA).
+     */
+    static void tearDownClass()
+    {
+        if (Server != null)
+        {
+            Server.stop();
+            Server = null;
+        }
+    }
+
+    /**
+     * Returns the base folder for tests. You can override the DEFAULT_URI by 
using the system property name defined by
+     * TEST_URI.
+     */
+    @Override
+    public FileObject getBaseTestFolder(final FileSystemManager manager) 
throws Exception
+    {
+        String uri = getSystemTestUriOverride();
+        if (uri == null)
+        {
+            uri = ConnectionUri;
+        }
+        return manager.resolveFile(uri, getFileSystemOptions());
+    }
+
+    protected FileSystemOptions getFileSystemOptions()
+    {
+        if (fileSystemOptions == null)
+        {
+            fileSystemOptions = new FileSystemOptions();
+            final FtpsFileSystemConfigBuilder builder = 
FtpsFileSystemConfigBuilder.getInstance();
+            builder.setPassiveMode(fileSystemOptions, true);
+            builder.setDataTimeout(fileSystemOptions, Integer.valueOf(2000));
+            builder.setFtpsType(fileSystemOptions, 
FtpsFileSystemConfigBuilder.FTPS_TYPE_IMPLICIT);
+        }
+        return fileSystemOptions;
+    }
+
+    /**
+     * Prepares the file system manager.
+     */
+    @Override
+    public void prepare(final DefaultFileSystemManager manager) throws 
Exception
+    {
+        manager.addProvider("ftps", new FtpsFileProvider());
+    }
+}

Propchange: 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftps/test/FtpsProviderTestCase_Disabled.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftps/test/FtpsProviderTestCase_Disabled.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftps/test/MultipleConnectionTestCase.java
URL: 
http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftps/test/MultipleConnectionTestCase.java?rev=1330514&view=auto
==============================================================================
--- 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftps/test/MultipleConnectionTestCase.java
 (added)
+++ 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftps/test/MultipleConnectionTestCase.java
 Wed Apr 25 19:43:34 2012
@@ -0,0 +1,88 @@
+/*
+ * 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.commons.vfs2.provider.ftps.test;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.SocketException;
+
+import org.apache.commons.net.ftp.FTPSClient;
+import org.apache.commons.vfs2.FileObject;
+import org.apache.commons.vfs2.FileSystemException;
+import org.apache.commons.vfs2.VFS;
+import org.apache.ftpserver.ftplet.FtpException;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class MultipleConnectionTestCase
+{
+
+    @BeforeClass
+    public static void setUpClass() throws FtpException, IOException
+    {
+        FtpsProviderTestCase_Disabled.setUpClass();
+    }
+
+    @AfterClass
+    public static void tearDownClass() throws MalformedURLException, 
FtpException
+    {
+        FtpsProviderTestCase_Disabled.tearDownClass();
+    }
+
+    private FTPSClient init(FTPSClient client)
+    {
+        client.enterLocalPassiveMode();
+        return client;
+    }
+
+    private FileObject resolveRoot() throws FileSystemException
+    {
+        return 
VFS.getManager().resolveFile(FtpsProviderTestCase_Disabled.getConnectionUri(),
+                new FtpsProviderTestCase_Disabled().getFileSystemOptions());
+    }
+
+    @Test
+    public void testConnectRoot() throws SocketException, IOException
+    {
+        resolveRoot();
+        resolveRoot();
+    }
+
+    @Test
+    public void testUnderlyingConnect() throws SocketException, IOException
+    {
+        FTPSClient client1 = this.init(new FTPSClient(true));
+        FTPSClient client2 = this.init(new FTPSClient(true));
+        try
+        {
+            final String hostname = "localhost";
+            client1.connect(hostname, 
FtpsProviderTestCase_Disabled.getSocketPort());
+            client2.connect(hostname, 
FtpsProviderTestCase_Disabled.getSocketPort());
+        } finally
+        {
+            if (client1 != null)
+            {
+                client1.disconnect();
+            }
+            if (client2 != null)
+            {
+                client2.disconnect();
+            }
+        }
+    }
+}

Propchange: 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftps/test/MultipleConnectionTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
commons/proper/vfs/trunk/core/src/test/java/org/apache/commons/vfs2/provider/ftps/test/MultipleConnectionTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: 
commons/proper/vfs/trunk/core/src/test/resources/org.apache.ftpsserver/ftpserver.jks
URL: 
http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/resources/org.apache.ftpsserver/ftpserver.jks?rev=1330514&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
commons/proper/vfs/trunk/core/src/test/resources/org.apache.ftpsserver/ftpserver.jks
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
commons/proper/vfs/trunk/core/src/test/resources/org.apache.ftpsserver/users.properties
URL: 
http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/test/resources/org.apache.ftpsserver/users.properties?rev=1330514&view=auto
==============================================================================
--- 
commons/proper/vfs/trunk/core/src/test/resources/org.apache.ftpsserver/users.properties
 (added)
+++ 
commons/proper/vfs/trunk/core/src/test/resources/org.apache.ftpsserver/users.properties
 Wed Apr 25 19:43:34 2012
@@ -0,0 +1,43 @@
+# 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.
+
+# Password is "admin"
+ftpserver.user.admin.userpassword=21232F297A57A5A743894A0E4A801FC3
+ftpserver.user.admin.homedirectory=target/test-classes/test-data
+ftpserver.user.admin.enableflag=true
+ftpserver.user.admin.writepermission=true
+ftpserver.user.admin.maxloginnumber=0
+ftpserver.user.admin.maxloginperip=0
+ftpserver.user.admin.idletime=0
+ftpserver.user.admin.uploadrate=0
+ftpserver.user.admin.downloadrate=0
+
+ftpserver.user.anonymous.userpassword=
+ftpserver.user.anonymous.homedirectory=target/test-classes/test-data
+ftpserver.user.anonymous.enableflag=true
+ftpserver.user.anonymous.writepermission=false
+ftpserver.user.anonymous.maxloginnumber=20
+ftpserver.user.anonymous.maxloginperip=2
+ftpserver.user.anonymous.idletime=300
+ftpserver.user.anonymous.uploadrate=4800
+ftpserver.user.anonymous.downloadrate=4800
+
+# password is "test"
+ftpserver.user.test.userpassword=098f6bcd4621d373cade4e832627b4f6
+ftpserver.user.test.homedirectory=target/test-classes/test-data
+ftpserver.user.test.enableflag=true
+ftpserver.user.test.writepermission=true

Propchange: 
commons/proper/vfs/trunk/core/src/test/resources/org.apache.ftpsserver/users.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
commons/proper/vfs/trunk/core/src/test/resources/org.apache.ftpsserver/users.properties
------------------------------------------------------------------------------
    svn:keywords = Id


Reply via email to