private void InitializeDataProviders() { try { SpecIfPluginConfiguration configuration = _configurationReaderWriter.GetConfiguration(); _metadataReader = new SpecIfFileMetadataReader(configuration.SpecIfMetadataDirectory); _specIfDataReader = new SpecIfJiraDataReader(configuration.JiraURL, configuration.JiraUserName, configuration.JiraApiKey, _metadataReader); _requirementMasterDataWriter = new SpecIfJiraDataWriter(configuration.JiraURL, configuration.JiraUserName, configuration.JiraApiKey, _metadataReader, _specIfDataReader); _projectIntegrator = new ProjectIntegrator(_repository, _metadataReader, _specIfDataReader); } catch (Exception exception) { MessageBox.Show("Error initializing the data providers\r\n" + exception.StackTrace, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); logger.Error(exception); } }
public void SetUp() { integrationTriggerMock = new Mock <ITrigger>(MockBehavior.Strict); projectMock = new Mock <IProject>(MockBehavior.Strict); projectMock.SetupGet(_project => _project.Name).Returns("project"); projectMock.SetupGet(_project => _project.QueueName).Returns(TestQueueName); projectMock.SetupGet(_project => _project.QueuePriority).Returns(0); projectMock.SetupGet(_project => _project.Triggers).Returns(integrationTriggerMock.Object); projectMock.SetupGet(_project => _project.WorkingDirectory).Returns(tempWorkingDir1); projectMock.SetupGet(_project => _project.ArtifactDirectory).Returns(tempArtifactDir1); integrationQueues = new IntegrationQueueSet(); integrationQueues.Add(TestQueueName, new DefaultQueueConfiguration(TestQueueName)); integrationQueue = integrationQueues[TestQueueName]; integrator = new ProjectIntegrator((IProject)projectMock.Object, integrationQueue); }
public void SetUp() { integrationTriggerMock = new LatchMock(typeof(ITrigger)); integrationTriggerMock.Strict = true; projectMock = new LatchMock(typeof(IProject)); projectMock.Strict = true; projectMock.SetupResult("Name", "project"); projectMock.SetupResult("QueueName", TestQueueName); projectMock.SetupResult("QueuePriority", 0); projectMock.SetupResult("Triggers", integrationTriggerMock.MockInstance); projectMock.SetupResult("WorkingDirectory", tempWorkingDir1); projectMock.SetupResult("ArtifactDirectory", tempArtifactDir1); integrationQueues = new IntegrationQueueSet(); integrationQueues.Add(TestQueueName, new DefaultQueueConfiguration(TestQueueName)); integrationQueue = integrationQueues[TestQueueName]; integrator = new ProjectIntegrator((IProject)projectMock.MockInstance, integrationQueue); }
public void CancellingAPendingRequestWhileNotBuildingGoesToSleeping() { LatchMock otherProjectMock = new LatchMock(typeof(IProject)); otherProjectMock.Strict = true; otherProjectMock.SetupResult("Name", "otherProject"); otherProjectMock.SetupResult("QueueName", TestQueueName); otherProjectMock.SetupResult("QueuePriority", 0); otherProjectMock.SetupResult("Triggers", integrationTriggerMock.MockInstance); otherProjectMock.SetupResult("WorkingDirectory", tempDir + "tempWorkingDir2"); otherProjectMock.SetupResult("ArtifactDirectory", tempDir + "tempArtifactDir2"); IProject otherProject = (IProject)otherProjectMock.MockInstance; IProject project = (IProject)projectMock.MockInstance; ProjectIntegrator otherIntegrator = new ProjectIntegrator(otherProject, integrationQueue); // Queue up the "otherProject" in the first queue position to build IntegrationRequest otherProjectRequest = new IntegrationRequest(BuildCondition.IfModificationExists, "intervalTrigger", null); otherProjectMock.Expect("NotifyPendingState"); // Queue up our test project on the same queue as so it goes to pending IntegrationRequest request2 = new IntegrationRequest(BuildCondition.IfModificationExists, "intervalTrigger", null); projectMock.Expect("NotifyPendingState"); // Cancelling the pending request should revert status to sleeping projectMock.Expect("NotifySleepingState"); integrationTriggerMock.Expect("IntegrationCompleted"); integrationQueue.Enqueue(new IntegrationQueueItem(otherProject, otherProjectRequest, otherIntegrator)); integrationQueue.Enqueue(new IntegrationQueueItem(project, request2, integrator)); // Cancel second build project on queue integrator.CancelPendingRequest(); otherProjectMock.Verify(); VerifyAll(); }
public void CancellingAPendingRequestWhileNotBuildingGoesToSleeping() { var otherProjectMock = new Mock <IProject>(MockBehavior.Strict); otherProjectMock.SetupGet(_project => _project.Name).Returns("otherProject"); otherProjectMock.SetupGet(_project => _project.QueueName).Returns(TestQueueName); otherProjectMock.SetupGet(_project => _project.QueuePriority).Returns(0); otherProjectMock.SetupGet(_project => _project.Triggers).Returns(integrationTriggerMock.Object); otherProjectMock.SetupGet(_project => _project.WorkingDirectory).Returns(tempDir + "tempWorkingDir2"); otherProjectMock.SetupGet(_project => _project.ArtifactDirectory).Returns(tempDir + "tempArtifactDir2"); IProject otherProject = (IProject)otherProjectMock.Object; IProject project = (IProject)projectMock.Object; ProjectIntegrator otherIntegrator = new ProjectIntegrator(otherProject, integrationQueue); // Queue up the "otherProject" in the first queue position to build IntegrationRequest otherProjectRequest = new IntegrationRequest(BuildCondition.IfModificationExists, "intervalTrigger", null); otherProjectMock.Setup(_project => _project.NotifyPendingState()).Verifiable(); // Queue up our test project on the same queue as so it goes to pending IntegrationRequest request2 = new IntegrationRequest(BuildCondition.IfModificationExists, "intervalTrigger", null); projectMock.Setup(_project => _project.NotifyPendingState()).Verifiable(); // Cancelling the pending request should revert status to sleeping projectMock.Setup(_project => _project.NotifySleepingState()).Verifiable(); integrationTriggerMock.Setup(_trigger => _trigger.IntegrationCompleted()).Verifiable(); integrationQueue.Enqueue(new IntegrationQueueItem(otherProject, otherProjectRequest, otherIntegrator)); integrationQueue.Enqueue(new IntegrationQueueItem(project, request2, integrator)); // Cancel second build project on queue integrator.CancelPendingRequest(); otherProjectMock.Verify(); VerifyAll(); }