Exemple #1
0
        /*----< Activates all build server components >----------------*/

        public void builder(Message msg)
        {
            TestRequest        newRequest = msg.body.FromXml <TestRequest>();
            List <TestElement> test       = newRequest.tests;

            foreach (TestElement t in test)
            {
                filesToBuild.Add(t.testDriver);
                List <String> codes = t.testCodes;
                foreach (String c in codes)
                {
                    filesToBuild.Add(c);
                }
                String status = builder1.libraryBuilder(filesToBuild, Receivepath);
                filesToBuild.Clear();
                logbuilder(t, status, name);
            }

            String log  = LogData.log_creator(data, "BuildLog");
            String temp = msg.toAddress;

            msg.toAddress   = msg.fromAddress;
            msg.fromAddress = temp;
            msg.body        = log;
            msg.type        = Message.MessageType.BuildLog;
            comm.postMessage(msg);
            String testRequest = create_testrequest(data, Receivepath, name);

            if (!testRequest.Equals(""))
            {
                Message msg1 = new Message(Message.MessageType.TestRequest);
                msg1.fromAddress = msg.fromAddress;
                msg1.toAddress   = "http://localhost:9090/IService";
                msg1.body        = testRequest;
                comm.postMessage(msg1);
            }
            else
            {
                Console.Write("\n\n\n Sending Ready Message to Mother builder \n");
                comm.postMessage(readyAgain);
            }
            data.Clear();
        }
Exemple #2
0
        /*----< Returns a test request for test harness >----------------*/

        public string create_testrequest(List <LogData> test, string path, string name)
        {
            Console.Write("\n \nConstructing Test Request for TestHarness");
            List <TestElement> te = new List <TestElement>();

            foreach (LogData test1 in test)
            {
                if (test1.status.Equals("Build Success"))
                {
                    TestElement te1 = new TestElement();
                    te1.testName = test1.testname;
                    te1.addDriver(Path.GetFileNameWithoutExtension(test1.testDriver) + ".dll");
                    te.Add(te1);
                }
            }
            TestRequest tr = new TestRequest();

            tr.author = name;
            for (int i = 0; i < te.Count; i++)
            {
                tr.tests.Add(te[i]);
            }
            string trXml;

            if (tr.tests.Count >= 1)
            {
                trXml = tr.ToXml();
                File.WriteAllText(path + "/TestRequesttoHarness.xml", trXml);
                Console.Write("\n \nTestRequest for the TestHarness:\n {0}\n", trXml);
                return(trXml);
            }
            else
            {
                Console.Write("\n *******Build failed so stopping further execution******** ");
                return("");
            }
        }
Exemple #3
0
        /*----< Returns list of files by parsing build request >----------------*/

        public List <String> parse(String buildRequest)
        {
            Console.Write("\n \n Child Build parses the Build Request");
            List <String> files      = new List <string>();
            TestRequest   newRequest = buildRequest.FromXml <TestRequest>();

            name        = newRequest.author;
            Receivepath = "../../../ChildBuildServer/" + name + "_" + DateTime.Now.ToString("yyyyMMddHHmmssffff");
            Console.Write("\n\nTemporary directory created :" + Receivepath + "\n");

            Directory.CreateDirectory(Receivepath);
            List <TestElement> test = newRequest.tests;

            foreach (TestElement t in test)
            {
                files.Add(t.testDriver);
                List <String> codes = t.testCodes;
                foreach (String c in codes)
                {
                    files.Add(c);
                }
            }
            return(files);
        }