protected override void OnStart(string[] ignored)
 {
     host = new RemoteAppDomainHost(asm, cfg);
     if (string.IsNullOrEmpty(hostType) == false)
         host.SetHostType(hostType);
     host.Start();
 }
示例#2
0
        protected override void OnStart(string[] ignored)
        {
            try
            {
                if (string.IsNullOrEmpty(bootStrapper) == false)
                {
                    var assembly = LoadAssembly();
                    var bootStrapperType = LoadBootStrapperType(assembly);
                    host = new RemoteAppDomainHost(bootStrapperType);
                    host.Configuration(cfg);
                }
                else
                {
                    host = new RemoteAppDomainHost(asm, cfg);
                }

                if (string.IsNullOrEmpty(hostType) == false)
                {
                    host.SetHostType(hostType);
                }

                host.Start();
            }
            catch (Exception x)
            {
                Log.Fatal("Hosted service failed to start", x);
                throw;
            }
        }
示例#3
0
        public void InitialDeployment(string user)
        {
            var tmpHost = new RemoteAppDomainHost(asm, cfg);

            tmpHost.InitialDeployment(user);
            tmpHost.Close();
        }
示例#4
0
        protected override void OnStart(string[] ignored)
        {
            try
            {
                if (string.IsNullOrEmpty(bootStrapper) == false)
                {
                    var assembly         = LoadAssembly();
                    var bootStrapperType = LoadBootStrapperType(assembly);
                    host = new RemoteAppDomainHost(bootStrapperType);
                    host.Configuration(cfg);
                }
                else
                {
                    host = new RemoteAppDomainHost(asm, cfg);
                }

                if (string.IsNullOrEmpty(hostType) == false)
                {
                    host.SetHostType(hostType);
                }

                host.Start();
            }
            catch (Exception x)
            {
                Log.Fatal("Hosted service failed to start", x);
                throw;
            }
        }
示例#5
0
        static void Main(string[] args)
        {
            var host = new RemoteAppDomainHost(typeof(AlexandriaBootStrapper));

            host.Start();

            Console.WriteLine("Starting to process messages");
            Console.ReadLine();
        }
示例#6
0
 protected override void OnStart(string[] ignored)
 {
     host = new RemoteAppDomainHost(asm, cfg);
     if (string.IsNullOrEmpty(hostType) == false)
     {
         host.SetHostType(hostType);
     }
     host.Start();
 }
        public BaseTesterTests()
        {
            XmlConfigurator.Configure();
            stubBrokerHost = new DefaultHost();
            stubBrokerHost.UseStandaloneCastleConfigurationFileName(@".\..\..\Tester\BrokerEndpoint.config");
            stubBrokerHost.Start <TestBootstrapper>();
            bus = stubBrokerHost.Container.Resolve <IServiceBus>();

            testerHost = new RemoteAppDomainHost(typeof(TesterBootstrapper));
            testerHost.Start();
        }
