public void TestThatQueueTimesOutCorrectly() { const int startPosition = 5; var client = new WebQMockClient(startPosition); var queue = new WebQueue(client, "test", TimeSpan.FromMilliseconds(10)); queue.WaitInQueue(TimeSpan.FromMilliseconds(1)); }
public void TestThatTimeOutAlertsGetsCalled() { const int startPosition = 5; var client = new WebQMockClient(startPosition); var queue = new WebQueue(client, "test", TimeSpan.FromMilliseconds(10)); queue.WebQueueTimeoutUpdate += (sender, args) => Assert.That(args.Message, Is.Not.Null.Or.Empty); queue.WaitInQueue(TimeSpan.FromMinutes(1)); }
public void TestThatQueueReturnsImmidiatlyWhenAddedToEmptyQueue() { const int startPosition = 0; var client = new WebQMockClient(startPosition); var queue = new WebQueue(client, "test", TimeSpan.FromMilliseconds(10)); queue.WebQueuePositionUpdate += (sender, args) => Assert.That(args.Item.Position, Is.EqualTo(0)); queue.WaitInQueue(TimeSpan.FromMilliseconds(1)); }
public void TestThatQueueIsCorrectlyProcessed() { const int startPosition = 5; var currentPosition = startPosition; var client = new WebQMockClient(startPosition); var queue = new WebQueue(client, "test", TimeSpan.FromMilliseconds(10)); queue.WebQueuePositionUpdate += (sender, args) => Assert.That(currentPosition--, Is.EqualTo(args.Item.Position)); queue.WaitInQueue(TimeSpan.FromMinutes(1)); }
static void Main(string[] args) { var exitCode = 0; WebQueue webQ = null; try { new LogConfigLoader().Load(); Logger.TraceLevel = TraceLevel.Info; var optionHandler = new CommandLineOptionHandler(args); if (optionHandler.Params.InstallWebQ) { throw new NotImplementedException(); } else { PrintCopyrightMessage(); Logger.LogSectionStart("ConDep"); if (!string.IsNullOrWhiteSpace(optionHandler.Params.WebQAddress)) { webQ = new WebQueue(optionHandler.Params.WebQAddress, optionHandler.Params.Environment); webQ.WebQueuePositionUpdate += (sender, eventArgs) => Logger.Info(eventArgs.Message); webQ.WebQueueTimeoutUpdate += (sender, eventArgs) => Logger.Info(eventArgs.Message); Logger.LogSectionStart("Waiting in Deployment Queue"); try { webQ.WaitInQueue(TimeSpan.FromMinutes(30)); } finally { Logger.LogSectionEnd("Waiting in Deployment Queue"); } } var configAssemblyLoader = new ConDepAssemblyHandler(optionHandler.Params.AssemblyName); var assembly = configAssemblyLoader.GetAssembly(); var conDepOptions = new ConDepOptions(optionHandler.Params.DeployAllApps, optionHandler.Params.Application, optionHandler.Params.DeployOnly, optionHandler.Params.WebDeployExist, optionHandler.Params.StopAfterMarkedServer, optionHandler.Params.ContinueAfterMarkedServer, assembly); var envSettings = ConfigHandler.GetEnvConfig(optionHandler.Params.Environment, optionHandler.Params.BypassLB, assembly); var status = new WebDeploymentStatus(); ConDepConfigurationExecutor.ExecuteFromAssembly(assembly, envSettings, conDepOptions, status); if (status.HasErrors) { exitCode = 1; } else { status.EndTime = DateTime.Now; status.PrintSummary(); } } } catch (Exception ex) { exitCode = 1; Logger.Error("ConDep reported a fatal error:"); Logger.Error("Message: " + ex.Message); Logger.Verbose("Stack trace:\n" + ex.StackTrace); } finally { if(webQ != null) { webQ.LeaveQueue(); } Logger.LogSectionEnd("ConDep"); Environment.Exit(exitCode); } }