You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by tg...@apache.org on 2012/08/17 23:45:41 UTC
svn commit: r1374450 - in
/hadoop/common/branches/branch-2.1.0-alpha/hadoop-common-project/hadoop-common:
CHANGES.txt src/test/java/org/apache/hadoop/fs/shell/TestPathData.java
Author: tgraves
Date: Fri Aug 17 21:45:41 2012
New Revision: 1374450
URL: http://svn.apache.org/viewvc?rev=1374450&view=rev
Log:
merge -r 1374446:1374447 from trunk. FIXES: HADOOP-8695
Modified:
hadoop/common/branches/branch-2.1.0-alpha/hadoop-common-project/hadoop-common/CHANGES.txt
hadoop/common/branches/branch-2.1.0-alpha/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathData.java
Modified: hadoop/common/branches/branch-2.1.0-alpha/hadoop-common-project/hadoop-common/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.1.0-alpha/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1374450&r1=1374449&r2=1374450&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.1.0-alpha/hadoop-common-project/hadoop-common/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2.1.0-alpha/hadoop-common-project/hadoop-common/CHANGES.txt Fri Aug 17 21:45:41 2012
@@ -665,6 +665,9 @@ Release 0.23.3 - UNRELEASED
HADOOP-8697. TestWritableName fails intermittently with JDK7 (Trevor
Robinson via tgraves)
+ HADOOP-8695. TestPathData fails intermittently with JDK7 (Trevor
+ Robinson via tgraves)
+
Release 0.23.2 - UNRELEASED
NEW FEATURES
Modified: hadoop/common/branches/branch-2.1.0-alpha/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathData.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.1.0-alpha/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathData.java?rev=1374450&r1=1374449&r2=1374450&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.1.0-alpha/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathData.java (original)
+++ hadoop/common/branches/branch-2.1.0-alpha/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestPathData.java Fri Aug 17 21:45:41 2012
@@ -26,23 +26,17 @@ import java.util.Arrays;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
-import org.junit.BeforeClass;
+import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
public class TestPathData {
- protected static Configuration conf;
- protected static FileSystem fs;
- protected static String dirString;
- protected static Path testDir;
- protected static PathData item;
-
- protected static String[] d1Paths =
- new String[] { "d1/f1", "d1/f1.1", "d1/f2" };
- protected static String[] d2Paths =
- new String[] { "d2/f3" };
-
- @BeforeClass
- public static void initialize() throws Exception {
+ protected Configuration conf;
+ protected FileSystem fs;
+ protected Path testDir;
+
+ @Before
+ public void initialize() throws Exception {
conf = new Configuration();
fs = FileSystem.getLocal(conf);
testDir = new Path(
@@ -60,23 +54,28 @@ public class TestPathData {
fs.create(new Path("d2","f3"));
}
+ @After
+ public void cleanup() throws Exception {
+ fs.close();
+ }
+
@Test
public void testWithDirStringAndConf() throws Exception {
- dirString = "d1";
- item = new PathData(dirString, conf);
- checkPathData();
+ String dirString = "d1";
+ PathData item = new PathData(dirString, conf);
+ checkPathData(dirString, item);
// properly implementing symlink support in various commands will require
// trailing slashes to be retained
dirString = "d1/";
item = new PathData(dirString, conf);
- checkPathData();
+ checkPathData(dirString, item);
}
@Test
public void testUnqualifiedUriContents() throws Exception {
- dirString = "d1";
- item = new PathData(dirString, conf);
+ String dirString = "d1";
+ PathData item = new PathData(dirString, conf);
PathData[] items = item.getDirectoryContents();
assertEquals(
sortedString("d1/f1", "d1/f1.1", "d1/f2"),
@@ -86,8 +85,8 @@ public class TestPathData {
@Test
public void testQualifiedUriContents() throws Exception {
- dirString = fs.makeQualified(new Path("d1")).toString();
- item = new PathData(dirString, conf);
+ String dirString = fs.makeQualified(new Path("d1")).toString();
+ PathData item = new PathData(dirString, conf);
PathData[] items = item.getDirectoryContents();
assertEquals(
sortedString(dirString+"/f1", dirString+"/f1.1", dirString+"/f2"),
@@ -97,8 +96,8 @@ public class TestPathData {
@Test
public void testCwdContents() throws Exception {
- dirString = Path.CUR_DIR;
- item = new PathData(dirString, conf);
+ String dirString = Path.CUR_DIR;
+ PathData item = new PathData(dirString, conf);
PathData[] items = item.getDirectoryContents();
assertEquals(
sortedString("d1", "d2"),
@@ -106,17 +105,16 @@ public class TestPathData {
);
}
-
- @Test
- public void testToFile() throws Exception {
- item = new PathData(".", conf);
+ @Test
+ public void testToFile() throws Exception {
+ PathData item = new PathData(".", conf);
assertEquals(new File(testDir.toString()), item.toFile());
- item = new PathData("d1/f1", conf);
- assertEquals(new File(testDir+"/d1/f1"), item.toFile());
- item = new PathData(testDir+"/d1/f1", conf);
- assertEquals(new File(testDir+"/d1/f1"), item.toFile());
- }
-
+ item = new PathData("d1/f1", conf);
+ assertEquals(new File(testDir + "/d1/f1"), item.toFile());
+ item = new PathData(testDir + "/d1/f1", conf);
+ assertEquals(new File(testDir + "/d1/f1"), item.toFile());
+ }
+
@Test
public void testAbsoluteGlob() throws Exception {
PathData[] items = PathData.expandAsGlob(testDir+"/d1/f1*", conf);
@@ -147,18 +145,18 @@ public class TestPathData {
@Test
public void testWithStringAndConfForBuggyPath() throws Exception {
- dirString = "file:///tmp";
- testDir = new Path(dirString);
- item = new PathData(dirString, conf);
+ String dirString = "file:///tmp";
+ Path tmpDir = new Path(dirString);
+ PathData item = new PathData(dirString, conf);
// this may fail some day if Path is fixed to not crunch the uri
// if the authority is null, however we need to test that the PathData
// toString() returns the given string, while Path toString() does
// the crunching
- assertEquals("file:/tmp", testDir.toString());
- checkPathData();
+ assertEquals("file:/tmp", tmpDir.toString());
+ checkPathData(dirString, item);
}
- public void checkPathData() throws Exception {
+ public void checkPathData(String dirString, PathData item) throws Exception {
assertEquals("checking fs", fs, item.fs);
assertEquals("checking string", dirString, item.toString());
assertEquals("checking path",