示例#8
0
        public void Can_by_coffee_from_starbucks()
        {
            PrepareQueues.Prepare("msmq://localhost/starbucks.barista.balancer", QueueType.LoadBalancer);
            PrepareQueues.Prepare("msmq://localhost/starbucks.barista", QueueType.Standard);
            PrepareQueues.Prepare("msmq://localhost/starbucks.cashier", QueueType.Standard);
            PrepareQueues.Prepare("msmq://localhost/starbucks.customer", QueueType.Standard);

            var baristaLoadBalancer = new RemoteAppDomainLoadBalancerHost(typeof(RemoteAppDomainHost).Assembly, "LoadBalancer.config");

            baristaLoadBalancer.Start();

            Console.WriteLine("Barista load balancer has started");

            var cashier = new RemoteAppDomainHost(typeof(CashierBootStrapper))
                          .Configuration("Cashier.config");

            cashier.Start();

            Console.WriteLine("Cashier has started");

            var barista = new RemoteAppDomainHost(typeof(BaristaBootStrapper))
                          .Configuration("Barista.config");

            barista.Start();

            Console.WriteLine("Barista has started");

            var customerHost = new DefaultHost();

            customerHost.Start <CustomerBootStrapper>();

            var bus = customerHost.Container.Resolve <IServiceBus>();

            var userInterface = new MockCustomerUserInterface();
            var customer      = new CustomerController(bus)
            {
                CustomerUserInterface = userInterface,
                Drink = "Hot Chocolate",
                Name  = "Ayende",
                Size  = DrinkSize.Venti
            };

            customer.BuyDrinkSync();

            cashier.Close();
            barista.Close();

            Assert.Equal("Ayende", userInterface.CoffeeRushName);
        }
        public IntegrationTest()
        {
            PrepareQueues.Prepare("msmq://localhost/starbucks.barista.balancer", QueueType.LoadBalancer);
            PrepareQueues.Prepare("msmq://localhost/starbucks.barista.balancer.acceptingwork", QueueType.LoadBalancer);
            PrepareQueues.Prepare("msmq://localhost/starbucks.barista", QueueType.Standard);
            PrepareQueues.Prepare("msmq://localhost/starbucks.cashier", QueueType.Standard);
            PrepareQueues.Prepare("msmq://localhost/starbucks.customer", QueueType.Standard);

            baristaLoadBalancer = new RemoteAppDomainHost(typeof(SpringLoadBalancerBootStrapper).Assembly, "BaristaLoadBalancer.config");
            cashier             = new RemoteAppDomainHost(typeof(CashierBootStrapper))
                                  .Configuration("Cashier.config");
            barista = new RemoteAppDomainHost(typeof(BaristaBootStrapper))
                      .Configuration("Barista.config");
            customerHost = new DefaultHost();
        }
示例#10
0
        public static void Main()
        {
            PrepareQueues.Prepare("msmq://localhost/starbucks.barista.balancer", QueueType.LoadBalancer);
            PrepareQueues.Prepare("msmq://localhost/starbucks.barista.balancer.acceptingwork", QueueType.Raw);
            PrepareQueues.Prepare("msmq://localhost/starbucks.barista", QueueType.Standard);
            PrepareQueues.Prepare("msmq://localhost/starbucks.cashier", QueueType.Standard);
            PrepareQueues.Prepare("msmq://localhost/starbucks.customer", QueueType.Standard);

            var baristaLoadBalancer = new RemoteAppDomainHost(typeof(CastleBootStrapper).Assembly, "BaristaLoadBalancer.config");

            baristaLoadBalancer.Start();

            Console.WriteLine("Barista load balancer has started");

            var cashier = new RemoteAppDomainHost(typeof(CashierBootStrapper))
                          .Configuration("Cashier.config");

            cashier.Start();

            Console.WriteLine("Cashier has started");

            var barista = new RemoteAppDomainHost(typeof(BaristaBootStrapper))
                          .Configuration("Barista.config");

            barista.Start();

            Console.WriteLine("Barista has started");

            var customerHost = new DefaultHost();

            customerHost.BusConfiguration(c => c.Bus("msmq://localhost/starbucks.customer")
                                          .Receive("Starbucks.Messages.Cashier", "msmq://localhost/starbucks.cashier")
                                          .Receive("Starbucks.Messages.Barista", "msmq://localhost/starbucks.barista.balancer"));
            customerHost.Start <CustomerBootStrapper>();

            var bus = (IServiceBus)customerHost.Bus;

            var customer = new CustomerController(bus)
            {
                Drink = "Hot Chocolate",
                Name  = "Ayende",
                Size  = DrinkSize.Venti
            };

            customer.BuyDrinkSync();

            Console.ReadLine();
        }
