Пример #1
0
        public virtual void TestLinkTargetNonSymlink()
        {
            FileContext fc         = null;
            Path        notSymlink = new Path("/notasymlink");

            try
            {
                fc = FileContext.GetFileContext(cluster.GetFileSystem().GetUri());
                fc.Create(notSymlink, EnumSet.Of(CreateFlag.Create));
                DFSClient client = new DFSClient(cluster.GetFileSystem().GetUri(), cluster.GetConfiguration
                                                     (0));
                try
                {
                    client.GetLinkTarget(notSymlink.ToString());
                    NUnit.Framework.Assert.Fail("Expected exception for resolving non-symlink");
                }
                catch (IOException e)
                {
                    GenericTestUtils.AssertExceptionContains("is not a symbolic link", e);
                }
            }
            finally
            {
                if (fc != null)
                {
                    fc.Delete(notSymlink, false);
                }
            }
        }
Пример #2
0
        public virtual void TestLinkTargetNonExistent()
        {
            Path      doesNotExist = new Path("/filethatdoesnotexist");
            DFSClient client       = new DFSClient(cluster.GetFileSystem().GetUri(), cluster.GetConfiguration
                                                       (0));

            try
            {
                client.GetLinkTarget(doesNotExist.ToString());
                NUnit.Framework.Assert.Fail("Expected exception for resolving non-existent file");
            }
            catch (FileNotFoundException e)
            {
                GenericTestUtils.AssertExceptionContains("File does not exist: " + doesNotExist.ToString
                                                             (), e);
            }
        }
Пример #3
0
 /// <exception cref="System.IO.IOException"/>
 public override Path GetLinkTarget(Path p)
 {
     return(new Path(dfs.GetLinkTarget(GetUriPath(p))));
 }