This is an automated email from the ASF dual-hosted git repository.
adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 4713a9c3b8 HDDS-9920. Add static import for assertions in
parameterized FS integration tests (#5792)
4713a9c3b8 is described below
commit 4713a9c3b8e78b82689c515cb8ba526bd0a77f8c
Author: Doroszlai, Attila <[email protected]>
AuthorDate: Thu Dec 14 17:47:32 2023 +0100
HDDS-9920. Add static import for assertions in parameterized FS integration
tests (#5792)
---
.../hadoop/fs/ozone/TestOzoneFileInterfaces.java | 10 +-
.../hadoop/fs/ozone/TestOzoneFileSystem.java | 143 ++++---
.../fs/ozone/TestOzoneFileSystemWithFSO.java | 39 +-
.../hadoop/fs/ozone/TestRootedOzoneFileSystem.java | 419 +++++++++++----------
.../fs/ozone/TestRootedOzoneFileSystemWithFSO.java | 7 +-
5 files changed, 309 insertions(+), 309 deletions(-)
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileInterfaces.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileInterfaces.java
index 701dffa4b9..c735e312aa 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileInterfaces.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileInterfaces.java
@@ -65,12 +65,12 @@ import static
org.apache.hadoop.fs.ozone.Constants.OZONE_DEFAULT_USER;
import org.junit.After;
import org.junit.AfterClass;
-import org.junit.Assert;
import static
org.apache.hadoop.ozone.om.helpers.BucketLayout.FILE_SYSTEM_OPTIMIZED;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import static org.junit.Assume.assumeFalse;
import org.junit.Before;
@@ -466,7 +466,7 @@ public class TestOzoneFileInterfaces {
cluster.getOzoneManager().getMetrics().getNumGetFileStatus();
FileStatus status = fs.getFileStatus(path);
- Assert.assertEquals(numFileStatus + 1,
+ assertEquals(numFileStatus + 1,
cluster.getOzoneManager().getMetrics().getNumGetFileStatus());
assertTrue(status.isDirectory());
assertEquals(FsPermission.getDirDefault(), status.getPermission());
@@ -481,7 +481,7 @@ public class TestOzoneFileInterfaces {
OzoneFileStatus omStatus =
cluster.getOzoneManager().getFileStatus(keyArgs);
//Another get file status here, incremented the counter.
- Assert.assertEquals(numFileStatus + 2,
+ assertEquals(numFileStatus + 2,
cluster.getOzoneManager().getMetrics().getNumGetFileStatus());
assertTrue("The created path is not directory.", omStatus.isDirectory());
@@ -586,10 +586,10 @@ public class TestOzoneFileInterfaces {
try {
fs = FileSystem.get(fs.getConf());
- Assert.fail("Should throw Exception due incompatible bucket layout");
+ fail("Should throw Exception due incompatible bucket layout");
} catch (IllegalArgumentException iae) {
// Expected exception
- Assert.assertTrue(iae.getMessage().contains(
+ assertTrue(iae.getMessage().contains(
"OBJECT_STORE, which does not support file system semantics"));
}
}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileSystem.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileSystem.java
index 166084ee2b..b5d8370483 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileSystem.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileSystem.java
@@ -66,7 +66,6 @@ import org.apache.ozone.test.GenericTestUtils;
import org.apache.ozone.test.TestClock;
import org.junit.After;
import org.junit.AfterClass;
-import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestRule;
@@ -458,16 +457,16 @@ public class TestOzoneFileSystem {
}
// Delete the child key
- Assert.assertTrue(fs.delete(child, false));
+ assertTrue(fs.delete(child, false));
// Deleting the only child should create the parent dir key if it does
// not exist
FileStatus fileStatus = o3fs.getFileStatus(parent);
- Assert.assertTrue(fileStatus.isDirectory());
+ assertTrue(fileStatus.isDirectory());
assertEquals(parent.toString(), fileStatus.getPath().toUri().getPath());
// Recursive delete with DeleteIterator
- Assert.assertTrue(fs.delete(grandparent, true));
+ assertTrue(fs.delete(grandparent, true));
}
@Test
@@ -483,9 +482,9 @@ public class TestOzoneFileSystem {
// delete a dir with sub-file
try {
FileStatus[] parents = fs.listStatus(grandparent);
- Assert.assertTrue(parents.length > 0);
+ assertTrue(parents.length > 0);
fs.delete(parents[0].getPath(), false);
- Assert.fail("Must throw exception as dir is not empty!");
+ fail("Must throw exception as dir is not empty!");
} catch (PathIsNotEmptyDirectoryException pde) {
// expected
}
@@ -493,7 +492,7 @@ public class TestOzoneFileSystem {
// delete a dir with sub-file
try {
fs.delete(grandparent, false);
- Assert.fail("Must throw exception as dir is not empty!");
+ fail("Must throw exception as dir is not empty!");
} catch (PathIsNotEmptyDirectoryException pde) {
// expected
}
@@ -554,8 +553,8 @@ public class TestOzoneFileSystem {
fs.getFileStatus(path);
fail("testRecursiveDelete failed");
} catch (IOException ex) {
- Assert.assertTrue(ex instanceof FileNotFoundException);
- Assert.assertTrue(ex.getMessage().contains("No such file or directory"));
+ assertTrue(ex instanceof FileNotFoundException);
+ assertTrue(ex.getMessage().contains("No such file or directory"));
}
}
@@ -602,15 +601,15 @@ public class TestOzoneFileSystem {
Path file2 = new Path(parent, "key2");
FileStatus[] fileStatuses = o3fs.listStatus(ROOT, EXCLUDE_TRASH);
- Assert.assertEquals("Should be empty", 0, fileStatuses.length);
+ assertEquals("Should be empty", 0, fileStatuses.length);
ContractTestUtils.touch(fs, file1);
ContractTestUtils.touch(fs, file2);
fileStatuses = o3fs.listStatus(ROOT, EXCLUDE_TRASH);
- Assert.assertEquals("Should have created parent",
+ assertEquals("Should have created parent",
1, fileStatuses.length);
- Assert.assertEquals("Parent path doesn't match",
+ assertEquals("Parent path doesn't match",
fileStatuses[0].getPath().toUri().getPath(), parent.toString());
// ListStatus on a directory should return all subdirs along with
@@ -653,7 +652,7 @@ public class TestOzoneFileSystem {
return fs.listStatus(ROOT, EXCLUDE_TRASH).length != 0;
} catch (IOException e) {
LOG.error("listStatus() Failed", e);
- Assert.fail("listStatus() Failed");
+ fail("listStatus() Failed");
return false;
}
}, 1000, 120000);
@@ -662,7 +661,7 @@ public class TestOzoneFileSystem {
FileStatus[] fileStatuses = fs.listStatus(ROOT, EXCLUDE_TRASH);
// the number of immediate children of root is 1
- Assert.assertEquals(Arrays.toString(fileStatuses), 1, fileStatuses.length);
+ assertEquals(Arrays.toString(fileStatuses), 1, fileStatuses.length);
writeClient.deleteKey(keyArgs);
}
@@ -687,20 +686,20 @@ public class TestOzoneFileSystem {
return fs.listStatus(ROOT, EXCLUDE_TRASH).length != 0;
} catch (IOException e) {
LOG.error("listStatus() Failed", e);
- Assert.fail("listStatus() Failed");
+ fail("listStatus() Failed");
return false;
}
}, 1000, 120000);
}
FileStatus[] fileStatuses = fs.listStatus(ROOT, EXCLUDE_TRASH);
// the number of immediate children of root is 1
- Assert.assertEquals(1, fileStatuses.length);
- Assert.assertEquals(fileStatuses[0].isErasureCoded(),
+ assertEquals(1, fileStatuses.length);
+ assertEquals(fileStatuses[0].isErasureCoded(),
!bucketLayout.isFileSystemOptimized());
fileStatuses = fs.listStatus(new Path(
fileStatuses[0].getPath().toString() + "/object-name1"));
- Assert.assertEquals(1, fileStatuses.length);
- Assert.assertTrue(fileStatuses[0].isErasureCoded());
+ assertEquals(1, fileStatuses.length);
+ assertTrue(fileStatuses[0].isErasureCoded());
writeClient.deleteKey(keyArgs);
}
@@ -825,7 +824,7 @@ public class TestOzoneFileSystem {
for (FileStatus fileStatus : fileStatuses) {
LOG.error("Unexpected file, should have been deleted: {}", fileStatus);
}
- Assert.assertEquals("Delete root failed!", 0, fileStatuses.length);
+ assertEquals("Delete root failed!", 0, fileStatuses.length);
}
}
@@ -886,7 +885,7 @@ public class TestOzoneFileSystem {
try {
// Iterator should have no items when dir is empty
RemoteIterator<FileStatus> it = o3fs.listStatusIterator(ROOT);
- Assert.assertFalse(it.hasNext());
+ assertFalse(it.hasNext());
ContractTestUtils.touch(fs, file1);
ContractTestUtils.touch(fs, file2);
@@ -894,8 +893,8 @@ public class TestOzoneFileSystem {
it = o3fs.listStatusIterator(ROOT);
while (it.hasNext()) {
FileStatus fileStatus = it.next();
- Assert.assertNotNull(fileStatus);
- Assert.assertEquals("Parent path doesn't match",
+ assertNotNull(fileStatus);
+ assertEquals("Parent path doesn't match",
fileStatus.getPath().toUri().getPath(), parent.toString());
}
// Iterator on a directory should return all subdirs along with
@@ -905,9 +904,9 @@ public class TestOzoneFileSystem {
while (it.hasNext()) {
iCount++;
FileStatus fileStatus = it.next();
- Assert.assertNotNull(fileStatus);
+ assertNotNull(fileStatus);
}
- Assert.assertEquals(
+ assertEquals(
"Iterator did not return all the file status",
2, iCount);
// Iterator should return file status for only the
@@ -922,9 +921,9 @@ public class TestOzoneFileSystem {
while (it.hasNext()) {
iCount++;
FileStatus fileStatus = it.next();
- Assert.assertNotNull(fileStatus);
+ assertNotNull(fileStatus);
}
- Assert.assertEquals("Iterator did not return file status " +
+ assertEquals("Iterator did not return file status " +
"of all the children of the directory", 3, iCount);
} finally {
@@ -953,7 +952,7 @@ public class TestOzoneFileSystem {
while (it.hasNext()) {
iCount++;
FileStatus fileStatus = it.next();
- Assert.assertNotNull(fileStatus);
+ assertNotNull(fileStatus);
// Verify that dir12 is not included in the result
// of the listStatusIterator on root.
assertNotEquals(fileStatus.getPath().toUri().getPath(),
@@ -1006,7 +1005,7 @@ public class TestOzoneFileSystem {
while (it.hasNext()) {
iCount++;
FileStatus fileStatus = it.next();
- Assert.assertNotNull(fileStatus);
+ assertNotNull(fileStatus);
assertTrue(fileStatus.getPath().toUri().getPath().
equals(dir11.toString()) || fileStatus.getPath().toUri().getPath()
.equals(dir12.toString()));
@@ -1034,9 +1033,9 @@ public class TestOzoneFileSystem {
Path fileNotExists = new Path("/file_notexist");
try {
fs.open(fileNotExists);
- Assert.fail("Should throw FileNotFoundException as file doesn't exist!");
+ fail("Should throw FileNotFoundException as file doesn't exist!");
} catch (FileNotFoundException fnfe) {
- Assert.assertTrue("Expected KEY_NOT_FOUND error",
+ assertTrue("Expected KEY_NOT_FOUND error",
fnfe.getMessage().contains("KEY_NOT_FOUND"));
}
}
@@ -1060,13 +1059,13 @@ public class TestOzoneFileSystem {
FileStatus fileStatus = fs.getFileStatus(file);
long blkSize = fileStatus.getBlockSize();
long fileLength = fileStatus.getLen();
- Assert.assertTrue("Block allocation should happen",
+ assertTrue("Block allocation should happen",
fileLength > blkSize);
long newNumBlockAllocations =
cluster.getOzoneManager().getMetrics().getNumBlockAllocates();
- Assert.assertTrue("Block allocation should happen",
+ assertTrue("Block allocation should happen",
(newNumBlockAllocations > numBlockAllocationsOrg));
stream.seek(fileLength);
@@ -1142,7 +1141,7 @@ public class TestOzoneFileSystem {
LOG.info("Rename op-> source:{} to destin:{}", sourceRoot, subDir1);
try {
fs.rename(sourceRoot, subDir1);
- Assert.fail("Should throw exception : Cannot rename a directory to" +
+ fail("Should throw exception : Cannot rename a directory to" +
" its own subdirectory");
} catch (IllegalArgumentException iae) {
// expected
@@ -1220,7 +1219,7 @@ public class TestOzoneFileSystem {
final Path baPath = new Path(fs.getUri().toString() + "/b/a/c");
fs.mkdirs(baPath);
- Assert.assertFalse("New destin sub-path /b/a already exists",
+ assertFalse("New destin sub-path /b/a already exists",
fs.rename(aSourcePath, bDestinPath));
// Case-5.b) Rename file from /a/b/c/file1 to /a.
@@ -1235,7 +1234,7 @@ public class TestOzoneFileSystem {
final Path aDestinPath = new Path(fs.getUri().toString() + "/a");
- Assert.assertFalse("New destin sub-path /b/a already exists",
+ assertFalse("New destin sub-path /b/a already exists",
fs.rename(abcFile1, aDestinPath));
}
@@ -1252,7 +1251,7 @@ public class TestOzoneFileSystem {
ContractTestUtils.touch(fs, file1Destin);
Path abcRootPath = new Path(fs.getUri().toString() + "/a/b/c");
fs.mkdirs(abcRootPath);
- Assert.assertFalse("key already exists /root_dir/file1",
+ assertFalse("key already exists /root_dir/file1",
fs.rename(abcRootPath, file1Destin));
}
@@ -1336,7 +1335,7 @@ public class TestOzoneFileSystem {
final Path destinPath = new Path(fs.getUri().toString() + root + "/b/c");
try {
fs.rename(dir2SourcePath, destinPath);
- Assert.fail("Should fail as parent of dst does not exist!");
+ fail("Should fail as parent of dst does not exist!");
} catch (FileNotFoundException fnfe) {
// expected
}
@@ -1348,7 +1347,7 @@ public class TestOzoneFileSystem {
Path newDestinPath = new Path(filePath, "c");
try {
fs.rename(dir2SourcePath, newDestinPath);
- Assert.fail("Should fail as parent of dst is a file!");
+ fail("Should fail as parent of dst is a file!");
} catch (IOException ioe) {
// expected
}
@@ -1481,7 +1480,7 @@ public class TestOzoneFileSystem {
// Test with current user
Path outPath1 = o3fs.getTrashRoot(inPath1);
Path expectedOutPath1 = o3fs.makeQualified(new Path(TRASH_ROOT, username));
- Assert.assertEquals(expectedOutPath1, outPath1);
+ assertEquals(expectedOutPath1, outPath1);
}
@Test
@@ -1539,7 +1538,7 @@ public class TestOzoneFileSystem {
OzoneFileSystem o3FS, Path keyPath, ReplicationType expectedType)
throws IOException {
o3FS.createFile(keyPath).build().close();
- Assert.assertEquals(expectedType.name(),
+ assertEquals(expectedType.name(),
bucket.getKey(o3FS.pathToKey(keyPath)).getReplicationConfig()
.getReplicationType().name());
}
@@ -1550,16 +1549,16 @@ public class TestOzoneFileSystem {
Path userTrash = new Path(TRASH_ROOT, username);
Collection<FileStatus> res = o3fs.getTrashRoots(false);
- Assert.assertEquals(0, res.size());
+ assertEquals(0, res.size());
fs.mkdirs(userTrash);
res = o3fs.getTrashRoots(false);
- Assert.assertEquals(1, res.size());
- res.forEach(e -> Assert.assertEquals(
+ assertEquals(1, res.size());
+ res.forEach(e -> assertEquals(
userTrash.toString(), e.getPath().toUri().getPath()));
// Only have one user trash for now
res = o3fs.getTrashRoots(true);
- Assert.assertEquals(1, res.size());
+ assertEquals(1, res.size());
// Create a few more random user trash dir
for (int i = 1; i <= 5; i++) {
@@ -1572,25 +1571,25 @@ public class TestOzoneFileSystem {
// allUsers = false should still return current user trash
res = o3fs.getTrashRoots(false);
- Assert.assertEquals(1, res.size());
- res.forEach(e -> Assert.assertEquals(
+ assertEquals(1, res.size());
+ res.forEach(e -> assertEquals(
userTrash.toString(), e.getPath().toUri().getPath()));
// allUsers = true should return all user trash
res = o3fs.getTrashRoots(true);
- Assert.assertEquals(6, res.size());
+ assertEquals(6, res.size());
}
@Test
public void testDeleteRootWithTrash() throws IOException {
// Try to delete root
Path root = new Path(OZONE_URI_DELIMITER);
- Assert.assertThrows(IOException.class, () -> trash.moveToTrash(root));
+ assertThrows(IOException.class, () -> trash.moveToTrash(root));
// Also try with TrashPolicyDefault
OzoneConfiguration conf2 = new OzoneConfiguration(cluster.getConf());
conf2.setClass("fs.trash.classname", TrashPolicyDefault.class,
TrashPolicy.class);
Trash trashPolicyDefault = new Trash(conf2);
- Assert.assertThrows(IOException.class,
+ assertThrows(IOException.class,
() -> trashPolicyDefault.moveToTrash(root));
}
@@ -1603,7 +1602,7 @@ public class TestOzoneFileSystem {
String testKeyName = "testKey2";
Path path = new Path(OZONE_URI_DELIMITER, testKeyName);
ContractTestUtils.touch(fs, path);
- Assert.assertTrue(trash.getConf().getClass(
+ assertTrue(trash.getConf().getClass(
"fs.trash.classname", TrashPolicy.class).
isAssignableFrom(TrashPolicyOzone.class));
assertEquals(TRASH_INTERVAL, trash.getConf().
@@ -1614,13 +1613,13 @@ public class TestOzoneFileSystem {
Path userTrash = new Path(TRASH_ROOT, username);
Path userTrashCurrent = new Path(userTrash, "Current");
Path trashPath = new Path(userTrashCurrent, testKeyName);
- Assert.assertFalse(o3fs.exists(userTrash));
+ assertFalse(o3fs.exists(userTrash));
// Call moveToTrash. We can't call protected fs.rename() directly
trash.moveToTrash(path);
- Assert.assertTrue(o3fs.exists(userTrash));
- Assert.assertTrue(o3fs.exists(trashPath) || o3fs.listStatus(
+ assertTrue(o3fs.exists(userTrash));
+ assertTrue(o3fs.exists(trashPath) || o3fs.listStatus(
o3fs.listStatus(userTrash)[0].getPath()).length > 0);
// Wait until the TrashEmptier purges the key
@@ -1629,7 +1628,7 @@ public class TestOzoneFileSystem {
return !o3fs.exists(trashPath);
} catch (IOException e) {
LOG.error("Delete from Trash Failed");
- Assert.fail("Delete from Trash Failed");
+ fail("Delete from Trash Failed");
return false;
}
}, 100, 120000);
@@ -1640,7 +1639,7 @@ public class TestOzoneFileSystem {
return o3fs.listStatus(userTrash).length == 0;
} catch (IOException e) {
LOG.error("Delete from Trash Failed", e);
- Assert.fail("Delete from Trash Failed");
+ fail("Delete from Trash Failed");
return false;
}
}, 1000, 120000);
@@ -1662,9 +1661,9 @@ public class TestOzoneFileSystem {
try {
new OzonePrefixPathImpl(getVolumeName(), getBucketName(), "invalidKey",
cluster.getOzoneManager().getKeyManager());
- Assert.fail("Non-existent key name!");
+ fail("Non-existent key name!");
} catch (OMException ome) {
- Assert.assertEquals(OMException.ResultCodes.KEY_NOT_FOUND,
+ assertEquals(OMException.ResultCodes.KEY_NOT_FOUND,
ome.getResult());
}
@@ -1673,13 +1672,13 @@ public class TestOzoneFileSystem {
cluster.getOzoneManager().getKeyManager());
OzoneFileStatus status = ozonePrefixPath.getOzoneFileStatus();
- Assert.assertNotNull(status);
- Assert.assertEquals(keyName, status.getTrimmedName());
- Assert.assertTrue(status.isDirectory());
+ assertNotNull(status);
+ assertEquals(keyName, status.getTrimmedName());
+ assertTrue(status.isDirectory());
Iterator<? extends OzoneFileStatus> pathItr =
ozonePrefixPath.getChildren(keyName);
- Assert.assertTrue("Failed to list keyPath:" + keyName, pathItr.hasNext());
+ assertTrue("Failed to list keyPath:" + keyName, pathItr.hasNext());
Set<String> actualPaths = new TreeSet<>();
while (pathItr.hasNext()) {
@@ -1689,18 +1688,18 @@ public class TestOzoneFileSystem {
// no subpaths, expected an empty list
Iterator<? extends OzoneFileStatus> subPathItr =
ozonePrefixPath.getChildren(pathname);
- Assert.assertNotNull(subPathItr);
- Assert.assertFalse("Failed to list keyPath: " + pathname,
+ assertNotNull(subPathItr);
+ assertFalse("Failed to list keyPath: " + pathname,
subPathItr.hasNext());
}
- Assert.assertEquals("ListStatus failed", paths.size(),
+ assertEquals("ListStatus failed", paths.size(),
actualPaths.size());
for (String pathname : actualPaths) {
paths.remove(pathname);
}
- Assert.assertTrue("ListStatus failed:" + paths, paths.isEmpty());
+ assertTrue("ListStatus failed:" + paths, paths.isEmpty());
}
@Test
@@ -1724,14 +1723,14 @@ public class TestOzoneFileSystem {
FileStatus fileStatus = fs.getFileStatus(path);
// verify that mtime is updated as expected.
- Assert.assertEquals(mtime, fileStatus.getModificationTime());
+ assertEquals(mtime, fileStatus.getModificationTime());
long mtimeDontUpdate = -1;
fs.setTimes(path, mtimeDontUpdate, 2000);
fileStatus = fs.getFileStatus(path);
// verify that mtime is NOT updated as expected.
- Assert.assertEquals(mtime, fileStatus.getModificationTime());
+ assertEquals(mtime, fileStatus.getModificationTime());
}
@Test
@@ -1758,10 +1757,10 @@ public class TestOzoneFileSystem {
try {
FileSystem.get(URI.create(rootPath), cluster.getConf());
- Assert.fail("Should throw Exception due to loop in Link Buckets");
+ fail("Should throw Exception due to loop in Link Buckets");
} catch (OMException oe) {
// Expected exception
-
Assert.assertEquals(OMException.ResultCodes.DETECTED_LOOP_IN_BUCKET_LINKS,
+ assertEquals(OMException.ResultCodes.DETECTED_LOOP_IN_BUCKET_LINKS,
oe.getResult());
} finally {
volume.deleteBucket(linkBucket1Name);
@@ -1784,7 +1783,7 @@ public class TestOzoneFileSystem {
FileSystem.get(URI.create(rootPath2), cluster.getConf());
} catch (OMException oe) {
// Expected exception
- Assert.fail("Should not throw Exception and show orphan buckets");
+ fail("Should not throw Exception and show orphan buckets");
} finally {
volume.deleteBucket(danglingLinkBucketName);
}
@@ -1830,6 +1829,6 @@ public class TestOzoneFileSystem {
}
GenericTestUtils.setLogLevel(log, Level.INFO);
- Assert.assertNotEquals(nonZeroLines, 0);
+ assertNotEquals(nonZeroLines, 0);
}
}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileSystemWithFSO.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileSystemWithFSO.java
index 70ca226b44..d2d2fd6b81 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileSystemWithFSO.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneFileSystemWithFSO.java
@@ -33,7 +33,6 @@ import org.apache.hadoop.ozone.om.helpers.OmBucketInfo;
import org.apache.hadoop.ozone.om.helpers.OmDirectoryInfo;
import org.apache.hadoop.ozone.om.helpers.OmKeyInfo;
import org.apache.ozone.test.GenericTestUtils;
-import org.junit.Assert;
import org.junit.After;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -296,7 +295,7 @@ public class TestOzoneFileSystemWithFSO extends
TestOzoneFileSystem {
final Path sourceRoot = new Path(getFs().getUri().toString() + root);
LOG.info("Rename op-> source:{} to destin:{}", sourceRoot, subDir1);
// rename should fail and return false
- Assert.assertFalse(getFs().rename(sourceRoot, subDir1));
+ assertFalse(getFs().rename(sourceRoot, subDir1));
}
/**
@@ -316,13 +315,13 @@ public class TestOzoneFileSystemWithFSO extends
TestOzoneFileSystem {
+ root + "/b/c");
// rename should fail and return false
- Assert.assertFalse(getFs().rename(dir2SourcePath, destinPath));
+ assertFalse(getFs().rename(dir2SourcePath, destinPath));
// (b) parent of dst is a file. /root_dir/file1/c
Path filePath = new Path(getFs().getUri().toString() + root + "/file1");
ContractTestUtils.touch(getFs(), filePath);
Path newDestinPath = new Path(filePath, "c");
// rename should fail and return false
- Assert.assertFalse(getFs().rename(dir2SourcePath, newDestinPath));
+ assertFalse(getFs().rename(dir2SourcePath, newDestinPath));
}
@Test
@@ -432,7 +431,7 @@ public class TestOzoneFileSystemWithFSO extends
TestOzoneFileSystem {
// reset metrics
long numKeys = getCluster().getOzoneManager().getMetrics().getNumKeys();
getCluster().getOzoneManager().getMetrics().decNumKeys(numKeys);
- Assert.assertEquals(0,
+ assertEquals(0,
getCluster().getOzoneManager().getMetrics().getNumKeys());
// Op 1. create dir -> /d1/d2/d3/d4/
@@ -445,7 +444,7 @@ public class TestOzoneFileSystemWithFSO extends
TestOzoneFileSystem {
getCluster().getOzoneManager().getMetadataManager();
OmBucketInfo omBucketInfo = omMgr.getBucketTable()
.get(omMgr.getBucketKey(getVolumeName(), getBucketName()));
- Assert.assertNotNull("Failed to find bucketInfo", omBucketInfo);
+ assertNotNull("Failed to find bucketInfo", omBucketInfo);
final long volumeId = omMgr.getVolumeId(getVolumeName());
final long bucketId = omMgr.getBucketId(getVolumeName(), getBucketName());
@@ -463,7 +462,7 @@ public class TestOzoneFileSystemWithFSO extends
TestOzoneFileSystem {
verifyDirKey(volumeId, bucketId, d3ObjectID,
"d4", "/d1/d2/d3/d4", dirKeys, omMgr);
- Assert.assertEquals("Wrong OM numKeys metrics", 4,
+ assertEquals("Wrong OM numKeys metrics", 4,
getCluster().getOzoneManager().getMetrics().getNumKeys());
// create sub-dirs under same parent
@@ -477,11 +476,11 @@ public class TestOzoneFileSystemWithFSO extends
TestOzoneFileSystem {
long d6ObjectID =
verifyDirKey(volumeId, bucketId, d4ObjectID,
"d6", "/d1/d2/d3/d4/d6", dirKeys, omMgr);
- Assert.assertTrue(
+ assertTrue(
"Wrong objectIds for sub-dirs[" + d5ObjectID + "/d5, " + d6ObjectID
+ "/d6] of same parent!", d5ObjectID != d6ObjectID);
- Assert.assertEquals("Wrong OM numKeys metrics", 6,
+ assertEquals("Wrong OM numKeys metrics", 6,
getCluster().getOzoneManager().getMetrics().getNumKeys());
}
@@ -497,7 +496,7 @@ public class TestOzoneFileSystemWithFSO extends
TestOzoneFileSystem {
getCluster().getOzoneManager().getMetadataManager();
OmBucketInfo omBucketInfo = omMgr.getBucketTable()
.get(omMgr.getBucketKey(getVolumeName(), getBucketName()));
- Assert.assertNotNull("Failed to find bucketInfo", omBucketInfo);
+ assertNotNull("Failed to find bucketInfo", omBucketInfo);
ArrayList<String> dirKeys = new ArrayList<>();
@@ -517,7 +516,7 @@ public class TestOzoneFileSystemWithFSO extends
TestOzoneFileSystem {
outputStream.close();
OmKeyInfo omKeyInfo =
omMgr.getKeyTable(getBucketLayout()).get(openFileKey);
- Assert.assertNotNull("Invalid Key!", omKeyInfo);
+ assertNotNull("Invalid Key!", omKeyInfo);
verifyOMFileInfoFormat(omKeyInfo, file.getName(), d2ObjectID);
// wait for DB updates
@@ -526,7 +525,7 @@ public class TestOzoneFileSystemWithFSO extends
TestOzoneFileSystem {
return omMgr.getOpenKeyTable(getBucketLayout()).isEmpty();
} catch (IOException e) {
LOG.error("DB failure!", e);
- Assert.fail("DB failure!");
+ fail("DB failure!");
return false;
}
}, 1000, 120000);
@@ -572,11 +571,11 @@ public class TestOzoneFileSystemWithFSO extends
TestOzoneFileSystem {
private void verifyOMFileInfoFormat(OmKeyInfo omKeyInfo, String fileName,
long parentID) {
- Assert.assertEquals("Wrong keyName", fileName, omKeyInfo.getKeyName());
- Assert.assertEquals("Wrong parentID", parentID,
+ assertEquals("Wrong keyName", fileName, omKeyInfo.getKeyName());
+ assertEquals("Wrong parentID", parentID,
omKeyInfo.getParentObjectID());
String dbKey = parentID + OzoneConsts.OM_KEY_PREFIX + fileName;
- Assert.assertEquals("Wrong path format", dbKey, omKeyInfo.getPath());
+ assertEquals("Wrong path format", dbKey, omKeyInfo.getPath());
}
long verifyDirKey(long volumeId, long bucketId, long parentId,
@@ -587,15 +586,15 @@ public class TestOzoneFileSystemWithFSO extends
TestOzoneFileSystem {
parentId + "/" + dirKey;
dirKeys.add(dbKey);
OmDirectoryInfo dirInfo = omMgr.getDirectoryTable().get(dbKey);
- Assert.assertNotNull("Failed to find " + absolutePath +
+ assertNotNull("Failed to find " + absolutePath +
" using dbKey: " + dbKey, dirInfo);
- Assert.assertEquals("Parent Id mismatches", parentId,
+ assertEquals("Parent Id mismatches", parentId,
dirInfo.getParentObjectID());
- Assert.assertEquals("Mismatches directory name", dirKey,
+ assertEquals("Mismatches directory name", dirKey,
dirInfo.getName());
- Assert.assertTrue("Mismatches directory creation time param",
+ assertTrue("Mismatches directory creation time param",
dirInfo.getCreationTime() > 0);
- Assert.assertEquals("Mismatches directory modification time param",
+ assertEquals("Mismatches directory modification time param",
dirInfo.getCreationTime(), dirInfo.getModificationTime());
return dirInfo.getObjectID();
}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestRootedOzoneFileSystem.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestRootedOzoneFileSystem.java
index 65b8ebcc93..272a12a492 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestRootedOzoneFileSystem.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestRootedOzoneFileSystem.java
@@ -73,8 +73,6 @@ import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.util.ToolRunner;
import org.apache.ozone.test.GenericTestUtils;
import org.junit.After;
-import org.junit.Assert;
-import org.junit.Assume;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -130,12 +128,17 @@ import static
org.apache.hadoop.ozone.security.acl.IAccessAuthorizer.ACLType.REA
import static
org.apache.hadoop.ozone.security.acl.IAccessAuthorizer.ACLType.WRITE;
import static
org.apache.hadoop.ozone.security.acl.IAccessAuthorizer.ACLType.DELETE;
import static
org.apache.hadoop.ozone.security.acl.IAccessAuthorizer.ACLType.LIST;
+import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeFalse;
+import static org.junit.Assume.assumeTrue;
/**
* Ozone file system tests that are not covered by contract tests.
@@ -327,7 +330,7 @@ public class TestRootedOzoneFileSystem {
OzoneConfiguration confTestLoader = new OzoneConfiguration();
// fs.ofs.impl should be loaded from META-INF, no need to explicitly set it
- Assert.assertEquals(FileSystem.getFileSystemClass(
+ assertEquals(FileSystem.getFileSystemClass(
OzoneConsts.OZONE_OFS_URI_SCHEME, confTestLoader),
RootedOzoneFileSystem.class);
}
@@ -342,7 +345,7 @@ public class TestRootedOzoneFileSystem {
OzoneKeyDetails key = getKey(child, false);
OFSPath childOFSPath = new OFSPath(child, conf);
- Assert.assertEquals(key.getName(), childOFSPath.getKeyName());
+ assertEquals(key.getName(), childOFSPath.getKeyName());
// Creating a child should not add parent keys to the bucket
try {
@@ -352,10 +355,10 @@ public class TestRootedOzoneFileSystem {
}
// List status on the parent should show the child file
- Assert.assertEquals(
+ assertEquals(
"List status of parent should include the 1 child file",
1L, fs.listStatus(parent).length);
- Assert.assertTrue(
+ assertTrue(
"Parent directory does not appear to be a directory",
fs.getFileStatus(parent).isDirectory());
@@ -394,7 +397,7 @@ public class TestRootedOzoneFileSystem {
}, 1000, 120000);
}
FileStatus fileStatus = fs.getFileStatus(parent);
- Assert.assertEquals((size == dirs.size() - 1 &&
+ assertEquals((size == dirs.size() - 1 &&
!bucketLayout.isFileSystemOptimized()) || size == dirs.size(),
fileStatus.isErasureCoded());
}
@@ -405,7 +408,7 @@ public class TestRootedOzoneFileSystem {
public void testDeleteCreatesFakeParentDir() throws Exception {
// TODO: Request for comment.
// If possible, improve this to test when FS Path is enabled.
- Assume.assumeTrue("FS Path is enabled. Skipping this test as it is not " +
+ assumeTrue("FS Path is enabled. Skipping this test as it is not " +
"tuned for FS Path yet", !enabledFileSystemPaths);
Path grandparent = new Path(bucketPath,
@@ -423,17 +426,17 @@ public class TestRootedOzoneFileSystem {
}
// Delete the child key
- Assert.assertTrue(fs.delete(child, false));
+ assertTrue(fs.delete(child, false));
// Deleting the only child should create the parent dir key if it does
// not exist
OFSPath parentOFSPath = new OFSPath(parent, conf);
String parentKey = parentOFSPath.getKeyName() + "/";
OzoneKeyDetails parentKeyInfo = getKey(parent, true);
- Assert.assertEquals(parentKey, parentKeyInfo.getName());
+ assertEquals(parentKey, parentKeyInfo.getName());
// Recursive delete with DeleteIterator
- Assert.assertTrue(fs.delete(grandparent, true));
+ assertTrue(fs.delete(grandparent, true));
}
@Test
@@ -443,21 +446,21 @@ public class TestRootedOzoneFileSystem {
Path file2 = new Path(parent, "key2");
FileStatus[] fileStatuses = ofs.listStatus(bucketPath);
- Assert.assertEquals("Should be empty", 0, fileStatuses.length);
+ assertEquals("Should be empty", 0, fileStatuses.length);
ContractTestUtils.touch(fs, file1);
ContractTestUtils.touch(fs, file2);
fileStatuses = ofs.listStatus(bucketPath);
- Assert.assertEquals("Should have created parent",
+ assertEquals("Should have created parent",
1, fileStatuses.length);
- Assert.assertEquals("Parent path doesn't match",
+ assertEquals("Parent path doesn't match",
fileStatuses[0].getPath().toUri().getPath(), parent.toString());
// ListStatus on a directory should return all subdirs along with
// files, even if there exists a file and sub-dir with the same name.
fileStatuses = ofs.listStatus(parent);
- Assert.assertEquals(
+ assertEquals(
"FileStatus did not return all children of the directory",
2, fileStatuses.length);
@@ -467,7 +470,7 @@ public class TestRootedOzoneFileSystem {
ContractTestUtils.touch(fs, file3);
ContractTestUtils.touch(fs, file4);
fileStatuses = ofs.listStatus(parent);
- Assert.assertEquals(
+ assertEquals(
"FileStatus did not return all children of" +
" the directory : Got " + Arrays.toString(
fileStatuses), 3, fileStatuses.length);
@@ -487,15 +490,15 @@ public class TestRootedOzoneFileSystem {
try {
// Iterator should have no items when dir is empty
RemoteIterator<FileStatus> it = ofs.listStatusIterator(bucketPath);
- Assert.assertFalse(it.hasNext());
+ assertFalse(it.hasNext());
ContractTestUtils.touch(fs, file1);
ContractTestUtils.touch(fs, file2);
// Iterator should have an item when dir is not empty
it = ofs.listStatusIterator(bucketPath);
while (it.hasNext()) {
FileStatus fileStatus = it.next();
- Assert.assertNotNull(fileStatus);
- Assert.assertEquals("Parent path doesn't match",
+ assertNotNull(fileStatus);
+ assertEquals("Parent path doesn't match",
fileStatus.getPath().toUri().getPath(), parent.toString());
}
// Iterator on a directory should return all subdirs along with
@@ -505,9 +508,9 @@ public class TestRootedOzoneFileSystem {
while (it.hasNext()) {
iCount++;
FileStatus fileStatus = it.next();
- Assert.assertNotNull(fileStatus);
+ assertNotNull(fileStatus);
}
- Assert.assertEquals(
+ assertEquals(
"Iterator did not return all the file status",
2, iCount);
// Iterator should return file status for only the
@@ -521,9 +524,9 @@ public class TestRootedOzoneFileSystem {
while (it.hasNext()) {
iCount++;
FileStatus fileStatus = it.next();
- Assert.assertNotNull(fileStatus);
+ assertNotNull(fileStatus);
}
- Assert.assertEquals("Iterator did not return file status " +
+ assertEquals("Iterator did not return file status " +
"of all the children of the directory", 3, iCount);
} finally {
// Cleanup
@@ -554,10 +557,10 @@ public class TestRootedOzoneFileSystem {
while (it.hasNext()) {
iCount++;
FileStatus fileStatus = it.next();
- Assert.assertNotNull(fileStatus);
- Assert.assertNotEquals(fileStatus, dir12.toString());
+ assertNotNull(fileStatus);
+ assertNotEquals(fileStatus, dir12.toString());
}
- Assert.assertEquals(
+ assertEquals(
"FileStatus should return only the immediate children",
2, iCount);
@@ -573,9 +576,9 @@ public class TestRootedOzoneFileSystem {
Path path = new Path("/test/test1/test2");
try {
ofs.listStatusIterator(path);
- Assert.fail("Should have thrown OMException");
+ fail("Should have thrown OMException");
} catch (OMException omEx) {
- Assert.assertEquals("Volume test is not found",
+ assertEquals("Volume test is not found",
OMException.ResultCodes.VOLUME_NOT_FOUND, omEx.getResult());
}
}
@@ -621,18 +624,18 @@ public class TestRootedOzoneFileSystem {
while (it.hasNext()) {
iCount++;
FileStatus fileStatus = it.next();
- Assert.assertNotNull(fileStatus);
- Assert.assertNotEquals(fileStatus, dir12.toString());
+ assertNotNull(fileStatus);
+ assertNotEquals(fileStatus, dir12.toString());
// Verify that the two children of /dir1
// returned by listStatusIterator operation
// are /dir1/dir11 and /dir1/dir12.
- Assert.assertTrue(
+ assertTrue(
fileStatus.getPath().toUri().getPath().
equals(dir11.toString()) ||
fileStatus.getPath().toUri().getPath().
equals(dir12.toString()));
}
- Assert.assertEquals(
+ assertEquals(
"Iterator should return only the immediate children",
2, iCount);
} finally {
@@ -662,7 +665,7 @@ public class TestRootedOzoneFileSystem {
}
}
if (retriesLeft <= 0) {
- Assert.fail(
+ fail(
"Failed to generate random volume name that doesn't exist already.");
}
return name;
@@ -675,7 +678,7 @@ public class TestRootedOzoneFileSystem {
public void testMkdirOnNonExistentVolumeBucketDir() throws Exception {
// TODO: Request for comment.
// If possible, improve this to test when FS Path is enabled.
- Assume.assumeTrue("FS Path is enabled. Skipping this test as it is not " +
+ assumeTrue("FS Path is enabled. Skipping this test as it is not " +
"tuned for FS Path yet", !enabledFileSystemPaths);
String volumeNameLocal = getRandomNonExistVolumeName();
@@ -693,22 +696,22 @@ public class TestRootedOzoneFileSystem {
OFSPath ofsPathDir1 = new OFSPath(dir12, conf);
String key = ofsPathDir1.getKeyName() + "/";
OzoneKeyDetails ozoneKeyDetails = ozoneBucket.getKey(key);
- Assert.assertEquals(key, ozoneKeyDetails.getName());
+ assertEquals(key, ozoneKeyDetails.getName());
// Verify that directories are created.
FileStatus[] fileStatuses = ofs.listStatus(root);
- Assert.assertEquals(
+ assertEquals(
fileStatuses[0].getPath().toUri().getPath(), dir1.toString());
- Assert.assertEquals(
+ assertEquals(
fileStatuses[1].getPath().toUri().getPath(), dir2.toString());
fileStatuses = ofs.listStatus(dir1);
- Assert.assertEquals(
+ assertEquals(
fileStatuses[0].getPath().toUri().getPath(), dir12.toString());
fileStatuses = ofs.listStatus(dir12);
- Assert.assertEquals(fileStatuses.length, 0);
+ assertEquals(fileStatuses.length, 0);
fileStatuses = ofs.listStatus(dir2);
- Assert.assertEquals(fileStatuses.length, 0);
+ assertEquals(fileStatuses.length, 0);
// Cleanup
fs.delete(dir2, true);
@@ -732,15 +735,15 @@ public class TestRootedOzoneFileSystem {
Iterator<? extends OzoneVolume> iterVol =
objectStore.listVolumesByUser(null, volumeNameLocal, null);
OzoneVolume ozoneVolume = iterVol.next();
- Assert.assertNotNull(ozoneVolume);
- Assert.assertEquals(volumeNameLocal, ozoneVolume.getName());
+ assertNotNull(ozoneVolume);
+ assertEquals(volumeNameLocal, ozoneVolume.getName());
Iterator<? extends OzoneBucket> iterBuc =
ozoneVolume.listBuckets("bucket-");
OzoneBucket ozoneBucket = iterBuc.next();
- Assert.assertNotNull(ozoneBucket);
- Assert.assertEquals(bucketNameLocal, ozoneBucket.getName());
- Assert.assertEquals(bucketLayout, ozoneBucket.getBucketLayout());
+ assertNotNull(ozoneBucket);
+ assertEquals(bucketNameLocal, ozoneBucket.getName());
+ assertEquals(bucketLayout, ozoneBucket.getBucketLayout());
// TODO: Use listStatus to check volume and bucket creation in HDDS-2928.
// Cleanup
@@ -763,8 +766,8 @@ public class TestRootedOzoneFileSystem {
Iterator<? extends OzoneVolume> iterVol =
objectStore.listVolumesByUser(null, volumeNameLocal, null);
OzoneVolume ozoneVolume = iterVol.next();
- Assert.assertNotNull(ozoneVolume);
- Assert.assertEquals(volumeNameLocal, ozoneVolume.getName());
+ assertNotNull(ozoneVolume);
+ assertEquals(volumeNameLocal, ozoneVolume.getName());
// TODO: Use listStatus to check volume and bucket creation in HDDS-2928.
@@ -779,10 +782,10 @@ public class TestRootedOzoneFileSystem {
public void testGetFileStatusRoot() throws Exception {
Path root = new Path("/");
FileStatus fileStatus = fs.getFileStatus(root);
- Assert.assertNotNull(fileStatus);
- Assert.assertEquals(new Path(rootPath), fileStatus.getPath());
- Assert.assertTrue(fileStatus.isDirectory());
- Assert.assertEquals(FsPermission.getDirDefault(),
+ assertNotNull(fileStatus);
+ assertEquals(new Path(rootPath), fileStatus.getPath());
+ assertTrue(fileStatus.isDirectory());
+ assertEquals(FsPermission.getDirDefault(),
fileStatus.getPermission());
}
@@ -803,7 +806,7 @@ public class TestRootedOzoneFileSystem {
// exist) and dir2 only. dir12 is not an immediate child of root and
// hence should not be listed.
FileStatus[] fileStatuses = ofs.listStatus(root);
- Assert.assertEquals(
+ assertEquals(
"FileStatus should return only the immediate children",
2, fileStatuses.length);
@@ -811,8 +814,8 @@ public class TestRootedOzoneFileSystem {
// root
String fileStatus1 = fileStatuses[0].getPath().toUri().getPath();
String fileStatus2 = fileStatuses[1].getPath().toUri().getPath();
- Assert.assertNotEquals(fileStatus1, dir12.toString());
- Assert.assertNotEquals(fileStatus2, dir12.toString());
+ assertNotEquals(fileStatus1, dir12.toString());
+ assertNotEquals(fileStatus2, dir12.toString());
} finally {
// cleanup
fs.delete(dir1, true);
@@ -836,12 +839,12 @@ public class TestRootedOzoneFileSystem {
}
FileStatus[] fileStatuses = ofs.listStatus(root);
- Assert.assertEquals(
+ assertEquals(
"Total directories listed do not match the existing directories",
numDirs, fileStatuses.length);
for (int i = 0; i < numDirs; i++) {
- Assert.assertTrue(paths.contains(fileStatuses[i].getPath().getName()));
+ assertTrue(paths.contains(fileStatuses[i].getPath().getName()));
}
} finally {
// Cleanup
@@ -878,7 +881,7 @@ public class TestRootedOzoneFileSystem {
fs.mkdirs(dir2);
FileStatus[] fileStatuses = ofs.listStatus(dir1);
- Assert.assertEquals(
+ assertEquals(
"FileStatus should return only the immediate children",
2, fileStatuses.length);
@@ -886,9 +889,9 @@ public class TestRootedOzoneFileSystem {
// are /dir1/dir11 and /dir1/dir12.
String fileStatus1 = fileStatuses[0].getPath().toUri().getPath();
String fileStatus2 = fileStatuses[1].getPath().toUri().getPath();
- Assert.assertTrue(fileStatus1.equals(dir11.toString()) ||
+ assertTrue(fileStatus1.equals(dir11.toString()) ||
fileStatus1.equals(dir12.toString()));
- Assert.assertTrue(fileStatus2.equals(dir11.toString()) ||
+ assertTrue(fileStatus2.equals(dir11.toString()) ||
fileStatus2.equals(dir12.toString()));
// Cleanup
@@ -909,15 +912,15 @@ public class TestRootedOzoneFileSystem {
fs.mkdirs(target);
fs.mkdirs(leafInsideInterimPath);
- Assert.assertTrue(fs.rename(leafInsideInterimPath, leafInTarget));
+ assertTrue(fs.rename(leafInsideInterimPath, leafInTarget));
// after rename listStatus for interimPath should succeed and
// interimPath should have no children
FileStatus[] statuses = fs.listStatus(interimPath);
- Assert.assertNotNull("liststatus returns a null array", statuses);
- Assert.assertEquals("Statuses array is not empty", 0, statuses.length);
+ assertNotNull("liststatus returns a null array", statuses);
+ assertEquals("Statuses array is not empty", 0, statuses.length);
FileStatus fileStatus = fs.getFileStatus(interimPath);
- Assert.assertEquals("FileStatus does not point to interimPath",
+ assertEquals("FileStatus does not point to interimPath",
interimPath.getName(), fileStatus.getPath().getName());
// Cleanup
@@ -945,7 +948,7 @@ public class TestRootedOzoneFileSystem {
Path leafInTargetInAnotherBucket = new Path(bucket2, "leaf");
try {
fs.rename(leafInsideInterimPath, leafInTargetInAnotherBucket);
- Assert.fail(
+ fail(
"Should have thrown exception when renaming to a different bucket");
} catch (IOException ignored) {
// Test passed. Exception thrown as expected.
@@ -1023,14 +1026,14 @@ public class TestRootedOzoneFileSystem {
Path bucketPath2 = createRandomVolumeBucketWithDirs();
// listStatus("/volume/bucket")
FileStatus[] fileStatusBucket = ofs.listStatus(bucketPath1);
- Assert.assertEquals(2, fileStatusBucket.length);
+ assertEquals(2, fileStatusBucket.length);
// listStatus("/volume")
Path volume = new Path(
OZONE_URI_DELIMITER + new OFSPath(bucketPath1, conf).getVolumeName());
FileStatus[] fileStatusVolume = ofs.listStatus(volume);
- Assert.assertEquals(1, fileStatusVolume.length);
- Assert.assertEquals(ownerShort, fileStatusVolume[0].getOwner());
- Assert.assertEquals(group, fileStatusVolume[0].getGroup());
+ assertEquals(1, fileStatusVolume.length);
+ assertEquals(ownerShort, fileStatusVolume[0].getOwner());
+ assertEquals(group, fileStatusVolume[0].getGroup());
// listStatus("/")
Path root = new Path(OZONE_URI_DELIMITER);
@@ -1048,13 +1051,13 @@ public class TestRootedOzoneFileSystem {
if (!enableAcl) {
// When ACL is disabled, ofs.listStatus(root) will see 2+1 = 3 volumes,
// the +1 is the default volume "s3v" created by OM during start up.
- Assert.assertEquals(2 + 1, fileStatusRoot.length);
+ assertEquals(2 + 1, fileStatusRoot.length);
for (FileStatus fileStatus : fileStatusRoot) {
- Assert.assertEquals(ownerShort, fileStatus.getOwner());
- Assert.assertEquals(group, fileStatus.getGroup());
+ assertEquals(ownerShort, fileStatus.getOwner());
+ assertEquals(group, fileStatus.getGroup());
}
} else {
- Assert.assertEquals(2 + 1 + 1, fileStatusRoot.length);
+ assertEquals(2 + 1 + 1, fileStatusRoot.length);
}
// Cleanup
@@ -1102,16 +1105,16 @@ public class TestRootedOzoneFileSystem {
// Compare. The results would be in the same order due to assumptions:
// 1. They are both using DFS internally;
// 2. They both return ordered results.
- Assert.assertEquals(statusesFromAdapter.size(), statusesFromFS.size());
+ assertEquals(statusesFromAdapter.size(), statusesFromFS.size());
final int n = statusesFromFS.size();
for (int i = 0; i < n; i++) {
FileStatus statusFromAdapter = statusesFromAdapter.get(i);
FileStatus statusFromFS = statusesFromFS.get(i);
- Assert.assertEquals(statusFromAdapter.getPath(), statusFromFS.getPath());
- Assert.assertEquals(statusFromAdapter.getLen(), statusFromFS.getLen());
- Assert.assertEquals(statusFromAdapter.isDirectory(),
+ assertEquals(statusFromAdapter.getPath(), statusFromFS.getPath());
+ assertEquals(statusFromAdapter.getLen(), statusFromFS.getLen());
+ assertEquals(statusFromAdapter.isDirectory(),
statusFromFS.isDirectory());
- Assert.assertEquals(statusFromAdapter.getModificationTime(),
+ assertEquals(statusFromAdapter.getModificationTime(),
statusFromFS.getModificationTime());
}
}
@@ -1151,7 +1154,7 @@ public class TestRootedOzoneFileSystem {
*/
private FileStatus[] customListStatus(Path f, boolean recursive,
String startPath, int numEntries) throws IOException {
- Assert.assertTrue(numEntries > 0);
+ assertTrue(numEntries > 0);
LinkedList<FileStatus> statuses = new LinkedList<>();
List<FileStatus> tmpStatusList;
do {
@@ -1170,7 +1173,7 @@ public class TestRootedOzoneFileSystem {
public void testListStatusRootAndVolumeContinuation() throws IOException {
// TODO: Request for comment.
// If possible, improve this to test when FS Path is enabled.
- Assume.assumeTrue("FS Path is enabled. Skipping this test as it is not " +
+ assumeTrue("FS Path is enabled. Skipping this test as it is not " +
"tuned for FS Path yet", !enabledFileSystemPaths);
Path[] paths = new Path[5];
@@ -1185,19 +1188,19 @@ public class TestRootedOzoneFileSystem {
false, "", 8);
// There are only 5 volumes
// Default volume "s3v" is created during startup.
- Assert.assertEquals(5 + 1, fileStatusesOver.length);
+ assertEquals(5 + 1, fileStatusesOver.length);
// numEntries = 5
FileStatus[] fileStatusesExact = customListStatus(new Path("/"),
false, "", 5);
- Assert.assertEquals(5, fileStatusesExact.length);
+ assertEquals(5, fileStatusesExact.length);
// numEntries < 5
FileStatus[] fileStatusesLimit1 = customListStatus(new Path("/"),
false, "", 3);
// Should only return 3 volumes even though there are more than that due to
// the specified limit
- Assert.assertEquals(3, fileStatusesLimit1.length);
+ assertEquals(3, fileStatusesLimit1.length);
// Get the last entry in the list as startPath
String nextStartPath =
@@ -1206,7 +1209,7 @@ public class TestRootedOzoneFileSystem {
false, nextStartPath, 3);
// Note: at the time of writing this test,
OmMetadataManagerImpl#listVolumes
// excludes startVolume (startPath) from the result. Might change.
- Assert.assertEquals(fileStatusesOver.length,
+ assertEquals(fileStatusesOver.length,
fileStatusesLimit1.length + fileStatusesLimit2.length);
// Cleanup
@@ -1244,18 +1247,18 @@ public class TestRootedOzoneFileSystem {
.setQuotaInNamespace(1000)
.setQuotaInBytes(Long.MAX_VALUE).build();
// Sanity check
- Assert.assertEquals("admin", volumeArgs.getOwner());
- Assert.assertEquals("admin", volumeArgs.getAdmin());
- Assert.assertEquals(Long.MAX_VALUE, volumeArgs.getQuotaInBytes());
- Assert.assertEquals(1000, volumeArgs.getQuotaInNamespace());
- Assert.assertEquals(0, volumeArgs.getMetadata().size());
- Assert.assertEquals(2, volumeArgs.getAcls().size());
+ assertEquals("admin", volumeArgs.getOwner());
+ assertEquals("admin", volumeArgs.getAdmin());
+ assertEquals(Long.MAX_VALUE, volumeArgs.getQuotaInBytes());
+ assertEquals(1000, volumeArgs.getQuotaInNamespace());
+ assertEquals(0, volumeArgs.getMetadata().size());
+ assertEquals(2, volumeArgs.getAcls().size());
// Create volume "tmp" with world access read+write to access tmp mount
// admin has all access to tmp mount
proxy.createVolume(OFSPath.OFS_MOUNT_TMP_VOLUMENAME, volumeArgs);
OzoneVolume vol = objectStore.getVolume(OFSPath.OFS_MOUNT_TMP_VOLUMENAME);
- Assert.assertNotNull(vol);
+ assertNotNull(vol);
// Begin test
String hashedUsername = OFSPath.getTempMountBucketNameOfCurrentUser();
@@ -1266,7 +1269,7 @@ public class TestRootedOzoneFileSystem {
} catch (OMException ex) {
// Expect BUCKET_NOT_FOUND
if (!ex.getResult().equals(BUCKET_NOT_FOUND)) {
- Assert.fail("Temp bucket for current user shouldn't have been
created");
+ fail("Temp bucket for current user shouldn't have been created");
}
}
@@ -1304,16 +1307,16 @@ public class TestRootedOzoneFileSystem {
// Verify temp bucket creation
OzoneBucket bucket = vol.getBucket("tmp");
- Assert.assertNotNull(bucket);
+ assertNotNull(bucket);
// Verify dir1 creation
FileStatus[] fileStatuses = fs.listStatus(new Path("/tmp/"));
- Assert.assertEquals(1, fileStatuses.length);
- Assert.assertEquals(
+ assertEquals(1, fileStatuses.length);
+ assertEquals(
"/tmp/dir1", fileStatuses[0].getPath().toUri().getPath());
// Verify file1 creation
FileStatus[] fileStatusesInDir1 = fs.listStatus(dir1);
- Assert.assertEquals(1, fileStatusesInDir1.length);
- Assert.assertEquals("/tmp/dir1/file1",
+ assertEquals(1, fileStatusesInDir1.length);
+ assertEquals("/tmp/dir1/file1",
fileStatusesInDir1[0].getPath().toUri().getPath());
// Cleanup
@@ -1324,7 +1327,7 @@ public class TestRootedOzoneFileSystem {
// Expect PERMISSION_DENIED, User regularuser1 doesn't have DELETE
// permission for /tmp
if (!ex.getResult().equals(PERMISSION_DENIED)) {
- Assert.fail("Temp bucket cannot be deleted by current user");
+ fail("Temp bucket cannot be deleted by current user");
}
}
fs.delete(new Path("/tmp"), true);
@@ -1352,17 +1355,17 @@ public class TestRootedOzoneFileSystem {
.setAcls(Collections.singletonList(aclWorldAccess))
.setQuotaInNamespace(1000).build();
// Sanity check
- Assert.assertNull(volumeArgs.getOwner());
- Assert.assertNull(volumeArgs.getAdmin());
- Assert.assertEquals(-1, volumeArgs.getQuotaInBytes());
- Assert.assertEquals(1000, volumeArgs.getQuotaInNamespace());
- Assert.assertEquals(0, volumeArgs.getMetadata().size());
- Assert.assertEquals(1, volumeArgs.getAcls().size());
+ assertNull(volumeArgs.getOwner());
+ assertNull(volumeArgs.getAdmin());
+ assertEquals(-1, volumeArgs.getQuotaInBytes());
+ assertEquals(1000, volumeArgs.getQuotaInNamespace());
+ assertEquals(0, volumeArgs.getMetadata().size());
+ assertEquals(1, volumeArgs.getAcls().size());
// Create volume "tmp" with world access. allow non-admin to create buckets
proxy.createVolume(OFSPath.OFS_MOUNT_TMP_VOLUMENAME, volumeArgs);
OzoneVolume vol = objectStore.getVolume(OFSPath.OFS_MOUNT_TMP_VOLUMENAME);
- Assert.assertNotNull(vol);
+ assertNotNull(vol);
// Begin test
String hashedUsername = OFSPath.getTempMountBucketNameOfCurrentUser();
@@ -1373,7 +1376,7 @@ public class TestRootedOzoneFileSystem {
} catch (OMException ex) {
// Expect BUCKET_NOT_FOUND
if (!ex.getResult().equals(BUCKET_NOT_FOUND)) {
- Assert.fail("Temp bucket for current user shouldn't have been
created");
+ fail("Temp bucket for current user shouldn't have been created");
}
}
@@ -1387,16 +1390,16 @@ public class TestRootedOzoneFileSystem {
// Verify temp bucket creation
OzoneBucket bucket = vol.getBucket(hashedUsername);
- Assert.assertNotNull(bucket);
+ assertNotNull(bucket);
// Verify dir1 creation
FileStatus[] fileStatuses = fs.listStatus(new Path("/tmp/"));
- Assert.assertEquals(1, fileStatuses.length);
- Assert.assertEquals(
+ assertEquals(1, fileStatuses.length);
+ assertEquals(
"/tmp/dir1", fileStatuses[0].getPath().toUri().getPath());
// Verify file1 creation
FileStatus[] fileStatusesInDir1 = fs.listStatus(dir1);
- Assert.assertEquals(1, fileStatusesInDir1.length);
- Assert.assertEquals("/tmp/dir1/file1",
+ assertEquals(1, fileStatusesInDir1.length);
+ assertEquals("/tmp/dir1/file1",
fileStatusesInDir1[0].getPath().toUri().getPath());
// Cleanup
@@ -1431,7 +1434,7 @@ public class TestRootedOzoneFileSystem {
private void deleteNonRecursivelyAndFail(Path f) throws IOException {
try {
fs.delete(f, false);
- Assert.fail("Should have thrown PathIsNotEmptyDirectoryException!");
+ fail("Should have thrown PathIsNotEmptyDirectoryException!");
} catch (PathIsNotEmptyDirectoryException ignored) {
}
}
@@ -1446,11 +1449,11 @@ public class TestRootedOzoneFileSystem {
fs.mkdirs(volumePath1);
// Check volume creation
OzoneVolume volume1 = objectStore.getVolume(volumeStr1);
- Assert.assertEquals(volumeStr1, volume1.getName());
+ assertEquals(volumeStr1, volume1.getName());
// Delete empty volume non-recursively
- Assert.assertTrue(fs.delete(volumePath1, false));
+ assertTrue(fs.delete(volumePath1, false));
// Verify the volume is deleted
- Assert.assertFalse(volumeStr1 + " should have been deleted!",
+ assertFalse(volumeStr1 + " should have been deleted!",
volumeExist(volumeStr1));
}
@@ -1464,16 +1467,16 @@ public class TestRootedOzoneFileSystem {
fs.mkdirs(bucketPath2);
// Check volume and bucket creation
OzoneVolume volume2 = objectStore.getVolume(volumeStr2);
- Assert.assertEquals(volumeStr2, volume2.getName());
+ assertEquals(volumeStr2, volume2.getName());
OzoneBucket bucket2 = volume2.getBucket(bucketStr2);
- Assert.assertEquals(bucketStr2, bucket2.getName());
+ assertEquals(bucketStr2, bucket2.getName());
// Delete volume non-recursively should fail since it is not empty
deleteNonRecursivelyAndFail(volumePath2);
// Delete bucket first, then volume
- Assert.assertTrue(fs.delete(bucketPath2, false));
- Assert.assertTrue(fs.delete(volumePath2, false));
+ assertTrue(fs.delete(bucketPath2, false));
+ assertTrue(fs.delete(volumePath2, false));
// Verify the volume is deleted
- Assert.assertFalse(volumeExist(volumeStr2));
+ assertFalse(volumeExist(volumeStr2));
}
@Test
@@ -1490,11 +1493,11 @@ public class TestRootedOzoneFileSystem {
deleteNonRecursivelyAndFail(volumePath3);
deleteNonRecursivelyAndFail(bucketPath3);
// Delete key first, then bucket, then volume
- Assert.assertTrue(fs.delete(dirPath3, false));
- Assert.assertTrue(fs.delete(bucketPath3, false));
- Assert.assertTrue(fs.delete(volumePath3, false));
+ assertTrue(fs.delete(dirPath3, false));
+ assertTrue(fs.delete(bucketPath3, false));
+ assertTrue(fs.delete(volumePath3, false));
// Verify the volume is deleted
- Assert.assertFalse(volumeExist(volumeStr3));
+ assertFalse(volumeExist(volumeStr3));
}
private void createSymlinkSrcDestPaths(String srcVol,
@@ -1505,16 +1508,16 @@ public class TestRootedOzoneFileSystem {
new Path(OZONE_URI_DELIMITER + srcBucket));
fs.mkdirs(volumeSrcPath);
OzoneVolume volume = objectStore.getVolume(srcVol);
- Assert.assertEquals(srcVol, volume.getName());
+ assertEquals(srcVol, volume.getName());
fs.mkdirs(bucketSrcPath);
OzoneBucket bucket = volume.getBucket(srcBucket);
- Assert.assertEquals(srcBucket, bucket.getName());
+ assertEquals(srcBucket, bucket.getName());
// dest link destVol/destBucket -> srcVol/srcBucket
Path volumeLinkPath = new Path(OZONE_URI_DELIMITER + destVol);
fs.mkdirs(volumeLinkPath);
volume = objectStore.getVolume(destVol);
- Assert.assertEquals(destVol, volume.getName());
+ assertEquals(destVol, volume.getName());
createLinkBucket(destVol, destBucket, srcVol, srcBucket);
}
@@ -1535,8 +1538,8 @@ public class TestRootedOzoneFileSystem {
new GenericTestUtils.SystemOutCapturer()) {
String linkPathStr = rootPath + destVolume;
ToolRunner.run(shell, new String[]{"-ls", linkPathStr});
- Assert.assertTrue(capture.getOutput().contains("drwxrwxrwx"));
- Assert.assertTrue(capture.getOutput().contains(linkPathStr +
+ assertTrue(capture.getOutput().contains("drwxrwxrwx"));
+ assertTrue(capture.getOutput().contains(linkPathStr +
OZONE_URI_DELIMITER + srcBucket));
} finally {
shell.close();
@@ -1549,7 +1552,7 @@ public class TestRootedOzoneFileSystem {
.createKey(key, 1)) {
outputStream.write(RandomUtils.nextBytes(1));
}
- Assert.assertEquals(objectStore.getVolume(srcVolume)
+ assertEquals(objectStore.getVolume(srcVolume)
.getBucket(srcBucket).getKey(key).getName(), key);
// test ls -R /destVol/destBucket, srcBucket with key (non-empty)
@@ -1558,11 +1561,11 @@ public class TestRootedOzoneFileSystem {
String linkPathStr = rootPath + destVolume;
ToolRunner.run(shell, new String[]{"-ls", "-R",
linkPathStr + OZONE_URI_DELIMITER + srcBucket});
- Assert.assertTrue(capture.getOutput().contains("drwxrwxrwx"));
- Assert.assertTrue(capture.getOutput().contains(linkPathStr +
+ assertTrue(capture.getOutput().contains("drwxrwxrwx"));
+ assertTrue(capture.getOutput().contains(linkPathStr +
OZONE_URI_DELIMITER + srcBucket));
- Assert.assertTrue(capture.getOutput().contains("-rw-rw-rw-"));
- Assert.assertTrue(capture.getOutput().contains(linkPathStr +
+ assertTrue(capture.getOutput().contains("-rw-rw-rw-"));
+ assertTrue(capture.getOutput().contains(linkPathStr +
OZONE_URI_DELIMITER + srcBucket + OZONE_URI_DELIMITER + key));
} finally {
shell.close();
@@ -1590,7 +1593,7 @@ public class TestRootedOzoneFileSystem {
try {
// test symlink destVol/destBucket -> srcVol/srcBucket exists
- Assert.assertTrue(fs.exists(new Path(OZONE_URI_DELIMITER +
+ assertTrue(fs.exists(new Path(OZONE_URI_DELIMITER +
destVolume + OZONE_URI_DELIMITER + srcBucket)));
// add key to srcBucket
@@ -1600,7 +1603,7 @@ public class TestRootedOzoneFileSystem {
.createKey(key, 1)) {
outputStream.write(RandomUtils.nextBytes(1));
}
- Assert.assertEquals(objectStore.getVolume(srcVolume)
+ assertEquals(objectStore.getVolume(srcVolume)
.getBucket(srcBucket).getKey(key).getName(), key);
// test symlink -rm destVol/destBucket -> srcVol/srcBucket
@@ -1611,23 +1614,23 @@ public class TestRootedOzoneFileSystem {
srcBucket;
int res = ToolRunner.run(shell, new String[]{"-rm", "-skipTrash",
linkPathStr});
- Assert.assertEquals(0, res);
+ assertEquals(0, res);
try {
objectStore.getVolume(destVolume).getBucket(srcBucket);
- Assert.fail("Bucket should not exist, should throw OMException");
+ fail("Bucket should not exist, should throw OMException");
} catch (OMException ex) {
- Assert.assertEquals(BUCKET_NOT_FOUND, ex.getResult());
+ assertEquals(BUCKET_NOT_FOUND, ex.getResult());
}
- Assert.assertEquals(srcBucket, objectStore.getVolume(srcVolume)
+ assertEquals(srcBucket, objectStore.getVolume(srcVolume)
.getBucket(srcBucket).getName());
- Assert.assertEquals(key, objectStore.getVolume(srcVolume)
+ assertEquals(key, objectStore.getVolume(srcVolume)
.getBucket(srcBucket).getKey(key).getName());
// re-create symlink
createLinkBucket(destVolume, srcBucket, srcVolume, srcBucket);
- Assert.assertTrue(fs.exists(new Path(OZONE_URI_DELIMITER +
+ assertTrue(fs.exists(new Path(OZONE_URI_DELIMITER +
destVolume + OZONE_URI_DELIMITER + srcBucket)));
// test symlink -rm -R -f destVol/destBucket/ -> srcVol/srcBucket
@@ -1637,20 +1640,20 @@ public class TestRootedOzoneFileSystem {
linkPathStr = rootPath + destVolume + OZONE_URI_DELIMITER + srcBucket;
res = ToolRunner.run(shell, new String[]{"-rm", "-skipTrash",
"-f", "-R", linkPathStr + OZONE_URI_DELIMITER});
- Assert.assertEquals(0, res);
+ assertEquals(0, res);
- Assert.assertEquals(srcBucket, objectStore.getVolume(destVolume)
+ assertEquals(srcBucket, objectStore.getVolume(destVolume)
.getBucket(srcBucket).getName());
- Assert.assertEquals(true, objectStore.getVolume(destVolume)
+ assertEquals(true, objectStore.getVolume(destVolume)
.getBucket(srcBucket).isLink());
- Assert.assertEquals(srcBucket, objectStore.getVolume(srcVolume)
+ assertEquals(srcBucket, objectStore.getVolume(srcVolume)
.getBucket(srcBucket).getName());
try {
objectStore.getVolume(srcVolume).getBucket(srcBucket).getKey(key);
- Assert.fail("Key should be deleted under srcBucket, " +
+ fail("Key should be deleted under srcBucket, " +
"OMException expected");
} catch (OMException ex) {
- Assert.assertEquals(KEY_NOT_FOUND, ex.getResult());
+ assertEquals(KEY_NOT_FOUND, ex.getResult());
}
// test symlink -rm -R -f destVol/destBucket -> srcVol/srcBucket
@@ -1659,20 +1662,20 @@ public class TestRootedOzoneFileSystem {
linkPathStr = rootPath + destVolume + OZONE_URI_DELIMITER + srcBucket;
res = ToolRunner.run(shell, new String[]{"-rm", "-skipTrash",
"-f", "-R", linkPathStr});
- Assert.assertEquals(0, res);
+ assertEquals(0, res);
- Assert.assertEquals(srcBucket, objectStore.getVolume(srcVolume)
+ assertEquals(srcBucket, objectStore.getVolume(srcVolume)
.getBucket(srcBucket).getName());
// test link existence
try {
objectStore.getVolume(destVolume).getBucket(srcBucket);
- Assert.fail("link should not exist, " +
+ fail("link should not exist, " +
"OMException expected");
} catch (OMException ex) {
- Assert.assertEquals(BUCKET_NOT_FOUND, ex.getResult());
+ assertEquals(BUCKET_NOT_FOUND, ex.getResult());
}
// test src bucket existence
- Assert.assertEquals(objectStore.getVolume(srcVolume)
+ assertEquals(objectStore.getVolume(srcVolume)
.getBucket(srcBucket).getName(), srcBucket);
} finally {
shell.close();
@@ -1713,7 +1716,7 @@ public class TestRootedOzoneFileSystem {
// confirm data through link
FileStatus dirLinkStatus = fs.getFileStatus(dirPathLink);
- Assert.assertNotNull(dirLinkStatus);
+ assertNotNull(dirLinkStatus);
// confirm non recursive delete of volume with link fails
deleteNonRecursivelyAndFail(linkVolumePath);
@@ -1722,7 +1725,7 @@ public class TestRootedOzoneFileSystem {
fs.delete(linkVolumePath, false);
// confirm vol1 data is unaffected
- Assert.assertTrue(dir1Status.equals(fs.getFileStatus(dirPath1)));
+ assertTrue(dir1Status.equals(fs.getFileStatus(dirPath1)));
// confirm link is gone
FileNotFoundException exception = assertThrows(FileNotFoundException.class,
@@ -1738,8 +1741,8 @@ public class TestRootedOzoneFileSystem {
@Test
public void testFailToDeleteRoot() throws IOException {
// rm root should always fail for OFS
- Assert.assertFalse(fs.delete(new Path("/"), false));
- Assert.assertFalse(fs.delete(new Path("/"), true));
+ assertFalse(fs.delete(new Path("/"), false));
+ assertFalse(fs.delete(new Path("/"), true));
}
/**
@@ -1751,8 +1754,8 @@ public class TestRootedOzoneFileSystem {
private void checkFirstFileStatusPath(String expected,
Collection<FileStatus> res) {
Optional<FileStatus> optional = res.stream().findFirst();
- Assert.assertTrue(optional.isPresent());
- Assert.assertEquals(expected, optional.get().getPath().toUri().getPath());
+ assertTrue(optional.isPresent());
+ assertEquals(expected, optional.get().getPath().toUri().getPath());
}
/**
@@ -1764,8 +1767,8 @@ public class TestRootedOzoneFileSystem {
*/
private void checkFileStatusOwner(int expectedSize, String expectedOwner,
Collection<FileStatus> res) {
- Assert.assertEquals(expectedSize, res.size());
- res.forEach(e -> Assert.assertEquals(expectedOwner, e.getOwner()));
+ assertEquals(expectedSize, res.size());
+ res.forEach(e -> assertEquals(expectedOwner, e.getOwner()));
}
/**
@@ -1777,21 +1780,21 @@ public class TestRootedOzoneFileSystem {
OzoneVolume volume1 = objectStore.getVolume(volumeName);
String prevOwner = volume1.getOwner();
// Set owner of the volume to current user, so it will show up in vol list
- Assert.assertTrue(volume1.setOwner(username));
+ assertTrue(volume1.setOwner(username));
Path trashRoot1 = new Path(bucketPath, TRASH_PREFIX);
Path user1Trash1 = new Path(trashRoot1, username);
// When user trash dir hasn't been created
- Assert.assertEquals(0, fs.getTrashRoots(false).size());
- Assert.assertEquals(0, fs.getTrashRoots(true).size());
+ assertEquals(0, fs.getTrashRoots(false).size());
+ assertEquals(0, fs.getTrashRoots(true).size());
// Let's create our first user1 (current user) trash dir.
fs.mkdirs(user1Trash1);
// Results should be getTrashRoots(false)=1, gTR(true)=1
Collection<FileStatus> res = fs.getTrashRoots(false);
- Assert.assertEquals(1, res.size());
+ assertEquals(1, res.size());
checkFirstFileStatusPath(user1Trash1.toString(), res);
res = fs.getTrashRoots(true);
- Assert.assertEquals(1, res.size());
+ assertEquals(1, res.size());
checkFirstFileStatusPath(user1Trash1.toString(), res);
// Create one more trash for user2 in the same bucket
@@ -1799,7 +1802,7 @@ public class TestRootedOzoneFileSystem {
fs.mkdirs(user2Trash1);
// Results should be getTrashRoots(false)=1, gTR(true)=2
checkFileStatusOwner(1, username, fs.getTrashRoots(false));
- Assert.assertEquals(2, fs.getTrashRoots(true).size());
+ assertEquals(2, fs.getTrashRoots(true).size());
// Create a new bucket in the same volume
final String bucketName2 = "trashroottest2";
@@ -1816,13 +1819,13 @@ public class TestRootedOzoneFileSystem {
// Results should still be getTrashRoots(false)=1, gTR(true)=2
checkFileStatusOwner(1, username, fs.getTrashRoots(false));
checkFirstFileStatusPath(user1Trash1.toString(), res);
- Assert.assertEquals(2, fs.getTrashRoots(true).size());
+ assertEquals(2, fs.getTrashRoots(true).size());
// Remove the file and create a dir instead. It should be recognized now
fs.delete(user1Trash2, false);
fs.mkdirs(user1Trash2);
// Results should now be getTrashRoots(false)=2, gTR(true)=3
checkFileStatusOwner(2, username, fs.getTrashRoots(false));
- Assert.assertEquals(3, fs.getTrashRoots(true).size());
+ assertEquals(3, fs.getTrashRoots(true).size());
// Create a new volume and a new bucket
OzoneBucket bucket3 =
@@ -1837,35 +1840,35 @@ public class TestRootedOzoneFileSystem {
// Results should be getTrashRoots(false)=3, gTR(true)=4
fs.mkdirs(user1Trash3);
checkFileStatusOwner(3, username, fs.getTrashRoots(false));
- Assert.assertEquals(4, fs.getTrashRoots(true).size());
+ assertEquals(4, fs.getTrashRoots(true).size());
// One more user
Path user3Trash1 = new Path(trashRoot3, "testuser3");
fs.mkdirs(user3Trash1);
// Results should be getTrashRoots(false)=3, gTR(true)=5
checkFileStatusOwner(3, username, fs.getTrashRoots(false));
- Assert.assertEquals(5, fs.getTrashRoots(true).size());
+ assertEquals(5, fs.getTrashRoots(true).size());
// Clean up, and check while doing so
fs.delete(trashRoot3, true);
checkFileStatusOwner(2, username, fs.getTrashRoots(false));
- Assert.assertEquals(3, fs.getTrashRoots(true).size());
+ assertEquals(3, fs.getTrashRoots(true).size());
fs.delete(trashRoot2, true);
checkFileStatusOwner(1, username, fs.getTrashRoots(false));
- Assert.assertEquals(2, fs.getTrashRoots(true).size());
+ assertEquals(2, fs.getTrashRoots(true).size());
fs.delete(user2Trash1, true);
checkFileStatusOwner(1, username, fs.getTrashRoots(false));
- Assert.assertEquals(1, fs.getTrashRoots(true).size());
+ assertEquals(1, fs.getTrashRoots(true).size());
volume3.deleteBucket(bucket3.getName());
objectStore.deleteVolume(volume3.getName());
volume1.deleteBucket(bucketName2);
fs.delete(user1Trash1, true);
- Assert.assertEquals(0, fs.getTrashRoots(false).size());
- Assert.assertEquals(0, fs.getTrashRoots(true).size());
+ assertEquals(0, fs.getTrashRoots(false).size());
+ assertEquals(0, fs.getTrashRoots(true).size());
fs.delete(trashRoot1, true);
// Restore owner
- Assert.assertTrue(volume1.setOwner(prevOwner));
+ assertTrue(volume1.setOwner(prevOwner));
}
@Test
@@ -1931,7 +1934,7 @@ public class TestRootedOzoneFileSystem {
stream.write(1);
}
- Assert.assertTrue(trash.getConf().getClass(
+ assertTrue(trash.getConf().getClass(
"fs.trash.classname", TrashPolicy.class).
isAssignableFrom(TrashPolicyOzone.class));
@@ -1964,7 +1967,7 @@ public class TestRootedOzoneFileSystem {
trash.moveToTrash(keyPath2);
// key should either be present in Current or checkpointDir
- Assert.assertTrue(ofs.exists(trashPath)
+ assertTrue(ofs.exists(trashPath)
|| ofs.listStatus(ofs.listStatus(userTrash)[0].getPath()).length > 0);
@@ -1974,20 +1977,20 @@ public class TestRootedOzoneFileSystem {
return !ofs.exists(trashPath) && !ofs.exists(trashPath2);
} catch (IOException e) {
LOG.error("Delete from Trash Failed", e);
- Assert.fail("Delete from Trash Failed");
+ fail("Delete from Trash Failed");
return false;
}
}, 1000, 180000);
if (isBucketFSOptimized) {
- Assert.assertTrue(getOMMetrics()
+ assertTrue(getOMMetrics()
.getNumTrashAtomicDirRenames() > prevNumTrashAtomicDirRenames);
} else {
// This condition should pass after the checkpoint
- Assert.assertTrue(getOMMetrics()
+ assertTrue(getOMMetrics()
.getNumTrashRenames() > prevNumTrashRenames);
// With new layout version, file renames wouldn't be counted
- Assert.assertTrue(getOMMetrics()
+ assertTrue(getOMMetrics()
.getNumTrashFilesRenames() > prevNumTrashFileRenames);
}
@@ -1998,7 +2001,7 @@ public class TestRootedOzoneFileSystem {
ofs.listStatus(userTrash2).length == 0;
} catch (IOException e) {
LOG.error("Delete from Trash Failed", e);
- Assert.fail("Delete from Trash Failed");
+ fail("Delete from Trash Failed");
return false;
}
}, 1000, 120000);
@@ -2214,7 +2217,7 @@ public class TestRootedOzoneFileSystem {
final OzoneBucket bucket100 = TestDataUtil
.createVolumeAndBucket(client, vol, buck,
omBucketArgs);
- Assert.assertEquals(ReplicationType.STAND_ALONE.name(),
+ assertEquals(ReplicationType.STAND_ALONE.name(),
bucket100.getReplicationConfig().getReplicationType().name());
// Bucket has default STAND_ALONE and client has default RATIS.
@@ -2226,7 +2229,7 @@ public class TestRootedOzoneFileSystem {
OFSPath ofsPath = new OFSPath(vol + "/" + buck + "/test", conf);
final OzoneBucket bucket = adapter.getBucket(ofsPath, false);
final OzoneKeyDetails key = bucket.getKey(ofsPath.getKeyName());
- Assert.assertEquals(key.getReplicationConfig().getReplicationType().name(),
+ assertEquals(key.getReplicationConfig().getReplicationType().name(),
ReplicationType.RATIS.name());
}
@@ -2245,7 +2248,7 @@ public class TestRootedOzoneFileSystem {
final OzoneBucket bucket101 = TestDataUtil
.createVolumeAndBucket(client, vol, buck,
omBucketArgs);
- Assert.assertEquals(ReplicationType.EC.name(),
+ assertEquals(ReplicationType.EC.name(),
bucket101.getReplicationConfig().getReplicationType().name());
// Bucket has default EC and client has default RATIS.
// In this case, it should inherit from bucket
@@ -2256,7 +2259,7 @@ public class TestRootedOzoneFileSystem {
OFSPath ofsPath = new OFSPath(vol + "/" + buck + "/test", conf);
final OzoneBucket bucket = adapter.getBucket(ofsPath, false);
final OzoneKeyDetails key = bucket.getKey(ofsPath.getKeyName());
- Assert.assertEquals(ReplicationType.EC.name(),
+ assertEquals(ReplicationType.EC.name(),
key.getReplicationConfig().getReplicationType().name());
}
@@ -2308,7 +2311,7 @@ public class TestRootedOzoneFileSystem {
long spaceConsumed = contentSummary.getSpaceConsumed();
long expectDiskUsage = QuotaUtil.getReplicatedSize(length,
new ECReplicationConfig(3, 2, RS, (int) OzoneConsts.MB));
- Assert.assertEquals(expectDiskUsage, spaceConsumed);
+ assertEquals(expectDiskUsage, spaceConsumed);
//clean up
ofs.delete(filePath, true);
}
@@ -2336,7 +2339,7 @@ public class TestRootedOzoneFileSystem {
long expectDiskUsage = QuotaUtil.getReplicatedSize(length,
RatisReplicationConfig.getInstance(
HddsProtos.ReplicationFactor.THREE));
- Assert.assertEquals(expectDiskUsage, spaceConsumed);
+ assertEquals(expectDiskUsage, spaceConsumed);
//clean up
ofs.delete(filePathTest, true);
}
@@ -2344,11 +2347,11 @@ public class TestRootedOzoneFileSystem {
public void testNonPrivilegedUserMkdirCreateBucket() throws IOException {
// This test is only meaningful when ACL is enabled
- Assume.assumeTrue("ACL is not enabled. Skipping this test as it requires "
+
+ assumeTrue("ACL is not enabled. Skipping this test as it requires " +
"ACL to be enabled to be meaningful.", enableAcl);
// Sanity check
- Assert.assertTrue(cluster.getOzoneManager().getAclsEnabled());
+ assertTrue(cluster.getOzoneManager().getAclsEnabled());
final String volume = "volume-for-test-get-bucket";
// Create a volume as admin
@@ -2374,9 +2377,9 @@ public class TestRootedOzoneFileSystem {
// Have to prepend the root to bucket path here.
// Otherwise, FS will automatically prepend user home directory path
// which is not we want here.
- Assert.assertTrue(userOfs.mkdirs(new Path("/", myBucketPath)));
+ assertTrue(userOfs.mkdirs(new Path("/", myBucketPath)));
} catch (IOException e) {
- Assert.fail("Should not have thrown exception when creating bucket as" +
+ fail("Should not have thrown exception when creating bucket as" +
" a regular user here");
}
@@ -2428,11 +2431,11 @@ public class TestRootedOzoneFileSystem {
FileStatus[] f1 = fs.listStatus(snapPath1);
FileStatus[] f2 = fs.listStatus(snapPath2);
FileStatus[] f3 = fs.listStatus(snapPath3);
- Assert.assertEquals(2, f1.length);
- Assert.assertEquals(0, f2.length);
- Assert.assertEquals(3, f3.length);
+ assertEquals(2, f1.length);
+ assertEquals(0, f2.length);
+ assertEquals(3, f3.length);
} catch (Exception e) {
- Assert.fail("Failed to read/list on snapshotPath, exception: " + e);
+ fail("Failed to read/list on snapshotPath, exception: " + e);
}
}
@@ -2464,15 +2467,15 @@ public class TestRootedOzoneFileSystem {
String toSnap = toSnapPath != null ? toSnapPath.toString() : null;
SnapshotDiffReport diff =
ofs.getSnapshotDiffReport(bucketPath1, fromSnap, toSnap);
- Assert.assertEquals(2, diff.getDiffList().size());
- Assert.assertEquals(SnapshotDiffReport.DiffType.CREATE,
+ assertEquals(2, diff.getDiffList().size());
+ assertEquals(SnapshotDiffReport.DiffType.CREATE,
diff.getDiffList().get(0).getType());
- Assert.assertEquals(SnapshotDiffReport.DiffType.CREATE,
+ assertEquals(SnapshotDiffReport.DiffType.CREATE,
diff.getDiffList().get(1).getType());
- Assert.assertArrayEquals(
+ assertArrayEquals(
"key1".getBytes(StandardCharsets.UTF_8),
diff.getDiffList().get(0).getSourcePath());
- Assert.assertArrayEquals(
+ assertArrayEquals(
"key2".getBytes(StandardCharsets.UTF_8),
diff.getDiffList().get(1).getSourcePath());
@@ -2489,19 +2492,19 @@ public class TestRootedOzoneFileSystem {
fromSnap = fromSnapPath != null ? fromSnapPath.toString() : null;
toSnap = toSnapPath != null ? toSnapPath.toString() : null;
diff = ofs.getSnapshotDiffReport(bucketPath1, fromSnap, toSnap);
- Assert.assertEquals(10, diff.getDiffList().size());
+ assertEquals(10, diff.getDiffList().size());
Path file =
new Path(bucketPath1, "key" + RandomStringUtils.randomAlphabetic(5));
ContractTestUtils.touch(fs, file);
diff = ofs.getSnapshotDiffReport(bucketPath1, toSnap, "");
- Assert.assertEquals(1, diff.getDiffList().size());
+ assertEquals(1, diff.getDiffList().size());
diff = ofs.getSnapshotDiffReport(bucketPath1, "", toSnap);
- Assert.assertEquals(1, diff.getDiffList().size());
+ assertEquals(1, diff.getDiffList().size());
diff = ofs.getSnapshotDiffReport(bucketPath1, "", "");
- Assert.assertEquals(0, diff.getDiffList().size());
+ assertEquals(0, diff.getDiffList().size());
// try snapDiff between non-bucket paths
String errorMsg = "Path is not a bucket";
@@ -2531,14 +2534,14 @@ public class TestRootedOzoneFileSystem {
FileStatus fileStatus = fs.getFileStatus(path);
// verify that mtime is updated as expected.
- Assert.assertEquals(mtime, fileStatus.getModificationTime());
+ assertEquals(mtime, fileStatus.getModificationTime());
long mtimeDontUpdate = -1;
fs.setTimes(path, mtimeDontUpdate, 2000);
fileStatus = fs.getFileStatus(path);
// verify that mtime is NOT updated as expected.
- Assert.assertEquals(mtime, fileStatus.getModificationTime());
+ assertEquals(mtime, fileStatus.getModificationTime());
}
}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestRootedOzoneFileSystemWithFSO.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestRootedOzoneFileSystemWithFSO.java
index b4005169f8..49da3e7218 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestRootedOzoneFileSystemWithFSO.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestRootedOzoneFileSystemWithFSO.java
@@ -24,7 +24,6 @@ import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.contract.ContractTestUtils;
import org.apache.hadoop.ozone.om.exceptions.OMException;
-import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -199,10 +198,10 @@ public class TestRootedOzoneFileSystemWithFSO
*/
long prevDeletes = getOMMetrics().getNumKeyDeletes();
- Assert.assertTrue(getFs().delete(bucketPath2, true));
- Assert.assertTrue(getFs().delete(volumePath1, false));
+ assertTrue(getFs().delete(bucketPath2, true));
+ assertTrue(getFs().delete(volumePath1, false));
long deletes = getOMMetrics().getNumKeyDeletes();
- Assert.assertTrue(deletes == prevDeletes + 1);
+ assertTrue(deletes == prevDeletes + 1);
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]