Example #1
0
 public ProjectEditor(
     IProjectRepository repository,
     IChannelRepository channelRepository,
     IDeploymentProcessRepository deploymentProcessRepository,
     IProjectTriggerRepository projectTriggerRepository,
     IVariableSetRepository variableSetRepository)
 {
     this.repository   = repository;
     channels          = new Lazy <ProjectChannelsEditor>(() => new ProjectChannelsEditor(channelRepository, Instance));
     deploymentProcess = new Lazy <DeploymentProcessEditor>(() => new DeploymentProcessEditor(deploymentProcessRepository).Load(Instance.DeploymentProcessId));
     triggers          = new Lazy <ProjectTriggersEditor>(() => new ProjectTriggersEditor(projectTriggerRepository, Instance));
     variables         = new Lazy <VariableSetEditor>(() => new VariableSetEditor(variableSetRepository).Load(Instance.VariableSetId));
 }
 public DeploymentProcessService(
     ILogger <IDeploymentProcessRepository> logger,
     IDeploymentProcessRepository deploymentProcessRepository,
     IApiDeploymentProcessRequestModelValidator deploymentProcessModelValidator,
     IBOLDeploymentProcessMapper boldeploymentProcessMapper,
     IDALDeploymentProcessMapper daldeploymentProcessMapper
     )
     : base(logger,
            deploymentProcessRepository,
            deploymentProcessModelValidator,
            boldeploymentProcessMapper,
            daldeploymentProcessMapper)
 {
 }
 public AbstractDeploymentProcessService(
     ILogger logger,
     IDeploymentProcessRepository deploymentProcessRepository,
     IApiDeploymentProcessRequestModelValidator deploymentProcessModelValidator,
     IBOLDeploymentProcessMapper bolDeploymentProcessMapper,
     IDALDeploymentProcessMapper dalDeploymentProcessMapper)
     : base()
 {
     this.deploymentProcessRepository     = deploymentProcessRepository;
     this.deploymentProcessModelValidator = deploymentProcessModelValidator;
     this.bolDeploymentProcessMapper      = bolDeploymentProcessMapper;
     this.dalDeploymentProcessMapper      = dalDeploymentProcessMapper;
     this.logger = logger;
 }
