Exemple #1
0
        private Assignment CreateTestAssignment(IBuildServiceFacade facade)
        {
            //setup the mock for facade
            Assignment assignment = new Assignment();

            facade.GetAssignmentById(Arg.Any <int>(), true).Returns(assignment);
            assignment.Path = @"c:\mocs\assignments\1\";
            assignment.AssignmentFiles.Add(new AssignmentFile()
            {
                Name = "InterfaceFile", FileName = "IHelloWorld.cs"
            });
            assignment.AssignmentFiles.Add(new AssignmentFile()
            {
                Name = "NunitTestFileServer", FileName = "HelloWorldTestsServer.cs"
            });
            assignment.AssignmentFiles.Add(new AssignmentFile()
            {
                Name = "NunitTestFileClient", FileName = "HelloWorldTests.cs"
            });
            assignment.AssignmentFiles.Add(new AssignmentFile()
            {
                Name = "ServerFileToCopy", FileName = "serverfile1.xml"
            });
            assignment.AssignmentFiles.Add(new AssignmentFile()
            {
                Name = "ServerFileToCopy", FileName = "serverfile2.dll"
            });
            assignment.Id = 1;
            assignment.ClassNameToImplement     = "HelloWorld";
            assignment.InterfaceNameToImplement = "IHelloWorld";

            return(assignment);
        }
Exemple #2
0
        public void SaveStatusToDatabase()
        {
            string details = "";

            if (!string.IsNullOrEmpty(this.Result.Output))
            {
                details = this.Result.Output;
            }

            if (details.Length >= 1000)
            {
                details.Substring(0, 999);
            }

            IBuildServiceFacade facade = ServiceLocator.Instance.GetService <IBuildServiceFacade>();

            switch (Result.Result)
            {
            case ExitCode.Failure:
                facade.UpdateSubmitStatusDetails(Submit.Id, SubmitStatus.ErrorValidation, details, DateTime.Now);
                break;

            case ExitCode.Success:
                facade.UpdateSubmitStatusDetails(Submit.Id, SubmitStatus.Success, details, DateTime.Now);
                break;
            }
        }
Exemple #3
0
        public void StartWatching()
        {
            IBuildServiceFacade facade  = ServiceLocator.Instance.GetService <IBuildServiceFacade>();
            List <Submit>       submits = facade.GetUnprocessedSubmits();

            StartWatchingNewSubmits(submits);
            StartPolling();
        }
Exemple #4
0
        private void _timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            IBuildServiceFacade facade  = ServiceLocator.Instance.GetService <IBuildServiceFacade>();
            List <Submit>       submits = facade.GetUnprocessedSubmits();

            StartWatchingNewSubmits(submits);
            TerminateOldSubmits();
            TraceStatus();
        }
Exemple #5
0
        public void Process()
        {
            IBuildServiceFacade facade = ServiceLocator.Instance.GetService <IBuildServiceFacade>();

            ProcessSettings settings = ServiceLocator.Instance.GetService <ProcessSettings>().Clone();

            settings.Submit = this.Submit;

            settings.Assignment = facade.GetAssignmentById(this.Submit.TournamentAssignment.Assignment.Id, true);
            this.Submit.TournamentAssignment.Assignment = settings.Assignment;

            facade.UpdateSubmitStatusDetails(Submit.Id, SubmitStatus.Processing, "submit is being processed", DateTime.Now);

            IFileSystem           fileSystem = ServiceLocator.Instance.GetService <IFileSystem>();
            MoCSValidationProcess process    = new MoCSValidationProcess(settings, fileSystem);
            ExecuteProcessResult  result     = process.Process();

            this.Result = result;
            SaveStatusToDatabase();
        }
Exemple #6
0
        private Assignment CreateTestAssignment(IBuildServiceFacade facade)
        {
            //setup the mock for facade
            Assignment assignment = new Assignment();
            facade.GetAssignmentById(Arg.Any<int>(), true).Returns(assignment);
            assignment.Path = @"c:\mocs\assignments\1\";
            assignment.AssignmentFiles.Add(new AssignmentFile() { Name = "InterfaceFile", FileName = "IHelloWorld.cs" });
            assignment.AssignmentFiles.Add(new AssignmentFile() { Name = "NunitTestFileServer", FileName = "HelloWorldTestsServer.cs" });
            assignment.AssignmentFiles.Add(new AssignmentFile() { Name = "NunitTestFileClient", FileName = "HelloWorldTests.cs" });
            assignment.AssignmentFiles.Add(new AssignmentFile() { Name = "ServerFileToCopy", FileName = "serverfile1.xml" });
            assignment.AssignmentFiles.Add(new AssignmentFile() { Name = "ServerFileToCopy", FileName = "serverfile2.dll" });
            assignment.Id = 1;
            assignment.ClassNameToImplement = "HelloWorld";
            assignment.InterfaceNameToImplement = "IHelloWorld";

            return assignment;
        }