hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r786386 - in /hadoop/core/branches/HADOOP-4687/hdfs: ivy.xml ivy/libraries.properties src/test/hdfs/org/apache/hadoop/fs/ftp/TestFTPFileSystem.java
Date Fri, 19 Jun 2009 06:30:09 GMT
Author: omalley
Date: Fri Jun 19 06:30:08 2009
New Revision: 786386

URL: http://svn.apache.org/viewvc?rev=786386&view=rev
Log:
HADOOP-4687. Fix libraries to be consistent with each other and fix 
TestFTPFileSystem test case to use the current API.

Modified:
    hadoop/core/branches/HADOOP-4687/hdfs/ivy.xml
    hadoop/core/branches/HADOOP-4687/hdfs/ivy/libraries.properties
    hadoop/core/branches/HADOOP-4687/hdfs/src/test/hdfs/org/apache/hadoop/fs/ftp/TestFTPFileSystem.java

Modified: hadoop/core/branches/HADOOP-4687/hdfs/ivy.xml
URL: http://svn.apache.org/viewvc/hadoop/core/branches/HADOOP-4687/hdfs/ivy.xml?rev=786386&r1=786385&r2=786386&view=diff
==============================================================================
--- hadoop/core/branches/HADOOP-4687/hdfs/ivy.xml (original)
+++ hadoop/core/branches/HADOOP-4687/hdfs/ivy.xml Fri Jun 19 06:30:08 2009
@@ -219,10 +219,6 @@
       name="ftpserver-core"
       rev="${ftpserver-core.version}"
       conf="test->default"/>
-    <dependency org="org.apache.ftpserver"
-      name="ftpserver-deprecated"
-      rev="${ftpserver-deprecated.version}"
-      conf="test->default"/>
 
     <dependency org="junit"
       name="junit"

Modified: hadoop/core/branches/HADOOP-4687/hdfs/ivy/libraries.properties
URL: http://svn.apache.org/viewvc/hadoop/core/branches/HADOOP-4687/hdfs/ivy/libraries.properties?rev=786386&r1=786385&r2=786386&view=diff
==============================================================================
--- hadoop/core/branches/HADOOP-4687/hdfs/ivy/libraries.properties (original)
+++ hadoop/core/branches/HADOOP-4687/hdfs/ivy/libraries.properties Fri Jun 19 06:30:08 2009
@@ -33,9 +33,8 @@
 core.version=3.1.1
 coreplugin.version=1.3.2
 
-ftplet-api.version=1.0.0-M3
-ftpserver-core.version=1.0.0-M2
-ftpserver-deprecated.version=1.0.0-M2
+ftplet-api.version=1.0.2
+ftpserver-core.version=1.0.2
 
 hsqldb.version=1.8.0.10
 
@@ -57,7 +56,7 @@
 log4j.version=1.2.15
 lucene-core.version=2.3.1
 
-mina-core.version=2.0.0-M4
+mina-core.version=2.0.0-M6
 
 oro.version=2.0.8
 

Modified: hadoop/core/branches/HADOOP-4687/hdfs/src/test/hdfs/org/apache/hadoop/fs/ftp/TestFTPFileSystem.java
URL: http://svn.apache.org/viewvc/hadoop/core/branches/HADOOP-4687/hdfs/src/test/hdfs/org/apache/hadoop/fs/ftp/TestFTPFileSystem.java?rev=786386&r1=786385&r2=786386&view=diff
==============================================================================
--- hadoop/core/branches/HADOOP-4687/hdfs/src/test/hdfs/org/apache/hadoop/fs/ftp/TestFTPFileSystem.java
(original)
+++ hadoop/core/branches/HADOOP-4687/hdfs/src/test/hdfs/org/apache/hadoop/fs/ftp/TestFTPFileSystem.java
Fri Jun 19 06:30:08 2009
@@ -17,16 +17,19 @@
  */
 package org.apache.hadoop.fs.ftp;
 
+import java.io.File;
 import java.net.URI;
 import junit.framework.TestCase;
 
