static void Main(string[] args) { var host = ConfigurationManager.AppSettings["host"]; var port = Convert.ToUInt16(ConfigurationManager.AppSettings["port"]); var wsConf = new WilmaServiceConfig(host, port); var ws = new WilmaService(wsConf, new Logger()); ws.GetVersionInformationAsync().ContinueWith(res => { Console.WriteLine(res.Result); }); ws.GetActualLoadInformationAsync().ContinueWith(res => { Console.WriteLine(res.Result); }); ws.GetMessageLoggingStatusAsync().ContinueWith(res => { Console.WriteLine(res.Result); }); ws.SetMessageLoggingStatusAsync(WilmaService.MessageLoggingControlStatus.On).ContinueWith(res => { if (res.Result) { ws.GetMessageLoggingStatusAsync().ContinueWith(res1 => { Console.WriteLine(res1.Result); }); } }); ws.SetOperationModeAsync(WilmaService.OperationModes.WILMA).ContinueWith(res1 => { ws.GetOperationModeAsync().ContinueWith(res => { Console.WriteLine(res.Result); }); }); ws.SetLocalhostBlockingStatusAsync(WilmaService.LocalhostControlStatuses.On).ContinueWith(res1 => { ws.GetLocalhostBlockingStatusAsync().ContinueWith(res => { Console.WriteLine(res.Result); }); }); ws.GetStubConfigInformationAsync().ContinueWith(res => { Console.WriteLine(res.Result); }); ws.ChangeStubConfigStatusAsync("EPAMNEWS", WilmaService.StubConfigStatus.Enabled).ContinueWith(res => { Console.WriteLine(res.Result); }); ws.ChangeStubConfigOrderAsync("EPAMNEWS", WilmaService.StubConfigOrder.Up).ContinueWith(res => { Console.WriteLine(res.Result); }); ws.DropStubConfigAsync("EPAMNEWS").ContinueWith(res => { Console.WriteLine(res.Result); }); ws.PersistActualStubConfigAsync().ContinueWith(res => { Console.WriteLine(res.Result); }); Upload(@"trial", ws.UploadConditionCheckerAsync).ContinueWith(res => { Console.WriteLine(res.Result); }); Upload(@"trial", ws.UploadTemplateAsync).ContinueWith(res => { Console.WriteLine(res.Result); }); Upload(@"trial", ws.UploadTemplateFormatterAsync).ContinueWith(res => { Console.WriteLine(res.Result); }); Upload(@"trial", ws.UploadStubConfigurationAsync).ContinueWith(res => { Console.WriteLine(res.Result); }); // ws.ShutdownApplicationAsync().ContinueWith(res => { Console.WriteLine("Wilma shuted down: {0}", res.Result);}); Console.ReadLine(); }
private WilmaService PrepareWilmaPost(string strContent) { var res = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(strContent) }; var messageHandler = new FakeHttpMessageHandler(res); var client = new HttpClient(messageHandler); var ws = new WilmaService(new WilmaServiceConfig("proba", 1), new LoggerImpl(), client); return ws; }