예제 #1
0
        public void EC_WinFormsTest_WMED0004()
        {
            using (var fs = new LocalFileSystem(null))
                using (var mb = new Metabank(fs, null, TestSources.RPATH))
                    using (var session = BootConfLoader.LoadForTest(SystemApplicationType.TestRig, mb, TestSources.THIS_HOST))
                    {
                        var host = mb.CatalogReg.NavigateHost(WMED0004);

                        var conf = host.GetEffectiveAppConfig("WinFormsTest");

                        Aver.AreEqual("WinFormsTest on HOST1", conf.Navigate("/$application-name").Value);
                        Aver.AreEqual("Nikulin", conf.Navigate("/$clown").Value);

                        Aver.AreEqual("A", conf.Navigate("/gv/$a").Value);
                        Aver.AreEqual("B", conf.Navigate("/gv/$b").Value);

                        Aver.IsNull(conf.Navigate("/glue/$zoloto").Value);
                        Aver.AreEqual("da", conf.Navigate("/glue/$serebro").Value);

                        Aver.AreEqual(123, conf.Navigate("/east-block/$something").ValueAsInt());
                        Aver.IsTrue(conf.Navigate("/cleveland/$solon").ValueAsBool());
                        Aver.IsFalse(conf.Navigate("/cleveland/$hudson").ValueAsBool());
                        Aver.IsFalse(conf.Navigate("/windows7/$build").Exists);
                    }
        }
예제 #2
0
        public void EC_Various_Parallel()
        {
            using (var fs = new LocalFileSystem(null))
                using (var mb = new Metabank(fs, null, TestSources.RPATH))
                    using (var session = BootConfLoader.LoadForTest(SystemApplicationType.TestRig, mb, TestSources.THIS_HOST))
                    {
                        Parallel.For(0, TestSources.PARALLEL_LOOP_TO, (i) =>
                        {
                            Thread.SpinWait(ExternalRandomGenerator.Instance.NextScaledRandomInteger(10, 2000));

                            var host = mb.CatalogReg.NavigateHost(WMED0004);

                            var conf = host.GetEffectiveAppConfig("WebApp1");

                            Aver.AreEqual("WebApp1", conf.Navigate("/$application-name").Value);

                            Aver.AreEqual("A", conf.Navigate("/gv/$a").Value);
                            Aver.AreEqual("B", conf.Navigate("/gv/$b").Value);

                            Aver.AreEqual("da", conf.Navigate("/glue/$zoloto").Value);
                            Aver.AreEqual("da", conf.Navigate("/glue/$serebro").Value);

                            Aver.AreEqual(123, conf.Navigate("/east-block/$something").ValueAsInt());
                            Aver.AreEqual(true, conf.Navigate("/cleveland/$solon").ValueAsBool());
                            Aver.AreEqual(true, conf.Navigate("/cleveland/$hudson").ValueAsBool());
                            Aver.IsFalse(conf.Navigate("/windows7/$build").Exists);


                            //--------------------------------------------
                            Thread.SpinWait(ExternalRandomGenerator.Instance.NextScaledRandomInteger(10, 2000));
                            host = mb.CatalogReg.NavigateHost(WMED0002);
                            conf = host.GetEffectiveAppConfig("WebApp");
                            Aver.AreEqual("1.2.0890b", conf.Navigate("/windows7/$build").Value);

                            //--------------------------------------------
                            Thread.SpinWait(ExternalRandomGenerator.Instance.NextScaledRandomInteger(10, 2000));
                            host = mb.CatalogReg.NavigateHost(WMED0004);

                            conf = host.GetEffectiveAppConfig("WinFormsTest");

                            Aver.AreEqual("WinFormsTest on HOST1", conf.Navigate("/$application-name").Value);

                            Aver.AreEqual("A", conf.Navigate("/gv/$a").Value);
                            Aver.AreEqual("B", conf.Navigate("/gv/$b").Value);

                            Aver.IsNull(conf.Navigate("/glue/$zoloto").Value);
                            Aver.AreEqual("da", conf.Navigate("/glue/$serebro").Value);

                            Aver.AreEqual(123, conf.Navigate("/east-block/$something").ValueAsInt());
                            Aver.AreEqual(true, conf.Navigate("/cleveland/$solon").ValueAsBool());
                            Aver.AreEqual(false, conf.Navigate("/cleveland/$hudson").ValueAsBool());

                            Aver.IsFalse(conf.Navigate("/windows7/$build").Exists);
                        });
                    }
        }
