Exemplo n.º 1
0
        //This enables processing of messages sent by other packages and takes appropriate actions
        public void ProcessRequest(Message msg)
        {
            TestRequest  tr     = new TestRequest();
            BuildRequest newTrq = msg.body.FromXml <BuildRequest>();

            tr.author    = newTrq.author;
            tr.timeStamp = DateTime.Now;
            System.IO.Directory.CreateDirectory(Path.GetFullPath(storagepath));
            bl.createLog(newTrq.author);
            foreach (TestElement tl in newTrq.tests)
            {
                testDriverToBeTested = null;
                TestElement t = new TestElement();
                t.testName          = tl.testName;
                t.testConfiguration = tl.testConfiguration;
                if (tl.testConfiguration == "C#")
                {
                    t.testDriver = Path.GetFileNameWithoutExtension(tl.testDriver) + ".dll";
                }
                if (tl.testConfiguration == "Java")
                {
                    t.testDriver = Path.GetFileNameWithoutExtension(tl.testDriver) + ".jar";
                }
                testFiles.Clear();
                testFiles.Add(tl.testDriver);
                testFiles.AddRange(tl.testCodes);
                Console.WriteLine("\n  1. Builder parses the message and gets test request \n  then builder parses the test request and pulls required files from repository storage.");
                if (receiveFiles(testFiles))
                {
                    Console.WriteLine("\n  2. Builder tries to build files send to it. (Requirement 8)");
                    Build(tl.testDriver, tl.testConfiguration, tl.testCodes);
                    if (testDriverToBeTested != null)
                    {
                        tr.tests.Add(t);
                    }
                }
                else
                {
                    Console.WriteLine("\n  Files not received");
                }
            }
            if (tr.tests.Any())
            {
                sendTestRequest(tr);
            }
            sendLog(bl.getLog(), newTrq.author);
        }
Exemplo n.º 2
0
        //This enables processing of messages sent by other packages and takes appropriate actions
        public void ProcessRequest(Message msg)
        {
            TestRequest newTrq = msg.body.FromXml <TestRequest>();

            tr.author    = newTrq.author;
            tr.timeStamp = DateTime.Now;
            bl.createLog(newTrq.author);
            //Creating temporary directory named Build Storage
            System.IO.Directory.CreateDirectory(Path.GetFullPath(fm.buildPath));
            foreach (TestElement tl in newTrq.tests)
            {
                buildResult = false;
                testConfig  = "";
                testConfig  = tl.testConfiguration;
                TestElement t = new TestElement();
                t.testName          = tl.testName;
                t.testConfiguration = tl.testConfiguration;
                if (tl.testConfiguration == "C#")
                {
                    t.testDriver = Path.GetFileNameWithoutExtension(tl.testDriver) + ".dll";
                }
                if (tl.testConfiguration == "Java")
                {
                    t.testDriver = Path.GetFileNameWithoutExtension(tl.testDriver) + ".jar";
                }
                testFiles.Clear();
                testFiles.Add(tl.testDriver);
                testFiles.AddRange(tl.testCodes);
                Console.WriteLine("\n  3. Builder parses the message and gets test request \n  then builder parses the test request and pulls required files from repository.");
                receiveFiles(testFiles);
                Console.WriteLine("\n  4. Builder tries to build files send to it. (Requirements 5,6)");
                Build(tl.testDriver, tl.testConfiguration, tl.testCodes);
                if (buildResult)
                {
                    tr.tests.Add(t);
                }
            }
            sendLog(bl.getLog(), newTrq.author, testConfig);
        }