public OctopusCreateReleaseStep(OctopusConnector client, NugetClient nugetClient, InstanceDeploy instance)
 {
     this.client = client;
     this.nugetClient = nugetClient;
     this.instance = instance;
     Name = "Creating Release.";
 }
Esempio n. 2
0
 public UpdateCommand(NugetClient nugetClient, DBDepsConfigurationFile configurationFile,
                      DependencyManager dependencyManager)
 {
     this.nugetClient       = nugetClient;
     this.configurationFile = configurationFile;
     this.dependencyManager = dependencyManager;
 }
        GetPackageSearchMetadataAsync
        (
        )
        {
            IEnumerable <IPackageSearchMetadata> package_metadata = null;

            package_metadata = await NugetClient.GetPackageMetadataAsync
                               (
                this.PackageId
                               ).ConfigureAwait(false);

            // sorting in reverse order of version
            // in order to hit later versions first (speeding up) when iterating through
            // IEnumebrable/collections/containers
            package_metadata = from IPackageSearchMetadata psm in package_metadata
                               orderby psm.Identity.Version descending
                               select psm
            ;
            IEnumerable <string> versions = null;

            versions = from IPackageSearchMetadata psm in package_metadata
                       // no need to sort - done above
                       //orderby psm.Identity.Version descending
                       select psm.Identity.Version.ToFullString()
            ;

            this.VersionsTextual = versions.ToList();

            return(package_metadata);
        }
Esempio n. 4
0
        public async Task WhenPassNullParameterToGetConfigurationThenExceptionIsThrown()
        {
            // ARRANGE
            var nugetClient = new NugetClient(new HttpClientFactory());

            // ASSERT
            await Assert.ThrowsAsync <ArgumentNullException>(() => nugetClient.GetConfiguration(null));
        }
Esempio n. 5
0
 public InstallCommand(DependencyManager dependencyManager,
                       NugetClient nugetClient,
                       DBDepsConfigurationFile configurationFile)
 {
     this.dependencyManager = dependencyManager;
     this.nugetClient       = nugetClient;
     this.configurationFile = configurationFile;
 }
        public IModuleLoader BuidlerModuleLoader(ModuleLoaderOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            var nugetClient             = new NugetClient(new HttpClientFactory());
            var moduleFeedClientFactory = new ModuleFeedClientFactory();

            return(new ModuleLoader(nugetClient, moduleFeedClientFactory, options));
        }
