コード例 #1
0
        private void RepoMsgProc()
        {
            Console.WriteLine("\nWaiting for message from repository");

            Message msgFromRepo = msgReciever.TryGetRepoMessage("Load");

            TestLoadStatus loadStatus = msgReciever.ParseLoadMsg(msgFromRepo);

            Console.WriteLine("");
            Console.WriteLine("\nRecieved message from repository.");
            Console.WriteLine("");
            Console.WriteLine(loadStatus.loadMessage);

            if (loadStatus.status)
            {
                Console.WriteLine("\nSending message to TH");
                clientUtil.SetupMessageToTH(msgToTH, "http://localhost:4244/ICommService/BasicHttp", "http://localhost:8284/ICommService/BasicHttp");
                msgSenderwithTH.channel.PostMessage(msgToTH);
            }
        }
コード例 #2
0
        public void THMsgProc()
        {
            while (true)
            {
                HiResTimer hrt = new HiResTimer();
                Message    msg = msgReciever.TryGetTHMessage();
                Console.WriteLine("\n<--------------------------------------------------------->");
                Console.WriteLine("\nMessage recieved from test harness.");
                if (msg.recipient == "AboutLog")
                {
                    Console.WriteLine("\nDemonstrating test logs and results:");
                    TestResults tr = msgReciever.ParseResultMsg(msg);
                    Console.WriteLine(tr.log);

                    Console.WriteLine("\nDemonstrating querying results from repository:");
                    Console.WriteLine("\nSending message to repository...");
                    SetupQueryMessageToRepo(tr, "http://localhost:4048/ICommService/BasicHttp",
                                            "http://localhost:8088/ICommService/BasicHttp", "Upload");

                    msgSenderwithRepo.channel.PostMessage(msgToRepoQuery);

                    Console.WriteLine("\nWaiting for message from repository...");
                    hrt.Start();
                    Message repoReply = msgReciever.TryGetRepoMessage("Query");
                    hrt.Stop();
                    Console.WriteLine("");
                    Console.WriteLine("\nRecieved message in {0} microsec.", hrt.ElapsedMicroseconds);
                    Console.WriteLine("");
                    TestLoadStatus loadStatus = msgReciever.ParseLoadMsg(repoReply);
                    Console.WriteLine(loadStatus.loadMessage);
                    if (loadStatus.status)
                    {
                        using (FileStream fs = new FileStream(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "..\\..\\..\\TestResults", tr.LogName + "Summary.txt"), FileMode.Open))
                            using (StreamReader sr = new StreamReader(fs))
                            {
                                Console.WriteLine(sr.ReadToEnd());
                            }
                    }
                }
                else
                {
                    Console.WriteLine("\nDemonstrating dll load status in test harness:");
                    Console.WriteLine(msgReciever.ParseLoadMsg(msg).loadMessage);
                }
            }
        }