public RunTestsResult runTests(RunTestsRequest RunTestsRequest) { object[] results = this.Invoke("runTests", new object[] { RunTestsRequest }); return((RunTestsResult)(results[0])); }
/// <remarks/> public void runTestsAsync(RunTestsRequest RunTestsRequest, object userState) { if ((this.runTestsOperationCompleted == null)) { this.runTestsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnrunTestsOperationCompleted); } this.InvokeAsync("runTests", new object[] { RunTestsRequest }, this.runTestsOperationCompleted, userState); }
private bool HandleRunTestsRequest(RunTestsRequest runTestsRequest) { testDll = runTestsRequest.Dll; var agentList = agentListActor.Ask <AgentListResponse>(new GetAgentList()).Result; foreach (var agent in agentList.AgentActorRefs) { agent.Tell(new CheckoutAndBuild { Server = runTestsRequest.Server, Branch = runTestsRequest.Branch }, Self); } return(true); }
/// <remarks/> public void runTestsAsync(RunTestsRequest RunTestsRequest, object userState) { if ((this.runTestsOperationCompleted == null)) { this.runTestsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnrunTestsOperationCompleted); } this.InvokeAsync("runTests", new object[] { RunTestsRequest}, this.runTestsOperationCompleted, userState); }
/// <remarks/> public void runTestsAsync(RunTestsRequest RunTestsRequest) { this.runTestsAsync(RunTestsRequest, null); }
/// <remarks/> public System.IAsyncResult BeginrunTests(RunTestsRequest RunTestsRequest, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("runTests", new object[] { RunTestsRequest}, callback, asyncState); }
public RunTestsResult runTests(RunTestsRequest RunTestsRequest) { object[] results = this.Invoke("runTests", new object[] { RunTestsRequest}); return ((RunTestsResult)(results[0])); }
/// <remarks/> public void runTestsAsync(RunTestsRequest RunTestsRequest) { this.runTestsAsync(RunTestsRequest, null); }
public RunTestsResponse RunTests(RunTestsRequest request) { RunTestsResponse response = new RunTestsResponse(); AuthToken authToken = null; try { Common.Helpers.ValidationHelper.ValidateRequiredField(request.AuthToken, "Auth Token"); Common.Helpers.ValidationHelper.ValidateRequiredField(request.AntiForgeryToken, "Auth Token"); Common.Helpers.ValidationHelper.ValidateRequiredField(request.Output, "Output"); Common.Helpers.ValidationHelper.ValidateStringLength(request.Output, "Output", Constants.MaxBlobLength); if (string.IsNullOrEmpty(request.AuthToken) || !UserController.ValidateSession(request.AuthToken, out authToken)) { throw new AuthenticationException("Authentication failed."); } UserController.ValidateAntiForgeryToken(request.AntiForgeryToken, authToken); DbContext context = DataController.CreateDbContext(); E::Question question = context.Questions .Where(q => q.ID == request.QuestionID) .FirstOrDefault(); if (question.LastTestRunOn.HasValue && DateTime.UtcNow - question.LastTestRunOn.Value < TimeSpan.FromSeconds(5)) { throw new Common.Exceptions.ValidationException("Please wait at least 5 seconds between test runs."); } question.LastTestRunOn = DateTime.UtcNow; if (question.QuestionTypeID == (short)QuestionType.Standard) { var testsJson = DataController.DownloadBlob(question.Tests.Value.ToString()); var tests = TestsController.FromJson(testsJson).OrderBy(t => t.ID); int numberOfTests = Settings.Default.TestsExecutedPerQuestion; var randomTests = tests.Shuffle(0).Take(numberOfTests).ToList(); var parsedOutput = request.Output.Lines(); if (randomTests.Count > parsedOutput.Length) { throw new Common.Exceptions.ValidationException(string.Format("Invalid output. Expected {0} lines, found {1}.", randomTests.Count, parsedOutput.Length)); } else { response.Tests = (from pair in randomTests.OrderBy(t => t.Name).Zip(parsedOutput, Tuple.Create) select new RunTestsResponseItem { TestName = pair.Item1.Name, TestID = pair.Item1.ID, Success = pair.Item1.ExpectedOutput.EqualsLenient(pair.Item2), Input = pair.Item1.Input.Truncate(100), ExpectedOutput = pair.Item1.ExpectedOutput.Truncate(100), Output = pair.Item2.Truncate(100) }) .ToArray(); } } else { response.Tests = CodedQuestionController.RunTests(question.CodedTestID.Value, request.Output, 0) .Select(test => new RunTestsResponseItem { TestName = test.TestName, Success = test.Success, Input = test.Input.Truncate(100), ExpectedOutput = test.ExpectedOutput.Truncate(100), Output = test.Output.Truncate(100) }) .OrderBy(test => test.TestName) .ToArray(); } } catch (AuthenticationException ex) { throw new WebFaultException <string>(ex.Message, System.Net.HttpStatusCode.BadRequest); } catch (Common.Exceptions.ValidationException ex) { throw new WebFaultException <string>(ex.Message, System.Net.HttpStatusCode.BadRequest); } catch (Exception ex) { ExceptionHelper.Log(ex, authToken == null ? null : authToken.Username); throw new WebFaultException <string>("An unknown error has occurred.", System.Net.HttpStatusCode.InternalServerError); } return(response); }