private InstallationComponent CreateBuildRunFinishTimeProperty() { return(new InstallationComponent("Creating build run finish time property", BuildRunInstallationActions.CreateFinishTimeProperty(), OtherActions.DoNothing(), OtherActions.DoNothing())); }
private InstallationComponent GetTargetCrmUrlInstallationComponent() { return(new InstallationComponent("Creating build target CRM URL field", BuildInstallationActions.CreateTargetCrmUrlField(), OtherActions.DoNothing(), OtherActions.DoNothing())); }
private InstallationComponent CreateBuildRunMessageOrderProperty() { return(new InstallationComponent("Creating build run message order property", BuildRunMessageInstallationActions.CreateOrderProperty(), OtherActions.DoNothing(), OtherActions.DoNothing())); }
private InstallationComponent CreateBuildRunEntity() { return(new InstallationComponent("Creating build run entity", BuildRunInstallationActions.CreateEntity(), OtherActions.DoNothing(), BuildRunInstallationActions.DeleteEntity())); }
private InstallationComponent GetTargetPasswordInstallationComponent() { return(new InstallationComponent("Creating build target password field", BuildInstallationActions.CreateTargetPasswordField(), OtherActions.DoNothing(), OtherActions.DoNothing())); }
private InstallationComponent CreateSolutionIdProperty() { return(new InstallationComponent("Creating solution id property", BuildInstallationActions.CreateSolutionIdField(), OtherActions.DoNothing(), OtherActions.DoNothing())); }
private InstallationComponent GetTargetUsernameInstallationComponent() { return(new InstallationComponent("Creating build target username field", BuildInstallationActions.CreateTargetUsernameField(), OtherActions.DoNothing(), OtherActions.DoNothing())); }
private InstallationComponent GetTargetDomainInstallationComponent() { return(new InstallationComponent("Creating build target domain field", BuildInstallationActions.CreateTargetDomainField(), OtherActions.DoNothing(), OtherActions.DoNothing())); }
private InstallationComponent GetTargetEmailAddressInstallationComponent() { return(new InstallationComponent("Creating build target email address field", BuildInstallationActions.CreateTargetEmailField(), OtherActions.DoNothing(), OtherActions.DoNothing())); }
private InstallationComponent CreateBuildToBuildRunRelationship() { return(new InstallationComponent("Creating relationship between build and build run entities", BuildInstallationActions.CreateRelationshipWithBuildRunEntity(), OtherActions.DoNothing(), OtherActions.DoNothing())); }
private InstallationComponent CreateBuildRunStatusProperty() { return(new InstallationComponent("Creating build run status property", BuildRunInstallationActions.CreateStatusProperty(), OtherActions.DoNothing(), OtherActions.DoNothing())); }
public void InstallNextComponent_WithUnknownVersionComponent_FailsInstallation() { var unknownVersion = new Version(int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue); var currentVersion = new Version("0.0.0.1"); var latestVersion = new Version("0.0.0.2"); var component = new InstallationComponent("dshajdkh", OtherActions.DoNothing(), OtherActions.DoNothing(), OtherActions.DoNothing()); // Does nothing on installation or rollback var installationComponents = new Dictionary <int, InstallationComponent>(); installationComponents.Add(0, component); A.CallTo(() => discovery.Discover()) .Returns(new List <InstallationVersion> { new TestInstallationVersion(currentVersion, new Dictionary <int, InstallationComponent>()), new TestInstallationVersion(latestVersion, installationComponents), }); var dispatcher = A.Fake <IDataAccessDispatcher>(); A.CallTo(() => dispatcher.Dispatch(A <DataAccessAction <Solution> > ._)) .Returns(new Solution { Name = "TestSolution", DisplayName = "Test Solution", Version = currentVersion.ToString() }); var result = new InstallationService(discovery, dispatcher).InstallNextComponent(int.MaxValue, latestVersion); Assert.False(result.IsSuccess); Assert.False(result.MoreToInstall); Assert.NotNull(result.ErrorMessage); }
private InstallationComponent GetTargetAuthenticationTypeInstallationComponent() { return(new InstallationComponent("Creating build target authentication type field", BuildInstallationActions.CreateTargetAuthenticationTypeField(), OtherActions.DoNothing(), OtherActions.DoNothing())); }
private InstallationComponent RemoveExistingBuilds() { return(new InstallationComponent("Removing any existing builds", OtherActions.DoNothing(), BuildActions.DeleteAllBuilds(), OtherActions.DoNothing())); }
private InstallationComponent CreateMinorVersionProperty() { return(new InstallationComponent( "Creating minor version property", BuildInstallationActions.CreateMinorVersionField(), OtherActions.DoNothing(), OtherActions.DoNothing())); }
private void RegisterComponents() { var createBuildVersioningTypeOption = new InstallationComponent("Adding build versioning type option", BuildInstallationActions.CreateBuildVersioningTypeField(), OtherActions.DoNothing(), OtherActions.DoNothing()); RegisterNextComponent(createBuildVersioningTypeOption); }
public void InstallNextComponent_ForTwoNewVersionsWithTwoComponents_InstallationIsNotComplete_AndGivesDetailsOfNextComponentToInstall() { var currentVersion = new Version("0.0.0.1"); var firstNewVersion = new Version("0.0.0.2"); var secondNewVersion = new Version("0.0.0.3"); var firstComponentDescription = "dhjskldsa"; var secondComponentDescription = "DLAOIEHJK"; var firstComponent = new InstallationComponent(firstComponentDescription, OtherActions.DoNothing(), OtherActions.DoNothing(), OtherActions.DoNothing()); // Does nothing on installation or rollback var secondComponent = new InstallationComponent(secondComponentDescription, OtherActions.DoNothing(), OtherActions.DoNothing(), OtherActions.DoNothing()); var firstNewVersionComponents = new Dictionary <int, InstallationComponent>(); firstNewVersionComponents.Add(0, firstComponent); var secondNewVersionComponents = new Dictionary <int, InstallationComponent>(); secondNewVersionComponents.Add(0, secondComponent); A.CallTo(() => discovery.Discover()) .Returns(new List <InstallationVersion> { new TestInstallationVersion(currentVersion, new Dictionary <int, InstallationComponent>()), new TestInstallationVersion(firstNewVersion, firstNewVersionComponents), new TestInstallationVersion(secondNewVersion, secondNewVersionComponents), }); var dispatcher = A.Fake <IDataAccessDispatcher>(); A.CallTo(() => dispatcher.Dispatch(A <DataAccessAction <Solution> > ._)) .Returns(new Solution { Name = "TestSolution", DisplayName = "Test Solution", Version = currentVersion.ToString() }); var installation = new InstallationService(discovery, dispatcher); var startInstallationResult = installation.StartInstallation(); var result = installation.InstallNextComponent(startInstallationResult.NextComponentId.Value, startInstallationResult.Version); Assert.True(result.IsSuccess); Assert.True(result.MoreToInstall); Assert.Equal(secondComponentDescription, result.NextComponentDescription); Assert.True(result.NextComponentId.HasValue); Assert.Equal(0, result.NextComponentId.Value); Assert.NotNull(result.NextComponentVersion); Assert.Equal(0, secondNewVersion.CompareTo(result.NextComponentVersion)); }
private void RegisterComponents() { var createEntity = new InstallationComponent("Creating build entity", BuildInstallationActions.CreateEntity(), OtherActions.DoNothing(), OtherActions.DoNothing()); var createName = new InstallationComponent("Creating build entity name", BuildInstallationActions.CreateNameField(), OtherActions.DoNothing(), OtherActions.DoNothing()); // Rollback is covered by deletion of entity in first component RegisterNextComponent(createEntity); RegisterNextComponent(createName); }
public void InstallNextComponent_ForTwoNewVersionsWithTwoComponents_UpdatesSolutionVersionAsFirstComponentInstalled() { var currentVersion = new Version("0.0.0.1"); var firstNewVersion = new Version("0.0.0.2"); var secondNewVersion = new Version("0.0.0.3"); var firstComponentDescription = "dhjskldsa"; var secondComponentDescription = "DLAOIEHJK"; var firstComponent = new InstallationComponent(firstComponentDescription, OtherActions.DoNothing(), OtherActions.DoNothing(), OtherActions.DoNothing()); // Does nothing on installation or rollback var secondComponent = new InstallationComponent(secondComponentDescription, OtherActions.DoNothing(), OtherActions.DoNothing(), OtherActions.DoNothing()); var firstNewVersionComponents = new Dictionary <int, InstallationComponent>(); firstNewVersionComponents.Add(0, firstComponent); var secondNewVersionComponents = new Dictionary <int, InstallationComponent>(); secondNewVersionComponents.Add(0, secondComponent); A.CallTo(() => discovery.Discover()) .Returns(new List <InstallationVersion> { new TestInstallationVersion(currentVersion, new Dictionary <int, InstallationComponent>()), new TestInstallationVersion(firstNewVersion, firstNewVersionComponents), new TestInstallationVersion(secondNewVersion, secondNewVersionComponents), }); var dispatcher = A.Fake <IDataAccessDispatcher>(); A.CallTo(() => dispatcher.Dispatch(A <DataAccessAction <Solution> > ._)) .Returns(new Solution { Name = "TestSolution", DisplayName = "Test Solution", Version = currentVersion.ToString() }); var installation = new Services.Installation.InstallationService(discovery, dispatcher); var startInstallationResult = installation.StartInstallation(); var result = installation.InstallNextComponent(startInstallationResult.NextComponentId.Value, startInstallationResult.NextComponentVersion); A.CallTo(() => dispatcher.Dispatch(A <DataAccessAction> ._)) .MustHaveHappened(); }
public void StartInstallation_ForNewVersionWithOneComponent_InstallationIsNotComplete_AndReturnsDetailsOfFirstComponent() { var currentVersion = new Version("0.0.0.1"); var latestVersion = new Version("0.0.0.2"); var componentDescription = "dhjskldsa"; var componentInstall = new InstallationComponent(componentDescription, OtherActions.DoNothing(), OtherActions.DoNothing(), OtherActions.DoNothing()); var components = new Dictionary <int, InstallationComponent>(); components.Add(0, componentInstall); A.CallTo(() => discovery.Discover()) .Returns(new List <InstallationVersion> { new TestInstallationVersion(currentVersion, new Dictionary <int, InstallationComponent>()), new TestInstallationVersion(latestVersion, components), }); var dispatcher = A.Fake <IDataAccessDispatcher>(); A.CallTo(() => dispatcher.Dispatch(A <DataAccessAction <Solution> > ._)) .Returns(new Solution { Name = "TestSolution", DisplayName = "Test Solution", Version = currentVersion.ToString() }); var result = new InstallationService(discovery, dispatcher).StartInstallation(); Assert.True(result.IsSuccess); Assert.Equal(componentDescription, result.NextComponentDescription); Assert.Equal(0, result.NextComponentId); Assert.Equal("0.0.0.2", result.NextComponentVersion.ToString()); Assert.True(result.MoreToInstall); }