Exemplo n.º 1
0
        void rcvThreadProc()
        {
            while (true)
            {
                Message msg = comm.rcvr.GetMessage();
                Console.WriteLine("\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
                Console.Write("\n  {0} received the following message from {1}:\n", comm.name, msg.from);
                Console.WriteLine("\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
                msg.time = DateTime.Now;
                Console.WriteLine("\n\n Requirement:  Shall implement a Test Harness Server that accepts one or more Test Requests,"
                                  + "each in the form of a message" + ",  with XML body that specifies the test developer's identity "
                                  + "and the names of a set of one or more test libraries to be tested. Each test driver and the code it will be" +
                                  " testing is implemented as a dynamic link library (DLL)");

                msg.showMsg();

                if (threadpool < maxthreads - 1)
                {
                    testQueue.enQ(msg);
                    Console.WriteLine("\nxxxxxxxxxxxxxxxxxxxx Size of common blocking queue: {0}xxxxxxxxxxxxxxxxxxxxx", testQueue.size());
                    threadpool++;
                    utlitity = performTask(msg);
                    threadpool--;
                }
                else
                {
                    utlitity = performTask(msg);
                    threadpool--;
                }
            }
        }
Exemplo n.º 2
0
        public Message performTask(Message msg)
        {
            Task <Message> t = new Task <Message>(() => startTesting(testQueue));

            Console.WriteLine("\n    Status of child thread:{0}", t.Status);
            t.Start();
            t.Wait();
            Message result = t.Result;

            result.from   = endPoint;
            result.author = "Kunal";
            result.type   = "RESULTS";
            result.to     = msg.from;
            Console.Write("\n  {0} is adding following message to the send-queue:\n", comm.name);
            result.showMsg();
            comm.sndr.PostMessage(result);

            string[] allFiles = Directory.GetFiles(Path.GetFullPath(@"..\\..\\..\\TServer\\ToSend"));
            requiredDLLs = new List <string>();
            Console.WriteLine("\nRequirement:At the end of test execution the Test Harness shall store the test results and logs in the Repository" +
                              "and send test results to the requesting client. It then shall unload the child AppDomain responsible for that testing.");
            foreach (string file in allFiles)
            {
                string name = Path.GetFileName(file);
                uploadFile(name, ToSendPath, SavePath);
            }

            Console.WriteLine("\nCHECKING TO SEE IF THERE ARE ANY REMAINING MESSAGES IN RECEIVE QUEUE");
            if (testQueue.size() == 0)
            {
                Console.WriteLine("\nNO MORE REQUESTS AT THIS TIME, WAITING FOR MORE..................");
            }

            return(msg);
        }