//----< run client demo >---------------------------------------- static void Main(string[] args) { ServiceHost host1 = ClientTransfer.CreateAServiceChannel("http://localhost:8003/StreamService"); host1.Open(); Console.Write("\n Client sending selected test libraries to the Repository"); Console.Write("\n ==============================================================\n"); Console.ReadKey(); }
void rcvThreadProc() { while (true) { Message msg = comm.rcvr.GetMessage(); msg.time = DateTime.Now; Console.Write("\n {0} received message:", comm.name); msg.showMsg(); if (msg.body == "quit") { break; } else { string xml = msg.body; TestHarness test = new TestHarness(); Logger.Logger log = new Logger.Logger(); test.channel = TestHarness.CreateServiceChannel("http://localhost:8002/StreamService"); THTimer.HiResTimer hrt = new THTimer.HiResTimer(); hrt.Start(); string driverName = null; //test driver name List <string> codeName = new List <String>(); //List type for test code names string testCode; string testName; string author = msg.author; TestHarness filePath = new TestHarness(); string testPath = filePath.SavePath; TestRequest testRequest = xml.FromXml <TestRequest>(); Console.Write("\n Tests to be run in the test harness"); Console.Write("\n ==========================================\n"); foreach (var requests in testRequest.tests) { testName = requests.testName; Console.Write("\n Test Name: " + testName); driverName = requests.testDriver; Console.Write("\n Test Driver required: " + driverName); codeName = requests.testCodes; test.download(driverName); //test.download("driverName"); foreach (string cname in codeName) { testCode = cname; Console.Write("\n Test Code required: " + testCode); test.download(cname); } Console.Write("\n"); Console.Write("\n Required files received from the repository"); Console.Write("\n ==========================================\n"); log.setLogName(author + "_" + DateTime.Now.ToString("MMdd_hhss")); string logFileName = log.getLogName(); log.writeLog("*****************************************************************"); log.writeLog("In App Domain......"); AppDomain main = AppDomain.CurrentDomain; log.writeLog("\n Starting in AppDomain " + main.FriendlyName); AppDomainSetup domaininfo = new AppDomainSetup(); domaininfo.ApplicationBase = System.Environment.CurrentDirectory;//need to change path //Create evidence for the new AppDomain from evidence of current Evidence adevidence = AppDomain.CurrentDomain.Evidence; // Create Child AppDomain AppDomain ad = AppDomain.CreateDomain("ChildDomain", adevidence, domaininfo); ad.Load("ChildAppDomain"); log.writeLog("\n Child App Domain Created......"); //Console.Write("\n Child App Domain Created......"); ObjectHandle oh = ad.CreateInstance("ChildAppDomain", "ChildAppDomain.Loader"); object ob = oh.Unwrap(); // unwrap creates proxy to ChildDomain // using object in ChildDomain through IHello interface ChildAppDomain.Loader h = (ChildAppDomain.Loader)ob; h.run(testPath, driverName, codeName, logFileName); //h.run(testPath, driverName, codeName); AppDomain.Unload(ad); test.uploadFile(logFileName); hrt.Stop(); Console.Write("\n\n total elapsed time for uploading = {0} microsec.\n", hrt.ElapsedMicroseconds); ClientTransfer clnt = new ClientTransfer(); test.channel = TestHarness.CreateServiceChannel("http://localhost:8003/StreamService"); test.uploadFile(logFileName); Console.Write("\n\n total elapsed time for uploading = {0} microsec.\n", hrt.ElapsedMicroseconds); } } } }