Пример #1
0
        //----< loop to get message and execute the corresponding operation >-----------------

        private void testerLoop()
        {
            Console.Write("The test path is: {0}", pathToTestLibs_);
            while (true)
            {
                CommMessage msg = testerComm.getMessage();
                msg.show();
                if (msg.command == "test")
                {
                    string dirName = "TestLog" + (logCount++);
                    currentFileStorage = Path.Combine(fileStorage, dirName);
                    if (!Directory.Exists(currentFileStorage))
                    {
                        Directory.CreateDirectory(currentFileStorage);
                    }
                    logName         = dirName + ".txt";
                    msg.fileStorage = currentFileStorage;
                    msg.to          = msg.from;
                    msg.from        = localAddress;
                    msg.command     = "send dll";
                    testerComm.postMessage(msg);
                    checkDll();
                    postLog();
                    postReadyMsg(msg);
                }
                else if (msg.command == "close")
                {
                    Process pro = Process.GetCurrentProcess();
                    pro.Kill();
                }
            }
        }
Пример #2
0
        /*
         * This function is used to send messages.
         */
        private void postMessage(int to, string timestamp, string command, List <string> arguments, string content)
        {
            CommMessage comm = new CommMessage(CommMessage.MessageType.reply);

            comm.to      = "http://localhost:" + to + "/MessagePassingComm.Receiver";
            comm.from    = "http://localhost:" + port + "/MessagePassingComm.Receiver";
            comm.author  = "ChilBuilder : " + port;
            comm.command = command;
            foreach (string s in arguments)
            {
                comm.arguments.Add(s);
            }
            comm.timestamp = timestamp;
            comm.content   = content;
            channel.postMessage(comm);
        }
Пример #3
0
        //Recieve Messages using WCF
        void recieveMessages()
        {
            while (true)
            {
                CommMessage msg = c.rcvr.getMessage();
                msg.show();
                if (msg.type == CommMessage.MessageType.testRequest)
                {
                    string logName = "LogTestHarness" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".txt";
                    logfile     = testersLocation + "/" + logName;
                    this.logger = new Logger(logfile);

                    fileName.Clear();
                    testRequest = msg.body;

                    parse = new TestRequest();
                    parse = parseTestRequest();
                    foreach (string name in fileName)
                    {
                        CommMessage csndMsg2 = new CommMessage(CommMessage.MessageType.fileReq);
                        csndMsg2.command = "show";
                        csndMsg2.author  = "Jim Fawcett";
                        csndMsg2.to      = msg.from;
                        csndMsg2.from    = testAddr;
                        csndMsg2.body    = name + "|" + testersLocation;
                        c.postMessage(csndMsg2);
                        Console.WriteLine(name + " file receiving from Child Builder");
                        logger.log(name + " file receiving from Child Builder");
                    }
                    Thread.Sleep(2000);
                    runTestHarness(parse);
                    SendLog(logName);
                }
            }
        }
Пример #4
0
        /*----< Sets a message type to reply, adds required dll files as a list in message argument
         * and sends ia message to a particular child builder via MessagePassingComm service >----*/

        private void replyRequestedDllFilesToChildProc(List <string> dllFileName)
        {
            CommMessage csndMsg = new CommMessage(CommMessage.MessageType.reply);

            csndMsg.command   = "requestedDllFiles";
            csndMsg.author    = "Theerut Foongkiatcharoen";
            csndMsg.from      = "http://localhost:9050/IPluggableComm"; //testHarness
            csndMsg.to        = "http://localhost:" + _childPort + "/IPluggableComm";
            csndMsg.arguments = dllFileName;
            comm.postMessage(csndMsg);
            Console.BackgroundColor = ConsoleColor.Black;
            Console.ForegroundColor = ConsoleColor.Green;
            foreach (string dllFile in dllFileName)
            {
                Console.WriteLine("Replying a child builder address: {0} that Test Harness requires dllfiles: {1}", csndMsg.to, dllFile);
            }
            Console.ResetColor();
        }