コード例 #1
0
        public void OrleansHostParseUsageArgWithOtherArgs()
        {
            WindowsServerHost prog = new WindowsServerHost();

            Assert.IsFalse(prog.ParseArguments(new string[] { "/?", "SiloName", "CfgFile.xml" }));
            Assert.IsFalse(prog.ParseArguments(new string[] { "SiloName", "CfgFile.xml", "/?" }));
        }
コード例 #2
0
        public void OrleansHostParseUsageArg()
        {
            WindowsServerHost prog = new WindowsServerHost();

            Assert.IsFalse(prog.ParseArguments(new string[] { "/?" }));
            Assert.IsFalse(prog.ParseArguments(new string[] { "-?" }));
            Assert.IsFalse(prog.ParseArguments(new string[] { "/help" }));
        }
コード例 #3
0
        public void OrleansHostParseSiloNameArg()
        {
            var expectedSiloName   = "MySilo";
            var expectedSiloType   = Silo.SiloType.Secondary;
            WindowsServerHost prog = new WindowsServerHost();

            Assert.IsTrue(prog.ParseArguments(new string[] { expectedSiloName }));
            Assert.AreEqual(expectedSiloType, prog.SiloHost.Type);
            Assert.AreEqual(expectedSiloName, prog.SiloHost.Name);
        }
コード例 #4
0
        public void OrleansHostParseDeploymentGroupArg()
        {
            var expectedSiloName     = this.hostname;
            var expectedDeploymentId = Guid.NewGuid().ToString("D");
            WindowsServerHost prog   = new WindowsServerHost();

            Assert.IsTrue(prog.ParseArguments(new string[] { "DeploymentGroup=" + expectedDeploymentId }));
            Assert.AreEqual(expectedSiloName, prog.SiloHost.Name);
            Assert.IsNull(prog.SiloHost.DeploymentId);
        }
コード例 #5
0
        public void OrleansHostParseNoArgs()
        {
            var expectedSiloName   = this.hostname;
            var expectedSiloType   = Silo.SiloType.Secondary;
            WindowsServerHost prog = new WindowsServerHost();

            Assert.True(prog.ParseArguments(new string[] { }));
            Assert.Equal(expectedSiloType, prog.SiloHost.Type);
            Assert.Equal(expectedSiloName, prog.SiloHost.Name);
        }
コード例 #6
0
        public void OrleansHostParsePrimarySiloNameArg()
        {
            var expectedSiloName   = "Primary";
            var expectedSiloType   = Silo.SiloType.Primary;
            WindowsServerHost prog = new WindowsServerHost();

            Assert.True(prog.ParseArguments(new string[] { expectedSiloName }));
            prog.Init();
            Assert.Equal(expectedSiloType, prog.SiloHost.Type);
            Assert.Equal(expectedSiloName, prog.SiloHost.Name);
        }
コード例 #7
0
        public void OrleansHostParseConfigFileArg()
        {
            var expectedSiloName       = "MySilo";
            var expectedSiloType       = Silo.SiloType.Secondary;
            var expectedConfigFileName = @"OrleansConfiguration.xml";
            WindowsServerHost prog     = new WindowsServerHost();

            Assert.True(prog.ParseArguments(new string[] { expectedSiloName, expectedConfigFileName }));
            Assert.Equal(expectedSiloType, prog.SiloHost.Type);
            Assert.Equal(expectedSiloName, prog.SiloHost.Name);
            Assert.Equal(expectedConfigFileName, prog.SiloHost.ConfigFileName);
        }
コード例 #8
0
        public void OrleansHostParseDeploymentGroupLastArgWins()
        {
            var expectedDeploymentId1 = Guid.NewGuid();
            var expectedDeploymentId2 = Guid.NewGuid();
            WindowsServerHost prog    = new WindowsServerHost();

            Assert.IsTrue(prog.ParseArguments(new string[] {
                "DeploymentId=" + expectedDeploymentId1,
                "DeploymentId=" + expectedDeploymentId2,
                "DeploymentGroup=" + expectedDeploymentId1,
                "DeploymentGroup=" + expectedDeploymentId2
            }));
            Assert.AreEqual(expectedDeploymentId2.ToString(), prog.SiloHost.DeploymentId);
        }
コード例 #9
0
        public void OrleansHostParseMultipleArgs()
        {
            var expectedSiloName       = "MySilo";
            var expectedConfigFileName = @"OrleansConfiguration.xml";
            var expectedDeploymentId   = Guid.NewGuid();
            WindowsServerHost prog     = new WindowsServerHost();

            Assert.IsTrue(prog.ParseArguments(new string[] {
                expectedSiloName,
                expectedConfigFileName,
                "DeploymentId=" + expectedDeploymentId
            }));
            Assert.AreEqual(expectedSiloName, prog.SiloHost.Name);
            Assert.AreEqual(expectedConfigFileName, prog.SiloHost.ConfigFileName);
            Assert.AreEqual(expectedDeploymentId.ToString(), prog.SiloHost.DeploymentId);
        }
