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" }));
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            RuntimeVersion.ProgamIdent();

            var prog = new WindowsServerHost();
            
            int exitCode;
            try
            {
                if (!prog.ParseArguments(args))
                {
                    prog.PrintUsage();
                    exitCode = -1;
                }
                else
                {
                    if (prog.Debug)
                        DumpCommandLineArgs(args);
                    
                    prog.Init();
                    exitCode = prog.Run();
                }
            }
            catch (Exception exc)
            {
                ConsoleText.WriteError(string.Format("{0} halting due to error - {1}", RuntimeVersion.ProgramName, exc.ToString()));
                exitCode = 1;
            }
            finally
            {
                prog.Dispose();
            }

            Environment.Exit(exitCode);
        }
 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);
 }
 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);
 }
 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=" }));
 }
 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);
 }
Beispiel #7
0
        static void Main(string[] args)
        {
            RuntimeVersion.ProgamIdent();

            var prog = new WindowsServerHost();

            int exitCode;

            try
            {
                if (!prog.ParseArguments(args))
                {
                    prog.PrintUsage();
                    exitCode = -1;
                }
                else
                {
                    if (prog.Debug)
                    {
                        DumpCommandLineArgs(args);
                    }

                    prog.Init();
                    exitCode = prog.Run();
                }
            }
            catch (Exception exc)
            {
                ConsoleText.WriteError(string.Format("{0} halting due to error - {1}", RuntimeVersion.ProgramName, exc.ToString()));
                exitCode = 1;
            }
            finally
            {
                prog.Dispose();
            }

            Environment.Exit(exitCode);
        }
 public void OrleansHostParseDeploymentIdArg()
 {
     var expectedSiloName = this.hostname;
     var expectedDeploymentId = Guid.NewGuid().ToString("D");
     WindowsServerHost prog = new WindowsServerHost();
     Assert.IsTrue(prog.ParseArguments(new string[] { "DeploymentId=" + expectedDeploymentId }));
     Assert.AreEqual(expectedSiloName, prog.SiloHost.Name);
     Assert.AreEqual(expectedDeploymentId, prog.SiloHost.DeploymentId);
 }
 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", "/?" }));
 }
 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);
 }
 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);
 }
        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);
        }
Beispiel #13
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);
 }