|
@@ -46,16 +46,17 @@ import org.apache.hadoop.test.GenericTestUtils;
|
|
import org.apache.hadoop.util.JarFinder;
|
|
import org.apache.hadoop.util.JarFinder;
|
|
import org.apache.hadoop.util.ToolRunner;
|
|
import org.apache.hadoop.util.ToolRunner;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration;
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration;
|
|
-import org.junit.After;
|
|
|
|
-import org.junit.Assert;
|
|
|
|
-import static org.junit.Assert.*;
|
|
|
|
-import static org.slf4j.LoggerFactory.getLogger;
|
|
|
|
-import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
-
|
|
|
|
-import org.junit.Before;
|
|
|
|
-import org.junit.Test;
|
|
|
|
|
|
+import org.junit.jupiter.api.AfterEach;
|
|
|
|
+import org.junit.jupiter.api.BeforeEach;
|
|
|
|
+import org.junit.jupiter.api.Test;
|
|
import org.slf4j.event.Level;
|
|
import org.slf4j.event.Level;
|
|
|
|
|
|
|
|
+import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
|
|
|
+import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
|
|
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
|
|
+import static org.slf4j.LoggerFactory.getLogger;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* test {@link HadoopArchives}
|
|
* test {@link HadoopArchives}
|
|
*/
|
|
*/
|
|
@@ -104,7 +105,7 @@ public class TestHadoopArchives {
|
|
return sb.toString();
|
|
return sb.toString();
|
|
}
|
|
}
|
|
|
|
|
|
- @Before
|
|
|
|
|
|
+ @BeforeEach
|
|
public void setUp() throws Exception {
|
|
public void setUp() throws Exception {
|
|
conf = new Configuration();
|
|
conf = new Configuration();
|
|
conf.set(CapacitySchedulerConfiguration.PREFIX
|
|
conf.set(CapacitySchedulerConfiguration.PREFIX
|
|
@@ -133,7 +134,7 @@ public class TestHadoopArchives {
|
|
fileList.add(createFile(inputPath, fs, "c"));
|
|
fileList.add(createFile(inputPath, fs, "c"));
|
|
}
|
|
}
|
|
|
|
|
|
- @After
|
|
|
|
|
|
+ @AfterEach
|
|
public void tearDown() throws Exception {
|
|
public void tearDown() throws Exception {
|
|
if (dfscluster != null) {
|
|
if (dfscluster != null) {
|
|
dfscluster.shutdown();
|
|
dfscluster.shutdown();
|
|
@@ -155,7 +156,7 @@ public class TestHadoopArchives {
|
|
|
|
|
|
// compare results:
|
|
// compare results:
|
|
final List<String> harPaths = lsr(shell, fullHarPathStr);
|
|
final List<String> harPaths = lsr(shell, fullHarPathStr);
|
|
- Assert.assertEquals(originalPaths, harPaths);
|
|
|
|
|
|
+ assertEquals(originalPaths, harPaths);
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
@@ -173,7 +174,7 @@ public class TestHadoopArchives {
|
|
|
|
|
|
// compare results:
|
|
// compare results:
|
|
final List<String> harPaths = lsr(shell, fullHarPathStr);
|
|
final List<String> harPaths = lsr(shell, fullHarPathStr);
|
|
- Assert.assertEquals(originalPaths, harPaths);
|
|
|
|
|
|
+ assertEquals(originalPaths, harPaths);
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
@@ -194,10 +195,10 @@ public class TestHadoopArchives {
|
|
createFile(archivePath, fs, harName);
|
|
createFile(archivePath, fs, harName);
|
|
final String[] args = { "-archiveName", harName, "-p", inputPathStr, "*",
|
|
final String[] args = { "-archiveName", harName, "-p", inputPathStr, "*",
|
|
archivePath.toString() };
|
|
archivePath.toString() };
|
|
- Assert.assertEquals(-1, ToolRunner.run(har, args));
|
|
|
|
|
|
+ assertEquals(-1, ToolRunner.run(har, args));
|
|
String output = byteStream.toString();
|
|
String output = byteStream.toString();
|
|
final Path outputPath = new Path(archivePath, harName);
|
|
final Path outputPath = new Path(archivePath, harName);
|
|
- Assert.assertTrue(output.indexOf("Archive path: " + outputPath.toString()
|
|
|
|
|
|
+ assertTrue(output.indexOf("Archive path: " + outputPath.toString()
|
|
+ " already exists") != -1);
|
|
+ " already exists") != -1);
|
|
|
|
|
|
byteStream.reset();
|
|
byteStream.reset();
|
|
@@ -207,9 +208,9 @@ public class TestHadoopArchives {
|
|
final Path archivePath2 = new Path(archivePath, "sub1");
|
|
final Path archivePath2 = new Path(archivePath, "sub1");
|
|
final String[] args2 = { "-archiveName", harName, "-p", inputPathStr, "*",
|
|
final String[] args2 = { "-archiveName", harName, "-p", inputPathStr, "*",
|
|
archivePath2.toString() };
|
|
archivePath2.toString() };
|
|
- Assert.assertEquals(-1, ToolRunner.run(har, args2));
|
|
|
|
|
|
+ assertEquals(-1, ToolRunner.run(har, args2));
|
|
output = byteStream.toString();
|
|
output = byteStream.toString();
|
|
- Assert.assertTrue(output.indexOf("Destination " + archivePath2.toString()
|
|
|
|
|
|
+ assertTrue(output.indexOf("Destination " + archivePath2.toString()
|
|
+ " should be a directory but is a file") != -1);
|
|
+ " should be a directory but is a file") != -1);
|
|
|
|
|
|
System.setErr(stderr);
|
|
System.setErr(stderr);
|
|
@@ -239,7 +240,7 @@ public class TestHadoopArchives {
|
|
|
|
|
|
// compare results
|
|
// compare results
|
|
final List<String> harPaths = lsr(shell, fullHarPathStr);
|
|
final List<String> harPaths = lsr(shell, fullHarPathStr);
|
|
- Assert.assertEquals(originalPaths, harPaths);
|
|
|
|
|
|
+ assertEquals(originalPaths, harPaths);
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
@@ -258,7 +259,7 @@ public class TestHadoopArchives {
|
|
|
|
|
|
// compare results:
|
|
// compare results:
|
|
final List<String> harPaths = lsr(shell, fullHarPathStr);
|
|
final List<String> harPaths = lsr(shell, fullHarPathStr);
|
|
- Assert.assertEquals(originalPaths, harPaths);
|
|
|
|
|
|
+ assertEquals(originalPaths, harPaths);
|
|
}
|
|
}
|
|
|
|
|
|
@Test
|
|
@Test
|
|
@@ -283,7 +284,7 @@ public class TestHadoopArchives {
|
|
// compare results:
|
|
// compare results:
|
|
final List<String> harPaths = lsr(shell, fullHarPathStr,
|
|
final List<String> harPaths = lsr(shell, fullHarPathStr,
|
|
fullHarPathStr + "/" + glob);
|
|
fullHarPathStr + "/" + glob);
|
|
- Assert.assertEquals(originalPaths, harPaths);
|
|
|
|
|
|
+ assertEquals(originalPaths, harPaths);
|
|
}
|
|
}
|
|
|
|
|
|
private static List<String> lsr(final FsShell shell, String rootDir) throws Exception {
|
|
private static List<String> lsr(final FsShell shell, String rootDir) throws Exception {
|
|
@@ -302,7 +303,7 @@ public class TestHadoopArchives {
|
|
System.setErr(out);
|
|
System.setErr(out);
|
|
final String results;
|
|
final String results;
|
|
try {
|
|
try {
|
|
- Assert.assertEquals(0, shell.run(new String[] { "-lsr", dir }));
|
|
|
|
|
|
+ assertEquals(0, shell.run(new String[]{"-lsr", dir}));
|
|
results = bytes.toString();
|
|
results = bytes.toString();
|
|
} finally {
|
|
} finally {
|
|
IOUtils.closeStream(out);
|
|
IOUtils.closeStream(out);
|
|
@@ -605,7 +606,7 @@ public class TestHadoopArchives {
|
|
private static void expectSeekIOE(FSDataInputStream fsdis, long seekPos, String message) {
|
|
private static void expectSeekIOE(FSDataInputStream fsdis, long seekPos, String message) {
|
|
try {
|
|
try {
|
|
fsdis.seek(seekPos);
|
|
fsdis.seek(seekPos);
|
|
- assertTrue(message + " (Position = " + fsdis.getPos() + ")", false);
|
|
|
|
|
|
+ assertTrue(false, message + " (Position = " + fsdis.getPos() + ")");
|
|
} catch (IOException ioe) {
|
|
} catch (IOException ioe) {
|
|
// okay
|
|
// okay
|
|
}
|
|
}
|
|
@@ -764,7 +765,7 @@ public class TestHadoopArchives {
|
|
while (listFiles.hasNext()) {
|
|
while (listFiles.hasNext()) {
|
|
LocatedFileStatus next = listFiles.next();
|
|
LocatedFileStatus next = listFiles.next();
|
|
if (!next.getPath().toString().endsWith("_SUCCESS")) {
|
|
if (!next.getPath().toString().endsWith("_SUCCESS")) {
|
|
- assertEquals(next.getPath().toString(), 2, next.getReplication());
|
|
|
|
|
|
+ assertEquals(2, next.getReplication(), next.getPath().toString());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return fullHarPathStr;
|
|
return fullHarPathStr;
|