HADOOP-12448. TestTextCommand: use mkdirs rather than mkdir to create test directory. (Contributed by Colin Patrick McCabe and Chris Nauroth)
This commit is contained in:
parent
071733dc69
commit
06abc57a90
|
@ -1100,6 +1100,9 @@ Release 2.8.0 - UNRELEASED
|
||||||
|
|
||||||
HADOOP-12447. Clean up some htrace integration issues (cmccabe)
|
HADOOP-12447. Clean up some htrace integration issues (cmccabe)
|
||||||
|
|
||||||
|
HADOOP-12448. TestTextCommand: use mkdirs rather than mkdir to create test
|
||||||
|
directory. (Contributed by Colin Patrick McCabe and Chris Nauroth)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
HADOOP-12051. ProtobufRpcEngine.invoke() should use Exception.toString()
|
HADOOP-12051. ProtobufRpcEngine.invoke() should use Exception.toString()
|
||||||
|
|
|
@ -22,11 +22,13 @@ import static org.junit.Assert.*;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
|
@ -38,12 +40,13 @@ import org.junit.Test;
|
||||||
* by the Text command.
|
* by the Text command.
|
||||||
*/
|
*/
|
||||||
public class TestTextCommand {
|
public class TestTextCommand {
|
||||||
private static final String TEST_ROOT_DIR =
|
private static final File TEST_ROOT_DIR =
|
||||||
System.getProperty("test.build.data", "build/test/data/") + "/testText";
|
Paths.get(System.getProperty("test.build.data", "build/test/data"),
|
||||||
|
"testText").toFile();
|
||||||
private static final String AVRO_FILENAME =
|
private static final String AVRO_FILENAME =
|
||||||
new Path(TEST_ROOT_DIR, "weather.avro").toUri().getPath();
|
new File(TEST_ROOT_DIR, "weather.avro").toURI().getPath();
|
||||||
private static final String TEXT_FILENAME =
|
private static final String TEXT_FILENAME =
|
||||||
new Path(TEST_ROOT_DIR, "testtextfile.txt").toUri().getPath();
|
new File(TEST_ROOT_DIR, "testtextfile.txt").toURI().getPath();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests whether binary Avro data files are displayed correctly.
|
* Tests whether binary Avro data files are displayed correctly.
|
||||||
|
@ -126,7 +129,7 @@ public class TestTextCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createFile(String fileName, byte[] contents) throws IOException {
|
private void createFile(String fileName, byte[] contents) throws IOException {
|
||||||
(new File(TEST_ROOT_DIR)).mkdir();
|
Files.createDirectories(TEST_ROOT_DIR.toPath());
|
||||||
File file = new File(fileName);
|
File file = new File(fileName);
|
||||||
file.createNewFile();
|
file.createNewFile();
|
||||||
FileOutputStream stream = new FileOutputStream(file);
|
FileOutputStream stream = new FileOutputStream(file);
|
||||||
|
|
Loading…
Reference in New Issue