コード例 #1
0
        public void CloudQueueTestAnalyticsRoundTripAPM()
        {
            CloudQueueClient client = GenerateCloudQueueClient();

            ServiceProperties props = new ServiceProperties();

            props.Logging.LoggingOperations = LoggingOperations.Read | LoggingOperations.Write;
            props.Logging.RetentionDays     = 5;
            props.Logging.Version           = "1.0";

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

            using (ManualResetEvent evt = new ManualResetEvent(false))
            {
                IAsyncResult result = null;
                client.BeginSetServiceProperties(props, (res) =>
                {
                    result = res;
                    evt.Set();
                }, null);
                evt.WaitOne();

                client.EndSetServiceProperties(result);
            }

            // Wait for analytics server to update
            Thread.Sleep(60 * 1000);

            ServiceProperties retrievedProps = null;

            using (ManualResetEvent evt = new ManualResetEvent(false))
            {
                IAsyncResult result = null;
                client.BeginGetServiceProperties((res) =>
                {
                    result = res;
                    evt.Set();
                }, null);
                evt.WaitOne();

                retrievedProps = client.EndGetServiceProperties(result);
            }

            AssertServicePropertiesAreEqual(props, retrievedProps);
        }
コード例 #2
0
        public void CloudQueueTestAnalyticsRoundTripAPM()
        {
            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"
                }
            });

            using (ManualResetEvent evt = new ManualResetEvent(false))
            {
                IAsyncResult result = null;
                client.BeginSetServiceProperties(props, (res) =>
                {
                    result = res;
                    evt.Set();
                }, null);
                evt.WaitOne();

                client.EndSetServiceProperties(result);
            }

            ServiceProperties retrievedProps = null;

            using (ManualResetEvent evt = new ManualResetEvent(false))
            {
                IAsyncResult result = null;
                client.BeginGetServiceProperties((res) =>
                {
                    result = res;
                    evt.Set();
                }, null);
                evt.WaitOne();

                retrievedProps = client.EndGetServiceProperties(result);
            }

            TestHelper.AssertServicePropertiesAreEqual(props, retrievedProps);
        }