Example #4
0
        public void Setup()
        {
            // setup data objects
            channelVersionRules = new List <ChannelVersionRuleResource>();
            projectResource     = new ProjectResource
            {
                DeploymentProcessId = TestHelpers.GetId("deploymentprocess"),
                Id = TestHelpers.GetId("project")
            };
            deploymentProcessResource = new DeploymentProcessResource
            {
                ProjectId = projectResource.Id,
                Id        = projectResource.DeploymentProcessId
            };

            releaseTemplateResource = new ReleaseTemplateResource
            {
                DeploymentProcessId = projectResource.DeploymentProcessId,
                Packages            = new List <ReleaseTemplatePackage>(),
                Id = TestHelpers.GetId("releaseTemplate")
            };
            channelResource = new ChannelResource
            {
                IsDefault = true,
                Id        = TestHelpers.GetId("channel"),
                ProjectId = projectResource.Id,
                Rules     = channelVersionRules,
                Name      = TestHelpers.GetId("channelname")
            };
            feedResource = new FeedResource
            {
                Links = new LinkCollection {
                    { "SearchTemplate", TestHelpers.GetId("searchUri") }
                }
            };

            // setup mocks
            logger            = Substitute.For <ILogger>();
            versionResolver   = Substitute.For <IPackageVersionResolver>();
            versionRuleTester = Substitute.For <IChannelVersionRuleTester>();

            deploymentProcessRepository = Substitute.For <IDeploymentProcessRepository>();
            deploymentProcessRepository.Get(projectResource.DeploymentProcessId)
            .Returns(Task.FromResult(deploymentProcessResource));
            deploymentProcessRepository
            .GetTemplate(Arg.Is <DeploymentProcessResource>(deploymentProcessResource),
                         Arg.Is <ChannelResource>(channelResource)).Returns(Task.FromResult(releaseTemplateResource));
            versionRuleTester
            .Test(Arg.Any <IOctopusAsyncRepository>(), Arg.Any <ChannelVersionRuleResource>(), Arg.Any <string>())
            .Returns(Task.FromResult(channelVersionRuleTestResult));

            releaseRepository = Substitute.For <IReleaseRepository>();
            feedRepository    = Substitute.For <IFeedRepository>();
            feedRepository.Get(Arg.Any <string>()).Returns(feedResource);

            repository = Substitute.For <IOctopusAsyncRepository>();
            repository.DeploymentProcesses.Returns(deploymentProcessRepository);
            repository.Releases.Returns(releaseRepository);
            repository.Feeds.Returns(feedRepository);
            repository.Client
            .Get <List <PackageResource> >(Arg.Any <string>(), Arg.Any <IDictionary <string, object> >()).Returns(packages);

            builder = new ReleasePlanBuilder(logger, versionResolver, versionRuleTester);
        }
 public DeploymentProcessEditor(IDeploymentProcessRepository repository)
 {
     this.repository = repository;
 }
 public ApiDeploymentProcessRequestModelValidator(IDeploymentProcessRepository deploymentProcessRepository)
     : base(deploymentProcessRepository)
 {
 }
        public void Setup()
        {
            // setup data objects
            channelVersionRules = new List <ChannelVersionRuleResource>();
            projectResource     = new ProjectResource
            {
                DeploymentProcessId = TestHelpers.GetId("deploymentprocess"),
                Id = TestHelpers.GetId("project")
            };
            deploymentProcessResource = new DeploymentProcessResource
            {
                ProjectId = projectResource.Id,
                Id        = projectResource.DeploymentProcessId
            };

            releaseTemplateResource = new ReleaseTemplateResource
            {
                DeploymentProcessId = projectResource.DeploymentProcessId,
                Packages            = new List <ReleaseTemplatePackage>(),
                Id = TestHelpers.GetId("releaseTemplate")
            };
            channelResource = new ChannelResource
            {
                IsDefault = true,
                Id        = TestHelpers.GetId("channel"),
                ProjectId = projectResource.Id,
                Rules     = channelVersionRules,
                Name      = TestHelpers.GetId("channelname")
            };
            feedResource = new FeedResource
            {
                Id    = BuiltInFeedId,
                Name  = "Built in feed",
                Links = new LinkCollection {
                    { "SearchTemplate", TestHelpers.GetId("searchUri") }
                }
            };

            // setup mocks
            logger                = Substitute.For <ILogger>();
            versionResolver       = Substitute.For <IPackageVersionResolver>();
            versionRuleTester     = Substitute.For <IChannelVersionRuleTester>();
            commandOutputProvider = Substitute.For <ICommandOutputProvider>();

            deploymentProcessRepository = Substitute.For <IDeploymentProcessRepository>();
            deploymentProcessRepository.Get(projectResource.DeploymentProcessId)
            .Returns(Task.FromResult(deploymentProcessResource));
            deploymentProcessRepository
            .GetTemplate(Arg.Is(deploymentProcessResource),
                         Arg.Is(channelResource))
            .Returns(Task.FromResult(releaseTemplateResource));
            versionRuleTester
            .Test(Arg.Any <IOctopusAsyncRepository>(), Arg.Any <ChannelVersionRuleResource>(), Arg.Any <string>(), Arg.Any <string>())
            .Returns(Task.FromResult(channelVersionRuleTestResult));

            deploymentProcessRepositoryBeta = Substitute.For <IDeploymentProcessRepositoryBeta>();
            deploymentProcessRepositoryBeta.Get(projectResource, Arg.Any <string>())
            .Returns(Task.FromResult(deploymentProcessResource));

            var feeds = new List <FeedResource>
            {
                feedResource
            };

            releaseRepository = Substitute.For <IReleaseRepository>();
            feedRepository    = Substitute.For <IFeedRepository>();
            feedRepository.Get(Arg.Any <string[]>()).Returns(feeds);
            feedRepository.FindByNames(Arg.Any <IEnumerable <string> >()).Returns(feeds);

            repository = Substitute.For <IOctopusAsyncRepository>();
            repository.DeploymentProcesses.Returns(deploymentProcessRepository);
            repository.DeploymentProcesses.Beta().Returns(deploymentProcessRepositoryBeta);
            repository.Releases.Returns(releaseRepository);
            repository.Feeds.Returns(feedRepository);
            repository.Client
            .Get <List <PackageResource> >(Arg.Any <string>(), Arg.Any <IDictionary <string, object> >())
            .Returns(packages);

            builder      = new ReleasePlanBuilder(logger, versionResolver, versionRuleTester, commandOutputProvider);
            gitReference = null;
        }
Example #8
0
 public AbstractApiDeploymentProcessRequestModelValidator(IDeploymentProcessRepository deploymentProcessRepository)
 {
     this.deploymentProcessRepository = deploymentProcessRepository;
 }