Search in sources :

Example 1 with Mountd

use of org.apache.hadoop.hdfs.nfs.mount.Mountd in project hadoop by apache.

the class TestExportsTable method testExportPoint.

@Test
public void testExportPoint() throws IOException {
    NfsConfiguration config = new NfsConfiguration();
    MiniDFSCluster cluster = null;
    String exportPoint = "/myexport1";
    config.setStrings(NfsConfigKeys.DFS_NFS_EXPORT_POINT_KEY, exportPoint);
    // Use emphral port in case tests are running in parallel
    config.setInt("nfs3.mountd.port", 0);
    config.setInt("nfs3.server.port", 0);
    try {
        cluster = new MiniDFSCluster.Builder(config).numDataNodes(1).build();
        cluster.waitActive();
        // Start nfs
        final Nfs3 nfsServer = new Nfs3(config);
        nfsServer.startServiceInternal(false);
        Mountd mountd = nfsServer.getMountd();
        RpcProgramMountd rpcMount = (RpcProgramMountd) mountd.getRpcProgram();
        assertTrue(rpcMount.getExports().size() == 1);
        String exportInMountd = rpcMount.getExports().get(0);
        assertTrue(exportInMountd.equals(exportPoint));
    } finally {
        if (cluster != null) {
            cluster.shutdown();
        }
    }
}
Also used : RpcProgramMountd(org.apache.hadoop.hdfs.nfs.mount.RpcProgramMountd) MiniDFSCluster(org.apache.hadoop.hdfs.MiniDFSCluster) Mountd(org.apache.hadoop.hdfs.nfs.mount.Mountd) RpcProgramMountd(org.apache.hadoop.hdfs.nfs.mount.RpcProgramMountd) NfsConfiguration(org.apache.hadoop.hdfs.nfs.conf.NfsConfiguration) Test(org.junit.Test)

Aggregations

MiniDFSCluster (org.apache.hadoop.hdfs.MiniDFSCluster)1 NfsConfiguration (org.apache.hadoop.hdfs.nfs.conf.NfsConfiguration)1 Mountd (org.apache.hadoop.hdfs.nfs.mount.Mountd)1 RpcProgramMountd (org.apache.hadoop.hdfs.nfs.mount.RpcProgramMountd)1 Test (org.junit.Test)1