Пример #1
0
		public void SetUp()
		{
			var compositeDatabaseConnection =
				MsSqlConfiguration.MsSql2008.ConnectionString(c => c.FromConnectionStringWithKey("test-db"));

			Container = new WindsorContainer();

			setAzureCredentials(Container);

			Fabric = new ConsoleFabric(Container);

			var composite = new BasicCompositeApp(Container)
				{
					Name = "Euclid.TestingSupport.HostingFabricFixture.Composite",
					Description = "A composite used in specification tests"
				};

			composite.RegisterNh(compositeDatabaseConnection, false);

			foreach (var agentAssembly in _agentAssemblies)
			{
				composite.AddAgent(agentAssembly);
			}

			composite.Configure(getCompositeSettings());

			Fabric.Initialize(getFabricSettings());

			Fabric.InstallComposite(composite);

			composite.CreateSchema(compositeDatabaseConnection, true);

			Fabric.Start();
		}
Пример #2
0
		public override void Run()
		{
			try
			{
				if (!RoleEnvironment.IsAvailable)
				{
					NConfigurator.UsingFile(@"~\Config\custom.config").SetAsSystemDefault();
					XmlConfigurator.Configure(
						new FileInfo(Path.Combine(Environment.CurrentDirectory, NConfigurator.Default.FileNames[0])));
					;
				}
				else
				{
					XmlConfigurator.Configure();
				}

				var databaseConfiguration =
					MsSqlConfiguration.MsSql2008.ConnectionString(c => c.FromConnectionStringWithKey("forum-db"));

				this.WriteInfoMessage("Starting agent console");

				var container = new WindsorContainer();

				setAzureCredentials(container);

				var fabric = new ConsoleFabric(container);

				var composite = new BasicCompositeApp(container)
					{ Name = "AgentConsole Composite", Description = "The composite app used by the agent console" };

				composite.AddAgent(typeof(PublishPost).Assembly);

				composite.AddAgent(typeof(LogEntry).Assembly);

				composite.Configure(getCompositeSettings());

				composite.RegisterNh(databaseConfiguration, false);

				this.WriteInfoMessage("Initializing fabric");

				fabric.Initialize(getFabricSettings());

				this.WriteInfoMessage("Installing composite: {0}", composite.Name);

				composite.CreateSchema(databaseConfiguration, false);

				fabric.InstallComposite(composite);

				fabric.Start();

				Thread.Sleep(Timeout.Infinite);
			}
			catch (Exception e)
			{
				this.WriteFatalMessage("WorkerRole failed and will recycle.", e);
			}

			this.WriteInfoMessage("Worker role is recycling.");
		}
Пример #3
0
		public static void Main(string[] args)
		{
			if (_instance == null)
			{
				_instance = new EntryPoint();
			}

			NConfigurator.UsingFile(@"Config\custom.config")
				.SetAsSystemDefault();

			var databaseConfiguration =
				MsSqlConfiguration.MsSql2008.ConnectionString(c => c.FromConnectionStringWithKey("forum-db"));

			try
			{
				XmlConfigurator.Configure(new FileInfo(Path.Combine(Environment.CurrentDirectory, NConfigurator.Default.FileNames[0])));

				_instance.WriteInfoMessage("Starting agent console");

				var container = new WindsorContainer();

				setAzureCredentials(container);

				var fabric = new ConsoleFabric(container);

				var composite = new BasicCompositeApp(container)
					{ Name = "AgentConsole Composite", Description = "The composite app used by the agent console" };

				composite.AddAgent(typeof(PublishPost).Assembly);

				composite.AddAgent(typeof(LogEntry).Assembly);

				composite.Configure(getCompositeSettings());

				composite.RegisterNh(databaseConfiguration, false);

				_instance.WriteInfoMessage("Initializing fabric");

				fabric.Initialize(getFabricSettings());

				_instance.WriteInfoMessage("Installing composite: {0}", composite.Name);

				composite.CreateSchema(databaseConfiguration, false);

				fabric.InstallComposite(composite);

				fabric.Start();

				Console.ReadLine();
			}
			catch (Exception e)
			{
				Console.WriteLine(e);
				Console.ReadLine();
			}
		}
Пример #4
0
// ReSharper disable InconsistentNaming
		private static void Main(string[] args)
// ReSharper restore InconsistentNaming
		{
			var log = new Program();
			try
			{
				NConfigurator.UsingFile(@"Config\custom.config").SetAsSystemDefault();

				XmlConfigurator.Configure(
					new FileInfo(Path.Combine(Environment.CurrentDirectory, NConfigurator.Default.FileNames[0])));

				var databaseConfiguration =
					MsSqlConfiguration.MsSql2008.ConnectionString(c => c.FromConnectionStringWithKey("test-db"));

				log.WriteInfoMessage("Starting agent console");

				var container = new WindsorContainer();

				setAzureCredentials(container, log);

				var fabric = new ConsoleFabric(container);

				var composite = new BasicCompositeApp(container)
				                	{Name = "AgentConsole Composite", Description = "The composite app used by the agent console"};

				composite.AddAgent(typeof (TestCommand).Assembly);

				composite.AddAgent(typeof (LogEntry).Assembly);

				composite.Configure(getCompositeSettings());

				composite.RegisterNh(databaseConfiguration, false);

				log.WriteInfoMessage("Initializing fabric");

				fabric.Initialize(getFabricSettings());

				log.WriteInfoMessage("Installing composite: {0}", composite.Name);

				composite.CreateSchema(databaseConfiguration, false);

				fabric.InstallComposite(composite);

				fabric.Start();

				Thread.Sleep(Timeout.Infinite);
			}
			catch (Exception e)
			{
				log.WriteFatalMessage("An exception occurred in the hosting fabric.", e);

				Console.WriteLine("Press any key to exit");
				Console.ReadKey();
			}
		}
Пример #5
0
		public void Configure(Assembly agentAssembly, bool recreateDb = true)
		{
			if (_configured)
			{
				return;
			}

			var compositeDatabaseConnection =
				MsSqlConfiguration.MsSql2008.ConnectionString(c => c.FromConnectionStringWithKey("test-db"));

			XmlConfigurator.Configure();

			setAzureCredentials(_container);

			Fabric = new ConsoleFabric(_container);

			var composite = new BasicCompositeApp(_container)
				{ Name = "Euclid.TestingSupport.ConfigureAgentSteps.Composite", Description = "A composite used for testing" };

			composite.AddAgent(agentAssembly);

			composite.Configure(getCompositeSettings());

			composite.RegisterNh(compositeDatabaseConnection, false);

			Fabric.Initialize(getFabricSettings());

			Fabric.InstallComposite(composite);

			Fabric.Start();

			_container.Register(Component.For<BasicFabric>().Instance(Fabric));

			composite.CreateSchema(compositeDatabaseConnection, recreateDb);

			_configured = true;
		}