HADOOP-16811: Use JUnit TemporaryFolder Rule in TestFileUtils (#1811). Contributed by David Mollitor.

This commit is contained in:
belugabehr 2020-01-25 10:12:21 -05:00 committed by Ayush Saxena
parent 6d008c0d39
commit 1afd54fbbb
1 changed files with 65 additions and 156 deletions

View File

@ -66,22 +66,38 @@ import org.junit.After;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class TestFileUtil { public class TestFileUtil {
private static final Logger LOG = LoggerFactory.getLogger(TestFileUtil.class); private static final Logger LOG = LoggerFactory.getLogger(TestFileUtil.class);
private static final File TEST_DIR = GenericTestUtils.getTestDir("fu"); @Rule
public TemporaryFolder testFolder = new TemporaryFolder();
private static final String FILE = "x"; private static final String FILE = "x";
private static final String LINK = "y"; private static final String LINK = "y";
private static final String DIR = "dir"; private static final String DIR = "dir";
private final File del = new File(TEST_DIR, "del");
private final File tmp = new File(TEST_DIR, "tmp"); private static final String FILE_1_NAME = "file1";
private final File dir1 = new File(del, DIR + "1");
private final File dir2 = new File(del, DIR + "2"); private File del;
private final File partitioned = new File(TEST_DIR, "partitioned"); private File tmp;
private File dir1;
private File dir2;
private File partitioned;
private File xSubDir;
private File xSubSubDir;
private File ySubDir;
private File file2;
private File file22;
private File file3;
private File zlink;
private InetAddress inet1; private InetAddress inet1;
private InetAddress inet2; private InetAddress inet2;
@ -118,21 +134,34 @@ public class TestFileUtil {
* file: part-r-00000, contents: "foo" * file: part-r-00000, contents: "foo"
* file: part-r-00001, contents: "bar" * file: part-r-00001, contents: "bar"
*/ */
@Ignore @Before
private void setupDirs() throws IOException { public void setup() throws IOException {
Assert.assertFalse(del.exists()); del = testFolder.newFolder("del");
Assert.assertFalse(tmp.exists()); tmp = testFolder.newFolder("tmp");
Assert.assertFalse(partitioned.exists()); partitioned = testFolder.newFolder("partitioned");
del.mkdirs();
tmp.mkdirs(); zlink = new File(del, "zlink");
partitioned.mkdirs();
xSubDir = new File(del, "xSubDir");
xSubSubDir = new File(xSubDir, "xSubSubDir");
ySubDir = new File(del, "ySubDir");
file2 = new File(xSubDir, "file2");
file22 = new File(xSubSubDir, "file22");
file3 = new File(ySubDir, "file3");
dir1 = new File(del, DIR + "1");
dir2 = new File(del, DIR + "2");
FileUtils.forceMkdir(dir1);
FileUtils.forceMkdir(dir2);
new File(del, FILE).createNewFile(); new File(del, FILE).createNewFile();
File tmpFile = new File(tmp, FILE); File tmpFile = new File(tmp, FILE);
tmpFile.createNewFile(); tmpFile.createNewFile();
// create directories // create files
dir1.mkdirs();
dir2.mkdirs();
new File(dir1, FILE).createNewFile(); new File(dir1, FILE).createNewFile();
new File(dir2, FILE).createNewFile(); new File(dir2, FILE).createNewFile();
@ -153,6 +182,11 @@ public class TestFileUtil {
FileUtil.symLink(del.toString(), dir1.toString() + "/cycle"); FileUtil.symLink(del.toString(), dir1.toString() + "/cycle");
} }
@After
public void tearDown() throws IOException {
testFolder.delete();
}
/** /**
* Creates a new file in the specified directory, with the specified name and * Creates a new file in the specified directory, with the specified name and
* the specified file contents. This method will add a newline terminator to * the specified file contents. This method will add a newline terminator to
@ -177,7 +211,6 @@ public class TestFileUtil {
@Test (timeout = 30000) @Test (timeout = 30000)
public void testListFiles() throws IOException { public void testListFiles() throws IOException {
setupDirs();
//Test existing files case //Test existing files case
File[] files = FileUtil.listFiles(partitioned); File[] files = FileUtil.listFiles(partitioned);
Assert.assertEquals(2, files.length); Assert.assertEquals(2, files.length);
@ -204,7 +237,6 @@ public class TestFileUtil {
@Test (timeout = 30000) @Test (timeout = 30000)
public void testListAPI() throws IOException { public void testListAPI() throws IOException {
setupDirs();
//Test existing files case //Test existing files case
String[] files = FileUtil.list(partitioned); String[] files = FileUtil.list(partitioned);
Assert.assertEquals("Unexpected number of pre-existing files", 2, files.length); Assert.assertEquals("Unexpected number of pre-existing files", 2, files.length);
@ -229,30 +261,8 @@ public class TestFileUtil {
} }
} }
@Before
public void before() throws IOException {
cleanupImpl();
}
@After
public void tearDown() throws IOException {
cleanupImpl();
}
private void cleanupImpl() throws IOException {
FileUtil.fullyDelete(del, true);
Assert.assertTrue(!del.exists());
FileUtil.fullyDelete(tmp, true);
Assert.assertTrue(!tmp.exists());
FileUtil.fullyDelete(partitioned, true);
Assert.assertTrue(!partitioned.exists());
}
@Test (timeout = 30000) @Test (timeout = 30000)
public void testFullyDelete() throws IOException { public void testFullyDelete() throws IOException {
setupDirs();
boolean ret = FileUtil.fullyDelete(del); boolean ret = FileUtil.fullyDelete(del);
Assert.assertTrue(ret); Assert.assertTrue(ret);
Assert.assertFalse(del.exists()); Assert.assertFalse(del.exists());
@ -267,8 +277,6 @@ public class TestFileUtil {
*/ */
@Test (timeout = 30000) @Test (timeout = 30000)
public void testFullyDeleteSymlinks() throws IOException { public void testFullyDeleteSymlinks() throws IOException {
setupDirs();
File link = new File(del, LINK); File link = new File(del, LINK);
Assert.assertEquals(5, del.list().length); Assert.assertEquals(5, del.list().length);
// Since tmpDir is symlink to tmp, fullyDelete(tmpDir) should not // Since tmpDir is symlink to tmp, fullyDelete(tmpDir) should not
@ -297,7 +305,6 @@ public class TestFileUtil {
*/ */
@Test (timeout = 30000) @Test (timeout = 30000)
public void testFullyDeleteDanglingSymlinks() throws IOException { public void testFullyDeleteDanglingSymlinks() throws IOException {
setupDirs();
// delete the directory tmp to make tmpDir a dangling link to dir tmp and // delete the directory tmp to make tmpDir a dangling link to dir tmp and
// to make y as a dangling link to file tmp/x // to make y as a dangling link to file tmp/x
boolean ret = FileUtil.fullyDelete(tmp); boolean ret = FileUtil.fullyDelete(tmp);
@ -324,7 +331,6 @@ public class TestFileUtil {
@Test (timeout = 30000) @Test (timeout = 30000)
public void testFullyDeleteContents() throws IOException { public void testFullyDeleteContents() throws IOException {
setupDirs();
boolean ret = FileUtil.fullyDeleteContents(del); boolean ret = FileUtil.fullyDeleteContents(del);
Assert.assertTrue(ret); Assert.assertTrue(ret);
Assert.assertTrue(del.exists()); Assert.assertTrue(del.exists());
@ -338,15 +344,6 @@ public class TestFileUtil {
Assert.assertTrue(new File(tmp, FILE).exists()); Assert.assertTrue(new File(tmp, FILE).exists());
} }
private final File xSubDir = new File(del, "xSubDir");
private final File xSubSubDir = new File(xSubDir, "xSubSubDir");
private final File ySubDir = new File(del, "ySubDir");
private static final String file1Name = "file1";
private final File file2 = new File(xSubDir, "file2");
private final File file22 = new File(xSubSubDir, "file22");
private final File file3 = new File(ySubDir, "file3");
private final File zlink = new File(del, "zlink");
/** /**
* Creates a directory which can not be deleted completely. * Creates a directory which can not be deleted completely.
* *
@ -368,36 +365,30 @@ public class TestFileUtil {
* @throws IOException * @throws IOException
*/ */
private void setupDirsAndNonWritablePermissions() throws IOException { private void setupDirsAndNonWritablePermissions() throws IOException {
Assert.assertFalse("The directory del should not have existed!", new MyFile(del, FILE_1_NAME).createNewFile();
del.exists());
del.mkdirs();
new MyFile(del, file1Name).createNewFile();
// "file1" is non-deletable by default, see MyFile.delete(). // "file1" is non-deletable by default, see MyFile.delete().
xSubDir.mkdirs(); xSubDir.mkdirs();
file2.createNewFile(); file2.createNewFile();
xSubSubDir.mkdirs(); xSubSubDir.mkdirs();
file22.createNewFile(); file22.createNewFile();
revokePermissions(file22); revokePermissions(file22);
revokePermissions(xSubSubDir); revokePermissions(xSubSubDir);
revokePermissions(file2); revokePermissions(file2);
revokePermissions(xSubDir); revokePermissions(xSubDir);
ySubDir.mkdirs(); ySubDir.mkdirs();
file3.createNewFile(); file3.createNewFile();
Assert.assertFalse("The directory tmp should not have existed!",
tmp.exists());
tmp.mkdirs();
File tmpFile = new File(tmp, FILE); File tmpFile = new File(tmp, FILE);
tmpFile.createNewFile(); tmpFile.createNewFile();
FileUtil.symLink(tmpFile.toString(), zlink.toString()); FileUtil.symLink(tmpFile.toString(), zlink.toString());
} }
private static void grantPermissions(final File f) { private static void grantPermissions(final File f) {
FileUtil.setReadable(f, true); FileUtil.setReadable(f, true);
FileUtil.setWritable(f, true); FileUtil.setWritable(f, true);
@ -419,7 +410,7 @@ public class TestFileUtil {
Assert.assertFalse("The return value should have been false.", ret); Assert.assertFalse("The return value should have been false.", ret);
Assert.assertTrue("The file file1 should not have been deleted.", Assert.assertTrue("The file file1 should not have been deleted.",
new File(del, file1Name).exists()); new File(del, FILE_1_NAME).exists());
Assert.assertEquals( Assert.assertEquals(
"The directory xSubDir *should* not have been deleted.", "The directory xSubDir *should* not have been deleted.",
@ -447,7 +438,7 @@ public class TestFileUtil {
boolean ret = FileUtil.fullyDelete(new MyFile(del)); boolean ret = FileUtil.fullyDelete(new MyFile(del));
validateAndSetWritablePermissions(true, ret); validateAndSetWritablePermissions(true, ret);
} }
@Test (timeout = 30000) @Test (timeout = 30000)
public void testFailFullyDeleteGrantPermissions() throws IOException { public void testFailFullyDeleteGrantPermissions() throws IOException {
setupDirsAndNonWritablePermissions(); setupDirsAndNonWritablePermissions();
@ -484,7 +475,7 @@ public class TestFileUtil {
public boolean delete() { public boolean delete() {
LOG.info("Trying to delete myFile " + getAbsolutePath()); LOG.info("Trying to delete myFile " + getAbsolutePath());
boolean bool = false; boolean bool = false;
if (getName().equals(file1Name)) { if (getName().equals(FILE_1_NAME)) {
bool = false; bool = false;
} else { } else {
bool = super.delete(); bool = super.delete();
@ -534,7 +525,7 @@ public class TestFileUtil {
// this time the directories with revoked permissions *should* be deleted: // this time the directories with revoked permissions *should* be deleted:
validateAndSetWritablePermissions(false, ret); validateAndSetWritablePermissions(false, ret);
} }
/** /**
* Test that getDU is able to handle cycles caused due to symbolic links * Test that getDU is able to handle cycles caused due to symbolic links
* and that directory sizes are not added to the final calculated size * and that directory sizes are not added to the final calculated size
@ -542,9 +533,7 @@ public class TestFileUtil {
*/ */
@Test (timeout = 30000) @Test (timeout = 30000)
public void testGetDU() throws Exception { public void testGetDU() throws Exception {
setupDirs(); long du = FileUtil.getDU(testFolder.getRoot());
long du = FileUtil.getDU(TEST_DIR);
// Only two files (in partitioned). Each has 3 characters + system-specific // Only two files (in partitioned). Each has 3 characters + system-specific
// line separator. // line separator.
final long expected = 2 * (3 + System.getProperty("line.separator").length()); final long expected = 2 * (3 + System.getProperty("line.separator").length());
@ -593,8 +582,6 @@ public class TestFileUtil {
@Test (timeout = 30000) @Test (timeout = 30000)
public void testUnTar() throws IOException { public void testUnTar() throws IOException {
setupDirs();
// make a simple tar: // make a simple tar:
final File simpleTar = new File(del, FILE); final File simpleTar = new File(del, FILE);
OutputStream os = new FileOutputStream(simpleTar); OutputStream os = new FileOutputStream(simpleTar);
@ -631,7 +618,6 @@ public class TestFileUtil {
@Test (timeout = 30000) @Test (timeout = 30000)
public void testReplaceFile() throws IOException { public void testReplaceFile() throws IOException {
setupDirs();
final File srcFile = new File(tmp, "src"); final File srcFile = new File(tmp, "src");
// src exists, and target does not exist: // src exists, and target does not exist:
@ -673,7 +659,6 @@ public class TestFileUtil {
@Test (timeout = 30000) @Test (timeout = 30000)
public void testCreateLocalTempFile() throws IOException { public void testCreateLocalTempFile() throws IOException {
setupDirs();
final File baseFile = new File(tmp, "base"); final File baseFile = new File(tmp, "base");
File tmp1 = FileUtil.createLocalTempFile(baseFile, "foo", false); File tmp1 = FileUtil.createLocalTempFile(baseFile, "foo", false);
File tmp2 = FileUtil.createLocalTempFile(baseFile, "foo", true); File tmp2 = FileUtil.createLocalTempFile(baseFile, "foo", true);
@ -689,8 +674,7 @@ public class TestFileUtil {
@Test (timeout = 30000) @Test (timeout = 30000)
public void testUnZip() throws IOException { public void testUnZip() throws IOException {
setupDirs(); // make sa simple zip
// make a simple zip
final File simpleZip = new File(del, FILE); final File simpleZip = new File(del, FILE);
OutputStream os = new FileOutputStream(simpleZip); OutputStream os = new FileOutputStream(simpleZip);
ZipOutputStream tos = new ZipOutputStream(os); ZipOutputStream tos = new ZipOutputStream(os);
@ -726,7 +710,6 @@ public class TestFileUtil {
@Test (timeout = 30000) @Test (timeout = 30000)
public void testUnZip2() throws IOException { public void testUnZip2() throws IOException {
setupDirs();
// make a simple zip // make a simple zip
final File simpleZip = new File(del, FILE); final File simpleZip = new File(del, FILE);
OutputStream os = new FileOutputStream(simpleZip); OutputStream os = new FileOutputStream(simpleZip);
@ -757,8 +740,6 @@ public class TestFileUtil {
* Test method copy(FileSystem srcFS, Path src, File dst, boolean deleteSource, Configuration conf) * Test method copy(FileSystem srcFS, Path src, File dst, boolean deleteSource, Configuration conf)
*/ */
public void testCopy5() throws IOException { public void testCopy5() throws IOException {
setupDirs();
URI uri = tmp.toURI(); URI uri = tmp.toURI();
Configuration conf = new Configuration(); Configuration conf = new Configuration();
FileSystem fs = FileSystem.newInstance(uri, conf); FileSystem fs = FileSystem.newInstance(uri, conf);
@ -848,9 +829,6 @@ public class TestFileUtil {
@Test (timeout = 30000) @Test (timeout = 30000)
public void testSymlink() throws Exception { public void testSymlink() throws Exception {
Assert.assertFalse(del.exists());
del.mkdirs();
byte[] data = "testSymLink".getBytes(); byte[] data = "testSymLink".getBytes();
File file = new File(del, FILE); File file = new File(del, FILE);
@ -883,9 +861,6 @@ public class TestFileUtil {
*/ */
@Test (timeout = 30000) @Test (timeout = 30000)
public void testSymlinkRenameTo() throws Exception { public void testSymlinkRenameTo() throws Exception {
Assert.assertFalse(del.exists());
del.mkdirs();
File file = new File(del, FILE); File file = new File(del, FILE);
file.createNewFile(); file.createNewFile();
File link = new File(del, "_link"); File link = new File(del, "_link");
@ -915,9 +890,6 @@ public class TestFileUtil {
*/ */
@Test (timeout = 30000) @Test (timeout = 30000)
public void testSymlinkDelete() throws Exception { public void testSymlinkDelete() throws Exception {
Assert.assertFalse(del.exists());
del.mkdirs();
File file = new File(del, FILE); File file = new File(del, FILE);
file.createNewFile(); file.createNewFile();
File link = new File(del, "_link"); File link = new File(del, "_link");
@ -939,9 +911,6 @@ public class TestFileUtil {
*/ */
@Test (timeout = 30000) @Test (timeout = 30000)
public void testSymlinkLength() throws Exception { public void testSymlinkLength() throws Exception {
Assert.assertFalse(del.exists());
del.mkdirs();
byte[] data = "testSymLinkData".getBytes(); byte[] data = "testSymLinkData".getBytes();
File file = new File(del, FILE); File file = new File(del, FILE);
@ -978,9 +947,6 @@ public class TestFileUtil {
*/ */
@Test @Test
public void testSymlinkWithNullInput() throws IOException { public void testSymlinkWithNullInput() throws IOException {
Assert.assertFalse(del.exists());
del.mkdirs();
File file = new File(del, FILE); File file = new File(del, FILE);
File link = new File(del, "_link"); File link = new File(del, "_link");
@ -998,9 +964,6 @@ public class TestFileUtil {
// The operation should fail and returns 1 // The operation should fail and returns 1
result = FileUtil.symLink(null, link.getAbsolutePath()); result = FileUtil.symLink(null, link.getAbsolutePath());
Assert.assertEquals(1, result); Assert.assertEquals(1, result);
file.delete();
link.delete();
} }
/** /**
@ -1011,9 +974,6 @@ public class TestFileUtil {
*/ */
@Test @Test
public void testSymlinkFileAlreadyExists() throws IOException { public void testSymlinkFileAlreadyExists() throws IOException {
Assert.assertFalse(del.exists());
del.mkdirs();
File file = new File(del, FILE); File file = new File(del, FILE);
File link = new File(del, "_link"); File link = new File(del, "_link");
@ -1029,9 +989,6 @@ public class TestFileUtil {
result1 = FileUtil.symLink(file.getAbsolutePath(), link.getAbsolutePath()); result1 = FileUtil.symLink(file.getAbsolutePath(), link.getAbsolutePath());
Assert.assertEquals(1, result1); Assert.assertEquals(1, result1);
file.delete();
link.delete();
} }
/** /**
@ -1043,19 +1000,16 @@ public class TestFileUtil {
*/ */
@Test @Test
public void testSymlinkSameFile() throws IOException { public void testSymlinkSameFile() throws IOException {
Assert.assertFalse(del.exists());
del.mkdirs();
File file = new File(del, FILE); File file = new File(del, FILE);
file.delete();
// Create a symbolic link // Create a symbolic link
// The operation should succeed // The operation should succeed
int result = int result =
FileUtil.symLink(file.getAbsolutePath(), file.getAbsolutePath()); FileUtil.symLink(file.getAbsolutePath(), file.getAbsolutePath());
Assert.assertEquals(0, result); Assert.assertEquals(0, result);
file.delete();
} }
/** /**
@ -1067,8 +1021,6 @@ public class TestFileUtil {
*/ */
@Test @Test
public void testSymlink2DifferentFile() throws IOException { public void testSymlink2DifferentFile() throws IOException {
Assert.assertFalse(del.exists());
del.mkdirs();
File file = new File(del, FILE); File file = new File(del, FILE);
File fileSecond = new File(del, FILE + "_1"); File fileSecond = new File(del, FILE + "_1");
File link = new File(del, "_link"); File link = new File(del, "_link");
@ -1085,10 +1037,6 @@ public class TestFileUtil {
FileUtil.symLink(fileSecond.getAbsolutePath(), link.getAbsolutePath()); FileUtil.symLink(fileSecond.getAbsolutePath(), link.getAbsolutePath());
Assert.assertEquals(1, result); Assert.assertEquals(1, result);
file.delete();
fileSecond.delete();
link.delete();
} }
/** /**
@ -1100,8 +1048,6 @@ public class TestFileUtil {
*/ */
@Test @Test
public void testSymlink2DifferentLinks() throws IOException { public void testSymlink2DifferentLinks() throws IOException {
Assert.assertFalse(del.exists());
del.mkdirs();
File file = new File(del, FILE); File file = new File(del, FILE);
File link = new File(del, "_link"); File link = new File(del, "_link");
File linkSecond = new File(del, "_link_1"); File linkSecond = new File(del, "_link_1");
@ -1118,10 +1064,6 @@ public class TestFileUtil {
FileUtil.symLink(file.getAbsolutePath(), linkSecond.getAbsolutePath()); FileUtil.symLink(file.getAbsolutePath(), linkSecond.getAbsolutePath());
Assert.assertEquals(0, result); Assert.assertEquals(0, result);
file.delete();
link.delete();
linkSecond.delete();
} }
private void doUntarAndVerify(File tarFile, File untarDir) private void doUntarAndVerify(File tarFile, File untarDir)
@ -1166,10 +1108,6 @@ public class TestFileUtil {
@Test (timeout = 30000) @Test (timeout = 30000)
public void testCreateJarWithClassPath() throws Exception { public void testCreateJarWithClassPath() throws Exception {
// setup test directory for files
Assert.assertFalse(tmp.exists());
Assert.assertTrue(tmp.mkdirs());
// create files expected to match a wildcard // create files expected to match a wildcard
List<File> wildcardMatches = Arrays.asList(new File(tmp, "wildcard1.jar"), List<File> wildcardMatches = Arrays.asList(new File(tmp, "wildcard1.jar"),
new File(tmp, "wildcard2.jar"), new File(tmp, "wildcard3.JAR"), new File(tmp, "wildcard2.jar"), new File(tmp, "wildcard3.JAR"),
@ -1258,9 +1196,6 @@ public class TestFileUtil {
assertTrue("no jars should be returned for a bogus path", assertTrue("no jars should be returned for a bogus path",
jars.isEmpty()); jars.isEmpty());
// setup test directory for files
assertFalse(tmp.exists());
assertTrue(tmp.mkdirs());
// create jar files to be returned // create jar files to be returned
File jar1 = new File(tmp, "wildcard1.jar"); File jar1 = new File(tmp, "wildcard1.jar");
@ -1366,7 +1301,6 @@ public class TestFileUtil {
@Test(timeout = 8000) @Test(timeout = 8000)
public void testCreateSymbolicLinkUsingJava() throws IOException { public void testCreateSymbolicLinkUsingJava() throws IOException {
setupDirs();
final File simpleTar = new File(del, FILE); final File simpleTar = new File(del, FILE);
OutputStream os = new FileOutputStream(simpleTar); OutputStream os = new FileOutputStream(simpleTar);
TarArchiveOutputStream tos = new TarArchiveOutputStream(os); TarArchiveOutputStream tos = new TarArchiveOutputStream(os);
@ -1460,9 +1394,6 @@ public class TestFileUtil {
*/ */
@Test @Test
public void testReadSymlink() throws IOException { public void testReadSymlink() throws IOException {
Assert.assertFalse(del.exists());
del.mkdirs();
File file = new File(del, FILE); File file = new File(del, FILE);
File link = new File(del, "_link"); File link = new File(del, "_link");
@ -1471,9 +1402,6 @@ public class TestFileUtil {
String result = FileUtil.readLink(link); String result = FileUtil.readLink(link);
Assert.assertEquals(file.getAbsolutePath(), result); Assert.assertEquals(file.getAbsolutePath(), result);
file.delete();
link.delete();
} }
/** /**
@ -1484,9 +1412,6 @@ public class TestFileUtil {
*/ */
@Test @Test
public void testReadSymlinkWithAFileAsInput() throws IOException { public void testReadSymlinkWithAFileAsInput() throws IOException {
Assert.assertFalse(del.exists());
del.mkdirs();
File file = new File(del, FILE); File file = new File(del, FILE);
String result = FileUtil.readLink(file); String result = FileUtil.readLink(file);
@ -1500,8 +1425,6 @@ public class TestFileUtil {
*/ */
@Test @Test
public void testWriteBytesFileSystem() throws IOException { public void testWriteBytesFileSystem() throws IOException {
setupDirs();
URI uri = tmp.toURI(); URI uri = tmp.toURI();
Configuration conf = new Configuration(); Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(uri, conf); FileSystem fs = FileSystem.get(uri, conf);
@ -1522,8 +1445,6 @@ public class TestFileUtil {
*/ */
@Test @Test
public void testWriteStringsFileSystem() throws IOException { public void testWriteStringsFileSystem() throws IOException {
setupDirs();
URI uri = tmp.toURI(); URI uri = tmp.toURI();
Configuration conf = new Configuration(); Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(uri, conf); FileSystem fs = FileSystem.get(uri, conf);
@ -1544,8 +1465,6 @@ public class TestFileUtil {
*/ */
@Test @Test
public void testWriteStringFileSystem() throws IOException { public void testWriteStringFileSystem() throws IOException {
setupDirs();
URI uri = tmp.toURI(); URI uri = tmp.toURI();
Configuration conf = new Configuration(); Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(uri, conf); FileSystem fs = FileSystem.get(uri, conf);
@ -1567,8 +1486,6 @@ public class TestFileUtil {
*/ */
@Test @Test
public void testWriteStringNoCharSetFileSystem() throws IOException { public void testWriteStringNoCharSetFileSystem() throws IOException {
setupDirs();
URI uri = tmp.toURI(); URI uri = tmp.toURI();
Configuration conf = new Configuration(); Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(uri, conf); FileSystem fs = FileSystem.get(uri, conf);
@ -1588,8 +1505,6 @@ public class TestFileUtil {
*/ */
@Test @Test
public void testWriteBytesFileContext() throws IOException { public void testWriteBytesFileContext() throws IOException {
setupDirs();
URI uri = tmp.toURI(); URI uri = tmp.toURI();
Configuration conf = new Configuration(); Configuration conf = new Configuration();
FileContext fc = FileContext.getFileContext(uri, conf); FileContext fc = FileContext.getFileContext(uri, conf);
@ -1610,8 +1525,6 @@ public class TestFileUtil {
*/ */
@Test @Test
public void testWriteStringsFileContext() throws IOException { public void testWriteStringsFileContext() throws IOException {
setupDirs();
URI uri = tmp.toURI(); URI uri = tmp.toURI();
Configuration conf = new Configuration(); Configuration conf = new Configuration();
FileContext fc = FileContext.getFileContext(uri, conf); FileContext fc = FileContext.getFileContext(uri, conf);
@ -1632,8 +1545,6 @@ public class TestFileUtil {
*/ */
@Test @Test
public void testWriteStringFileContext() throws IOException { public void testWriteStringFileContext() throws IOException {
setupDirs();
URI uri = tmp.toURI(); URI uri = tmp.toURI();
Configuration conf = new Configuration(); Configuration conf = new Configuration();
FileContext fc = FileContext.getFileContext(uri, conf); FileContext fc = FileContext.getFileContext(uri, conf);
@ -1655,8 +1566,6 @@ public class TestFileUtil {
*/ */
@Test @Test
public void testWriteStringNoCharSetFileContext() throws IOException { public void testWriteStringNoCharSetFileContext() throws IOException {
setupDirs();
URI uri = tmp.toURI(); URI uri = tmp.toURI();
Configuration conf = new Configuration(); Configuration conf = new Configuration();
FileContext fc = FileContext.getFileContext(uri, conf); FileContext fc = FileContext.getFileContext(uri, conf);