public void StreamToXMLPartialConstructorTest() { string projectName = "test project"; IntegrationStatus buildStatus = IntegrationStatus.Exception; DateTime lastBuildDate = DateTime.Now; ProjectStatus projectStatus = new ProjectStatus(projectName, buildStatus, lastBuildDate); XmlSerializer serializer = new XmlSerializer(typeof(ProjectStatus)); TextWriter writer = new StringWriter(); XmlSerializerNamespaces nmsp = new XmlSerializerNamespaces(); nmsp.Add("", ""); serializer.Serialize(writer, projectStatus, nmsp); Assert.AreEqual("<?xml version=\"1.0\" encoding=\"utf-16\"?>" + Environment.NewLine + "<projectStatus " + "showForceBuildButton=\"true\" " + "showStartStopButton=\"true\" " + "serverName=\"" + Environment.MachineName + "\" " + "status=\"Running\" " + "buildStatus=\"" + buildStatus.ToString() + "\" " + "name=\"" + projectName + "\" " + "queuePriority=\"0\" " + "lastBuildDate=\"" + lastBuildDate.ToString("yyyy-MM-ddTHH:mm:ss.FFFFFFF") + "\" " + "nextBuildTime=\"0001-01-01T00:00:00\"" + ">" + Environment.NewLine + " <activity type=\"Sleeping\" />" + Environment.NewLine + " <parameters />" + Environment.NewLine + "</projectStatus>", writer.ToString()); }
/// <summary> /// Initializes a new instance of the <see cref="IntegrationSummary" /> class. /// </summary> /// <param name="status">The status.</param> /// <param name="label">The label.</param> /// <param name="lastSuccessfulIntegrationLabel">The last successful integration label.</param> /// <param name="startTime">The start time.</param> /// <remarks></remarks> public IntegrationSummary(IntegrationStatus status, string label, string lastSuccessfulIntegrationLabel, DateTime startTime) { this.status = status; this.label = label; this.lastSuccessfulIntegrationLabel = lastSuccessfulIntegrationLabel; this.startTime = startTime; }
/// <summary> /// Generate a label string from the last change number. /// If there is no valid change number (e.g. for a forced build without modifications), /// then the last integration label is used. /// </summary> /// <param name="resultFromThisBuild">IntegrationResult object for the current build</param> /// <returns>the new label</returns> public string Generate(IIntegrationResult resultFromThisBuild) { int changeNumber = resultFromThisBuild.LastChangeNumber; IntegrationStatus lastIntegration = resultFromThisBuild.LastIntegrationStatus; string firstSuffix = AllowDuplicateSubsequentLabels ? string.Empty : "." + INITIAL_SUFFIX_NUMBER.ToString(); if (changeNumber != 0) { return(LabelPrefix + changeNumber + firstSuffix); } else if (string.IsNullOrEmpty(resultFromThisBuild.LastSuccessfulIntegrationLabel)) { return(LabelPrefix + "unknown" + firstSuffix); } else if (!AllowDuplicateSubsequentLabels) { return(IncrementLabel(resultFromThisBuild.LastSuccessfulIntegrationLabel)); } else { return(resultFromThisBuild.LastSuccessfulIntegrationLabel); } }
private string GetRequestXml(IntegrationStatus status, int patentTypeId, RequestInfo requestInfo, bool dopUsluga) { var patentCode = GetPatentCodeByTypeUid(patentTypeId, dopUsluga); return($@" <?xml version=""1.0"" encoding=""utf-16""?> <soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http:www.w3.org/2001XMLSchema""> <soap:Body> <sendResponse xmlns=""http://MU.P{patentCode}.Library/MU/P{patentCode}""> <request xmlns=""> <responseData> <documentId>{status.RequestBarcode}</documentId> <status>{status.OnlineRequisitionStatusId}</status> <additionalInfo>{status.AdditionalInfo}</additionalInfo> </responseData> <systemInfo> <requestNumber /> <messageId>{requestInfo.messageId}</messageId> <chainId>{requestInfo.chainId}</chainId> <messageDate>{DateTime.Now:o}</messageDate> <digiSign /> <status /> <option /> <Sender>NIIS</Sender> <RequestIINBIN /> <RequestedIINBIN /> <ClientIPAddress /> </systemInfo> </request> </sendResponse> </soap:Body> </soap:Envelope>"); }
private void Integrate() { Log.Info(string.Format("{0}:Begin", System.Reflection.MethodBase.GetCurrentMethod().Name)); // should we integrate this pass? bool ShouldIntegration = this.ShouldRunIntegration(); if (ShouldIntegration) { IntegrationStatus status = IntegrationStatus.Unknown; try { Log.Info(string.Format("{0}.{1}:Before _integratable.RunIntegration", System.Reflection.MethodBase.GetCurrentMethod().ReflectedType.Name, System.Reflection.MethodBase.GetCurrentMethod().Name)); status = _integratable.RunIntegration(this.IntegrationResult).Status; Log.Info(string.Format("{0}.{1}:results.Status={2}", System.Reflection.MethodBase.GetCurrentMethod().ReflectedType.Name, System.Reflection.MethodBase.GetCurrentMethod().Name, status.ToString())); Log.Info(string.Format("{0}.{1}:After _integratable.RunIntegration", System.Reflection.MethodBase.GetCurrentMethod().ReflectedType.Name, System.Reflection.MethodBase.GetCurrentMethod().Name)); } catch (Exception ex) { Log.Error(ex); } // notify the schedule whether the build was successful or not Log.Info(string.Format("{0}.{1}:Before _trigger.IntegrationCompleted", System.Reflection.MethodBase.GetCurrentMethod().ReflectedType.Name, System.Reflection.MethodBase.GetCurrentMethod().Name)); if (status != IntegrationStatus.Unknown && status != IntegrationStatus.Exception) { _trigger.IntegrationCompleted(); } Log.Info(string.Format("{0}.{1}:After _trigger.IntegrationCompleted", System.Reflection.MethodBase.GetCurrentMethod().ReflectedType.Name, System.Reflection.MethodBase.GetCurrentMethod().Name)); } else { _trigger.IntegrationNotRun(); } Log.Info(string.Format("{0}:End", System.Reflection.MethodBase.GetCurrentMethod().Name)); }
private IntegrationResult CreateIntegrationResult(IntegrationStatus current, IntegrationStatus last) { IntegrationResult result = IntegrationResultMother.Create(current, last, new DateTime(1980, 1, 1)); result.ProjectName = "Project#9"; result.Label = "0"; return result; }
private IntegrationStatus CombinedIntegrationStatus(IntegrationStatus state1, IntegrationStatus state2, IntegrationStatus state3) { monitor1.SetupGet(_monitor => _monitor.IntegrationStatus).Returns(state1).Verifiable(); monitor2.SetupGet(_monitor => _monitor.IntegrationStatus).Returns(state2).Verifiable(); monitor3.SetupGet(_monitor => _monitor.IntegrationStatus).Returns(state3).Verifiable(); return(aggregator.IntegrationStatus); }
public void MarkSentStatus(IntegrationStatus integrationStatus) { if (integrationStatus != null) { integrationStatus.DateSent = DateTimeOffset.Now; _niisWebContext.SaveChanges(); } }
private IntegrationStatus CombinedIntegrationStatus(IntegrationStatus state1, IntegrationStatus state2, IntegrationStatus state3) { monitor1.SetupResult("IntegrationStatus", state1); monitor2.SetupResult("IntegrationStatus", state2); monitor3.SetupResult("IntegrationStatus", state3); return(aggregator.IntegrationStatus); }
public void SetNoteStatus(IntegrationStatus integrationStatus, string note) { if (integrationStatus != null) { integrationStatus.Note = note; _niisWebContext.SaveChanges(); } }
private IntegrationResult CreateIntegrationResult(IntegrationStatus current, IntegrationStatus last) { IntegrationResult result = IntegrationResultMother.Create(current, last, new DateTime(1980, 1, 1)); result.ProjectName = "Project#9"; result.Label = "0"; return(result); }
public void IntegrationCanBeDelayed() { string enforcer = "BuildForcer"; IntegrationResult result = new IntegrationResult(); result.ProjectName = (projectMock.Object as IProject).Name; result.Status = IntegrationStatus.Success; // The following latch is needed to ensure the end assertions are not called before // the events have been fired. Because of the multi-threaded nature of the integrators // this can happen without any of the other latches being affected. ManualResetEvent latch = new ManualResetEvent(false); bool eventIntegrationStartedFired = false; bool eventIntegrationCompletedFired = false; bool delayIntegration = true; IntegrationStatus status = IntegrationStatus.Unknown; integrator.IntegrationStarted += delegate(object o, IntegrationStartedEventArgs a) { eventIntegrationStartedFired = true; if (delayIntegration) { a.Result = IntegrationStartedEventArgs.EventResult.Delay; delayIntegration = !delayIntegration; } }; integrator.IntegrationCompleted += delegate(object o, IntegrationCompletedEventArgs a) { eventIntegrationCompletedFired = true; status = a.Status; latch.Set(); }; LatchHelper integrationTriggerLatchHelper = new LatchHelper(); integrationTriggerMock.Setup(_trigger => _trigger.Fire()).Verifiable(); LatchHelper projectLatchHelper = new LatchHelper(); projectMock.Setup(project => project.Integrate(It.Is <IntegrationRequest>(r => r.BuildCondition == BuildCondition.ForceBuild))).Returns(result).Verifiable(); projectMock.Setup(project => project.NotifyPendingState()).Verifiable(); projectMock.Setup(project => project.NotifySleepingState()).Callback(() => projectLatchHelper.SetLatch()).Verifiable(); projectMock.SetupGet(project => project.MaxSourceControlRetries).Returns(5); projectMock.SetupGet(project => project.SourceControlErrorHandling).Returns(ThoughtWorks.CruiseControl.Core.Sourcecontrol.Common.SourceControlErrorHandlingPolicy.ReportEveryFailure); integrationTriggerMock.Setup(_trigger => _trigger.IntegrationCompleted()).Callback(() => integrationTriggerLatchHelper.SetLatch()).Verifiable(); var parameters = new Dictionary <string, string>(); integrator.Start(); integrator.ForceBuild(enforcer, parameters); integrationTriggerLatchHelper.WaitForSignal(); projectLatchHelper.WaitForSignal(); VerifyAll(); projectMock.VerifyNoOtherCalls(); latch.WaitOne(2000, false); Assert.IsTrue(eventIntegrationStartedFired); Assert.IsTrue(eventIntegrationCompletedFired); Assert.AreEqual(IntegrationStatus.Success, status); }
public static IntegrationResult Create(IntegrationStatus status, IntegrationStatus lastIntegrationStatus, DateTime date) { IntegrationResult result = Create(new IntegrationSummary(lastIntegrationStatus, null, null, DateTime.MinValue)); result.Status = status; result.StartTime = date; result.EndTime = date; result.Label = "2.0"; result.ArtifactDirectory = Path.GetTempPath(); return result; }
/// <summary> /// Fires the IntegrationCompleted event. /// </summary> /// <param name="request">The integration request.</param> /// <param name="status">The outcome of the integration.</param> protected virtual void FireIntegrationCompleted(IntegrationRequest request, IntegrationStatus status) { if (IntegrationCompleted != null) { IntegrationCompletedEventArgs args = new IntegrationCompletedEventArgs(request, project.Name, status); IntegrationCompleted(this, args); } }
private BuildState ParseToBuildStatus(IntegrationStatus status, ProjectActivity activity) { if (activity == ProjectActivity.Building) return BuildState.Building; if (status == IntegrationStatus.Success) return BuildState.Good; return BuildState.Broken; }
private IIntegrationResult MakeResult(IntegrationStatus status, bool succeeded) { var mockResult = new Mock<IIntegrationResult>(); mockResult.SetupGet(x => x.ProjectUrl).Returns("http://dev/ccnet"); mockResult.SetupGet(x => x.ProjectName).Returns("developer"); mockResult.SetupGet(x => x.Label).Returns("3.2.1122.12297"); mockResult.SetupGet(x => x.Status).Returns(status); mockResult.SetupGet(x => x.Succeeded).Returns(succeeded); return mockResult.Object; }
public static IntegrationResult Create(IntegrationStatus status, IntegrationStatus lastIntegrationStatus, DateTime date) { IntegrationResult result = Create(new IntegrationSummary(lastIntegrationStatus, null, null, DateTime.MinValue)); result.Status = status; result.StartTime = date; result.EndTime = date; result.Label = "2.0"; result.ArtifactDirectory = Path.GetTempPath(); return(result); }
private IIntegrationResult MakeResult(IntegrationStatus status, bool succeeded) { var mockResult = new Mock <IIntegrationResult>(); mockResult.SetupGet(x => x.ProjectUrl).Returns("http://dev/ccnet"); mockResult.SetupGet(x => x.ProjectName).Returns("developer"); mockResult.SetupGet(x => x.Label).Returns("3.2.1122.12297"); mockResult.SetupGet(x => x.Status).Returns(status); mockResult.SetupGet(x => x.Succeeded).Returns(succeeded); return(mockResult.Object); }
private void AssertIntegrationStateReturned(IntegrationStatus integrationStatus) { ProjectStatus status = ProjectStatusFixture.New(integrationStatus, ProjectActivity.CheckingModifications); mockProjectManager.ExpectAndReturn("ProjectName", PROJECT_NAME); mockServerMonitor.ExpectAndReturn("GetProjectStatus", status, PROJECT_NAME); monitor.Poll(); Assert.AreEqual(integrationStatus, monitor.IntegrationStatus); }
public void SendStatus(IntegrationStatus status, IntegrationRequisition requisition) { var requestInfo = new RequestInfo { chainId = requisition.ChainId, Sender = CommonConstants.SystemInfoSenderNiis, messageId = Guid.NewGuid().ToString(), messageDate = DateTime.Now }; var logAction = new LogAction { DbDateTime = DateTimeOffset.Now, Project = CommonConstants.StatusSender, Type = ProjectType, Note = $"RequestBarcode = {status.RequestBarcode} StatusId = {status.OnlineRequisitionStatusId}", SystemInfoQueryId = _logging.CreateLogSystemInfo(Mapper.Map <LogSystemInfo>(requestInfo)) }; _logging.CreateLogAction(logAction); var responseInfo = new RequestInfo { status = new StatusInfo() }; string url = null; try { var dopUsluga = requisition.Callback != null && requisition.Callback.Contains(MessageSend); var response = SendStatusToPep(status, requisition.ProtectionDocTypeId, requestInfo, dopUsluga, out url); var xml = new XmlDocument(); xml.LoadXml(response); var responseNode = xml.GetElementsByTagName("response")[0]; responseInfo.status.Code = responseNode.ChildNodes[1].ChildNodes[0].InnerText; responseInfo.status.Message = responseNode.ChildNodes[1].ChildNodes[1].InnerText; } catch (WebException ex) { responseInfo.status.Code = "-99"; responseInfo.status.Message = ex.Message + " // " + GetResponseText(ex.Response); } catch (Exception ex) { responseInfo.status.Code = "-88"; responseInfo.status.Message = ex.ToString(); } logAction.SystemInfoAnswerId = _logging.CreateLogSystemInfo(Mapper.Map <LogSystemInfo>(requestInfo)); _logging.UpdateLogAction(logAction); if (!int.TryParse(responseInfo.status.Code, out var code) || code != 3) { var text = $"code = {responseInfo.status.Code} ; PEP => URL: {url} => {responseInfo.status.Message}"; throw new Exception(text); } }
public void IntegrationCanBeDelayed() { string enforcer = "BuildForcer"; IntegrationResult result = new IntegrationResult(); result.ProjectName = (projectMock.MockInstance as IProject).Name; result.Status = IntegrationStatus.Success; // The following latch is needed to ensure the end assertions are not called before // the events have been fired. Because of the multi-threaded nature of the integrators // this can happen without any of the other latches being affected. ManualResetEvent latch = new ManualResetEvent(false); bool eventIntegrationStartedFired = false; bool eventIntegrationCompletedFired = false; bool delayIntegration = true; IntegrationStatus status = IntegrationStatus.Unknown; integrator.IntegrationStarted += delegate(object o, IntegrationStartedEventArgs a) { eventIntegrationStartedFired = true; if (delayIntegration) { a.Result = IntegrationStartedEventArgs.EventResult.Delay; delayIntegration = !delayIntegration; } }; integrator.IntegrationCompleted += delegate(object o, IntegrationCompletedEventArgs a) { eventIntegrationCompletedFired = true; status = a.Status; latch.Set(); }; integrationTriggerMock.Expect("Fire"); projectMock.ExpectAndReturn("Integrate", result, new HasForceBuildCondition()); projectMock.Expect("NotifyPendingState"); projectMock.ExpectAndSignal("NotifySleepingState"); projectMock.ExpectNoCall("Integrate", typeof(IntegrationRequest)); projectMock.SetupResult("MaxSourceControlRetries", 5); projectMock.SetupResult("SourceControlErrorHandling", ThoughtWorks.CruiseControl.Core.Sourcecontrol.Common.SourceControlErrorHandlingPolicy.ReportEveryFailure); integrationTriggerMock.ExpectAndSignal("IntegrationCompleted"); var parameters = new Dictionary <string, string>(); integrator.Start(); integrator.ForceBuild(enforcer, parameters); integrationTriggerMock.WaitForSignal(); projectMock.WaitForSignal(); VerifyAll(); latch.WaitOne(2000, false); Assert.IsTrue(eventIntegrationStartedFired); Assert.IsTrue(eventIntegrationCompletedFired); Assert.AreEqual(IntegrationStatus.Success, status); }
private void AssertIntegrationStateReturned(IntegrationStatus integrationStatus) { ProjectStatus status = ProjectStatusFixture.New(integrationStatus, ProjectActivity.CheckingModifications); mockProjectManager.SetupGet(_manager => _manager.ProjectName).Returns(PROJECT_NAME).Verifiable(); mockServerMonitor.Setup(_monitor => _monitor.GetProjectStatus(PROJECT_NAME)).Returns(status).Verifiable(); monitor.Poll(); Assert.AreEqual(integrationStatus, monitor.IntegrationStatus); }
private IntegrationStatus WorstStatusOf(IntegrationStatus status1, IntegrationStatus status2) { int importanceOfStatus1 = GetIntegrationStatusImportance(status1); int importanceOfStatus2 = GetIntegrationStatusImportance(status2); if (importanceOfStatus1 > importanceOfStatus2) { return(status1); } return(status2); }
public ProjectStatus(ProjectIntegratorState status, IntegrationStatus buildStatus, ProjectActivity activity, string name, string webURL, DateTime lastBuildDate, string lastBuildLabel, string lastSuccessfulBuildLabel, DateTime nextBuildTime) { this.status = status; this.buildStatus = buildStatus; this.activity = activity; this.name = name; this.webURL = webURL; this.lastBuildDate = lastBuildDate; this.lastBuildLabel = lastBuildLabel; this.lastSuccessfulBuildLabel = lastSuccessfulBuildLabel; this.nextBuildTime = nextBuildTime; }
protected override void ExecuteTask() { Log(Level.Info, "Connecting to CCNet server " + ServerUrl); _cruiseManager = (ICruiseManager)RemotingServices.Connect(typeof(ICruiseManager), ServerUrl); IntegrationStatus status = LaunchBuild(_cruiseManager, ProjectName, PollingInterval, TimeOut); if (status != IntegrationStatus.Success) { throw new BuildException(string.Format("Project '{0}' failed : {1}", ProjectName, status)); } }
private IntegrationResult CreateIntegrationResult(IntegrationStatus status, int buildNumber, string artifactFolder) { IntegrationResult result = IntegrationResultMother.Create(status, new DateTime(1980, 1, 1, 1, 0, 0, buildNumber)); result.ProjectName = "proj"; result.StartTime = new DateTime(1980, 1, 1); result.Label = buildNumber.ToString(); result.Status = status; result.ArtifactDirectory = artifactFolder; return(result); }
private IntegrationResult CreateIntegrationResult(IntegrationStatus status, DateTime lastModifiedDate) { IntegrationResult result = new IntegrationResult(); result.StartTime = lastModifiedDate; result.Status = status; result.Label = "0"; result.Modifications = new Modification[1]; result.Modifications[0] = new Modification(); result.Modifications[0].ModifiedTime = lastModifiedDate; return(result); }
public void StreamToXMLFullConstructorTest() { string projectName = "full test"; string category = "categ1"; ProjectActivity activity = ProjectActivity.Building; IntegrationStatus buildStatus = IntegrationStatus.Failure; ProjectIntegratorState status = ProjectIntegratorState.Stopped; string webURL = "someurl"; DateTime lastBuildDate = DateTime.Now; string lastBuildLabel = "lastLabel"; string lastSuccessfulBuildLabel = "lastSuccess"; DateTime nextBuildTime = DateTime.Now.AddDays(2); string buildStage = "some stage"; string queue = "someQueue"; int queuePriority = 25; List <ParameterBase> parameters = new List <ParameterBase>(); ProjectStatus projectStatus = new ProjectStatus(projectName, category, activity, buildStatus, status, webURL, lastBuildDate, lastBuildLabel, lastSuccessfulBuildLabel, nextBuildTime, buildStage, queue, queuePriority, parameters); XmlSerializer serializer = new XmlSerializer(typeof(ProjectStatus)); TextWriter writer = new StringWriter(); XmlSerializerNamespaces nmsp = new XmlSerializerNamespaces(); nmsp.Add("", ""); serializer.Serialize(writer, projectStatus, nmsp); Assert.AreEqual("<?xml version=\"1.0\" encoding=\"utf-16\"?>" + Environment.NewLine + "<projectStatus " + "stage=\"" + buildStage + "\" " + "showForceBuildButton=\"true\" " + "showStartStopButton=\"true\" " + "serverName=\"" + Environment.MachineName + "\" " + "status=\"" + status.ToString() + "\" " + "buildStatus=\"" + buildStatus.ToString() + "\" " + "name=\"" + projectName + "\" " + "category=\"" + category + "\" " + "queueName=\"" + queue + "\" " + "queuePriority=\"" + queuePriority.ToString() + "\" " + "url=\"" + webURL + "\" " + "lastBuildDate=\"" + lastBuildDate.ToString("yyyy-MM-ddTHH:mm:ss.FFFFFFF") + "\" " + "lastBuildLabel=\"" + lastBuildLabel + "\" " + "lastSuccessfulBuildLabel=\"" + lastSuccessfulBuildLabel + "\" " + "nextBuildTime=\"" + nextBuildTime.ToString("yyyy-MM-ddTHH:mm:ss.FFFFFFF") + "\"" + ">" + Environment.NewLine + " <activity type=\"" + activity.ToString() + "\" />" + Environment.NewLine + " <parameters />" + Environment.NewLine + "</projectStatus>", writer.ToString()); }
private IntegrationResult CreateIntegrationResult(IntegrationStatus status, bool addModifications) { result.ProjectName = "proj"; result.Label = "1"; result.Status = status; if (addModifications) { result.Modifications = new Modification[1]; result.Modifications[0] = new Modification(); result.Modifications[0].ModifiedTime = new DateTime(2002, 2, 3); } return(result); }
private bool ShouldPublishResult(IIntegrationResult result) { IntegrationStatus integrationStatus = result.Status; if (integrationStatus == IntegrationStatus.Exception) { return(target.PublishExceptions); } else { return(integrationStatus != IntegrationStatus.Unknown); } }
private void AssertPollingGeneratesAppropriateLights(IntegrationStatus status, ProjectState state, bool redLightOn, bool yellowLightOn, bool greenLightOn) { stubProjectMonitor.IntegrationStatus = status; stubProjectMonitor.ProjectState = state; mockLampController.Expect("RedLightOn", redLightOn); mockLampController.Expect("YellowLightOn", yellowLightOn); mockLampController.Expect("GreenLightOn", greenLightOn); stubProjectMonitor.OnPolled(new MonitorPolledEventArgs(stubProjectMonitor)); mockLampController.Verify(); }
private void AssertPollingGeneratesAppropriateLights(IntegrationStatus status, ProjectState state, bool redLightOn, bool yellowLightOn, bool greenLightOn) { stubProjectMonitor.IntegrationStatus = status; stubProjectMonitor.ProjectState = state; mockLampController.SetupSet(controller => controller.RedLightOn = redLightOn).Verifiable(); mockLampController.SetupSet(controller => controller.YellowLightOn = yellowLightOn).Verifiable(); mockLampController.SetupSet(controller => controller.GreenLightOn = greenLightOn).Verifiable(); stubProjectMonitor.OnPolled(new MonitorPolledEventArgs(stubProjectMonitor)); mockLampController.Verify(); }
public void SendStatus(IntegrationStatus integrationStatus, IntegrationRequisition requisition) { var client = GetClientKazPatent(_configuration.KazPatentWebServiceUrl); var argument = new StatusSendArgument { SystemInfo = new SystemInfo { ChainId = requisition.ChainId, MessageDate = DateTime.Now, MessageId = Guid.NewGuid().ToString(), Sender = CommonConstants.SystemInfoSenderNiis }, Status = new Status { RowID = integrationStatus.Id, DocumentID = integrationStatus.RequestBarcode, StatusID = integrationStatus.OnlineRequisitionStatusId, Note = integrationStatus.Note } }; var logAction = new LogAction { DbDateTime = DateTimeOffset.Now, Project = CommonConstants.StatusSender, Type = ProjectTypeStatusSend, Note = $"RequestBarcode = {integrationStatus.RequestBarcode} StatusId = {integrationStatus.OnlineRequisitionStatusId}", SystemInfoQueryId = _logging.CreateLogSystemInfo(Mapper.Map <LogSystemInfo>(argument.SystemInfo)) }; _logging.CreateLogAction(logAction); var result = client.StatusSend(argument); logAction.SystemInfoAnswerId = _logging.CreateLogSystemInfo(Mapper.Map <LogSystemInfo>(result.SystemInfo)); _logging.UpdateLogAction(logAction); if (result.SystemInfo == null) { throw new Exception(); } if (int.Parse(result.SystemInfo.Status.Code) < 0) { var text = $"KazPatent => URL: {requisition.StatusURL} => {result.SystemInfo.Status.MessageKz}"; throw new Exception(text); } }
private string CalculateHtmlColor(IntegrationStatus status) { if (status == IntegrationStatus.Success) { return(Color.Green.Name); } else if (status == IntegrationStatus.Unknown) { return(Color.Yellow.Name); } else { return(Color.Red.Name); } }
private string CalculateHtmlColor(IntegrationStatus status) { if (status == IntegrationStatus.Success) { return Color.Green.Name; } else if (status == IntegrationStatus.Unknown) { return Color.Yellow.Name; } else { return Color.Red.Name; } }
/// <summary> /// Initialise a new populated <see cref="ProjectStatus"/>. /// </summary> /// <param name="name"></param> /// <param name="category"></param> /// <param name="activity"></param> /// <param name="buildStatus"></param> /// <param name="status"></param> /// <param name="webURL"></param> /// <param name="lastBuildDate"></param> /// <param name="lastBuildLabel"></param> /// <param name="lastSuccessfulBuildLabel"></param> /// <param name="nextBuildTime"></param> /// <param name="buildStage"></param> /// <param name="queue"></param> /// <param name="queuePriority"></param> public ProjectStatus(string name, string category, ProjectActivity activity, IntegrationStatus buildStatus, ProjectIntegratorState status, string webURL, DateTime lastBuildDate, string lastBuildLabel, string lastSuccessfulBuildLabel, DateTime nextBuildTime, string buildStage, string queue, int queuePriority) { this.status = status; this.buildStatus = buildStatus; this.activity = activity; this.name = name; this.category = category; this.webURL = webURL; this.lastBuildDate = new SerializableDateTime(lastBuildDate); this.lastBuildLabel = lastBuildLabel; this.lastSuccessfulBuildLabel = lastSuccessfulBuildLabel; this.nextBuildTime = new SerializableDateTime(nextBuildTime); this.currentBuildStage = buildStage; this.queue = queue; this.queuePriority = queuePriority; }
public ProjectStatus(string name, string category, ProjectActivity activity, IntegrationStatus buildStatus, ProjectIntegratorState status, string webURL, DateTime lastBuildDate, string lastBuildLabel, string lastSuccessfulBuildLabel, DateTime nextBuildTime, string buildStage, string queue, int queuePriority, List<ParameterBase> parameters) { this.status = status; this.buildStatus = buildStatus; this.activity = activity; this.name = name; this.category = category; this.webURL = webURL; this.lastBuildDate = lastBuildDate; this.lastBuildLabel = lastBuildLabel; this.lastSuccessfulBuildLabel = lastSuccessfulBuildLabel; this.nextBuildTime = nextBuildTime; this.currentBuildStage = buildStage; this.queue = queue; this.queuePriority = queuePriority; this.parameters = parameters; }
public ProjectStatus(ProjectIntegratorState status, IntegrationStatus buildStatus, ProjectActivity activity, string name, string webURL, DateTime lastBuildDate, TimeSpan lastBuildDuration, string lastBuildLabel, string lastSuccessfulBuildLabel, DateTime nextBuildTime, string forcee, Modification[] modifications, DateTime currentBuildStartTime, BuildCondition buildCondition) { this.status = status; this.buildStatus = buildStatus; this.activity = activity; this.name = name; this.webURL = webURL; this.lastBuildDate = lastBuildDate; this.lastBuildLabel = lastBuildLabel; this.lastSuccessfulBuildLabel = lastSuccessfulBuildLabel; this.nextBuildTime = nextBuildTime; this._Forcee = forcee; this._Modifications = modifications; this.currentBuildStartTime = currentBuildStartTime; this.buildCondition = buildCondition; this.lastBuildDuration = lastBuildDuration; }
public static ProjectStatus New(string project, string category, ProjectActivity activity, IntegrationStatus integrationStatus, ProjectIntegratorState integratorState, string label, DateTime lastBuildDate, string buildStage) { return new ProjectStatus(project, category, activity, integrationStatus, integratorState, DefaultUrl, lastBuildDate, label, label, DefaultLastBuildDate, buildStage, string.Empty, 0, new List<ParameterBase>()); }
public ProjectStatus(string name, string category, ProjectActivity activity, IntegrationStatus buildStatus, ProjectIntegratorState status, string webURL, DateTime lastBuildDate, string lastBuildLabel, string lastSuccessfulBuildLabel, DateTime nextBuildTime, string buildStage, string queue, int queuePriority, ParameterBase[] parameters) : this(name, category, activity, buildStatus, status, webURL, lastBuildDate, lastBuildLabel, lastSuccessfulBuildLabel, nextBuildTime, buildStage, queue, queuePriority, (parameters == null) ? new List<ParameterBase>() : new List<ParameterBase>(parameters)) { }
public static ProjectStatus New(IntegrationStatus integrationStatus, ProjectActivity activity, DateTime lastBuildDate) { return New(DefaultProject, activity, integrationStatus, DefaultIntegratorState, DefaultLabel, lastBuildDate); }
private void AssertTransition( IntegrationStatus initialIntegrationStatus, IntegrationStatus nextBuildIntegrationStatus, BuildTransition expectedBuildTransition) { // initial connection ProjectStatus status = CreateProjectStatus(initialIntegrationStatus, new DateTime(2004, 1, 1)); mockProjectManager.ExpectAndReturn("ProjectName", PROJECT_NAME); mockServerMonitor.ExpectAndReturn("GetProjectStatus", status, PROJECT_NAME); monitor.Poll(); // then the build status = CreateProjectStatus(nextBuildIntegrationStatus, new DateTime(2004, 1, 2)); mockProjectManager.ExpectAndReturn("ProjectName", PROJECT_NAME); mockServerMonitor.ExpectAndReturn("GetProjectStatus", status, PROJECT_NAME); monitor.Poll(); Assert.AreEqual(1, buildOccurredCount); Assert.AreEqual(expectedBuildTransition, lastBuildOccurredArgs.BuildTransition); buildOccurredCount = 0; }
/// <summary> /// Initialise a new populated <see cref="ProjectStatus"/>. /// </summary> /// <param name="name"></param> /// <param name="buildStatus"></param> /// <param name="lastBuildDate"></param> public ProjectStatus(string name, IntegrationStatus buildStatus, DateTime lastBuildDate) { this.name = name; this.buildStatus = buildStatus; this.lastBuildDate = new SerializableDateTime(lastBuildDate); }
private ProjectStatus NewProjectStatus(string name, IntegrationStatus integrationStatus, DateTime dateTime) { return ProjectStatusFixture.New(name, integrationStatus, dateTime); }
public static ProjectStatus New(string name, IntegrationStatus integrationStatus) { return New(name, integrationStatus, DefaultLastBuildDate); }
private IntegrationResult CreateIntegrationResult(IntegrationStatus status,int buildNumber, string artifactFolder ) { IntegrationResult result = IntegrationResultMother.Create(status, new DateTime(1980, 1, 1,1,0,0,buildNumber)); result.ProjectName = "proj"; result.StartTime = new DateTime(1980, 1, 1); result.Label = buildNumber.ToString(); result.Status = status; result.ArtifactDirectory = artifactFolder; return result; }
/// <summary> /// Initialise a new instance of <see cref="IntegrationCompletedEventArgs"/>. /// </summary> /// <param name="request">The request to process.</param> /// <param name="projectName"></param> /// <param name="status"></param> public IntegrationCompletedEventArgs(IntegrationRequest request, string projectName, IntegrationStatus status) : base(projectName) { this.request = request; this.status = status; }
private IntegrationResult CreateIntegrationResult(IntegrationStatus status, bool addModifications) { result.ProjectName = "proj"; result.Label = "1"; result.Status = status; if (addModifications) { result.Modifications = new Modification[1]; result.Modifications[0] = new Modification(); result.Modifications[0].ModifiedTime = new DateTime(2002, 2, 3); } return result; }
/// <summary> /// Merges another result. /// </summary> /// <param name="value">The result to merge.</param> public virtual void Merge(IIntegrationResult value) { // Apply some rules to the status merging - basically apply a hierachy of status codes if ((value.Status == IntegrationStatus.Exception) || (this.status == IntegrationStatus.Unknown)) { this.status = value.Status; } else if (((value.Status == IntegrationStatus.Failure) || (value.Status == IntegrationStatus.Cancelled)) && (this.status != IntegrationStatus.Exception)) { this.status = value.Status; } // Merge the exceptions if (value.ExceptionResult != null) { if (this.exception != null) { var mutliple = this.exception as MultipleIntegrationFailureException; if (mutliple == null) { mutliple = new MultipleIntegrationFailureException(this.exception); this.exception = mutliple; } mutliple.AddFailure(value.ExceptionResult); } else { this.exception = value.ExceptionResult; } } // Merge the results foreach (ITaskResult result in value.TaskResults) { AddTaskResult(result); } }
public static ProjectStatus New(string name, IntegrationStatus integrationStatus, DateTime lastBuildDate) { return New(name, ProjectActivity.Building, integrationStatus, DefaultIntegratorState, DefaultLabel, lastBuildDate); }
private ProjectStatus CreateProjectStatus(IntegrationStatus integrationStatus, DateTime lastBuildDate) { return ProjectStatusFixture.New(integrationStatus, lastBuildDate); }
private ProjectStatus CreateProjectStatus(IntegrationStatus integrationStatus, ProjectActivity activity) { return ProjectStatusFixture.New(integrationStatus, activity); }
public static IntegrationResult CreateSuccessful(IntegrationStatus previousIntegrationStatus) { return Create(IntegrationStatus.Success, previousIntegrationStatus, DateTime.Now); }
public static IntegrationResult CreateFailed(IntegrationStatus previousIntegrationStatus) { return Create(IntegrationStatus.Failure, previousIntegrationStatus, DateTime.Now); }
/// <summary> /// Initializes a new instance of the <see cref="CCProject"/> class from being created. /// </summary> /// <param name="client">The client.</param> /// <param name="name">The name.</param> /// <param name="category">The category.</param> /// <param name="activity">The activity.</param> /// <param name="buildStatus">The build status.</param> /// <param name="status">The status.</param> /// <param name="webURL">The web URL.</param> /// <param name="lastBuildDate">The last build date.</param> /// <param name="lastBuildLabel">The last build label.</param> /// <param name="lastSuccessfulBuildLabel">The last successful build label.</param> /// <param name="nextBuildTime">The next build time.</param> /// <param name="buildStage">The build stage.</param> /// <param name="queue">The queue.</param> /// <param name="queuePriority">The queue priority.</param> /// <param name="parameters">The project parameters</param> private CCProject(CruiseServerClientBase client, string name, string category, ProjectActivity activity, IntegrationStatus buildStatus, ProjectIntegratorState status, string webURL, DateTime lastBuildDate, string lastBuildLabel, string lastSuccessfulBuildLabel, DateTime nextBuildTime, string buildStage, string queue, int queuePriority, List<ParameterBase> parameters) : base(name, category, activity, buildStatus, status, webURL, lastBuildDate, lastBuildLabel, lastSuccessfulBuildLabel, nextBuildTime, buildStage, queue, queuePriority, parameters) { this.client = client; }