Example #1
0
        //------------------<Function to parse the build request>---------------------------------

        public void parseRequest(buildRequest.buildRequest br, List<string> names)
        {
            List<string> file = new List<string>();
            foreach (string s in names)
            {
                string fileName = Path.GetFileName(s);
                file.Add(fileName);
            }
            names = file;
            Console.WriteLine("\n\nParsing build Message");


            foreach (buildItems item in br.Builds)
            {
                foreach (buildName b in item.driver)
                {
                    if (names.Contains(b.fileName))
                    {
                        Console.WriteLine("test driver found" +b.fileName);
                    }
                    else
                        Console.WriteLine("Test Driver not found");
                }
                foreach (buildName b in item.sourcefiles)
                {
                    if (names.Contains(b.fileName))
                    {
                        Console.WriteLine("source driver found" + b.fileName); ;
                    }
                    else
                        Console.WriteLine("Source Driver not found");

                }
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            //-------------------<First build Driver>----------------------
            buildItems be1 = new buildItems();
            buildName  b1  = new buildName();

            b1.fileName   = "TestDriver.cs";
            be1.buildName = "build1";
            //  be1.buildName = "td1.cs";
            be1.addDriver(b1);
            buildName b2 = new buildName();
            buildName b3 = new buildName();

            b2.fileName = "TestedOne.cs";
            b3.fileName = "TestedTwo.cs";
            be1.addCode(b2);
            be1.addCode(b3);



            //-----------------<Build request>---------------------

            buildRequest br = new buildRequest();

            br.author = "Sarath Patlolla";
            br.Builds.Add(be1);

            string Xml = br.ToXml();

            Console.WriteLine("\nThe build Request Generated by the Client is {0}", Xml);
        }
        //----------------------------------------------<Function to get the associated Dll files in the build server>-----------------------
        //public void getFiles(string pattern)
        //{
        //    files.Clear();
        //    getFilesHelper(storagePath, pattern);
        //}

        //---------------------------------------<Function to process the build request>-------------------------------------

        public Dictionary <string, string> processBuild(string path, RepoMock rm)
        {
            Console.WriteLine("processing build request");
            Console.WriteLine("-------------------------------------");

            string xmlstring = File.ReadAllText(path);

            buildRequest.buildRequest newRequest = xmlstring.FromXml <buildRequest.buildRequest>();

            repo = rm;

            foreach (buildItems item in newRequest.Builds)
            {
                string s1 = "";

                List <string> l1 = new List <string>();

                foreach (buildName b1 in item.driver)
                {
                    l1.Add(b1.fileName);
                    Console.WriteLine("\nrequesting" + b1.fileName);
                    repo.processfilerequest(b1.fileName);
                }

                foreach (buildName c in item.sourcefiles)
                {
                    s1 = s1 + c.fileName + "  ";
                    Console.WriteLine("\nrequesting" + c.fileName);
                    repo.processfilerequest(c.fileName);
                }

                foreach (string str in l1)
                {
                    dictionary.Add(str, s1);
                }
            }

            return(dictionary);
        }
Example #4
0
        static void Main(string[] args)
        {
            TestExecutive testExecutive = new TestExecutive();

            Client.Client             client       = new Client.Client();
            buildRequest.buildRequest buildRequest = new buildRequest.buildRequest();

            RepoMock      repoMock    = new RepoMock();
            buildServer   buildServer = new buildServer();
            List <string> list;
            TestRequest   TestRequest = new TestRequest();
            TestHarness   TestHarness = new TestHarness();
            Dictionary <string, string> dictionary;


            Console.WriteLine("\n\n-------------------------Project 2: Demosntrating a Build Server------------------------------------- \n\n");
            Console.WriteLine("***********************************************************************************************************\n\n");

            //-------------------------------------------<Requirment 1>---------------------------------------------------------------------------------
            Console.WriteLine("\n\tRequirment 1: \n\n");
            Console.WriteLine("=========================================================================\n");
            Console.WriteLine("\t\tProject Prepared using C# .Net Framework and Visual Studio 2017" + Environment.Version.ToString() + "\n\n");
            Console.WriteLine("-----------------------------------------------------------------------------------\n\n");

            //----------------------------------------------<Requirment 2>------------------------------------------------------------------------------
            Console.WriteLine("\n\t Requirment 2: \n\n");
            Console.WriteLine("=========================================================================\n");
            Console.WriteLine("\t\tInclude a package for\n" + nameof(buildRequest) + "\n\n" + nameof(client) + "\n\n" + nameof(repoMock) + "\n\n" + nameof(buildServer) + "\n\n" + nameof(TestRequest) + "\n\n" + nameof(TestHarness) + "\n\n" + nameof(testExecutive) + "\n\n");
            Console.WriteLine("------------------------------------------------------------------------------------------------------------------------\n\n\n");

            //------------------------------------------------<Requirment 3>----------------------------------------------------------------------------------
            Console.WriteLine("\n\n\t Requirment 3: \n");
            Console.WriteLine("=========================================================================\n");
            Console.WriteLine("\t\tConstructed a fixed sequence of operations of the mock repository, mock test harness, and core builder\n\n");

            Console.WriteLine("------------------------------------------------------------------------------------------------------------------------\n\n\n");
            Console.WriteLine("The BuiltRequest Data structure generated by the client is \n");
            buildRequest = client.buildrequest();

            string sendXml = client.Xml;

            repoMock.getFiles("*.*");
            repoMock.parseRequest(buildRequest, repoMock.files);
            Console.WriteLine("\nBuiltRequest Sent to MockRepository");

            string buildrequestLocation = "../../../repoMock/repoStorage/buildRequest/buildRequest.xml";

            repoMock.savecontent(buildrequestLocation, sendXml);
            Console.WriteLine("\n\n Demonstrated the requirment of the builddriver xmlfile being saved in the repository\n\n");

            Console.WriteLine("------------------------------------------------------------------------------------------------------------------------\n\n\n");

            //----------------------------------------------<Requirment 4>------------------------------------------------------------------------------------------

            Console.WriteLine("\n\n\t Requirmrnt 4: \n");
            Console.WriteLine("=========================================================================\n");
            Console.WriteLine("\t\tRepopsitory on demand copies a set of test source files, test drivers and test request with a test for each test driver\n\n");
            Console.WriteLine("Enter command for copying a set of test source files, test drivers and test request( Enter :send)");
            string command = Console.ReadLine();

            repoMock.sendFile(command, buildrequestLocation, "../../../buildServer/builderStorage");
            Console.WriteLine("\n\nThe Demonstrated the requirment of sending the builtRequest on command to the buildserver build storage  \n");
            Console.WriteLine("-----------------------------------------------------------------------------");
            dictionary = buildServer.processBuild("../../../buildServer/builderStorage/buildRequest.xml", repoMock);
            Console.WriteLine("------------------------------------------------------------------------------------------------------------------------\n\n\n");

            //--------------------------------------------<Requirment 5>--------------------------------------------------------------------------------------------
            Console.WriteLine("\n\n\t Requirment 5:\n");
            Console.WriteLine("=========================================================================\n");
            Console.WriteLine("\t\t The build server builds each visual studio project delivered by the mock repository\n\n");
            list = buildServer.getBuilderFiles();
            list = buildServer.processdirectory(list);
            buildServer.buildFile(list, dictionary);
            Console.WriteLine("\n\nDemonstarted the requirment of successfully building the test files which have been sent to the build server repository\n\n");
            Console.WriteLine("-----------------------------------------------------------------------------------------------------------------------------\n\n");
            Console.WriteLine("------------------------------------------------------------------------------------------------------------------------\n\n\n");



            //----------------------------------------------<Requirment 6>-----------------------------------------------------------------------------------------
            Console.WriteLine("\n\n\t Requirment 6: \n");
            Console.WriteLine("=========================================================================\n");

            Console.WriteLine("\t\t The builder reported to the console the success or the failure of the build, and any warning emitted\n\n");
            Console.WriteLine("------------------------------------------------------------------------------------------------------------------------\n\n\n");



            //----------------------------------------------<Requirment 7>------------------------------------------------------------------------------------------
            Console.WriteLine("\n\n\t Requirment 7: \n");
            Console.WriteLine("=========================================================================\n");
            Console.WriteLine("\t\t The Builder on success delivered the built library path known by mock test harness \n\n ");
            TestRequest = buildServer.generateTestRequest();

            string xml = buildServer.xml;

            repoMock.getFiles("*.*");
            //     buildServer.parseTestRequest(TestRequest,buildServer.files);
            //buildServer.parseTestRequest(TestRequest, buildServer.files);
            string testRequestLocation = "../../../BuildServer/BuilderStorage/TestRequest.xml";

            repoMock.sendFile("send", testRequestLocation, "../../../DllLoaderDemo/testHarnessStorage");

            Console.WriteLine("Demonstarted the requirment of saving the testRequest in the build server");

            Console.WriteLine("------------------------------------------------------------------------------------------------------------------------\n\n\n");

            //-----------------------------------------------<Requirment 8>-------------------------------------------------------------------------------------------
            Console.WriteLine("\n\n\t Requirment 8: \n");
            Console.WriteLine("=========================================================================\n");
            Console.WriteLine("\t\t The test harness attempt to load and execute each test library \n\n");
            repoMock.savecontent(testRequestLocation, xml);
            // repoMock.sendFile("sendFile", testRequestLocation, "../../../DllLoaderDemo/testHarnessStorage");
            Console.WriteLine("Demonstrated the requirment of sending the testDriver to the testHarness");
            TestHarness.processTestRequest("../../../DllLoaderDemo/testHarnessStorage/TestRequest.xml", buildServer);
            Console.WriteLine("------------------------------------------------------------------------------------------------------------------------\n\n\n");
            Console.Write("\n\n The test driver and the test file dll have been successfully sent to the test harness\n\n");
            Console.WriteLine("-----------------------------------------------------------------------------------------\n");
            //string loadandexecute = TestHarness.loadAndExerciseTesters();

            //------------------------<For loading and executing the test libraries absolute path is required>------------------------------

            TestHarness.testersLocation = Path.GetFullPath("../../../DllLoaderDemo/testHarnessStorage");
            Console.Write("\n  Loading Test Modules from:\n    {0}\n", TestHarness.testersLocation);

            // run load and tests

            string result = TestHarness.loadAndExerciseTesters();

            Console.Write("\n\n  {0}", result);
            Console.Write("\n\n");
            Console.WriteLine("\n\nDemonstrated the requirment of Simulated testing\n\n ");
            Console.WriteLine("--------------------------------------------------------------------------------------------------------\n\n");
            Console.WriteLine("\n\n=======================================================================================================================\n\n");
        }