static void Main() { Console.Write(" ================================================================================================\n"); Console.Write("\n REPOSITORY WINDOW\n"); Console.Write("\n ================================================================================================\n"); Console.Write("\n Sending DLL files from Repository to Test Harness Server"); Console.Write("\n ==========================================\n"); Clientx clnt = new Clientx(); clnt.channel = CreateServiceChannel("http://localhost:8082/StreamService"); HRTimer.HiResTimer hrt = new HRTimer.HiResTimer(); hrt.Start(); clnt.uploadFile("DivideTest.dll"); clnt.uploadFile("TestCode2.dll"); clnt.uploadFile("TestCode3.dll"); clnt.uploadFile("TestCode4.dll"); clnt.uploadFile("TestDriver1.dll"); clnt.uploadFile("TestDriver2.dll"); clnt.uploadFile("TestDriver3.dll"); clnt.uploadFile("TestDriver4.dll"); hrt.Stop(); Console.Write("\n\n total elapsed time for uploading = {0} microsec.\n", hrt.ElapsedMicroseconds); Console.Write(" ================================================================================================\n"); Console.Write("\n\n Logs Stored in Repository:------->Requirement #7\n"); clnt.download("logfile.txt"); Console.Write("\n Total elapsed time for downloading = {0}", hrt.ElapsedMicroseconds); Console.Write("\n\n Press key to terminate Repository"); Console.ReadKey(); Console.Write("\n\n"); ((IChannel)clnt.channel).Close(); }
private void RunButtonClicked(object sender, RoutedEventArgs e) { ClientTransfer clnt = new ClientTransfer(); clnt.channel = ClientTransfer.CreateServiceChannel("http://localhost:8001/StreamService"); HRTimer.HiResTimer hrt = new HRTimer.HiResTimer(); hrt.Start(); clnt.uploadFile(testDriver); clnt.uploadFile(testCode); hrt.Stop(); Message msg = client.makeMessage("Karthik", client.endPoint, client.endPoint); //make a test request msg.body = TestMessages.makeTestRequest(testDriver, testCode); string remoteEndPoint = Comm <Client> .makeEndPoint("http://localhost", 8082); msg = msg.copy(); msg.to = remoteEndPoint; client.comm.sndr.PostMessage(msg); btnDriver.IsEnabled = false; btnCode.IsEnabled = false; btnRun.IsEnabled = false; btnLog.IsEnabled = true; client.comm.rcvr.CloseChannel(client.endPoint); MessageBox.Show("Required files sent to the Repository"); MessageBox.Show("Test Completed!"); }
/* * Service method to allow user to upload a file */ public static string uploadFile(FileTransferMessage msg) { Console.Write("UPLOAD FILE"); HRTimer.HiResTimer hrt = new HRTimer.HiResTimer(); hrt.Start(); //savePath += "\\" + msg.username; string uploadPath = ""; int count = -1; if (msg.uploadAsDirectory) { System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(savePath + "\\" + msg.username); count = dir.GetDirectories().Length + 1; uploadPath = savePath + "\\" + msg.username + "\\" + count.ToString(); } else { uploadPath = savePath + "\\" + msg.username; } string filename = msg.filename; string rfilename = Path.Combine(uploadPath, filename); if (!Directory.Exists(uploadPath)) { Directory.CreateDirectory(uploadPath); } using (var outputStream = new FileStream(rfilename, FileMode.Create)) { while (true) { int bytesRead = msg.transferStream.Read(block, 0, BlockSize); if (bytesRead > 0) { outputStream.Write(block, 0, bytesRead); } else { break; } } } hrt.Stop(); string xmlName = addToFileMetaData(msg.username, filename, count); Console.Write("\n Received file \"{0}\"", filename); //can upload one one file at once string[] files = new string[2]; string correctPath = "../../FileStorage/" + msg.username; if (msg.uploadAsDirectory) { correctPath += "/" + count; } files[0] = correctPath; files[1] = filename; calculateMaintainibility(files, xmlName); return("File successfully uploaded."); }
void rcvThreadProc() { while (true) { HRTimer.HiResTimer hrt = new HRTimer.HiResTimer(); Message msg = comm.rcvr.GetMessage(); hrt.Start(); msg.time = DateTime.Now; Console.Write("\n {0} received message:\n", comm.name); msg.ShowMsg(); if (msg.body == "quit") { break; } switch (msg.type) { case "testrequest": Task.Run(() => RunTestThrdProc(msg)); break; default: break; } hrt.Stop(); Console.Write( "\n Complete \"{0}\"'s test request in Thread_ID: {1} in {2} microsec.", msg.author, Thread.CurrentThread.ManagedThreadId, hrt.ElapsedMicroseconds); } }
//----< 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"); }
public TestHarnessHost() { //----------------------------------------------- For creating file stream receive end point block = new byte[BlockSize]; hrt = new HRTimer.HiResTimer(); //----------------------------------------------- For creating file stream receive end point END }
public void upLoadFile(FileTransferMessage msg) //uploadfiles { HRTimer.HiResTimer hrt = new HRTimer.HiResTimer(); hrt.Start(); filename = msg.filename; string rfilename = Path.Combine(savePath, filename); if (!Directory.Exists(savePath)) { Directory.CreateDirectory(savePath); } using (var outputStream = new FileStream(rfilename, FileMode.Create)) { while (true) { int bytesRead = msg.transferStream.Read(block, 0, BlockSize); if (bytesRead > 0) { outputStream.Write(block, 0, bytesRead); } else { break; } } } hrt.Stop(); Console.Write("\n Received file \"{0}\"", filename); }
//----< initialize receiver >------------------------------------ public Client() { comm.rcvr.CreateRecvChannel(endPoint); rcvThread = comm.rcvr.start(rcvThreadProc); block = new byte[BlockSize]; hrt = new HRTimer.HiResTimer(); }
static void Main(string[] args) { HiResTimer hrt = new HRTimer.HiResTimer(); hrt.Start(); Thread.Sleep(5000); hrt.Stop(); Console.WriteLine("time used in microsec {0}", hrt.ElapsedMicroseconds); }
public TestHarness() { Console.Title = "TestHarness: " + endPoint; Console.Write("\n creating instance of TestHarness"); receivePath_ = System.IO.Path.GetFullPath(receivePath_); cb_ = new Callback(); hrt = new HRTimer.HiResTimer(); comm.rcvr.CreateRecvChannel(endPoint); rcvThread = comm.rcvr.start(rcvThreadProc); }
public TestHarness(IRepository repo) { Console.Write("\n creating instance of TestHarness"); repo_ = repo; repoPath_ = System.IO.Path.GetFullPath(repoPath_); cb_ = new Callback(); block = new byte[BlockSize]; hrt = new HRTimer.HiResTimer(); }
public void callUploader(HashSet <string> files, string toSend) { HRTimer.HiResTimer hrtLocal = new HRTimer.HiResTimer(); hrtLocal.Start(); foreach (var file in files) { uploadFile(file, toSend); } hrtLocal.Stop(); Console.Write("\n\n total elapsed time for uploading = {0} microsec.\n", hrtLocal.ElapsedMicroseconds); Console.Write("\n\n"); }
public void MainWindow_Loaded(object sender, RoutedEventArgs e) { timer = new HRTimer.HiResTimer(); timer.Start(); button1.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); gtefiles.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); Createxmlbutton.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); button.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); Logresults.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); Console.Write("\n\nTOTAL TIME TAKEN : " + timer.ElapsedMicroseconds); }
// call the uploader function to upload files public void callUploader(string toSend) { HRTimer.HiResTimer hrtLocal = new HRTimer.HiResTimer(); hrtLocal.Start(); foreach (string files in Directory.GetFiles(toSend)) { uploadFile(Path.GetFileName(files), toSend); } hrtLocal.Stop(); Console.Write("\n\n total elapsed time for uploading = {0} microsec.\n", hrtLocal.ElapsedMicroseconds); Console.Write("\n\n"); }
public MainWindow() { InitializeComponent(); this.Show(); timer = new HRTimer.HiResTimer(); timer.Start(); button1.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); gtefiles.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); Createxmlbutton.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); button.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); Logresults.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); // Dispatcher.BeginInvoke(button.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent))); }
static void Main() { HRTimer.HiResTimer hrt = new HRTimer.HiResTimer(); hrt.Start(); Client client = new Client(); CommChannelDemo.Message msg = client.makeMessage("Sahil Shah", client.endPoint, client.endPoint); CommChannelDemo.Message msg1 = client.makeMessage("Rishi Dabre", client.endPoint, client.endPoint); string remoteEndPoint = Comm <Client> .makeEndPoint("http://localhost", 8080); msg.body = MessageTest.makeTestRequest(); msg.to = remoteEndPoint; msg1.body = MessageTest.makeAnotherTestRequest(); msg1.to = remoteEndPoint; client.comm.sndr.PostMessage(msg); client.comm.sndr.PostMessage(msg1); Console.Write("\n"); Console.Write("\n"); Console.Write(" ================================================================================================\n"); Console.Write("\n CLIENT WINDOW\n"); Console.Write("\n ================================================================================================\n"); Console.Write("\n\n Client Sending Files to Repository for the test request---------------->Requirement #2"); Console.Write("\n =======================================================\n"); Client1 clnt = new Client1(); clnt.channel = CreateServiceChannel("http://*****:*****@"../../../Service/DLL/logfile.txt"); System.Console.WriteLine("{0}", text); hrt.Stop(); Console.Write("\n\n total elapsed time for Entire Execution = {0} micro seconds------>Requirement #12.\n", hrt.ElapsedMicroseconds); ((IChannel)clnt.channel).Close(); }
// this test request contains message body public List <string> manager(Queue <KeyValuePair <string, string> > TestRequest, string path_Dll) { AppDomain main = AppDomain.CurrentDomain; ("[[ \"" + main.FriendlyName + "\" ]] ====>>>> APPLICATION DOMAIN created").title('='); (" [[ Displaying Requirement 4 ---->>> Application Domain Created ]]").title('='); CreateChild c1 = new CreateChild(); // creating child for every Test Request. string childName = "child "; HRTimer.HiResTimer testTimer = new HRTimer.HiResTimer(); testTimer.Start(); List <string> logs_and_Path = c1.childDomain(childName, TestRequest, path_Dll); testTimer.Stop(); (" [[ Displaying Requirement 12 ---->>> Test Execution Time " + testTimer.ElapsedMicroseconds + " ]]").title('='); return(logs_and_Path); }
static void Main() { Console.Write("\n Client of SelfHosted File Stream Service"); Console.Write("\n ==========================================\n"); Client clnt = new Client(); clnt.channel = CreateServiceChannel("http://localhost:8000/StreamService"); HRTimer.HiResTimer hrt = new HRTimer.HiResTimer(); hrt.Start(); clnt.uploadFile("DivideTest.dll"); clnt.uploadFile("TestCode2.dll"); clnt.uploadFile("TestCode3.dll"); clnt.uploadFile("TestCode4.dll"); clnt.uploadFile("TestDriver1.dll"); clnt.uploadFile("TestDriver2.dll"); clnt.uploadFile("TestDriver3.dll"); clnt.uploadFile("TestDriver4.dll"); hrt.Stop(); Console.Write( "\n\n total elapsed time for uploading = {0} microsec.\n", hrt.ElapsedMicroseconds ); /* hrt.Start(); * clnt.download("test.txt"); * clnt.download("FileStreaming.zip"); * clnt.download("CreateVirtDir.doc"); * clnt.download("demoWinForm.ncb"); * clnt.download("foobar"); * hrt.Stop(); * * Console.Write( * "\n\n Total elapsed time for downloading = {0}", * hrt.ElapsedMicroseconds * );*/ Console.Write("\n\n Press key to terminate client"); Console.ReadKey(); Console.Write("\n\n"); ((IChannel)clnt.channel).Close(); }
public MainWindow() { //---<Creates the dropdown list for combobox and channel for message passing>-------- InitializeComponent(); var di = new DirectoryInfo(@"..\..\..\GUI-Client\Test's"); var dir = new DirectoryInfo(@"..\..\..\GUI-Client\Only Dll's"); MyCollection = di.GetFiles(); // MyCollection1 = dir.GetFiles(); comm = new Comm <MainWindow>(); endPoint = Comm <MainWindow> .makeEndPoint("http://localhost", 9092); fileList = new List <string>(); fileList1 = new List <string>(); DataContext = this; comm.rcvr.CreateRecvChannel(endPoint); rcvThread = comm.rcvr.start(rcvThreadProc); ToSendPath = Path.GetFullPath(@"..\..\..\GUI-Client\ToSend"); SavePath = Path.GetFullPath(@"..\..\..\GUI-Repository\SelectedDll's"); block = new byte[BlockSize]; hrt = new HRTimer.HiResTimer(); }
public repoFileManager() { block = new byte[BlockSize]; hrt = new HRTimer.HiResTimer(); }
public Repository() // constructor { block = new byte[BlockSize]; hrt = new HRTimer.HiResTimer(); }
public TestHarnessManager() { block = new byte[BlockSize]; hrt = new HRTimer.HiResTimer(); }
// //----< Run tests in libraries that support ITest interface >---- public string RunTests() { StringWriter sw = new StringWriter(); XmlTextWriter xtw = new XmlTextWriter(sw); xtw.WriteStartDocument(); xtw.WriteStartElement("TestResults"); Console.Write("\n\n Running Tests in TestDomain"); Console.Write("\n -----------------------------"); /////////////////////////////////////////////////// // part of an alternate way to save test results // int count = 0; Assembly[] assems = AppDomain.CurrentDomain.GetAssemblies(); foreach(Assembly assem in assems) { if(assem.FullName.IndexOf("mscorlib") != -1) continue; if(assem.FullName.IndexOf("ITest") != -1) continue; if (assem.FullName.IndexOf("Loader") != -1) continue; if (assem.FullName.IndexOf("AbstractTest") != -1) continue; Console.Write("\n Loaded: {0}",assem.FullName); Type[] types = assem.GetTypes(); foreach(Type type in types) { Type interf = type.GetInterface("ITest"); if(interf != null) { HRTimer.HiResTimer timer = new HRTimer.HiResTimer(); timer.Start(); try { Invoker(type); } catch(Exception ex) { Console.Write("\n {0}",ex.Message); ret = false; } finally // save test result as XML element { xtw.WriteElementString(id.ToString(),ret.ToString()); } timer.Stop(); ulong timeSpan = timer.ElapsedMicroseconds; if(ret.ToString().ToLower() == "true") Console.Write( "\n test passed, elapsed time = {0} microsecs",timeSpan ); else Console.Write( "\n test failed, elapsed time = {0} microsecs",timeSpan ); Console.WriteLine(); /////////////////////////////////////////// // An alternate way to save test results // ++count; // AppDomain.CurrentDomain.SetData(count.ToString(),id); // AppDomain.CurrentDomain.SetData(id,ret); } } } xtw.WriteEndElement(); xtw.WriteEndDocument(); xtw.Close(); return sw.ToString(); }
public Repository() { block = new byte[BlockSize]; hrt = new HRTimer.HiResTimer(); }
public ClientTransfer() { block = new byte[BlockSize]; hrt = new HRTimer.HiResTimer(); }
StreamService() { block = new byte[BlockSize]; hrt = new HRTimer.HiResTimer(); }
Client() { block = new byte[BlockSize]; hrt = new HRTimer.HiResTimer(); }
// //----< Run tests in libraries that support ITest interface >---- public string RunTests() { StringWriter sw = new StringWriter(); XmlTextWriter xtw = new XmlTextWriter(sw); xtw.WriteStartDocument(); xtw.WriteStartElement("TestResults"); Console.Write("\n\n Running Tests in TestDomain\n -----------------------------"); Assembly[] assems = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assem in assems) { if (assem.FullName.IndexOf("mscorlib") != -1) { continue; } if (assem.FullName.IndexOf("ITest") != -1) { continue; } if (assem.FullName.IndexOf("Loader") != -1) { continue; } Console.Write("\n Loaded: {0}", assem.FullName); Type[] types = assem.GetTypes(); foreach (Type type in types) { Type interf = type.GetInterface("ITest"); if (interf != null) { HRTimer.HiResTimer timer = new HRTimer.HiResTimer(); timer.Start(); try { Invoker(type); } catch (Exception ex) { Console.Write("\n {0}", ex.Message); ret = false; } finally { } timer.Stop(); ulong timeSpan = timer.ElapsedMicroseconds; StreamWriter f = new StreamWriter(@"..\..\..\Tester\testlogs\" + filename_ + "testlog.txt", false); if (ret.ToString().ToLower() == "true") { Console.Write("\n test passed, elapsed time = {0} microsecs", timeSpan); f.WriteLine("\n test passed, elapsed time = {0} microsecs", timeSpan); f.Close(); } else { Console.Write("\n test failed, elapsed time = {0} microsecs", timeSpan); f.WriteLine("\n test failed, elapsed time = {0} microsecs", timeSpan); f.Close(); } } } } xtw.WriteEndElement(); xtw.WriteEndDocument(); xtw.Close(); return(sw.ToString()); }
StreamService() { block1 = new byte[BlockSize1]; hrt1 = new HRTimer.HiResTimer(); }
// //----< Run tests in libraries that support ITest interface >---- public string RunTests() { StringWriter sw = new StringWriter(); XmlTextWriter xtw = new XmlTextWriter(sw); xtw.WriteStartDocument(); xtw.WriteStartElement("TestResults"); Console.Write("\n\n Running Tests in TestDomain"); Console.Write("\n -----------------------------"); /////////////////////////////////////////////////// // part of an alternate way to save test results // int count = 0; Assembly[] assems = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assem in assems) { if (assem.FullName.IndexOf("mscorlib") != -1) { continue; } if (assem.FullName.IndexOf("ITest") != -1) { continue; } Console.Write("\n\n Loaded: {0}", assem.FullName); Type[] types = assem.GetTypes(); foreach (Type type in types) { Type interf = type.GetInterface("ITest"); if (interf != null) { HRTimer.HiResTimer timer = new HRTimer.HiResTimer(); timer.Start(); try { Invoker(type); } catch (Exception ex) { Console.Write("\n {0}", ex.Message); ret = false; } finally // save test result as XML element { xtw.WriteElementString(id.ToString(), ret.ToString()); } timer.Stop(); ulong timeSpan = timer.ElapsedMicroseconds; if (ret.ToString().ToLower() == "true") { Console.Write( "\n test passed, elapsed time = {0} microsecs", timeSpan ); } else { Console.Write( "\n test failed, elapsed time = {0} microsecs", timeSpan ); } /////////////////////////////////////////// // An alternate way to save test results // ++count; // AppDomain.CurrentDomain.SetData(count.ToString(),id); // AppDomain.CurrentDomain.SetData(id,ret); } } } xtw.WriteEndElement(); xtw.WriteEndDocument(); xtw.Close(); return(sw.ToString()); }