Created
June 15, 2013 11:08
-
-
Save yemrekeskin/5787772 to your computer and use it in GitHub Desktop.
test automation for web service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Scheduler | |
| { | |
| public Scheduler() { } | |
| public void Scheduler_Start() | |
| { | |
| TimerCallback callbackMinute = new TimerCallback(Jobs.WebServiceCheckJob); | |
| Timer minuteTimer = new Timer(callbackMinute, null, TimeSpan.Zero, TimeSpan.FromSeconds(10.0)); | |
| } | |
| } | |
| public class Jobs | |
| { | |
| public Jobs() { } | |
| public static void WebServiceCheckJob(object state) | |
| { | |
| //In here,our is doing just operational jobs :D | |
| // generally service list retrives from configuration tables | |
| List<String> services = new List<string> | |
| { | |
| "http://localhost:58216/BatchService.asmx", | |
| "http://localhost:58216/CoreService.asmx", | |
| "http://localhost:58216/Customer.asmx", | |
| "http://localhost:58216/DomesticService.asmx", | |
| "http://localhost:58216/ForeignService.asmx", | |
| "http://localhost:58216/ReportService.asmx", | |
| "http://localhost:58216/UtilService.asmx" | |
| }; | |
| foreach (var item in services) | |
| { | |
| if (item.isWebServiceRunning()) | |
| { | |
| LoggerService.Log.Info(item + " > Avilable"); | |
| } | |
| else | |
| { | |
| LoggerService.Log.Fatal(item + " > Fail"); | |
| } | |
| } | |
| } | |
| } | |
| public static class LoggerService | |
| { | |
| public static log4net.ILog Log | |
| { | |
| get | |
| { | |
| return log4net.LogManager | |
| .GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | |
| } | |
| } | |
| public static void Setup(HttpContext context) | |
| { | |
| string path = context.Server.MapPath("log4net.config"); | |
| if (File.Exists(path)) | |
| { | |
| log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(path)); | |
| } | |
| } | |
| } | |
| // Note: For instructions on enabling IIS6 or IIS7 classic mode, | |
| // visit http://go.microsoft.com/?LinkId=9394801 | |
| public class MvcApplication : System.Web.HttpApplication | |
| { | |
| protected void Application_Start() | |
| { | |
| log4net.Config.XmlConfigurator.Configure(); | |
| Scheduler scd = new Scheduler(); | |
| scd.Scheduler_Start(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment