//<child thread starts listening>// static void listen_child_thread() { Console.WriteLine(); Console.WriteLine("**************************************************************"); Console.WriteLine("************Child :{0} Listening*******************", proc_num); Console.WriteLine("**************************************************************"); if (comm != null) { while (true) { CommMessage rcv_msg = new CommMessage(CommMessage.MessageType.request); rcv_msg = comm.getMessage(); if (rcv_msg.port_number != 0 && rcv_msg.port_number == 8091 && rcv_msg.msg_body.Contains("to_child")) { Console.WriteLine(); Console.WriteLine("*******************************************************************************"); Console.WriteLine(" ********Child:{0} At Port Number: {1} Received Message From Mother Builder****", proc_num, str_port); Console.WriteLine("*********************************************************************************"); rcv_msg.show(); Build_Server bs = new Build_Server(); bool flag = bs.receive_string_from_client(rcv_msg.msg_body.Replace("to_child", ""), proc_num, out string child_folder_path); //build the files in each child process CommMessage send_msg = new CommMessage(CommMessage.MessageType.request); send_msg.command = "from child:" + proc_num; send_msg.author = "Salim Zhulkhrni"; send_msg.to = "http://localhost:8091/IPluggableComm"; send_msg.from = "http://localhost:" + str_port + "/IMessagePassingComm"; send_msg.msg_body = "childreply" + System.IO.Path.GetFullPath(child_folder_path); send_msg.port_number = str_port; comm.postMessage(send_msg); // child process sends message back to mother builder to indicate its availablity Console.WriteLine(); Console.WriteLine("*******************************************************************************"); Console.WriteLine("***************Child: {0} Is Ready For Next Request****************************", proc_num); Console.WriteLine("*******************************************************************************"); // to_test_harness if (flag == true) { CommMessage send_test_msg = new CommMessage(CommMessage.MessageType.request); send_test_msg.command = "from child:" + proc_num; send_test_msg.author = "Salim Zhulkhrni"; send_test_msg.to = "http://localhost:8010/IPluggableComm"; send_test_msg.from = "http://localhost:" + str_port + "/IMessagePassingComm"; send_test_msg.msg_body = "test" + System.IO.Path.GetFullPath(child_folder_path); send_test_msg.port_number = str_port; comm.postMessage(send_test_msg); // child process sends message to test harness with the folder path Console.WriteLine(); Console.WriteLine("*******************************************************************************"); Console.WriteLine("***************Child: {0} Has Requested For Testing****************************", proc_num); Console.WriteLine("*******************************************************************************"); } } } } }
public void call_client() { TestElement te1 = new TestElement(); te1.testName = "test1"; te1.addDriver("td1.cs"); te1.addCode("tc1.cs"); te1.addCode("tc2.cs"); //te1.addCode("tc3.cs"); TestElement te2 = new TestElement(); te2.testName = "test2"; te2.addDriver("td2.cs"); te2.addCode("tc3.cs"); te2.addCode("tc4.cs"); TestElement te3 = new TestElement(); te3.testName = "test3"; te3.addDriver("td3.cs"); te3.addCode("tc5.cs"); te3.addCode("tc6.cs"); //te1.addCode("tc3.cs"); TestElement te4 = new TestElement(); te4.testName = "test4"; te4.addDriver("td4.cs"); te4.addCode("tc7.cs"); te4.addCode("tc8.cs"); TestElement te5 = new TestElement(); te5.testName = "test5"; te5.addDriver("td5.cs"); te5.addCode("tc9.cs"); te5.addCode("tc10.cs"); TestRequest tr = new TestRequest(); tr.author = "Salim Zhulkhrni"; tr.tests.Add(te1); tr.tests.Add(te2); tr.tests.Add(te3); tr.tests.Add(te4); tr.tests.Add(te5); // creating test request // string trXml = tr.ToXml(); Console.WriteLine("************************************************"); Console.WriteLine("-----------------Test Request------------------"); Console.WriteLine("************************************************"); Console.Write(trXml); Console.WriteLine(); //sending files to the repository // RepoMock rm = new RepoMock(); rm.send_files_to_mock_repo(); Console.WriteLine(); Console.WriteLine("*********************************************************************"); Console.WriteLine("-----------------Sending Test Request to Repository------------------"); Console.WriteLine("*********************************************************************"); string repo_path = @"..\..\..\MockRepo\RepoStorage\Files\XMLDocument.xml"; File.WriteAllText(repo_path, trXml); Build_Server.Build_Server bs = new Build_Server.Build_Server(); //bs.receive_string_from_client(trXml); }