|
@@ -22,11 +22,13 @@ import static org.junit.Assert.*;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.io.FileOutputStream;
|
|
|
-import java.io.InputStream;
|
|
|
import java.io.IOException;
|
|
|
+import java.io.InputStream;
|
|
|
import java.io.StringWriter;
|
|
|
import java.lang.reflect.Method;
|
|
|
import java.net.URI;
|
|
|
+import java.nio.file.Files;
|
|
|
+import java.nio.file.Paths;
|
|
|
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
@@ -38,12 +40,13 @@ import org.junit.Test;
|
|
|
* by the Text command.
|
|
|
*/
|
|
|
public class TestTextCommand {
|
|
|
- private static final String TEST_ROOT_DIR =
|
|
|
- System.getProperty("test.build.data", "build/test/data/") + "/testText";
|
|
|
+ private static final File TEST_ROOT_DIR =
|
|
|
+ Paths.get(System.getProperty("test.build.data", "build/test/data"),
|
|
|
+ "testText").toFile();
|
|
|
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 =
|
|
|
- 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.
|
|
@@ -126,7 +129,7 @@ public class TestTextCommand {
|
|
|
}
|
|
|
|
|
|
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.createNewFile();
|
|
|
FileOutputStream stream = new FileOutputStream(file);
|