Example #1
0
        public static void MyClassInitialize(TestContext testContext)
        {
            client          = GenerateCloudQueueClient();
            startProperties = client.GetServiceProperties();

            if (TestBase.QueueBufferManager != null)
            {
                TestBase.QueueBufferManager.OutstandingBufferCount = 0;
            }
        }
Example #2
0
        private void TestCorsRules(CloudQueueClient client, IList <CorsRule> corsProps)
        {
            props.Cors.CorsRules.Clear();

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

            client.SetServiceProperties(props);
            TestHelper.AssertServicePropertiesAreEqual(props, client.GetServiceProperties());
        }
        public void CloudQueueClientServerTimeout()
        {
            CloudQueueClient client = GenerateCloudQueueClient();

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

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

            QueueRequestOptions options = new QueueRequestOptions();

            client.GetServiceProperties(null, context);
            Assert.IsNull(timeout);
            client.GetServiceProperties(options, context);
            Assert.IsNull(timeout);

            options.ServerTimeout = TimeSpan.FromSeconds(100);
            client.GetServiceProperties(options, context);
            Assert.AreEqual("100", timeout);

            client.DefaultRequestOptions.ServerTimeout = TimeSpan.FromSeconds(90);
            client.GetServiceProperties(null, context);
            Assert.AreEqual("90", timeout);
            client.GetServiceProperties(options, context);
            Assert.AreEqual("100", timeout);

            options.ServerTimeout = null;
            client.GetServiceProperties(options, context);
            Assert.AreEqual("90", timeout);

            options.ServerTimeout = TimeSpan.Zero;
            client.GetServiceProperties(options, context);
            Assert.IsNull(timeout);
        }
Example #4
0
        public void CloudQueueTestAnalyticsRoundTripSync()
        {
            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;

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

            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"
                }
            });

            client.SetServiceProperties(props);

            TestHelper.AssertServicePropertiesAreEqual(props, client.GetServiceProperties());
        }