From 6dcf42262d613f235530e4074bbc8e5858407f8c Mon Sep 17 00:00:00 2001 From: Eli Collins Date: Sun, 8 Jul 2012 18:15:30 +0000 Subject: [PATCH] HDFS-3603. Decouple TestHDFSTrash from TestTrash. Contributed by Jason Lowe git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1358804 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/hadoop/fs/TestTrash.java | 2 +- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 4 +- .../org/apache/hadoop/hdfs/TestHDFSTrash.java | 37 +++++++++---------- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestTrash.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestTrash.java index 782e4e4167..eab79dbf5e 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestTrash.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestTrash.java @@ -89,7 +89,7 @@ static void checkNotInTrash(FileSystem fs, Path trashRoot, String pathname) * @param base - the base path where files are created * @throws IOException */ - protected static void trashShell(final FileSystem fs, final Path base) + public static void trashShell(final FileSystem fs, final Path base) throws IOException { Configuration conf = new Configuration(); conf.set("fs.defaultFS", fs.getUri().toString()); diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 89b4fead7c..a1fb6bc3e5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -178,7 +178,7 @@ Trunk (unreleased changes) HDFS-3541. Deadlock between recovery, xceiver and packet responder (Vinay via umamahesh) Branch-2 ( Unreleased changes ) - + INCOMPATIBLE CHANGES HDFS-3446. HostsFileReader silently ignores bad includes/excludes @@ -439,6 +439,8 @@ Branch-2 ( Unreleased changes ) so that V conforms to boolean compiling HttpFSServer.java with OpenJDK (adi2 via tucu) + HDFS-3603. Decouple TestHDFSTrash from TestTrash. (Jason Lowe via eli) + Release 2.0.0-alpha - 05-23-2012 INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestHDFSTrash.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestHDFSTrash.java index 82c1dfb667..e4124e75c7 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestHDFSTrash.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestHDFSTrash.java @@ -19,46 +19,45 @@ import java.io.IOException; -import junit.extensions.TestSetup; -import junit.framework.Test; -import junit.framework.TestSuite; - import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.TestTrash; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; /** * This class tests commands from Trash. */ -public class TestHDFSTrash extends TestTrash { - +public class TestHDFSTrash { private static MiniDFSCluster cluster = null; - public static Test suite() { - TestSetup setup = new TestSetup(new TestSuite(TestHDFSTrash.class)) { - protected void setUp() throws Exception { - Configuration conf = new HdfsConfiguration(); - cluster = new MiniDFSCluster.Builder(conf).numDataNodes(2).build(); - } - protected void tearDown() throws Exception { - if (cluster != null) { cluster.shutdown(); } - } - }; - return setup; + + @BeforeClass + public static void setUp() throws Exception { + Configuration conf = new HdfsConfiguration(); + cluster = new MiniDFSCluster.Builder(conf).numDataNodes(2).build(); + } + + @AfterClass + public static void tearDown() { + if (cluster != null) { cluster.shutdown(); } } /** * Tests Trash on HDFS */ + @Test public void testTrash() throws IOException { - trashShell(cluster.getFileSystem(), new Path("/")); + TestTrash.trashShell(cluster.getFileSystem(), new Path("/")); } + @Test public void testNonDefaultFS() throws IOException { FileSystem fs = cluster.getFileSystem(); Configuration conf = fs.getConf(); conf.set(DFSConfigKeys.FS_DEFAULT_NAME_KEY, fs.getUri().toString()); - trashNonDefaultFS(conf); + TestTrash.trashNonDefaultFS(conf); } }