Exemple #1
0
        void ThreadProc()
        {
            while (true)
            {
                Message msg = inQ_.deQ();
                // Quit message so exit the thread and close the service.
                if (msg.body == "quit")
                {
                    Close();
                    break;
                }
                Console.Write("\n Client Child Thread Dequeued a new message \n");
                hrt.Stop();
                ulong  time      = hrt.ElapsedMicroseconds;
                double millitime = time / 1000.0;
                string timetaken = "Total time to get the response in milli seconds is " + millitime.ToString() + " - Req 12";
                timetaken.title();
                if (msg.from.Contains("Test"))
                {
                    Console.WriteLine("\nDisplaying the results of Test Request\n");
                }
                else
                {
                    Console.WriteLine("\nDisplaying the results of Query Logs\n");
                }

                msg.show();
                if (msg.from.Contains("Repo"))
                {
                    "Demonstarted that all Requirements from 2-10 are met - Req #13".title();
                }
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Console.Write("\n  Testing Message Class");
            Console.Write("\n =======================\n");

            Message msg = new Message();

            msg.to     = "TH";
            msg.from   = "CL";
            msg.type   = "basic";
            msg.author = "Fawcett";
            msg.body   = "    a body";

            Console.Write("\n  base message:\n    {0}", msg.ToString());
            Console.WriteLine();

            msg.show();
            Console.WriteLine();

            Console.Write("\n  Testing Message.fromString(string)");
            Console.Write("\n ------------------------------------");
            Message parsed = msg.fromString(msg.ToString());

            parsed.show();
            Console.WriteLine();
        }
 public void PostMessage(Message msg)
 {
     "Remote channel posted a new message to client".title();
     "The message is".title();
     msg.show();
     ClientWPF.EnqueueMessagesToClient(msg);
 }
        static void Main(string[] args)
        {
            Console.Write("\n  Testing Message Class");
            Console.Write("\n =======================\n");

            Message msg = new Message();

            msg.to     = "http://localhost:8080/ICommunicator";
            msg.from   = "http://localhost:8081/ICommunicator";
            msg.to     = "TH";
            msg.from   = "CL";
            msg.author = "Manjunath";
            msg.type   = "TestRequest";

            Console.Write("\n  base message:\n    {0}", msg.ToString());
            msg.show();
            Console.WriteLine();

            Console.Write("\n  Testing testRequest");
            Console.Write("\n ---------------------");
            testElement te1 = new testElement("test1");

            te1.addDriver("td1.dll");
            te1.addCode("tc1.dll");
            te1.addCode("tc2.dll");
            testElement te2 = new testElement("test2");

            te2.addDriver("td2.dll");
            te2.addCode("tc3.dll");
            te2.addCode("tc4.dll");
            testRequest tr = new testRequest();

            tr.author = "Manjunath";
            tr.tests.Add(te1);
            tr.tests.Add(te2);
            msg.body = tr.ToString();
            Console.Write("\n  TestRequest:");
            msg.show();
            Console.WriteLine();
            Console.Write(msg.body.formatXml());

            Console.Write("\n  Testing Message.fromString(string)");
            Console.Write("\n ------------------------------------");
            Message parsed = msg.fromString(msg.ToString());

            parsed.show();
        }
Exemple #5
0
        static void Main(string[] args)
        {
            Console.Write("\n  Testing Message Class");
            Console.Write("\n =======================\n");

            Message msg = new Message();

            msg.to     = "TH";
            msg.from   = "CL";
            msg.author = "Yuchang Chen";

            Console.Write("\n  base message:\n    {0}", msg.ToString());
            msg.show();
            Console.WriteLine();

            Console.Write("\n  Testing testRequest");
            Console.Write("\n ---------------------");
            testElement te1 = new testElement("test1");

            te1.addDriver("td1.dll");
            te1.addCode("tc1.dll");
            te1.addCode("tc2.dll");
            testElement te2 = new testElement("test2");

            te2.addDriver("td2.dll");
            te2.addCode("tc3.dll");
            te2.addCode("tc4.dll");
            testRequest tr = new testRequest();

            tr.author = "Jim Fawcett";
            tr.tests.Add(te1);
            tr.tests.Add(te2);
            msg.body = tr.ToString();
            Console.Write("\n  TestRequest:");
            msg.show();
            Console.WriteLine();
            Console.Write(msg.body.formatXml());

            Console.Write("\n  Testing Message.fromString(string)");
            Console.Write("\n ------------------------------------");
            Message parsed = msg.fromString(msg.ToString());

            parsed.show();
        }
Exemple #6
0
        void ThreadProc()
        {
            while (true)
            {
                Message msg = inQ_.deQ();

                if (msg.body == "quit")
                {
                    Close();
                    break;
                }
                //   Console.Write("\n Repository received a new message \n");
                //   msg.show();
                if (msg.from.Contains("Client"))
                {
                    Message newm = new Message("");
                    newm.from = "http://localhost:8080/RepoIService";
                    newm.to   = msg.from;
                    string toPrint = "Received a client query to search for string " + msg.body + "returns logs with that string - Req#9";
                    toPrint.title();
                    List <string> result = queryLogs(msg.body);
                    foreach (string str in result)
                    {
                        newm.body += str + "\n";
                    }
                    IService Clientchannel = createSendChannel(msg.from);
                    if (Clientchannel != null)
                    {
                        "Sending query log to the client".title();
                        "Sending the below message".title();
                        Console.WriteLine("Message body is {0} ", newm.body);
                        Clientchannel.PostMessage(newm);
                    }
                    else
                    {
                        "Client channel is not created hence cannot send query log".title();
                    }
                }
                else if (msg.from.Contains("Test"))
                {
                    //   Console.WriteLine("Repository received a message from TestHarness");
                    msg.show();
                    if (getFiles(msg.from, msg.body) != true)
                    {
                        "Failed to process the code request from the TestHarness".title();
                    }
                }
            }
        }
Exemple #7
0
        void ThreadProc()
        {
            while (true)
            {
                Message msg = inQ_.deQ();

                "Child Thread dequeued a new request".title();
                msg.show();
                if (msg.body == "quit")
                {
                    Close();
                    break;
                }

                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, OnNewMessage, msg);
            }
        }
 void ThreadProc()
 {
     while (true)
     {
         Message msg = inQ_.deQ();
         if (msg.body == "quit")
         {
             Close();
             break;
         }
         Console.Write("\n Client received a new message \n");
         hrt.Stop();
         ulong  time      = hrt.ElapsedMicroseconds;
         double millitime = time / 1000.0;
         string timetaken = "Total time to get the response in milli seconds is " + millitime.ToString() + " - Req 12";
         timetaken.title();
         msg.show();
     }
 }
