HDFS-5684. Annotate o.a.h.fs.viewfs.ViewFileSystem.MountPoint as VisibleForTesting. Contributed by Manoj Govindassamy.

This commit is contained in:
Andrew Wang 2016-10-25 15:35:39 -07:00
parent 86c735bcb1
commit 084bdab156
2 changed files with 14 additions and 2 deletions

View File

@ -32,6 +32,7 @@
import java.util.Set;
import java.util.Map.Entry;
import com.google.common.annotations.VisibleForTesting;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.conf.Configuration;
@ -104,9 +105,13 @@ static public class MountPoint {
src = srcPath;
targets = targetURIs;
}
@VisibleForTesting
Path getSrc() {
return src;
}
@VisibleForTesting
URI[] getTargets() {
return targets;
}

View File

@ -24,6 +24,7 @@
import java.util.List;
import java.util.ArrayList;
import com.google.common.base.Joiner;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.BlockLocation;
import org.apache.hadoop.fs.BlockStoragePolicySpi;
@ -39,13 +40,13 @@
import org.apache.hadoop.fs.permission.AclUtil;
import org.apache.hadoop.fs.permission.FsAction;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.fs.viewfs.ConfigUtil;
import org.apache.hadoop.fs.viewfs.ViewFileSystem.MountPoint;
import org.apache.hadoop.fs.viewfs.ViewFileSystem;
import org.apache.hadoop.security.AccessControlException;
import org.apache.hadoop.security.Credentials;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.security.token.Token;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.apache.hadoop.fs.FileSystemTestHelper.*;
import static org.apache.hadoop.fs.viewfs.Constants.PERMISSION_555;
@ -82,6 +83,8 @@ abstract public class ViewFileSystemBaseTest {
Path targetTestRoot;
Configuration conf;
final FileSystemTestHelper fileSystemTestHelper;
private static final Logger LOG =
LoggerFactory.getLogger(ViewFileSystemBaseTest.class);
public ViewFileSystemBaseTest() {
this.fileSystemTestHelper = createFileSystemHelper();
@ -144,6 +147,10 @@ void setupMountPoints() {
public void testGetMountPoints() {
ViewFileSystem viewfs = (ViewFileSystem) fsView;
MountPoint[] mountPoints = viewfs.getMountPoints();
for (MountPoint mountPoint : mountPoints) {
LOG.info("MountPoint: " + mountPoint.getSrc() + " => "
+ Joiner.on(",").join(mountPoint.getTargets()));
}
Assert.assertEquals(getExpectedMountPoints(), mountPoints.length);
}