Beispiel #1
0
        // forming the test message and uploading files and sending test request
        private void start_test(object sender, RoutedEventArgs e)
        {
            if (testname != "" && fileList.Count > 0 && author != "")
            {
                cc.comm.sndr.channel = Sender.CreateServiceChannel("http://localhost:8082/StreamService");
                foreach (string file in fileList)
                {
                    //uploading files
                    cc.comm.sndr.uploadFile(System.IO.Path.GetFileName(file));
                }
                string to = Comm <Client2> .makeEndPoint("http://localhost", 8080);

                string from = Comm <Client2> .makeEndPoint("http://localhost", 8084);

                Message msg = cc.makeMessage(author, from, to);
                //forming test request
                msg.body = MessageTest.makeTestRequestUI(testname, testcode, testdriver);
                //sending request
                cc.comm.sndr.PostMessage(msg);
            }
            else
            {
                MessageBox.Show("enter author and testname");
                return;
            }
        }
Beispiel #2
0
        //----< run client demo >----------------------------------------

        static void Main(string[] args)
        {
            Console.Write("\n  Client ");
            Console.Write("\n =====================\n");

            Client client = new Client();

            Message msg = client.makeMessage("Karthik", client.endPoint, client.endPoint);

            msg      = client.makeMessage("Karthik", client.endPoint, client.endPoint);
            msg.body = MessageTest.makeTestRequest();
            string remoteEndPoint = Comm <Client> .makeEndPoint("http://localhost", 8088);

            msg    = msg.copy();
            msg.to = remoteEndPoint;
            string author = EncryptMessage(msg.author);
            string body   = EncryptMessage(msg.body);

            msg.body   = body;
            msg.author = author;
            client.comm.sndr.PostMessage(msg);
            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");
        }
        //----< run client demo >----------------------------------------

        static void Main(string[] args)
        {
            Console.Title = "Client 1 Console";
            Console.Write("\n  Testing Client Demo");
            Console.Write("\n =====================\n");
            Client clnt = new Client();

            clnt.comm.sndr.channel = Sender.CreateServiceChannel("http://localhost:8082/StreamService");
            HiResTimer hrt = new HiResTimer();

            hrt.Start();
            clnt.comm.sndr.uploadFile("TestDriver.dll");
            clnt.comm.sndr.uploadFile("TestedCode.dll");
            hrt.Stop();
            Console.WriteLine("\n**********************************************************************");
            Console.WriteLine("\nDemonstrating requirement 12 latency");
            Console.Write(
                "\n\n  total elapsed time for uploading = {0} microsec.\n",
                hrt.ElapsedMicroseconds
                );
            Message msg = clnt.makeMessage("Brahma", clnt.endPoint, clnt.endPoint);

            msg.type = "TestRequest";
            msg      = clnt.makeMessage("Brahma", clnt.endPoint, clnt.endPoint);
            msg.body = MessageTest.makeTestRequest();
            Console.WriteLine("\n**********************************************************************");
            Console.WriteLine("\n Demonstrating requirement 2 : XML messages");
            msg.showMsg();
            string remoteEndPoint = Comm <Client> .makeEndPoint("http://localhost", 8080);

            msg    = msg.copy();
            msg.to = remoteEndPoint;
            clnt.comm.sndr.PostMessage(msg);
            string repository = Comm <Client> .makeEndPoint("http://localhost", 8082);

            msg      = clnt.makeMessage("Brahma", clnt.endPoint, repository);
            msg.type = "testlogs";
            msg.body = "brahma";
            clnt.comm.sndr.PostMessage(msg);
            Console.Write("\n  press key to exit: ");
            Console.ReadKey();
            msg.body = "quit";
            clnt.comm.sndr.PostMessage(msg);
            msg.showMsg();
            Console.Write("\n\n  Press key to terminate client");
            Console.ReadKey();
            Console.Write("\n\n");
            clnt.wait();
            ((IChannel)clnt.comm.sndr).Close();
            Console.Write("\n\n");
        }