Exemple #9
0
        public void OnNewMessageHandler(Message msg)
        {
            "Inside Message Handler".title();
            msg.show();

            if (msg.from.Contains("Test"))
            {
                "Received a Message from TestHarness".title();
                textBoxResult.Text = msg.body;
            }

            if (msg.from.Contains("Repo"))
            {
                "Received a message from Repository".title();
                textBoxRepo.Text = msg.body;
                "Repo:The message is loaded into textbox".title();
                //  textBoxRepo.Text.title();
            }
        }
Exemple #10
0
        public void ThreadProc()
        {
            " Creating Child thread".title();
            while (true)
            {
                Message testRequest = inQ_.deQ();
                if (testRequest.body == "quit")
                {
                    inQ_.enQ(testRequest);
                    return;
                }

                "Test Harness Server Dequeued Test Request Message- Req#2".title();
                testRequest.show();
                "Each message has author name , test drivers, test libraries  in the form of DLL's to be tested - Req#2".title();

                /* Sleep for sometime before the client sends the code base
                 * to Repository so that Testharness wont return file load failed result */
                Thread.Sleep(5000);
                ITestResults testResults = runTests(testRequest);
                lock (sync_)
                {
                    // client_.sendResults(makeTestResultsMessage(testResults));
                    Message resultmsg = makeTestResultsMessage(testResults, testRequest.from);
                    resultmsg.show();
                    IService ClientChannel = createSendChannel(testRequest.from);
                    resultmsg.from = "http://localhost:8080/TestHarnessIService";
                    resultmsg.to   = testRequest.from;
                    if (ClientChannel != null)
                    {
                        "Sending the test results to the requested client - Req#7".title();
                        "Using WCF channel to post to the client Blocking Queue- Req#10".title();
                        ClientChannel.PostMessage(resultmsg);
                    }
                    else
                    {
                        "Test Harness failed to send the test results to the client".title();
                    }
                }
            }
        }
 public void PostMessage(Message msg)
 {
     "TestHarness received a new message:".title();
     msg.show();
     TestHarness.EnqueueMessagesToTestHarness(msg);
 }
 public void PostMessage(Message msg)
 {
     "Client received a new message:".title();
     msg.show();
     Client.EnqueueMessagesToClient(msg);
 }