static void Main(string[] args) { try { TestExecutive currentProgram = new TestExecutive(); MessageServer msgReciever = new MessageServer(); FileServer fileServer = new FileServer(); Console.WriteLine("\n(Main thread)Constructing host to download/upload files"); fileServer.CreateFileServiceHost("http://localhost:4140/ICommService/BasicHttp"); fileServer.open(); Console.WriteLine("\n(Main thread)Constructing host to communicate with client and repository"); msgReciever.CreateMessageServiceHost("http://localhost:8180/ICommService/BasicHttp"); msgReciever.open(); while (true) { Console.WriteLine("\n(Main thread)Recieveing message from client..."); Message msg = msgReciever.TryGetMessage("Client", string.Empty); Console.WriteLine("\n(Main thread)Recieved message from client."); Thread childTH = new Thread(() => { currentProgram.CLMsgProc(msg, msgReciever); }); childTH.Start(); } } catch (Exception except) { Console.Write("\n {0}\n\n", except.Message); } /////////////////////////////////////////////////////////////////////////////////////////// }
/* * fetches the xml test requests from ../../../XMLTestRequests * and puts them in the queue,Invokes TestExecutive and passes the queue object. * It also creates an instance of logger class for the test requests, which logs the * execution details of the test harness to a file in ../../../Logs/TestHarnessLogs/ folder * */ public void readTestRequests() { try { m_objFileManager = new FileManager(); //lists all the xml files in the path, all the test request files are stored string[] testRequests = m_objFileManager.listFiles(m_testRequestFPath, "xml"); if (testRequests != null) { if (testRequests.Length > 0) { BlockingQueue <XDocument> objBlockingQueue = new BlockingQueue <XDocument>(); XDocument testRquestDoc = null; Console.WriteLine("Queuing XML Test Requests"); m_objLoggerTH.log("Queuing XML Test Requests"); //iterates over all test request files for (int i = 0; i < testRequests.Length; i++) { System.IO.FileStream xmlFile = new System.IO.FileStream(testRequests[i], System.IO.FileMode.Open); testRquestDoc = new XDocument(); testRquestDoc = XDocument.Load(xmlFile); // queues each xml test request file objBlockingQueue.enQ(testRquestDoc); string[] testRequestFName = testRequests[i].Split(new char[] { '\\' }); Console.WriteLine("Queued Test Request {0}", testRequestFName[1]); m_objLoggerTH.log("Queued Test Request " + testRequestFName[1]); xmlFile.Close(); } m_objTestExecutive = new TestExecutive(); //invokes test executive , passes the reference to the queue if (testRequests.Length > 0) { m_objTestExecutive.BeginTestHarness(objBlockingQueue, testRequests, m_objLoggerTH); } } else { Console.WriteLine("No test Requests found"); m_objLoggerTH.log("No test Requests found"); return; } } } catch (Exception ex) { Console.WriteLine("Caught exception in client, Check Log file {0}", m_objLoggerTH.fileName); m_objLoggerTH.log("Caught exception in client, Exception : " + ex); } }
static void Main(string[] args) { TestExecutive objTestExecutive = new TestExecutive(); Logger objLoggerTestDriver = new Logger(); Logger THDriver = new Logger("../../../Logs/TestHarnessLogs/TestHarnessLog_" + DateTime.Now.ToString().Replace("/", "-").Replace(":", "-") + ".txt"); string[] testRequests = { "TestRequest.xml" }; objTestExecutive.getLog("filename", objLoggerTestDriver); BlockingQueue <XDocument> objBlockingQueue = new BlockingQueue <XDocument>(); System.IO.FileStream xmlFile = new System.IO.FileStream("../../../XMLTestRequests/TestRequest", System.IO.FileMode.Open); XDocument testRquestDoc = new XDocument(); testRquestDoc = XDocument.Load(xmlFile); // queues each xml test request file objBlockingQueue.enQ(testRquestDoc); objTestExecutive.BeginTestHarness(objBlockingQueue, testRequests, THDriver); }