Beispiel #1
0
        public virtual void TestBasicPaths()
        {
            URI uri = fc.GetDefaultFileSystem().GetUri();

            Assert.Equal(chrootedTo.ToUri(), uri);
            Assert.Equal(fc.MakeQualified(new Path(Runtime.GetProperty("user.home"
                                                                       ))), fc.GetWorkingDirectory());
            Assert.Equal(fc.MakeQualified(new Path(Runtime.GetProperty("user.home"
                                                                       ))), fc.GetHomeDirectory());

            /*
             * ChRootedFs as its uri like file:///chrootRoot.
             * This is questionable since path.makequalified(uri, path) ignores
             * the pathPart of a uri. So our notion of chrooted URI is questionable.
             * But if we were to fix Path#makeQualified() then  the next test should
             *  have been:
             *
             * Assert.assertEquals(
             * new Path(chrootedTo + "/foo/bar").makeQualified(
             * FsConstants.LOCAL_FS_URI, null),
             * fc.makeQualified(new Path( "/foo/bar")));
             */
            Assert.Equal(new Path("/foo/bar").MakeQualified(FsConstants.LocalFsUri
                                                            , null), fc.MakeQualified(new Path("/foo/bar")));
        }
Beispiel #2
0
 public virtual void TestBasicPaths()
 {
     Assert.Equal(FsConstants.ViewfsUri, fcView.GetDefaultFileSystem
                      ().GetUri());
     Assert.Equal(fcView.MakeQualified(new Path("/user/" + Runtime.
                                                GetProperty("user.name"))), fcView.GetWorkingDirectory());
     Assert.Equal(fcView.MakeQualified(new Path("/user/" + Runtime.
                                                GetProperty("user.name"))), fcView.GetHomeDirectory());
     Assert.Equal(new Path("/foo/bar").MakeQualified(FsConstants.ViewfsUri
                                                     , null), fcView.MakeQualified(new Path("/foo/bar")));
 }
Beispiel #3
0
        internal static void SetUpHomeDir(Configuration conf, FileContext fsTarget)
        {
            string homeDir         = fsTarget.GetHomeDirectory().ToUri().GetPath();
            int    indexOf2ndSlash = homeDir.IndexOf('/', 1);

            if (indexOf2ndSlash > 0)
            {
                LinkUpFirstComponents(conf, homeDir, fsTarget, "home dir");
            }
            else
            {
                // home dir is at root. Just link the home dir itse
                URI linkTarget = fsTarget.MakeQualified(new Path(homeDir)).ToUri();
                ConfigUtil.AddLink(conf, homeDir, linkTarget);
                Org.Mortbay.Log.Log.Info("Added link for home dir " + homeDir + "->" + linkTarget
                                         );
            }
            // Now set the root of the home dir for viewfs
            string homeDirRoot = fsTarget.GetHomeDirectory().GetParent().ToUri().GetPath();

            ConfigUtil.SetHomeDirConf(conf, homeDirRoot);
            Org.Mortbay.Log.Log.Info("Home dir base for viewfs" + homeDirRoot);
        }