Beispiel #1
0
        static void Main(string[] args)
        {
            //setup the servicelocator
            ServiceLocator locator = ServiceLocator.Instance;

            locator.AddService(typeof(IFileSystem), new FileSystemWrapper());
            locator.AddService(typeof(ProcessSettings), SettingsFactory.CreateProcessSettings());
            locator.AddService(typeof(IBuildServiceFacade), new ClientFacade());
            locator.AddService(typeof(ILogger), new ConsoleLogger());

            bool everythingOk = true;

            try
            {
                locator.GetService <ProcessSettings>().Validate();
            }
            catch (Exception ex)
            {
                locator.GetService <ILogger>().Log(ex.Message);
                everythingOk = false;
            }

            if (everythingOk)
            {
                _watcher = new SubmitWatcher();
                Console.WriteLine("Start watching for submits to process.. Press enter to quit.");
                _watcher.StartWatching();
            }

            Console.ReadLine();
        }
Beispiel #2
0
        public SubmitWatcher()
        {
            //create a synchronized wrapper around the hashtable
            Hashtable ht2 = new Hashtable();

            _runningSubmitsHT = Hashtable.Synchronized(ht2);
            _systemSettings   = SettingsFactory.CreateSystemSettings();
            _fileSystem       = new MoCS.BuildService.Business.FileSystemWrapper();
        }
Beispiel #3
0
        private static void ProcessTeamSubmit(ValidationProcess validationProcess, SystemSettings sysSettings)
        {
            Submit submit         = validationProcess.Submit;
            string teamName       = submit.Team.Name;
            string assignmentName = submit.TournamentAssignment.Assignment.Name;

            Log(string.Format("Processing teamsubmit {0} for assignment {1}", teamName, assignmentName));

            //create the processor
            SubmitValidator validator = new SubmitValidator(new MoCS.BuildService.Business.FileSystemWrapper(), new ExecuteCmd());

            validationProcess.SetProcessor(validator);

            //prepare directory and files for processing
            string       teamSubmitDirName = CreateTeamDirectory(sysSettings, teamName, submit.TournamentAssignment.Assignment);
            ClientFacade facade            = new ClientFacade();

            MoCS.Business.Objects.Assignment assignment = facade.GetAssignmentById(submit.TournamentAssignment.Assignment.Id, true);
            CopyFiles(assignment, submit, teamSubmitDirName, sysSettings);

            //START PROCESSING

            //settings that are read from the assignment
            AssignmentSettings assignmentSettings = SettingsFactory.CreateAssignmentSettings(assignment, assignmentName);
            //settings that are from the submitprocess/team submit
            SubmitSettings submitSettings = SettingsFactory.CreateSubmitSettings(teamName, teamSubmitDirName, assignmentName);

            //set status of submit to 'processing'
            facade.UpdateSubmitStatusDetails(submit.Id, SubmitStatus.Processing, "This submitted is currently processed.", DateTime.Now);

            ValidationResult result = validator.Process(sysSettings, assignmentSettings, submitSettings);

            validationProcess.Result = result;

            Log(result.Status + " for " + submit.Team.Name + " on " + submit.TournamentAssignment.Assignment.Name);

            //save the new status to the database
            SaveStatusToDatabase(validationProcess.Submit, result);

            // Delete nunit.framework.dll from the submit dir to keep things clean
            CleanupFiles(teamSubmitDirName);
        }