private async Task TestCorsRulesAsync(CloudQueueClient client, OperationContext context, IList <CorsRule> corsProps)
        {
            props.Cors.CorsRules.Clear();

            foreach (CorsRule rule in corsProps)
            {
                props.Cors.CorsRules.Add(rule);
            }

            await client.SetServicePropertiesAsync(props, null, context);

            TestHelper.AssertServicePropertiesAreEqual(props, await client.GetServicePropertiesAsync());
        }
Esempio n. 2
0
        public void CloudQueueTestAnalyticsRoundTripTask()
        {
            props.Logging.LoggingOperations = LoggingOperations.Read | LoggingOperations.Write;
            props.Logging.RetentionDays     = 5;
            props.Logging.Version           = Constants.AnalyticsConstants.LoggingVersionV1;

            props.HourMetrics.MetricsLevel  = MetricsLevel.Service;
            props.HourMetrics.RetentionDays = 6;
            props.HourMetrics.Version       = Constants.AnalyticsConstants.MetricsVersionV1;

            client.SetServicePropertiesAsync(props).Wait();

            TestHelper.AssertServicePropertiesAreEqual(props, client.GetServicePropertiesAsync().Result);
        }
Esempio n. 3
0
        public async Task CloudQueueClientServerTimeoutAsync()
        {
            CloudQueueClient client = GenerateCloudQueueClient();

            string           timeout = null;
            OperationContext context = new OperationContext();

            context.SendingRequest += (sender, e) =>
            {
                IDictionary <string, string> query = HttpWebUtility.ParseQueryString(e.RequestUri.Query);
                if (!query.TryGetValue("timeout", out timeout))
                {
                    timeout = null;
                }
            };

            QueueRequestOptions options = new QueueRequestOptions();
            await client.GetServicePropertiesAsync(null, context);

            Assert.IsNull(timeout);
            await client.GetServicePropertiesAsync(options, context);

            Assert.IsNull(timeout);

            options.ServerTimeout = TimeSpan.FromSeconds(100);
            await client.GetServicePropertiesAsync(options, context);

            Assert.AreEqual("100", timeout);

            client.DefaultRequestOptions.ServerTimeout = TimeSpan.FromSeconds(90);
            await client.GetServicePropertiesAsync(null, context);

            Assert.AreEqual("90", timeout);
            await client.GetServicePropertiesAsync(options, context);

            Assert.AreEqual("100", timeout);

            options.ServerTimeout = null;
            await client.GetServicePropertiesAsync(options, context);

            Assert.AreEqual("90", timeout);

            options.ServerTimeout = TimeSpan.Zero;
            await client.GetServicePropertiesAsync(options, context);

            Assert.IsNull(timeout);
        }
Esempio n. 4
0
 public static void MyClassInitialize(TestContext testContext)
 {
     client          = GenerateCloudQueueClient();
     startProperties = client.GetServicePropertiesAsync().Result;
 }
Esempio n. 5
0
        public async Task CloudQueueTestAnalyticsRoundTripAsync()
        {
            props.Logging.LoggingOperations = LoggingOperations.Read | LoggingOperations.Write;
            props.Logging.RetentionDays     = 5;
            props.Logging.Version           = "1.0";

            props.HourMetrics.MetricsLevel  = MetricsLevel.Service;
            props.HourMetrics.RetentionDays = 6;
            props.HourMetrics.Version       = "1.0";

            props.MinuteMetrics.MetricsLevel  = MetricsLevel.Service;
            props.MinuteMetrics.RetentionDays = 6;
            props.MinuteMetrics.Version       = "1.0";

            props.Cors.CorsRules.Add(
                new CorsRule()
            {
                AllowedOrigins = new List <string>()
                {
                    "www.ab.com", "www.bc.com"
                },
                AllowedMethods  = CorsHttpMethods.Get | CorsHttpMethods.Put,
                MaxAgeInSeconds = 500,
                ExposedHeaders  =
                    new List <string>()
                {
                    "x-ms-meta-data*",
                    "x-ms-meta-source*",
                    "x-ms-meta-abc",
                    "x-ms-meta-bcd"
                },
                AllowedHeaders =
                    new List <string>()
                {
                    "x-ms-meta-data*",
                    "x-ms-meta-target*",
                    "x-ms-meta-xyz",
                    "x-ms-meta-foo"
                }
            });

            await client.SetServicePropertiesAsync(props);

            TestHelper.AssertServicePropertiesAreEqual(props, await client.GetServicePropertiesAsync());
        }