Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            THarness th      = new THarness();
            Receiver receive = new ProcessPool.Receiver();

            receive.start("http://localhost", 8050);   //test harness receiver
            Console.Write("\n  TestHarness Server Started!");
            CommMessage rcvMsg;
            Boolean     flag = true;
            Sender      sndr = new Sender("http://localhost", 8068);

            while (true)
            {
                rcvMsg = receive.getMessage();
                if (rcvMsg.command == "StartTest" && flag == true)
                {
                    rcvMsg.show();
                    Thread.Sleep(5000);
                    th.loadAndExerciseTestes();
                    flag = false;
                }
                if (rcvMsg.command == "SendTestResult")
                {
                    rcvMsg.show();
                    th.sendTestResultToRepo(sndr);
                }
            }
        }
 static void Main(string[] args)
 {
     Console.Write("\n  Repository Server Started!");
     try
     {
         Repo repo = new Repo();
         repo.initializeDispatcher();
         ProcessPool.Receiver re = new ProcessPool.Receiver();
         re.start("http://localhost", 8068);                                       //start the receiver for repo
         ProcessPool.Sender sd = new ProcessPool.Sender("http://localhost", 8069); // start sender for repo
         while (true)
         {
             CM msg = re.getMessage();
             if (msg.type == CM.MessageType.closeReceiver)
             {
                 break;
             }
             if (msg.command == "SendRequest")
             {
                 msg.show();
                 continue;
             }
             if (msg.command == null)
             {
                 continue;
             }
             if (msg.command == "SendRequestToBuildServer")
             {
                 msg.show();
                 repo.sendCreateDirtoBuild(msg);
                 continue;
             }
             if (msg.command == "DirCreated")
             {
                 msg.show();
                 repo.sendRequesttoBuild(msg);
                 continue;
             }
             if (msg.command == "log")
             {
                 continue;
             }
             if (msg.command == "sendTestResultToRepo")
             {
                 msg.show();
                 continue;
             }
             CM reply = repo.messageDispatcher[msg.command](msg);
             reply.show();
             sd.postMessage(reply);
         }
     }
     catch (Exception ex)
     {
         Console.Write("\n exception thrown:\n{0}\n\n", ex.Message);
     }
 }
        //Thread pool deque message from child process and deal with the message
        private void rcvThreadProc()
        {
            Console.Write("\n  starting client's receive thread");
            while (true)
            {
                CM msg = rece.getMessage();
                msg.show();
                if (msg.command == null)
                {
                    continue;
                }

                // pass the Dispatcher's action value to the main thread for execution
                Dispatcher.Invoke(messageDispatcher[msg.command], new object[] { msg });
            }
        }