示例#11
0
        static void Main(string[] args)
        {
            QueueUtil.PrepareQueue("cashier");
            QueueUtil.PrepareQueue("barista");
            QueueUtil.PrepareQueue("customer");

            var cashier = new RemoteAppDomainHost(typeof(CashierBootStrapper))
                          .Configuration("Cashier.config");

            cashier.Start();

            Console.WriteLine("Cashier has started");

            var barista = new RemoteAppDomainHost(typeof(BaristaBootStrapper))
                          .Configuration("Barista.config");

            barista.Start();

            Console.WriteLine("Barista has started");

            var customerHost = new DefaultHost();

            customerHost.BusConfiguration(c =>
            {
                c.Bus("rhino.queues://localhost:53000/LearningRhinoESB_E8_Customer", "customer");
                c.Receive("Messages.Cashier", "rhino.queues://localhost:52000/LearningRhinoESB_E8_Cashier");
                c.Receive("Messages.Barista", "rhino.queues://localhost:51000/LearningRhinoESB_E8_Barista");
                return(c);
            });

            customerHost.Start <CustomerBootStrapper>();

            var bus = customerHost.Bus as IServiceBus;

            var customer = new CustomerController(bus)
            {
                Drink = "Hot Chocolate",
                Name  = "Ayende",
                Size  = DrinkSize.Venti
            };

            customer.BuyDrinkSync();

            Console.ReadLine();
        }
示例#12
0
        private static void Main()
        {
            String appConfig    = Assembly.GetEntryAssembly().Location + ".config";
            var    bootstrapper = new Bootstrapper(appConfig);

            var host = new RemoteAppDomainHost(bootstrapper.GetType());

            host.Start();

            Microsoft.Isam.Esent.Interop.SystemParameters.CacheSizeMax = 512;

            Console.WriteLine("{0} is {1}running with server GC.",
                              Assembly.GetEntryAssembly().GetName().Name,
                              GCSettings.IsServerGC == true ? String.Empty : "not ");

            Console.ReadKey(true);

            host.Close();
        }
示例#13
0
        protected override void OnStart(string[] ignored)
        {
            if (string.IsNullOrEmpty(bootStrapper) == false)
            {
                var assembly = LoadAssembly();
                var bootStrapperType = LoadBootStrapperType(assembly);
                host = new RemoteAppDomainHost(bootStrapperType);
                host.Configuration(cfg);
            }
            else
            {
                host = new RemoteAppDomainHost(asm, cfg);
            }

            if (string.IsNullOrEmpty(hostType) == false)
            {
                host.SetHostType(hostType);
            }

            host.Start();
        }
示例#14
0
        static void Main(string[] args)
        {
            PrepareQueues.Prepare("msmq://localhost/LearningRhinoESB.E7.Barista", QueueType.Standard);
            PrepareQueues.Prepare("msmq://localhost/LearningRhinoESB.E7.Cashier", QueueType.Standard);
            PrepareQueues.Prepare("msmq://localhost/LearningRhinoESB.E7.Customer", QueueType.Standard);

            var cashier = new RemoteAppDomainHost(typeof(CashierBootStrapper))
                          .Configuration("Cashier.config");

            cashier.Start();

            Console.WriteLine("Cashier has started");

            var barista = new RemoteAppDomainHost(typeof(BaristaBootStrapper))
                          .Configuration("Barista.config");

            barista.Start();

            Console.WriteLine("Barista has started");

            var customerHost = new DefaultHost();

            customerHost.BusConfiguration(c => c.Bus("msmq://localhost/LearningRhinoESB.E7.Customer")
                                          .Receive("Messages.Cashier", "msmq://localhost/LearningRhinoESB.E7.Cashier")
                                          .Receive("Messages.Barista", "msmq://localhost/LearningRhinoESB.E7.Barista"));
            customerHost.Start <CustomerBootStrapper>();

            var bus = customerHost.Bus as IServiceBus;

            var customer = new CustomerController(bus)
            {
                Drink = "Hot Chocolate",
                Name  = "Ayende",
                Size  = DrinkSize.Venti
            };

            customer.BuyDrinkSync();

            Console.ReadLine();
        }
