public bool test() { Client2 clientTest = new Client2(false); string Clistr = "http://localhost:8080/ClientTestIService"; string Thstr = "http://localhost:8080/TestHarnessIService"; string Repostr = "http://localhost:8080/RepoIService"; clientTest.CreateClientRecvChannel(Clistr); // Assuming the Repository has the code to be tested clientTest.sendTestRequest(clientTest.buildTestMessage(Clistr, Thstr)); // Give sufficient time for execution before making the Query Thread.Sleep(10000); clientTest.makeQuery("test1", Clistr, Repostr); while (true) { Message msg = clientTest.getMessage(); if (msg.body == "quit") { clientTest.Close(); clientLog.Append(msg.ToString()); break; } clientLog.Append(msg.ToString()); } return(true); }
static void Main(string[] args) { Console.Title = "ConcurrentClient2Demo"; "Starting the Execution of Client Main".title(); "Implemented in C# using .Net Framework and Visual Studio 2015 - Req#1".title(); try { Client2 myClient2 = new Client2(true); string clistr = "http://localhost:8080/Client2IService"; string Repostr = "http://localhost:8080/RepoIService"; string Thstr = "http://localhost:8080/TestHarnessIService"; myClient2.CreateClientRecvChannel(clistr); Thread.Sleep(5000); /* Send all the code to be tested to the Repository */ string filepath = Path.GetFullPath(myClient2.ToSendPath); "Client is sending the Repository server before sending the Test Request to the Test Harness- Req#6".title(); Console.WriteLine("Retrieving files from {0}\n", filepath); string[] files = Directory.GetFiles(filepath); foreach (string file in files) { string filename = Path.GetFileName(file); Console.WriteLine("file retrieved is {0} \n", filename); myClient2.uploadFile(filename, Repostr); } // this sleep ensures that the code to be tested files // are sent to the Repository before the Testharness starts // copying them to local directory. Removal of this sleep // might result in testharness unable to load the dll files // and return the result message as file not loaded. Thread.Sleep(10000); Message msg = myClient2.buildTestMessage(clistr, Thstr); "Sending the test Request from concurrent client 2 to TestHarness - Req#4,6".title(); hrt.Start(); myClient2.sendTestRequest(msg); /* Wait for the TestHarness to complete the execution before * sending the query to the repository. This sleep ensures that * TestHarness completes the execution before the client executes * Query logs. Removal of this sleep might result in repository * returning empty message as it has not yet stored logs. */ Thread.Sleep(20000); hrt.Start(); myClient2.makeQuery("test1", clistr, Repostr); } catch (Exception ex) { Console.Write("\n\n {0}\n\n", ex.Message); } Console.ReadLine(); }
public void PostMessage(Message msg) { "Client received a new message:".title(); msg.show(); Client2.EnqueueMessagesToClient(msg); }