// <----------- Test Stub --------------->
        static void Main()
        {
            ClientFileManager cfm = new ClientFileManager();
            string            req = MessageTest.makeTestRequest("Nikhil");
            Parser            p   = new Parser();

            cfm.RetrieveFilesFromRepo(p.parse(req));
        }
Exemple #2
0
        //----< send message to connected listener >---------------------
        private void SendMessageButton_Click(object sender, RoutedEventArgs e)
        {
            string author1        = "Nikhil Prashar";
            string remoteEndPoint = Comm <WPFClient1> .makeEndPoint("http://localhost", 8080, "TestHarnessServer");

            Message msg = makeMessage(author1, endPoint, remoteEndPoint, "TestRequest");

            msg.body = MessageTest.makeTestRequest(author1);
            Parser p = new Parser();

            TestRequest       tr   = p.parse(msg.body);
            ClientFileManager cfm  = new ClientFileManager();
            List <string>     dlls = cfm.RetrieveFilesFromRepo(tr);

            int          count = 0;
            IFileService fs    = null;

            while (true)
            {
                try
                {
                    fs = CreateChannelForFileTransfer("http://localhost:8080/RepositoryServer");
                    break;
                }
                catch
                {
                    Console.Write("\n  connection to Test Harness service failed {0} times - trying again", ++count);
                    Thread.Sleep(500);
                    continue;
                }
            }

            foreach (string file in dlls)
            {
                string filename = System.IO.Path.GetFileName(file);
                Console.Write("\n  sending file {0}", filename);

                if (!SendFile(fs, file))
                {
                    Console.Write("\n  could not send file");
                }
            }


            Console.WriteLine("\nClient sending message: {0}", msg.ToString());
            comm.sndr.PostMessage(msg);

            this.Dispatcher.BeginInvoke(
                System.Windows.Threading.DispatcherPriority.Normal,
                SentNewMessage,
                msg.body);
        }
Exemple #3
0
        public void SendingDllsToRepository(Message msg)
        {
            Parser p = new Parser();

            TestRequest       tr   = p.parse(msg.body);
            ClientFileManager cfm  = new ClientFileManager();
            List <string>     dlls = cfm.RetrieveFilesFromRepo(tr);

            int          count = 0;
            IFileService fs    = null;

            while (true)
            {
                try
                {
                    fs = CreateChannelForFileTransfer("http://localhost:8080/RepositoryServer");
                    break;
                }
                catch
                {
                    Console.Write("\n  connection to Test Harness service failed {0} times - trying again", ++count);
                    Thread.Sleep(500);
                    continue;
                }
            }

            Console.WriteLine("Sending the Following dlls to the Repository ------> Requirement 6(Reference: Client.cs line number 68-92,141)");
            foreach (string file in dlls)
            {
                string filename = System.IO.Path.GetFileName(file);
                Console.Write("\n\t  sending file {0} from Client's Local Repository to Main Repository", filename);

                if (!SendFile(fs, file))
                {
                    Console.Write("\n  could not send file");
                }
            }
        }