示例#1
0
        public void ShouldReplaceForwardSlashInParameterName()
        {
            var client = Substitute.For <IAmazonSimpleSystemsManagement>();

            client.GetParametersByPathAsync(Arg.Is <GetParametersByPathRequest>(x => x.NextToken == null))
            .Returns(new GetParametersByPathResponse
            {
                HttpStatusCode = System.Net.HttpStatusCode.OK,
                NextToken      = null,
                Parameters     = new List <Parameter>
                {
                    new Parameter
                    {
                        Name  = "/section1/parameter1",
                        Type  = ParameterType.String,
                        Value = "value1"
                    }
                }
            });

            var provider = new AwsParameterStoreConfigurationProvider(client, ValidPath, new StartsWithFilteredParameterManager());

            provider.Load();

            provider.ShouldHaveKeyWithValue("section1:parameter1", "value1");
        }
示例#2
0
        public void ShouldNotLoadFilteredItems()
        {
            var client = Substitute.For <IAmazonSimpleSystemsManagement>();

            client.GetParametersByPathAsync(Arg.Is <GetParametersByPathRequest>(x => x.NextToken == null))
            .Returns(new GetParametersByPathResponse
            {
                HttpStatusCode = System.Net.HttpStatusCode.OK,
                NextToken      = "nexttoken",
                Parameters     = new List <Parameter>
                {
                    new Parameter
                    {
                        Name  = "parameter1",
                        Type  = ParameterType.String,
                        Value = "value1"
                    },
                    new Parameter
                    {
                        Name  = "filteredparameter",
                        Type  = ParameterType.String,
                        Value = "value"
                    }
                }
            });

            var provider = new AwsParameterStoreConfigurationProvider(client, ValidPath, new StartsWithFilteredParameterManager());

            provider.Load();

            var keys = provider.GetChildKeys(Enumerable.Empty <string>(), null).ToArray();

            Assert.Equal(new[] { "parameter1" }, keys);
            provider.ShouldHaveKeyWithValue("parameter1", "value1");
        }
示例#3
0
        public void ShouldOverrideExistingKeyWhenReload()
        {
            var client    = Substitute.For <IAmazonSimpleSystemsManagement>();
            var parameter = new Parameter
            {
                Name  = "parameter1",
                Type  = ParameterType.String,
                Value = "value1"
            };
            var response = new GetParametersByPathResponse
            {
                HttpStatusCode = System.Net.HttpStatusCode.OK,
                NextToken      = "nexttoken",
                Parameters     = new List <Parameter>
                {
                    parameter
                }
            };

            client.GetParametersByPathAsync(Arg.Is <GetParametersByPathRequest>(x => x.NextToken == null)).Returns(response);

            var provider = new AwsParameterStoreConfigurationProvider(client, ValidPath, new StartsWithFilteredParameterManager());

            provider.Load();

            provider.ShouldHaveKeyWithValue("parameter1", "value1");
            parameter.Value = "value2";

            provider.Load();
            provider.ShouldHaveKeyWithValue("parameter1", "value2");
        }