// Constructor public Receiver() { if (rcvQ == null) { rcvQ = new SWTools.BlockingQueue <CommMessage>(); } }
public BRHandler() { if (BRQ == null) { BRQ = new SWTools.BlockingQueue <CommMessage>(); } }
// Overloaded contructor to take one argument (Used by child builders) public Sender(string baseAddress) { fromAddress = baseAddress + "/IMessagePassingComm"; sndQ = new SWTools.BlockingQueue <CommMessage>(); sndThread = new Thread(threadProc); sndThread.Start(); }
public void loadTest(SWTools.BlockingQueue <TestData> p, TestLogger.TestLogger log)//dequeue test in the test queue, and write log to the txt file { bool show = true; TestData testData; while (p.size() != 0) { testData = p.deQ(); if (show == true) { Console.WriteLine("Processing Test Authoried by" + testData.author); } show = false; //this is just for demo use, which means it will be removed in test 4. if (testData.testName != "END") { log.writeLine("Test Name = " + testData.testName); log.writeLine("Test Author = " + testData.author); log.writeLine("Test Time = " + testData.timeStamp); bool summary = true; exec(testData, log, summary); } else { string filename = testData.author + "_" + testData.datetime + ".txt"; filename = log.getFolder() + filename; log.writeToFile(filename); //Console.WriteLine("---------------this is demo for requirement 7-------------\r\n" + "the key is the log file name and the file name is" + filename); //Console.WriteLine("---------------this is demo for requirement 6-------------\r\n writing to file:\r\n" + filename); //Console.WriteLine("\r\n getting log from logger" + log.getLog()); } } }
public ChildBuilderHandler() { if (ChildQ == null) { ChildQ = new SWTools.BlockingQueue <CommMessage>(); } }
//Constructor public MotherBuilder() { if (readyQ == null) { readyQ = new SWTools.BlockingQueue <Message>(); } if (testRequestQ == null) { testRequestQ = new SWTools.BlockingQueue <Message>(); } comm.rcvr.CreateRecvChannel(endPoint); //this thread constantly checks that are there any pending build requests and any ready // child process to which mother builder can assign next pending build request Thread t = new Thread(() => { while (true) { if (readyQ.size() != 0 && testRequestQ.size() != 0) { Message ready = readyQ.deQ(); Message testr = testRequestQ.deQ(); testr.to = ready.from; testr.from = endPoint; comm.sndr.PostMessage(testr); Console.Write("\n Sending message from {0} to {1}", comm.name, testr.to); testr.showMsg(); } } }); t.Start(); rcvThread = comm.rcvr.start(rcvThreadProc); }
/*----< constructor >------------------------------------------*/ public Receiver() { ClientEnvironment.verbose = true; if (rcvQ == null) { rcvQ = new SWTools.BlockingQueue <CommMessage>(); } }
void processMessages(SWTools.BlockingQueue <TestData> p, SWTools.BlockingQueue <System.IO.FileStream> q) //getMessage and decode message from Queue, return metadata of the test //p includes test, q include xmlstream. //we need to transfer p to TestLoader { System.IO.FileStream current = q.deQ(); XmlDecoder decoder = new XmlDecoder(); decoder.parse(current, p); }
/*----< constructor >------------------------------------------*/ public Sender(string baseAddress, int listenPort) { ClientEnvironment.verbose = true; port = listenPort; fromAddress = baseAddress + listenPort.ToString() + "/IPluggableComm"; sndQ = new SWTools.BlockingQueue <CommMessage>(); TestUtilities.putLine(string.Format("starting Sender on thread {0}", Thread.CurrentThread.ManagedThreadId)); sndThread = new Thread(threadProc); sndThread.Start(); }
public bool execuate(SWTools.BlockingQueue <System.IO.FileStream> q, string LogFolder)//execute the test { TestLogger.TestLogger log = new TestLogger.TestLogger(); try { SWTools.BlockingQueue <TestData> p = new SWTools.BlockingQueue <TestData>(); TestLoader.TestLoader loader = new TestLoader.TestLoader(); //every testrequest should have its own log log.clear(); log.setFolder(LogFolder); processMessages(p, q); loader.loadTest(p, log); return(true); } catch (Exception ex) { log = new TestLogger.TestLogger(); log.writeLine(ex.Message); log.writeLine("error time" + DateTime.Now); return(false); } }