コード例 #1
0
        public virtual void TestDelete()
        {
            string dir = "/testNamenodeRetryCache/testDelete";

            // Two retried calls to create a non existent file
            NewCall();
            nnRpc.Mkdirs(dir, perm, true);
            NewCall();
            NUnit.Framework.Assert.IsTrue(nnRpc.Delete(dir, false));
            NUnit.Framework.Assert.IsTrue(nnRpc.Delete(dir, false));
            NUnit.Framework.Assert.IsTrue(nnRpc.Delete(dir, false));
            // non-retried call fails and gets false as return
            NewCall();
            NUnit.Framework.Assert.IsFalse(nnRpc.Delete(dir, false));
        }
コード例 #2
0
            // add a bunch of transactions.
            public virtual void Run()
            {
                thr = Sharpen.Thread.CurrentThread();
                FsPermission p = new FsPermission((short)0x1ff);
                int          i = 0;

                while (!stopped)
                {
                    try
                    {
                        string dirname = "/thr-" + thr.GetId() + "-dir-" + i;
                        nn.Mkdirs(dirname, p, true);
                        nn.Delete(dirname, true);
                    }
                    catch (SafeModeException)
                    {
                    }
                    catch (Exception e)
                    {
                        // This is OK - the tests will bring NN in and out of safemode
                        Log.Warn("Got error in transaction thread", e);
                        caught.CompareAndSet(null, e);
                        break;
                    }
                    i++;
                }
            }
コード例 #3
0
        public virtual void TestMkdirRpcNonCanonicalPath()
        {
            MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).NumDataNodes(0).Build();

            try
            {
                NamenodeProtocols nnrpc = cluster.GetNameNodeRpc();
                foreach (string pathStr in NonCanonicalPaths)
                {
                    try
                    {
                        nnrpc.Mkdirs(pathStr, new FsPermission((short)0x1ed), true);
                        NUnit.Framework.Assert.Fail("Did not fail when called with a non-canonicalized path: "
                                                    + pathStr);
                    }
                    catch (InvalidPathException)
                    {
                    }
                }
            }
            finally
            {
                // expected
                cluster.Shutdown();
            }
        }