Esempio n. 7
0
        public async Task WhenPassNullParameterToDownloadNugetPackageThenExceptionIsThrown()
        {
            // ARRANGE
            var nugetClient = new NugetClient(new HttpClientFactory());

            // ASSERT
            await Assert.ThrowsAsync <ArgumentNullException>(() => nugetClient.DownloadNugetPackage(null, null, null));

            await Assert.ThrowsAsync <ArgumentNullException>(() => nugetClient.DownloadNugetPackage("url", null, null));

            await Assert.ThrowsAsync <ArgumentNullException>(() => nugetClient.DownloadNugetPackage("url", "packageName", null));
        }
        public async Task WhenRestorePackagesAndModuleLoaderIsNotInitializedThenExceptionIsThrown()
        {
            // ARRANGE
            var nugetClient             = new NugetClient(new HttpClientFactory());
            var moduleFeedClientFactory = new ModuleFeedClientFactory();
            var options      = new ModuleLoaderOptions();
            var moduleLoader = new ModuleLoader(nugetClient, moduleFeedClientFactory, options);

            // ACT
            var ex = await Assert.ThrowsAsync <ModuleLoaderInternalException>(() => moduleLoader.RestoreUnits());

            // ASSERT
            Assert.NotNull(ex);
        }
        GetPackageMetadataAsync
        (
        )
        {
            IEnumerable <IPackageSearchMetadata> package_metadata = null;

            package_metadata = await NugetClient.GetPackageMetadataAsync
                               (
                this.PackageId
                               ).ConfigureAwait(false);

            PackageSearchMetadata = package_metadata;

            return(package_metadata);
        }
        public void WhenInitializeModuleLoaderAndNoEnvironmentVariableThenExceptionIsThrown()
        {
            // ARRANGE
            Environment.SetEnvironmentVariable("SID_MODULE", null);
            var nugetClient             = new NugetClient(new HttpClientFactory());
            var moduleFeedClientFactory = new ModuleFeedClientFactory();
            var options      = new ModuleLoaderOptions();
            var moduleLoader = new ModuleLoader(nugetClient, moduleFeedClientFactory, options);

            // ACT
            var exception = Assert.Throws <ModuleLoaderConfigurationException>(() => moduleLoader.Initialize());

            // ASSERT
            Assert.NotNull(exception);
            Assert.Equal($"The SID_MODULE environment variable must be set", exception.Message);
        }
        public void WhenInitializeModuleLoaderAndEnvironmentVariableIsNotValidThenExceptionIsThrown()
        {
            // ARRANGE
            var nugetClient             = new NugetClient(new HttpClientFactory());
            var moduleFeedClientFactory = new ModuleFeedClientFactory();
            var options      = new ModuleLoaderOptions();
            var moduleLoader = new ModuleLoader(nugetClient, moduleFeedClientFactory, options);

            Environment.SetEnvironmentVariable("SID_MODULE", "invalid");

            // ACT
            var exception = Assert.Throws <ModuleLoaderConfigurationException>(() => moduleLoader.Initialize());

            // ASSERT
            Assert.NotNull(exception);
            Assert.Equal("The directory specified in the SID_MODULE environment variable doesn't exist", exception.Message);
        }
        public void WhenInitializeModuleLoaderAndNugetSourcesIsNullThenExceptionIsThrown()
        {
            // ARRANGE
            var nugetClient             = new NugetClient(new HttpClientFactory());
            var moduleFeedClientFactory = new ModuleFeedClientFactory();

            Environment.SetEnvironmentVariable("SID_MODULE", "C:\\");
            var options = new ModuleLoaderOptions
            {
                NugetSources = null
            };
            var moduleLoader = new ModuleLoader(nugetClient, moduleFeedClientFactory, options);

            // ACT
            var exception = Assert.Throws <ModuleLoaderConfigurationException>(() => moduleLoader.Initialize());

            // ASSERT
            Assert.NotNull(exception);
            Assert.Equal("At least one nuget sources must be specified", exception.Message);
        }
        public void WhenInitializeModuleLoaderAndConfigurationFileDoesntExistThenExceptionIsThrown()
        {
            // ARRANGE
            SetCurrentAssembly();
            RemoveFiles();
            var nugetClient             = new NugetClient(new HttpClientFactory());
            var moduleFeedClientFactory = new ModuleFeedClientFactory();

            Environment.SetEnvironmentVariable("SID_MODULE", "C:\\");
            var options = new ModuleLoaderOptions
            {
                NugetSources  = new[] { "nuget" },
                ProjectName   = "projectName",
                ModuleFeedUri = new Uri("http://localhost/configuration")
            };
            var moduleLoader = new ModuleLoader(nugetClient, moduleFeedClientFactory, options);

            // ACT
            var exception = Assert.Throws <FileNotFoundException>(() => moduleLoader.Initialize());

            // ASSERT
            Assert.NotNull(exception);
        }
Esempio n. 14
0
 public ListCommand(NugetClient nugetClient, DBDepsConfigurationFile configurationFile)
 {
     this.nugetClient       = nugetClient;
     this.configurationFile = configurationFile;
 }
Esempio n. 15
0
 public DependencyManager(NugetClient nugetClient, DBDepsConfigurationFile configurationFile)
 {
     this.nugetClient       = nugetClient;
     this.configurationFile = configurationFile;
 }