コード例 #10
0
        public void OrleansHostParseBadArguments()
        {
            WindowsServerHost prog = new WindowsServerHost();

            Assert.IsFalse(prog.ParseArguments(new string[] { "/xyz" }));
            Assert.IsFalse(prog.ParseArguments(new string[] { "/xyz", "/abc" }));
            Assert.IsFalse(prog.ParseArguments(new string[] { "/xyz", "/abc", "/123" }));
            Assert.IsFalse(prog.ParseArguments(new string[] { "/xyz", "/abc", "/123", "/456" }));
            Assert.IsFalse(prog.ParseArguments(new string[] { "DeploymentId=" }));
            Assert.IsFalse(prog.ParseArguments(new string[] { "DeploymentGroup=" }));
        }
コード例 #11
0
ファイル: Program.cs プロジェクト: zhilianghuang/Fishing
    //-------------------------------------------------------------------------
    static void Main(string[] args)
    {
        Console.Title = "FishingCell";

        EsEngineSettings settings;

        settings.NodeType            = 3;
        settings.NodeTypeString      = "Cell";
        settings.ListenIp            = "";
        settings.ListenPort          = 0;
        settings.RootEntityType      = "EtRoot";
        settings.EnableCoSupersocket = false;
        settings.Log4NetConfigPath   = "../../../Media/Fishing/Config/FishingCell.log4net.config";

        EsEngine e = new EsEngine(ref settings, new EsEngineListener());

        var silo_host = new WindowsServerHost();

        int exit_code;

        try
        {
            if (!silo_host.ParseArguments(args))
            {
                silo_host.PrintUsage();
                exit_code = -1;
            }
            else
            {
                silo_host.Init();
                exit_code = silo_host.Run();
            }
        }
        catch (Exception ex)
        {
            EbLog.Error(string.Format("halting due to error - {0}", ex.ToString()));
            exit_code = 1;
        }
        finally
        {
            silo_host.Dispose();
            e.close();
        }

        Environment.Exit(exit_code);
    }
コード例 #12
0
        public void OrleansHostParseDeploymentGroupArgFormats()
        {
            var expectedDeploymentId = Guid.NewGuid().ToString("N");
            WindowsServerHost prog   = new WindowsServerHost();

            Assert.IsTrue(prog.ParseArguments(new string[] { "DeploymentId=" + expectedDeploymentId }));
            Assert.AreEqual(expectedDeploymentId, prog.SiloHost.DeploymentId);

            prog = new WindowsServerHost();
            expectedDeploymentId = Guid.NewGuid().ToString("D");
            Assert.IsTrue(prog.ParseArguments(new string[] { "DeploymentId=" + expectedDeploymentId }));
            Assert.AreEqual(expectedDeploymentId, prog.SiloHost.DeploymentId);

            prog = new WindowsServerHost();
            expectedDeploymentId = Guid.NewGuid().ToString("B");
            Assert.IsTrue(prog.ParseArguments(new string[] { "DeploymentId=" + expectedDeploymentId }));
            Assert.AreEqual(expectedDeploymentId, prog.SiloHost.DeploymentId);

            prog = new WindowsServerHost();
            expectedDeploymentId = Guid.NewGuid().ToString("P");
            Assert.IsTrue(prog.ParseArguments(new string[] { "DeploymentId=" + expectedDeploymentId }));
            Assert.AreEqual(expectedDeploymentId, prog.SiloHost.DeploymentId);

            prog = new WindowsServerHost();
            expectedDeploymentId = Guid.NewGuid().ToString("X");
            Assert.IsTrue(prog.ParseArguments(new string[] { "DeploymentId=" + expectedDeploymentId }));
            Assert.AreEqual(expectedDeploymentId, prog.SiloHost.DeploymentId);

            prog = new WindowsServerHost();
            expectedDeploymentId = Guid.NewGuid().ToString("");
            Assert.IsTrue(prog.ParseArguments(new string[] { "DeploymentId=" + expectedDeploymentId }));
            Assert.AreEqual(expectedDeploymentId, prog.SiloHost.DeploymentId);

            prog = new WindowsServerHost();
            expectedDeploymentId = Guid.NewGuid().ToString();
            Assert.IsTrue(prog.ParseArguments(new string[] { "DeploymentId=" + expectedDeploymentId }));
            Assert.AreEqual(expectedDeploymentId, prog.SiloHost.DeploymentId);
        }