-import org.apache.ftpserver.DefaultFtpServerContext;
 import org.apache.ftpserver.FtpServer;
+import org.apache.ftpserver.FtpServerFactory;
+import org.apache.ftpserver.listener.Listener;
+import org.apache.ftpserver.listener.ListenerFactory;
 import org.apache.ftpserver.ftplet.Authority;
 import org.apache.ftpserver.ftplet.UserManager;
-import org.apache.ftpserver.listener.nio.NioListener;
-import org.apache.ftpserver.usermanager.BaseUser;
-import org.apache.ftpserver.usermanager.WritePermission;
+import org.apache.ftpserver.usermanager.ClearTextPasswordEncryptor;
+import org.apache.ftpserver.usermanager.PropertiesUserManagerFactory;
+import org.apache.ftpserver.usermanager.UserManagerFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hdfs.DFSTestUtil;
 import org.apache.hadoop.fs.FileSystem;
@@ -44,36 +47,30 @@
   private FtpServer server = null;
   private FileSystem localFs = null;
   private FileSystem ftpFs = null;
+  private Listener listener = null;
 
-  private Path workDir = new Path(new Path(System.getProperty(
-      "test.build.data", "."), "data"), "TestFTPFileSystem");
+  private Path workDir = new Path(System.getProperty("test.build.data", "."));
+  private File userFile = new File(System.getProperty("test.src.dir"), "ftp.user.properties");
 
-  Path ftpServerRoot = new Path(workDir, "FTPServer");
-  Path ftpServerConfig = null;
+  Path ftpServerRoot = new Path(workDir, "ftp-server");
 
   private void startServer() {
     try {
-      DefaultFtpServerContext context = new DefaultFtpServerContext(false);
-      NioListener listener = new NioListener();
-      // Set port to 0 for OS to give a free port
-      listener.setPort(0);
-      context.setListener("default", listener);
-
-      // Create a test user.
-      UserManager userManager = context.getUserManager();
-      BaseUser adminUser = new BaseUser();
-      adminUser.setName("admin");
-      adminUser.setPassword("admin");
-      adminUser.setEnabled(true);
-      adminUser.setAuthorities(new Authority[] { new WritePermission() });
-
-      Path adminUserHome = new Path(ftpServerRoot, "user/admin");
-      adminUser.setHomeDirectory(adminUserHome.toUri().getPath());
-      adminUser.setMaxIdleTime(0);
-      userManager.save(adminUser);
+      FtpServerFactory serverFactory = new FtpServerFactory();
+      ListenerFactory factory = new ListenerFactory();
+      factory.setPort(0);
+      listener = factory.createListener();
+      serverFactory.addListener("default", listener);
+      // Create a test user
+      PropertiesUserManagerFactory userFactory = new PropertiesUserManagerFactory();
+      userFactory.setFile(userFile);
+      userFactory.setPasswordEncryptor(new ClearTextPasswordEncryptor());
+      UserManager userManager = userFactory.createUserManager();
+      serverFactory.setUserManager(userManager);
 
       // Initialize the server and start.
-      server = new FtpServer(context);
+      
+      server = serverFactory.createServer();
       server.start();
 
     } catch (Exception e) {
@@ -92,9 +89,7 @@
     startServer();
     defaultConf = new Configuration();
     localFs = FileSystem.getLocal(defaultConf);
-    ftpServerConfig = new Path(localFs.getWorkingDirectory(), "res");
-    NioListener listener = (NioListener) server.getServerContext()
-        .getListener("default");
+    localFs.mkdirs(ftpServerRoot);
     int serverPort = listener.getPort();
     ftpFs = FileSystem.get(URI.create("ftp://admin:admin@localhost:"
         + serverPort), defaultConf);
@@ -103,7 +98,6 @@
   @Override
   public void tearDown() throws Exception {
     localFs.delete(ftpServerRoot, true);
-    localFs.delete(ftpServerConfig, true);
     localFs.close();
     ftpFs.close();
     stopServer();



Mime
View raw message