Пример #1
0
        public virtual void TestExportPoint()
        {
            NfsConfiguration config      = new NfsConfiguration();
            MiniDFSCluster   cluster     = null;
            string           exportPoint = "/myexport1";

            config.SetStrings(NfsConfigKeys.DfsNfsExportPointKey, 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
                Org.Apache.Hadoop.Hdfs.Nfs.Nfs3.Nfs3 nfsServer = new Org.Apache.Hadoop.Hdfs.Nfs.Nfs3.Nfs3
                                                                     (config);
                nfsServer.StartServiceInternal(false);
                Mountd           mountd   = nfsServer.GetMountd();
                RpcProgramMountd rpcMount = (RpcProgramMountd)mountd.GetRpcProgram();
                NUnit.Framework.Assert.IsTrue(rpcMount.GetExports().Count == 1);
                string exportInMountd = rpcMount.GetExports()[0];
                NUnit.Framework.Assert.IsTrue(exportInMountd.Equals(exportPoint));
            }
            finally
            {
                if (cluster != null)
                {
                    cluster.Shutdown();
                }
            }
        }
Пример #2
0
        public virtual void TestStart()
        {
            // Start minicluster
            NfsConfiguration config  = new NfsConfiguration();
            MiniDFSCluster   cluster = new MiniDFSCluster.Builder(config).NumDataNodes(1).Build
                                           ();

            cluster.WaitActive();
            // Use emphral port in case tests are running in parallel
            config.SetInt("nfs3.mountd.port", 0);
            config.SetInt("nfs3.server.port", 0);
            // Start nfs
            Org.Apache.Hadoop.Hdfs.Nfs.Nfs3.Nfs3 nfs3 = new Org.Apache.Hadoop.Hdfs.Nfs.Nfs3.Nfs3
                                                            (config);
            nfs3.StartServiceInternal(false);
            RpcProgramMountd mountd = (RpcProgramMountd)nfs3.GetMountd().GetRpcProgram();

            mountd.NullOp(new XDR(), 1234, Sharpen.Extensions.GetAddressByName("localhost"));
            RpcProgramNfs3 nfsd = (RpcProgramNfs3)nfs3.GetRpcProgram();

            nfsd.NullProcedure();
            cluster.Shutdown();
        }