Ejemplo n.º 1
0
        public void Connect()
        {
            var remotePath     = ".";
            var remotePathAttr = m_Config.Navigate("/tests/connect/$path");

            if (remotePathAttr.Exists)
            {
                remotePath = remotePathAttr.ValueAsString();
            }

            using (var session = FileSystem.StartSession(null))
            {
                var dir = session[remotePath] as FileSystemDirectory;
                Console.WriteLine("Files:");
                foreach (var item in dir.FileNames)
                {
                    Console.WriteLine("\t{0}", item);
                }
                Console.WriteLine("Directories:");
                foreach (var item in dir.SubDirectoryNames)
                {
                    Console.WriteLine("\t{0}", item);
                }
                var file = dir.CreateFile("nfx_ftp_fs.txt");
                file.WriteAllText("TEST");
                var remoteContent = file.ReadAllText();
                Console.WriteLine(remoteContent);

                Aver.AreEqual("TEST", remoteContent);
            }
        }
Ejemplo n.º 2
0
        private void checkIncludeInvariants(ConfigSectionNode conf)
        {
            Console.WriteLine(conf.ToLaconicString(Azos.CodeAnalysis.Laconfig.LaconfigWritingOptions.PrettyPrint));

            Aver.AreEqual(3, conf.ChildCount);

            Aver.AreEqual(129, conf.AttrByName("age").ValueAsInt());
            Aver.AreEqual("all", conf.AttrByName("_override").Value);

            Aver.AreEqual("Alex", conf.Navigate("/WithNewName/people/a").Value);
            Aver.AreEqual("Boris", conf.Navigate("/WithNewName/people/b").Value);

            Aver.AreEqual("Cleveland", conf.Navigate("/city/$name").Value);

            Aver.AreEqual("Alex", conf.Navigate("/people/a").Value);
            Aver.AreEqual("Boris", conf.Navigate("/people/b").Value);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Executes a SET statement configuration script (StopWatch is passed along to track timout adherence)
        /// </summary>
        protected virtual void DoSET(Stopwatch sw, ConfigSectionNode setStatement)
        {
            InitStatement(setStatement);

            var path = setStatement.AttrByName("path").Value ?? CoreConsts.NULL_STRING;
            var to   = setStatement.AttrByName("to").Value;

            to = EvaluateAnyExpression(setStatement, to);

            var target = setStatement.Navigate(path);

            if (!target.Exists)
            {
                throw new ConfigException(StringConsts.CONFIGURATION_SCRIPT_SET_PATH_ERROR.Args(setStatement.RootPath, path));
            }

            target.Value = to;
        }
Ejemplo n.º 4
0
        private void doSET(Stopwatch sw, ConfigSectionNode setStatement)
        {
            initStatement(setStatement);

                                var path = setStatement.AttrByName("path").Value ?? StringConsts.NULL_STRING;
                                var to =  setStatement.AttrByName("to").Value;

                                to = evaluateAnyExpression(setStatement, to);

                                var target = setStatement.Navigate(path);
                                if (!target.Exists)
                                    throw new ConfigException(StringConsts.CONFIGURATION_SCRIPT_SET_PATH_ERROR.Args(setStatement.RootPath, path) );

                                target.Value = to;
        }
Ejemplo n.º 5
0
        private void assert(ConfigSectionNode root)
        {
            Aver.AreEqual("tezt-root", root.Name);
            Aver.AreEqual("Hahaha\nha!", root.Value);

            Aver.AreEqual("Type1", root.Navigate("types/$t1").Value);
            Aver.AreEqual("Type2", root.Navigate("types/$t2").Value);

            Aver.AreEqual("Type1", root.Navigate("providers/provider1/$type").Value);
            Aver.AreEqual("Type2", root.Navigate("providers/provider2/$type").Value);
            Aver.IsFalse(root.Navigate("providers/provider3").Exists);

            Aver.AreEqual(3, root["providers"]["provider2"].ChildCount);
            Aver.AreEqual("Koshka", root.Navigate("providers/provider2/$name").Value);

            Aver.AreEqual("net", root.Navigate("providers/provider2/[0]/c/$da").Value);
            Aver.AreEqual(5623, root.Navigate("providers/provider2/[1]/$a").ValueAsInt());
            Aver.IsFalse(root.Navigate("providers/provider2/[1]/$b").ValueAsBool());
            Aver.AreEqual(78, root.Navigate("providers/provider2/[2]/$a").ValueAsInt());
            Aver.IsTrue(root.Navigate("providers/provider2/[2]/$b").ValueAsBool());
        }
Ejemplo n.º 6
0
        private void assert(ConfigSectionNode root)
        {
            Assert.AreEqual("tezt-root", root.Name);
              Assert.AreEqual("Hahaha\nha!", root.Value);

              Assert.AreEqual("Type1", root.Navigate("types/$t1").Value);
              Assert.AreEqual("Type2", root.Navigate("types/$t2").Value);

              Assert.AreEqual("Type1", root.Navigate("providers/provider1/$type").Value);
              Assert.AreEqual("Type2", root.Navigate("providers/provider2/$type").Value);
              Assert.IsFalse(root.Navigate("providers/provider3").Exists);

              Assert.AreEqual(3, root["providers"]["provider2"].ChildCount);
              Assert.AreEqual("Koshka", root.Navigate("providers/provider2/$name").Value);

              Assert.AreEqual("net", root.Navigate("providers/provider2/[0]/c/$da").Value);
              Assert.AreEqual(5623, root.Navigate("providers/provider2/[1]/$a").ValueAsInt());
              Assert.IsFalse(root.Navigate("providers/provider2/[1]/$b").ValueAsBool());
              Assert.AreEqual(78, root.Navigate("providers/provider2/[2]/$a").ValueAsInt());
              Assert.IsTrue(root.Navigate("providers/provider2/[2]/$b").ValueAsBool());
        }