Exemple #1
0
        //----< run client demo >----------------------------------------

        static void Main(string[] args)
        {
            Console.WriteLine("/////////////////////////////////////////////////////////////////");
            Console.WriteLine("            CSE681 - Software Modeling & Analysis                ");
            Console.WriteLine("               Project 4 - Remote Test Harness                   ");
            Console.WriteLine("          Yadav Narayana Murthy - SUID: 990783888                ");
            Console.WriteLine("//////////////////////////////////////////////////////////////////\n");

            Console.Title = "Client 2";
            Console.Write("\n  Client 2");
            Console.Write("\n =========\n");
            Console.Write(" REQ 1 - Shall be implemented in C# using the facilities of the .Net Framework Class Library and Visual Studio 2015");

            Console.Write("\n REQ 10 - Creating a WCF channel");
            Client client = new Client();

            Console.WriteLine(" \n File stream service starting:");
            Console.Write("=================================\n");
            Console.Write(" REQ 2 - Each test driver and the code it will be testing is implemented as a dynamic link library (DLL) and" +
                          " sent by the client to the Repository server before sending the Test Request to the Test Harness.\n");

            client.channel = CreateServiceChannel("http://localhost:8000/StreamService");
            HRTimer.HiResTimer hrt = new HRTimer.HiResTimer();

            // sending the DLLs to Repository
            Console.Write("\n REQ 6 - File Transfer using streams");
            hrt.Start();
            client.uploadFile("TestDriver2.dll");
            client.uploadFile("TestedCode2.dll");
            hrt.Stop();
            Console.Write(
                "\n\n  total elapsed time for uploading = {0} microsec.\n",
                hrt.ElapsedMicroseconds
                );

            // sending the Test Request to Test Harness
            Console.Write(" REQ 2 -  Sending Test Request to Test Harness");
            Message msg            = client.makeMessage("John", client.endPoint, client.endPoint);
            string  remoteEndPoint = Comm <Client> .makeEndPoint("http://localhost", 8080);

            msg    = msg.copy();
            msg.to = remoteEndPoint;
            client.comm.sndr.PostMessage(msg);


            // sending the query message to Repository
            string repoEndPoint = Comm <Client> .makeEndPoint("http://localhost", 8095);

            Message repoQuery = client.makeRepoMessage("John", "Client2", client.endPoint, repoEndPoint, "John");

            client.comm.sndr.PostMessage(repoQuery);

            Console.Write("\n  press key to exit: ");
            Console.ReadKey();
            msg.to   = client.endPoint;
            msg.body = "quit";
            client.comm.sndr.PostMessage(msg);
            client.wait();
            Console.Write("\n\n");
        }
Exemple #2
0
        static void Main(string[] args)
        {
            try
            {
                Console.Write("\n  Demonstrating TestHarness - Project #2 with Threading");
                Console.Write("\n =======================================================");

                TestExec te  = new TestExec();
                Message  msg = te.buildTestMessage();
                Console.Write("\nCreated message: \n {0}", msg.ToString());
                te.sendTestRequest(msg);
                te.sendTestRequest(msg);
                msg      = msg.copy();
                msg.body = "quit";
                te.sendTestRequest(msg);
                te.testHarness.processMessages();
                te.testHarness.wait();
                te.client.makeQuery("test1");
                Console.Write("\n\n");
            }
            catch (Exception ex)
            {
                Console.Write("\n\n  {0}\n\n", ex.Message);
            }
        }
        //----< make TestResults Message >-------------------------------
        /// <summary>
        /// generate TestResults Message from received message and results returned
        /// </summary>
        Message makeLogMessage(Message origin)
        {
            Message trMsg = origin.copy();

            trMsg.to   = repUrl;
            trMsg.type = "SendLog";
            return(trMsg);
        }
Exemple #4
0
        static void Main()
        {
            //Test Functions in Message
            Message Test = getMsg();

            Console.Write(Test.ToString());
            Message Test2 = Test.copy(Test);

            Console.Write(Test2.ToString());
        }