예제 #3
0
        public void EC_Server_fail()
        {
            using (var fs = new LocalFileSystem(null))
                using (var mb = new Metabank(fs, null, TestSources.RPATH))
                    using (var session = BootConfLoader.LoadForTest(SystemApplicationType.TestRig, mb, TestSources.THIS_HOST))
                    {
                        var host = mb.CatalogReg.NavigateHost(WMED0002);

                        var conf = host.GetEffectiveAppConfig("TestApp");
                    }
        }
예제 #4
0
        void IRunnableHook.Prologue(Runner runner, FID id)
        {
            Console.WriteLine("{0}.{1}".Args(GetType().FullName, "RigSetup()..."));
            m_FS          = new LocalFileSystem(null);
            m_Metabank    = new Metabank(m_FS, null, TestSources.RPATH);
            m_TestSession = BootConfLoader.LoadForTest(SystemApplicationType.TestRig, m_Metabank, TestSources.THIS_HOST);

            DoRigSetup();

            Console.WriteLine("{0}.{1}".Args(GetType().FullName, "...RigSetup() DONE"));
        }
예제 #5
0
        public void EC_Server_success()
        {
            using (var fs = new LocalFileSystem(null))
                using (var mb = new Metabank(fs, null, TestSources.RPATH))
                    using (var session = BootConfLoader.LoadForTest(SystemApplicationType.TestRig, mb, TestSources.THIS_HOST))
                    {
                        var host = mb.CatalogReg.NavigateHost(WMED0003);

                        var conf = host.GetEffectiveAppConfig("AZGov");

                        Aver.IsFalse(conf.Navigate("/windows7/$build").Exists);
                    }
        }
예제 #6
0
        public void MI_Test()
        {
            using (var fs = new LocalFileSystem(null))
                using (var mb = new Metabank(fs, null, TestSources.RPATH))
                    using (var session = BootConfLoader.LoadForTest(SystemApplicationType.TestRig, mb, TestSources.THIS_HOST))
                    {
                        var host = mb.CatalogReg.NavigateHost(WMED0004);

                        var conf = host.GetEffectiveAppConfig("WebApp1");

                        Aver.AreEqual("value", conf.Navigate("/$var").Value);
                    }
        }
예제 #7
0
        static void run(string[] args)
        {
            using (var app = new ServiceBaseApplication(args, null))
            {
                var silent = app.CommandArgs["s", "silent"].Exists;
                if (!silent)
                {
                    ConsoleUtils.WriteMarkupContent(typeof(ProgramBody).GetText("Welcome.txt"));

                    ConsoleUtils.Info("Build information:");
                    Console.WriteLine(" NFX:     " + BuildInformation.ForFramework);
                    Console.WriteLine(" Agni: " + new BuildInformation(typeof(Agni.AgniSystem).Assembly));
                    Console.WriteLine(" Tool:    " + new BuildInformation(typeof(amm.ProgramBody).Assembly));
                }

                if (app.CommandArgs["?", "h", "help"].Exists)
                {
                    ConsoleUtils.WriteMarkupContent(typeof(ProgramBody).GetText("Help.txt"));
                    return;
                }


                var mbPath = app.CommandArgs
                             .AttrByIndex(0)
                             .ValueAsString(System.Environment.GetEnvironmentVariable(BootConfLoader.ENV_VAR_METABASE_FS_ROOT));

                if (!Directory.Exists(mbPath))
                {
                    throw new Exception("Specified metabase path not found");
                }

                var fromHost = app.CommandArgs["host", "from"].AttrByIndex(0).Value;
                if (fromHost.IsNullOrWhiteSpace())
                {
                    fromHost = System.Environment.GetEnvironmentVariable(BootConfLoader.ENV_VAR_HOST_NAME);
                }

                if (!silent)
                {
                    ConsoleUtils.Info("Metabase path: " + mbPath);
                    ConsoleUtils.Info("Host (this machine): " + fromHost);
                }

                var w = System.Diagnostics.Stopwatch.StartNew();

                using (var fs = new LocalFileSystem("amm"))
                    using (var mb = new Metabank(fs, new FileSystemSessionConnectParams(), mbPath))
                    {
                        using (BootConfLoader.LoadForTest(SystemApplicationType.Tool, mb, fromHost))
                        {
                            if (app.CommandArgs["gbm"].Exists)
                            {
                                generateManifests(mb, silent);
                            }
                            else
                            {
                                validate(mb, silent);
                            }
                        }
                    }

                if (!silent)
                {
                    Console.WriteLine();
                    ConsoleUtils.Info("Run time: " + w.Elapsed.ToString());
                }
            }//using APP
        }