示例#15
0
        protected override void OnStart(string[] ignored)
        {
            RemoteAppDomainHost remoteAppDomainHost;

            if (string.IsNullOrEmpty(bootStrapper) == false)
            {
                var assembly         = LoadAssembly();
                var bootStrapperType = LoadBootStrapperType(assembly);
                remoteAppDomainHost = new RemoteAppDomainHost(bootStrapperType);
                remoteAppDomainHost.Configuration(cfg);
            }
            else
            {
                remoteAppDomainHost = new RemoteAppDomainHost(asm, cfg);
            }

            if (string.IsNullOrEmpty(hostType) == false)
            {
                remoteAppDomainHost.SetHostType(hostType);
            }

            remoteAppDomainHost.Start();
        }
 protected override void OnStart(string[] ignored)
 {
     host = new RemoteAppDomainHost(args[0]);
     host.Start();
 }
示例#17
0
 public void InitialDeployment(string user)
 {
     var tmpHost = new RemoteAppDomainHost(asm, cfg);
     tmpHost.InitialDeployment(user);
     tmpHost.Close();
 }
        public void prepare_contest_submit_solution_save_result()
        {
            var realProblemDirectory = @".\..\..\Tester\TestPrograms\RealProblem";

            var zip  = File.ReadAllBytes(Path.Combine(realProblemDirectory, "tests2.zip"));
            var user = new User {
                DisplayName = "User"
            };
            var contest = new Contest {
                Beginning = new DateTime(1990, 7, 7), Ending = new DateTime(1990, 7, 7), Type = "Icpc"
            };
            var problem = new Problem
            {
                Contest = contest,
                Limits  = new ResourceUsage
                {
                    MemoryInBytes      = int.MaxValue,
                    TimeInMilliseconds = 100500
                },
                TestInfo = new TestInfo
                {
                    Checker = new ProgramSource
                    {
                        LanguageId = "MSVC90Testlib",
                        Code       = File.ReadAllText(Path.Combine(realProblemDirectory, "check.cpp"))
                    }
                }
            };

            var submission = new Submission
            {
                Author  = user,
                Problem = problem,
                Source  = new ProgramSource
                {
                    Code       = File.ReadAllText(Path.Combine(realProblemDirectory, "tree_ai.cpp")),
                    LanguageId = "MSVC90"
                },
                SubmittedAt = contest.Beginning
            };

            var brokerHost = new RemoteAppDomainHost(typeof(BrokerBootstrapper));

            brokerHost.SetHostType(typeof(TestHost));
            brokerHost.Start();

            var testerHost = new RemoteAppDomainHost(typeof(TesterBootstrapper));

            testerHost.SetHostType(typeof(TestHost));
            testerHost.Start();

            var webHost = new TestHost(@".\..\..\Integration\WebEndpoint.config");

            webHost.Start <TestWebBootstrapper>();

            var bus = webHost.Container.Resolve <IServiceBus>();

            using (var factory = new TestDatabaseConfiguration().DatabaseConfiguration.BuildSessionFactory())
            {
                using (var scope = new SessionScope(factory))
                {
                    var session = scope.Session;
                    session.Save(user);
                    session.Save(contest);
                    session.Save(problem);
                    session.Save(submission);
                }

                bus.Send(new UnpackTestInfo {
                    ProblemId = problem.Id, ZipArchive = zip
                });
                bus.Send(new JudgeSubmission {
                    SubmissionId = submission.Id
                });

                Thread.Sleep(100000);

                using (var scope = new SessionScope(factory))
                {
                    submission = scope.Session.Get <Submission>(submission.Id);
                    Assert.Equal(SubmissionTestingStatus.Finished, submission.TestingStatus);
                    Assert.NotNull(submission.Result);
                    Assert.Contains("Accepted", submission.Result.Verdict);
                }
            }
        }