protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
        {
            _requestFactory = new AWSSDK.UnitTests.HttpHandlerTests.MockHttpRequestFactory();
            var httpHandler = new HttpHandler<Stream>(_requestFactory, this);

            pipeline.ReplaceHandler<HttpHandler<Stream>>(httpHandler);
        }
        public void AddHandlerTest()
        {
            var handlerA = new TestHandlerA();
            var pipeline = new RuntimePipeline(handlerA);
            var handlerB = new TestHandlerB();
            // B->A
            pipeline.AddHandler(handlerB);

            ValidatePipeline(pipeline, handlerB, handlerA);
        }
Beispiel #3
0
        public void TestSignerWithAnonymousCredentials()
        {            
            var pipeline = new RuntimePipeline(new MockHandler());
            pipeline.AddHandler(new Signer());
            pipeline.AddHandler(new CredentialsRetriever(new AnonymousAWSCredentials()));

            var context = CreateTestContext();
            var signer = new MockSigner();
            ((RequestContext)context.RequestContext).Signer = signer;
            pipeline.InvokeSync(context);

            Assert.IsTrue(context.RequestContext.IsSigned);
            Assert.AreEqual(0, signer.SignCount);
        }
Beispiel #4
0
        public void TestSignerWithBasicCredentials()
        {
            var pipeline = new RuntimePipeline(new MockHandler());            
            pipeline.AddHandler(new Signer());
            pipeline.AddHandler(new CredentialsRetriever(new BasicAWSCredentials("accessKey", "secretKey")));

            var context = CreateTestContext();
            var signer = new MockSigner();
            ((RequestContext)context.RequestContext).Signer = signer;
            pipeline.InvokeSync(context);

            Assert.IsTrue(context.RequestContext.IsSigned);
            Assert.AreEqual(1, signer.SignCount);
        }
Beispiel #5
0
        public async Task TestSignerWithBasicCredentialsAsync()
        {
            var pipeline = new RuntimePipeline(new MockHandler());            
            pipeline.AddHandler(new Signer());
            pipeline.AddHandler(new CredentialsRetriever(new BasicAWSCredentials("accessKey", "secretKey")));

            var context = CreateTestContext();
            var signer = new MockSigner();
            ((RequestContext)context.RequestContext).Signer = signer;
            await pipeline.InvokeAsync<AmazonWebServiceResponse>(context);

            Assert.IsTrue(context.RequestContext.IsSigned);
            Assert.AreEqual(1, signer.SignCount);
        }
        public void AddHandlerBeforeTest()
        {
            var handlerD = new TestHandlerD();
            var pipeline = new RuntimePipeline(handlerD);
            var handlerB = new TestHandlerB();
            // B->D
            pipeline.AddHandler(handlerB);
            var handlerA = new TestHandlerA();
            // A->B->D
            pipeline.AddHandlerBefore<TestHandlerB>(handlerA);
            ValidatePipeline(pipeline, handlerA, handlerB, handlerD);

            var handlerC = new TestHandlerC();
            // A->B->C->D
            pipeline.AddHandlerBefore<TestHandlerD>(handlerC);
            ValidatePipeline(pipeline, handlerA, handlerB, handlerC, handlerD);            
        }
        public void ReplaceHandlerTest()
        {
            var handlerC = new TestHandlerC();
            var pipeline = new RuntimePipeline(handlerC);
            var handlerB = new TestHandlerB();            
            pipeline.AddHandler(handlerB);
            var handlerA = new TestHandlerA();
            //A->B->C
            pipeline.AddHandler(handlerA);
            ValidatePipeline(pipeline, handlerA, handlerB, handlerC);

            var handlerD = new TestHandlerD();
            //A->D->C
            pipeline.ReplaceHandler<TestHandlerB>(handlerD);
            ValidatePipeline(pipeline, handlerA, handlerD, handlerC);
            Assert.IsNull(handlerB.OuterHandler);
            Assert.IsNull(handlerB.InnerHandler);
        }
Beispiel #8
0
        public void TestSignerWithMutableHeader()
        {
            var pipeline = new RuntimePipeline(new MockHandler());           
            pipeline.AddHandler(new Signer());
            pipeline.AddHandler(new CredentialsRetriever(new BasicAWSCredentials("accessKey", "secretKey")));

            var context = CreateTestContext();
            var signer = new AWS4Signer();
            ((RequestContext)context.RequestContext).Signer = signer;

            // inject a mutable header that the signer should strip out
            context.RequestContext.Request.Headers[HeaderKeys.XAmznTraceIdHeader] = "stuff";
            pipeline.InvokeSync(context);

            // verify that the header is not in the signature
            var t = context.RequestContext.Request.Headers[HeaderKeys.AuthorizationHeader];
            Assert.IsFalse(t.Contains(HeaderKeys.XAmznTraceIdHeader));

            Assert.IsTrue(context.RequestContext.Request.Headers.ContainsKey(HeaderKeys.XAmznTraceIdHeader));
        }
        public void TestErrorCall()
        {
            var factory = new MockHttpRequestFactory
            {
                GetResponseAction = () => { throw new IOException(); }
            };
            var httpHandler      = new HttpHandler <Stream>(factory, callbackSender);
            var runtimePipeline  = new RuntimePipeline(httpHandler);
            var executionContext = CreateExecutionContextForListBuckets();

            Utils.AssertExceptionExpected(() =>
            {
                httpHandler.InvokeSync(executionContext);
            }, typeof(IOException));

            var httpRequest = factory.LastCreatedRequest;

            Assert.AreEqual("GET", httpRequest.Method);
            Assert.IsTrue(httpRequest.IsConfigureRequestCalled);
            Assert.IsTrue(httpRequest.IsSetRequestHeadersCalled);
            Assert.IsTrue(httpRequest.IsDisposed);
        }
Beispiel #10
0
        public void TestSuppressed404()
        {
            Tester.Reset();
            Tester.Action = (int callCount) =>
            {
                var errorResponse = (HttpWebResponse)MockWebResponse.CreateFromResource("404Response.txt");
                throw new HttpErrorResponseException(new HttpWebRequestResponseData(errorResponse));
            };

            var context = CreateTestContext();
            var request = new GetBucketPolicyRequest
            {
                BucketName = "nonexistentbucket"
            };

            ((RequestContext)context.RequestContext).OriginalRequest = request;
            ((RequestContext)context.RequestContext).Request         = new GetBucketPolicyRequestMarshaller().Marshall(request);
            ((RequestContext)context.RequestContext).Unmarshaller    = GetBucketPolicyResponseUnmarshaller.Instance;

            RuntimePipeline.InvokeSync(context);
            Assert.AreEqual(1, Tester.CallCount);
        }
        public async Task TestListBucketsResponseUnmarshallingAsync()
        {
            Tester.Reset();

            var context = CreateTestContext();
            var request = new ListBucketsRequest();

            ((RequestContext)context.RequestContext).OriginalRequest = request;
            ((RequestContext)context.RequestContext).Request         = new ListBucketsRequestMarshaller().Marshall(request);
            ((RequestContext)context.RequestContext).Unmarshaller    = ListBucketsResponseUnmarshaller.Instance;

            var response = MockWebResponse.CreateFromResource("ListBucketsResponse.txt")
                           as HttpWebResponse;

            context.ResponseContext.HttpResponse = new HttpWebRequestResponseData(response);

            var listBucketsResponse = await RuntimePipeline.InvokeAsync <ListBucketsResponse>(context);

            Assert.AreEqual(1, Tester.CallCount);
            Assert.IsInstanceOfType(context.ResponseContext.Response, typeof(ListBucketsResponse));
            Assert.AreEqual(4, listBucketsResponse.Buckets.Count);
        }
Beispiel #12
0
        public void Customize(Type serviceClientType, RuntimePipeline pipeline)
        {
            if (serviceClientType.BaseType != typeof(AmazonServiceClient))
            {
                return;
            }

            bool addCustomization = _option.RegisterAll;

            if (!addCustomization)
            {
                addCustomization = ProcessType(serviceClientType, addCustomization);
            }

            var handler1 = _serviceProvider.GetRequiredService <ApplicationInsightsPipelineHandler>();

            pipeline.AddHandlerAfter <EndpointResolver>(handler1);

            var handler2 = _serviceProvider.GetRequiredService <ApplicationInsightsExceptionsPipelineHandler>();

            pipeline.AddHandlerAfter <RetryHandler>(handler2);
        }
        public async Task TestErrorAsyncCall()
        {
            var factory = new MockHttpRequestMessageFactory
            {
                GetResponseAction = () => { throw new IOException(); }
            };
            var httpHandler      = new HttpHandler <HttpContent>(factory, callbackSender);
            var runtimePipeline  = new RuntimePipeline(httpHandler);
            var executionContext = CreateExecutionContextForListBuckets();

            await Utils.AssertExceptionExpectedAsync(() =>
            {
                return(httpHandler.InvokeAsync <AmazonWebServiceResponse>(executionContext));
            }, typeof(IOException));

            var httpRequest = factory.LastCreatedRequest;

            Assert.AreEqual("GET", httpRequest.Method);
            Assert.IsTrue(httpRequest.IsConfigureRequestCalled);
            Assert.IsTrue(httpRequest.IsSetRequestHeadersCalled);
            Assert.IsTrue(httpRequest.IsDisposed);
        }
        public void RetryQuotaReachedAfterASingleRetry()
        {
            var config          = CreateConfig();
            var capacityManager = new CapacityManager(throttleRetryCount: 1, throttleRetryCost: 5, throttleCost: 1, timeoutRetryCost: 10);

            RunRetryTest((executionContext, retryPolicy) =>
            {
                Tester.Reset();
                Tester.Action = (int callCount) =>
                {
                    switch (callCount)
                    {
                    case 1:
                        throw new AmazonServiceException($"Mocked service error ({callCount})", new WebException(), HttpStatusCode.InternalServerError);

                    case 2:
                        throw new AmazonServiceException($"Mocked service error ({callCount})", new WebException(), HttpStatusCode.BadGateway);

                    default:
                        throw new Exception($"Invalid number of calls ({callCount})");
                    }
                };

                var exception = Utils.AssertExceptionExpected <AmazonServiceException>(() =>
                {
                    RuntimePipeline.InvokeSync(executionContext);
                });

                Assert.AreEqual("Mocked service error (2)", exception.Message);

                var capacity = MockAdaptiveRetryPolicy.CurrentCapacityManagerInstance.GetRetryCapacity(config.ServiceURL);
                Assert.AreEqual(1, executionContext.RequestContext.Retries);
                Assert.AreEqual(2, Tester.CallCount);
                Assert.AreEqual(0, capacity.AvailableCapacity);

                retryPolicy.AssertDelaysMatch(new int[] { 1000 });
            }, config, capacityManager);
        }
        public void Test400WithErrorTypeHeader()
        {
            Tester.Reset();
            Tester.Action = (int callCount) =>
            {
                var errorResponse = (HttpWebResponse)MockWebResponse.CreateFromResource("400WithErrorTypeHeader.txt");
                throw new HttpErrorResponseException(new HttpWebRequestResponseData(errorResponse));
            };

            var context = CreateTestContext();

            ((RequestContext)context.RequestContext).Unmarshaller =
                Amazon.IotData.Model.Internal.MarshallTransformations.UpdateThingShadowResponseUnmarshaller.Instance;

            var exception = Utils.AssertExceptionExpected <Amazon.IotData.Model.InvalidRequestException>(() =>
            {
                RuntimePipeline.InvokeSync(context);
            });

            Assert.AreEqual("InvalidRequestException", exception.ErrorCode);
            Assert.AreEqual(HttpStatusCode.BadRequest, exception.StatusCode);
            Assert.AreEqual(1, Tester.CallCount);
        }
Beispiel #16
0
        public void TestSuccessfulAsyncCall()
        {
            var factory         = new MockHttpRequestFactory();
            var httpHandler     = new HttpHandler <Stream>(factory, callbackSender);
            var runtimePipeline = new RuntimePipeline(httpHandler);

            var listBucketsRequest = new ListBucketsRequest();
            var executionContext   = CreateAsyncExecutionContextForListBuckets();

            var asyncResult = httpHandler.InvokeAsync(executionContext);

            asyncResult.AsyncWaitHandle.WaitOne();

            Assert.IsNull(executionContext.ResponseContext.AsyncResult.Exception);
            Assert.IsNotNull(executionContext.ResponseContext.HttpResponse);
            var httpRequest = factory.LastCreatedRequest;

            Assert.AreEqual("GET", httpRequest.Method);
            Assert.IsTrue(httpRequest.IsConfigureRequestCalled);
            Assert.IsTrue(httpRequest.IsSetRequestHeadersCalled);
            Assert.IsTrue(httpRequest.IsDisposed);
            Assert.IsFalse(httpRequest.IsAborted);
        }
        public void TestSignerWithMutableHeader()
        {
            var pipeline = new RuntimePipeline(new MockHandler());

            pipeline.AddHandler(new Signer());
            pipeline.AddHandler(new CredentialsRetriever(new BasicAWSCredentials("accessKey", "secretKey")));

            var context = CreateTestContext();
            var signer  = new AWS4Signer();

            ((RequestContext)context.RequestContext).Signer = signer;

            // inject a mutable header that the signer should strip out
            context.RequestContext.Request.Headers[HeaderKeys.XAmznTraceIdHeader] = "stuff";
            pipeline.InvokeSync(context);

            // verify that the header is not in the signature
            var t = context.RequestContext.Request.Headers[HeaderKeys.AuthorizationHeader];

            Assert.IsFalse(t.Contains(HeaderKeys.XAmznTraceIdHeader));

            Assert.IsTrue(context.RequestContext.Request.Headers.ContainsKey(HeaderKeys.XAmznTraceIdHeader));
        }
Beispiel #18
0
        public void TestListBucketsResponseUnmarshalling()
        {
            Tester.Reset();

            var context = CreateTestContext();
            var request = new ListBucketsRequest();

            ((RequestContext)context.RequestContext).OriginalRequest = request;
            ((RequestContext)context.RequestContext).Request         = new ListBucketsRequestMarshaller().Marshall(request);
            ((RequestContext)context.RequestContext).Unmarshaller    = ListBucketsResponseUnmarshaller.Instance;

            var response = GetListBucketsResponse();

            context.ResponseContext.HttpResponse = new HttpWebRequestResponseData(response);

            RuntimePipeline.InvokeSync(context);

            Assert.AreEqual(1, Tester.CallCount);
            Assert.IsInstanceOfType(context.ResponseContext.Response, typeof(ListBucketsResponse));

            var listBucketsResponse = context.ResponseContext.Response as ListBucketsResponse;

            Assert.AreEqual(4, listBucketsResponse.Buckets.Count);
        }
Beispiel #19
0
        public void Test404()
        {
            Tester.Reset();
            Tester.Action = (int callCount) =>
            {
                var body    = @"<?xml version=""1.0"" encoding=""UTF-8""?>
<Error>
    <Code>NoSuchBucket</Code>
    <Message>The specified bucket does not exist</Message>
    <BucketName>nonexistentbucket</BucketName>
    <RequestId>749945D6E23AFF48</RequestId>
    <HostId>xN4fcAA90mhYmTC8o/SX2jBBunBSrD45cMwLYwAu0LZhcn9HIU/KXwtieQO05beD</HostId>
</Error>";
                var headers = new Dictionary <string, string>();
                headers["x-amz-request-id"]  = "749945D6E23AFF48";
                headers["x-amz-id-2"]        = "xN4fcAA90mhYmTC8o/SX2jBBunBSrD45cMwLYwAu0LZhcn9HIU/KXwtieQO05beD";
                headers["Content-Type"]      = "application/xml";
                headers["Transfer-Encoding"] = "chunked";
                headers["Date"]   = "Mon, 16 Jun 2014 17:34:56 GMT";
                headers["Server"] = "AmazonS3";
                var errorResponse = (HttpWebResponse)MockWebResponse.Create(HttpStatusCode.NotFound, headers, body);
                throw new HttpErrorResponseException(new HttpWebRequestResponseData(errorResponse));
            };

            var context = CreateTestContext();

            var exception = Utils.AssertExceptionExpected(() =>
            {
                RuntimePipeline.InvokeSync(context);
            },
                                                          typeof(AmazonS3Exception));

            Assert.AreEqual("NoSuchBucket", ((AmazonS3Exception)exception).ErrorCode);
            Assert.AreEqual(HttpStatusCode.NotFound, ((AmazonS3Exception)exception).StatusCode);
            Assert.AreEqual(1, Tester.CallCount);
        }
        public void RunRetryTest(Action <IExecutionContext, MockStandardRetryPolicy> DoAction, AmazonS3Config config,
                                 CapacityManager capacityManager = null, double?exponentialPower = null, double?exponentialBase = null)
        {
            try
            {
                if (capacityManager != null)
                {
                    MockStandardRetryPolicy.SetCapacityManagerInstance(capacityManager);
                }

                var retryPolicy = new MockStandardRetryPolicy(config);
                retryPolicy.ExponentialBase  = exponentialBase ?? retryPolicy.ExponentialBase;
                retryPolicy.ExponentialPower = exponentialPower ?? retryPolicy.ExponentialPower;

                Handler = new RetryHandler(retryPolicy);
                if (RuntimePipeline.Handlers.Find(h => h is RetryHandler) != null)
                {
                    RuntimePipeline.ReplaceHandler <RetryHandler>(Handler);
                }
                else
                {
                    RuntimePipeline.AddHandler(Handler);
                }

                var executionContext = CreateTestContext(null, null, config);

                DoAction(executionContext, retryPolicy);
            }
            finally
            {
                if (capacityManager != null)
                {
                    MockStandardRetryPolicy.RestoreManagers();
                }
            }
        }
        private void BuildRuntimePipeline()
        {
            HttpHandler <string> httpHandler = null;

            httpHandler = ((AWSConfigs.HttpClient != 0) ? new HttpHandler <string>(new UnityWebRequestFactory(), this) : new HttpHandler <string>(new UnityWwwRequestFactory(), this));
            CallbackHandler callbackHandler = new CallbackHandler();

            callbackHandler.OnPreInvoke = ProcessPreRequestHandlers;
            CallbackHandler callbackHandler2 = new CallbackHandler();

            callbackHandler2.OnPreInvoke = ProcessRequestHandlers;
            CallbackHandler callbackHandler3 = new CallbackHandler();

            callbackHandler3.OnPostInvoke = ProcessResponseHandlers;
            ErrorCallbackHandler errorCallbackHandler = new ErrorCallbackHandler();

            errorCallbackHandler.OnError = ProcessExceptionHandlers;
            RuntimePipeline = new RuntimePipeline(new List <IPipelineHandler>
            {
                httpHandler,
                new Unmarshaller(SupportResponseLogging),
                new ErrorHandler(_logger),
                callbackHandler3,
                new Signer(),
                new CredentialsRetriever(Credentials),
                new RetryHandler(new DefaultRetryPolicy(Config)),
                callbackHandler2,
                new EndpointResolver(),
                new Marshaller(),
                callbackHandler,
                errorCallbackHandler,
                new MetricsHandler(),
                new ThreadPoolExecutionHandler(10)
            }, _logger);
            CustomizeRuntimePipeline(RuntimePipeline);
        }
Beispiel #22
0
        public void TestErrorAsyncCall()
        {
            var factory = new MockHttpRequestFactory
            {
                GetResponseAction = () => { throw new IOException(); }
            };
            var httpHandler      = new HttpHandler <Stream>(factory, callbackSender);
            var runtimePipeline  = new RuntimePipeline(httpHandler);
            var executionContext = CreateAsyncExecutionContextForListBuckets();

            var asyncResult = httpHandler.InvokeAsync(executionContext);

            asyncResult.AsyncWaitHandle.WaitOne();

            Assert.IsNotNull(executionContext.ResponseContext.AsyncResult.Exception);
            Assert.IsInstanceOfType(executionContext.ResponseContext.AsyncResult.Exception, typeof(IOException));

            var httpRequest = factory.LastCreatedRequest;

            Assert.AreEqual("GET", httpRequest.Method);
            Assert.IsTrue(httpRequest.IsConfigureRequestCalled);
            Assert.IsTrue(httpRequest.IsSetRequestHeadersCalled);
            Assert.IsTrue(httpRequest.IsDisposed);
        }
Beispiel #23
0
 public static void Initialize(TestContext t)
 {
     Handler = new RedirectHandler();
     RuntimePipeline.AddHandler(Handler);
 }
 /// <summary>
 /// Customizes the runtime pipeline.
 /// </summary>
 /// <param name="pipeline">Runtime pipeline for the current client.</param>
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.AddHandlerAfter<Amazon.Runtime.Internal.Marshaller>(new Amazon.CloudFormation.Internal.ProcessRequestHandler());
 }
Beispiel #25
0
 /// <summary>
 /// Customizes the runtime pipeline.
 /// </summary>
 /// <param name="pipeline">Runtime pipeline for the current client.</param>
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.AddHandlerAfter <Amazon.Runtime.Internal.Marshaller>(new Amazon.S3Control.Internal.AmazonS3ControlPostMarshallHandler());
     pipeline.AddHandlerBefore <Amazon.Runtime.Internal.Unmarshaller>(new Amazon.S3Control.Internal.AmazonS3ControlPostUnmarshallHandler());
     pipeline.AddHandlerAfter <Amazon.Runtime.Internal.ErrorCallbackHandler>(new Amazon.S3Control.Internal.AmazonS3ControlExceptionHandler());
 }
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     base.CustomizeRuntimePipeline(pipeline);
 }
 /// <summary>
 /// Customizes the runtime pipeline.
 /// </summary>
 /// <param name="pipeline">Runtime pipeline for the current client.</param>
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.AddHandlerAfter<Amazon.Runtime.Internal.Marshaller>(new Amazon.MachineLearning.Internal.ProcessRequestHandler());
     pipeline.AddHandlerBefore<Amazon.Runtime.Internal.Marshaller>(new Amazon.MachineLearning.Internal.IdempotencyHandler());
 }
Beispiel #28
0
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.AddHandlerAfter<Marshaller>(new ResponseValidationHandler());
 }
 /// <summary>
 /// Customizes the runtime pipeline.
 /// </summary>
 /// <param name="pipeline">Runtime pipeline for the current client.</param>
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.AddHandlerBefore<Amazon.Runtime.Internal.Marshaller>(new Amazon.ElasticTranscoder.Internal.AmazonElasticTranscoderPreMarshallHandler());
 }
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.ReplaceHandler<Amazon.Runtime.Internal.ErrorHandler>(new Amazon.Runtime.Internal.ErrorHandler<AmazonS3Exception>(this.Logger));
     pipeline.AddHandlerBefore<Amazon.Runtime.Internal.Marshaller>(new Amazon.S3.Internal.AmazonS3PreMarshallHandler());
     pipeline.AddHandlerAfter<Amazon.Runtime.Internal.Marshaller>(new Amazon.S3.Internal.AmazonS3PostMarshallHandler());
     pipeline.AddHandlerAfter<Amazon.Runtime.Internal.EndpointResolver>(new Amazon.S3.Internal.AmazonS3KmsHandler());
 }    
        protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
        {
            base.CustomizeRuntimePipeline(pipeline);

            pipeline.AddHandlerBefore<Amazon.Runtime.Internal.Marshaller>(new Amazon.S3.Encryption.Internal.SetupEncryptionHandler(this));
            pipeline.AddHandlerAfter<Amazon.Runtime.Internal.Marshaller>(new Amazon.S3.Encryption.Internal.UserAgentHandler());
            pipeline.AddHandlerBefore<Amazon.S3.Internal.AmazonS3ResponseHandler>(new Amazon.S3.Encryption.Internal.SetupDecryptionHandler(this));
        }  
Beispiel #32
0
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.AddHandlerAfter <Amazon.Runtime.Internal.Marshaller>(new Amazon.Route53.Internal.AmazonRoute53PostMarshallHandler());
 }
Beispiel #33
0
 /// <summary>
 /// Customizes the runtime pipeline.
 /// </summary>
 /// <param name="pipeline">Runtime pipeline for the current client.</param>
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.AddHandlerBefore <Amazon.Runtime.Internal.Marshaller>(new Amazon.ElasticTranscoder.Internal.AmazonElasticTranscoderPreMarshallHandler());
 }
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.ReplaceHandler <Amazon.Runtime.Internal.ErrorHandler>(new Amazon.Runtime.Internal.ErrorHandler <AmazonMobileAnalyticsException>(this.Logger));
 }
 /// <summary>
 /// Customize the pipeline
 /// </summary>
 /// <param name="pipeline"></param>
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.AddHandlerBefore<Amazon.Runtime.Internal.Marshaller>(new Amazon.EC2.Internal.AmazonEC2PreMarshallHandler(this.Credentials));
     pipeline.AddHandlerAfter<Amazon.Runtime.Internal.Marshaller>(new Amazon.EC2.Internal.AmazonEC2PostMarshallHandler());
     pipeline.AddHandlerBefore<Amazon.Runtime.Internal.Unmarshaller>(new Amazon.EC2.Internal.AmazonEC2ResponseHandler());
 }    
Beispiel #36
0
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.AddHandlerAfter <Marshaller>(new ResponseValidationHandler());
 }
Beispiel #37
0
 /// <summary>
 /// Customizes the runtime pipeline.
 /// </summary>
 /// <param name="pipeline">Runtime pipeline for the current client.</param>
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.AddHandlerBefore <Amazon.Runtime.Internal.Marshaller>(new Amazon.ElasticFileSystem.Internal.IdempotencyHandler());
 }
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.ReplaceHandler<Amazon.Runtime.Internal.ErrorHandler>(new Amazon.Runtime.Internal.ErrorHandler<AmazonSQSException>(this.Logger));
     pipeline.AddHandlerAfter<Amazon.Runtime.Internal.Marshaller>(new Amazon.SQS.Internal.ProcessRequestHandler());
     pipeline.AddHandlerBefore<Amazon.Runtime.Internal.Unmarshaller>(new Amazon.SQS.Internal.ValidationResponseHandler());
 }    
Beispiel #39
0
 /// <summary>
 /// Customize the pipeline
 /// </summary>
 /// <param name="pipeline"></param>
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.AddHandlerBefore <Amazon.Runtime.Internal.Marshaller>(new Amazon.CloudSearchDomain.Internal.ProcessRequestHandler());
     pipeline.AddHandlerBefore <Amazon.Runtime.Internal.Unmarshaller>(new Amazon.CloudSearchDomain.Internal.ValidationResponseHandler());
     pipeline.AddHandlerBefore <Amazon.Runtime.Internal.Unmarshaller>(new Amazon.CloudSearchDomain.Internal.ProcessExceptionHandler());
 }
 /// <summary>
 /// Customize the pipeline
 /// </summary>
 /// <param name="pipeline"></param>
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.AddHandlerAfter<Amazon.Runtime.Internal.Marshaller>(new Amazon.Route53.Internal.AmazonRoute53PostMarshallHandler());
     pipeline.AddHandlerAfter<Amazon.Runtime.Internal.ErrorCallbackHandler>(new Amazon.Route53.Internal.AmazonRoute53PreMarshallHandler());
 }    
Beispiel #41
0
 /// <summary>
 /// Customize the pipeline
 /// </summary>
 /// <param name="pipeline"></param>
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.ReplaceHandler <Amazon.Runtime.Internal.RetryHandler>(new Amazon.Runtime.Internal.RetryHandler(new Amazon.DynamoDBv2.Internal.DynamoDBRetryPolicy(this.Config.MaxErrorRetry)));
 }
 /// <summary>
 /// Customize the pipeline
 /// </summary>
 /// <param name="pipeline"></param>
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.RemoveHandler<Amazon.Runtime.Internal.CredentialsRetriever>();
     pipeline.AddHandlerBefore<Amazon.Runtime.Internal.Marshaller>(new Amazon.CognitoSync.Internal.CognitoCredentialsRetriever(this.Credentials));
 }    
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.ReplaceHandler<Amazon.Runtime.Internal.RetryHandler>(new Amazon.Runtime.Internal.RetryHandler(new Amazon.DynamoDBv2.Internal.DynamoDBRetryPolicy(this.Config.MaxErrorRetry)));
 }
Beispiel #44
0
 /// <summary>
 /// Customizes the runtime pipeline.
 /// </summary>
 /// <param name="pipeline">Runtime pipeline for the current client.</param>
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.AddHandlerAfter <Amazon.Runtime.Internal.Marshaller>(new Amazon.CloudFormation.Internal.ProcessRequestHandler());
 }
 public void Customize(Type type, RuntimePipeline pipeline)
 {
     pipeline.AddHandler(new SpecialPipelineHandler());
 }
Beispiel #46
0
 /// <summary>
 /// Customize the pipeline
 /// </summary>
 /// <param name="pipeline"></param>
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.AddHandlerBefore<Amazon.Runtime.Internal.Marshaller>(new Amazon.RDS.Internal.PreSignedUrlRequestHandler(this.Credentials));
 }    
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.AddHandlerBefore<Amazon.Runtime.Internal.Marshaller>(new Amazon.S3.Internal.AmazonS3PreMarshallHandler());
     pipeline.AddHandlerAfter<Amazon.Runtime.Internal.Marshaller>(new Amazon.S3.Internal.AmazonS3PostMarshallHandler());
     pipeline.AddHandlerBefore<Amazon.Runtime.Internal.Unmarshaller>(new Amazon.S3.Internal.AmazonS3ResponseHandler());
     pipeline.AddHandlerAfter<Amazon.Runtime.Internal.ErrorCallbackHandler>(new Amazon.S3.Internal.AmazonS3ExceptionHandler());
     pipeline.AddHandlerAfter<Amazon.Runtime.Internal.ErrorHandler>(new Amazon.Runtime.Internal.RedirectHandler());
 }    
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.ReplaceHandler<Amazon.Runtime.Internal.ErrorHandler>(new Amazon.Runtime.Internal.ErrorHandler<AmazonSecurityTokenServiceException>(this.Logger));
 }    
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.ReplaceHandler<Amazon.Runtime.Internal.ErrorHandler>(new Amazon.Runtime.Internal.ErrorHandler<AmazonCognitoIdentityException>(this.Logger));
 }    
Beispiel #50
0
 /// <summary>
 /// Customizes the runtime pipeline.
 /// </summary>
 /// <param name="pipeline">Runtime pipeline for the current client.</param>
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.RemoveHandler <Amazon.Runtime.Internal.CredentialsRetriever>();
     pipeline.AddHandlerBefore <Amazon.Runtime.Internal.Marshaller>(new Amazon.CognitoSync.Internal.CognitoCredentialsRetriever(this.Credentials));
 }
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.AddHandlerAfter<Amazon.Runtime.Internal.Marshaller>(new Amazon.CloudSearchDomain.Internal.ProcessRequestHandler());
     pipeline.AddHandlerBefore<Amazon.Runtime.Internal.Unmarshaller>(new Amazon.CloudSearchDomain.Internal.ValidationResponseHandler());
     pipeline.AddHandlerBefore<Amazon.Runtime.Internal.Unmarshaller>(new Amazon.CloudSearchDomain.Internal.ProcessExceptionHandler());
 }    
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.ReplaceHandler<Amazon.Runtime.Internal.ErrorHandler>(new Amazon.Runtime.Internal.ErrorHandler<AmazonMobileAnalyticsException>(this.Logger));
 }    
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.AddHandlerBefore<Amazon.Runtime.Internal.Marshaller>(new Amazon.S3.Internal.AmazonS3PreMarshallHandler());
     pipeline.AddHandlerAfter<Amazon.Runtime.Internal.Marshaller>(new Amazon.S3.Internal.AmazonS3PostMarshallHandler());
     pipeline.AddHandlerAfter<Amazon.Runtime.Internal.EndpointResolver>(new Amazon.S3.Internal.AmazonS3KmsHandler());
     pipeline.AddHandlerBefore<Amazon.Runtime.Internal.Unmarshaller>(new Amazon.S3.Internal.AmazonS3ResponseHandler());
     pipeline.AddHandlerAfter<Amazon.Runtime.Internal.ErrorCallbackHandler>(new Amazon.S3.Internal.AmazonS3ExceptionHandler());
     pipeline.AddHandlerAfter<Amazon.Runtime.Internal.Unmarshaller>(new Amazon.S3.Internal.AmazonS3RedirectHandler());
     pipeline.ReplaceHandler<Amazon.Runtime.Internal.RetryHandler>(new Amazon.Runtime.Internal.RetryHandler(new Amazon.S3.Internal.AmazonS3RetryPolicy(this.Config.MaxErrorRetry)));
 }
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.AddHandlerBefore<Amazon.Runtime.Internal.Marshaller>(new Amazon.ElasticFileSystem.Internal.IdempotencyHandler());
 }
 /// <summary>
 /// Customizes the runtime pipeline.
 /// </summary>
 /// <param name="pipeline">Runtime pipeline for the current client.</param>
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.AddHandlerAfter<Amazon.Runtime.Internal.Marshaller>(new Amazon.ElasticLoadBalancing.Internal.ProcessRequestHandler());
 }
Beispiel #56
0
 public static void Initialize(TestContext t)
 {
     Handler = new Unmarshaller(true);
     RuntimePipeline.AddHandler(Handler);
 }
 protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
     pipeline.ReplaceHandler<Amazon.Runtime.Internal.ErrorHandler>(new Amazon.Runtime.Internal.ErrorHandler<AmazonCognitoSyncException>(this.Logger));
     pipeline.RemoveHandler<Amazon.Runtime.Internal.CredentialsRetriever>();
     pipeline.AddHandlerBefore<Amazon.Runtime.Internal.Marshaller>(new Amazon.CognitoSync.Internal.CognitoCredentialsRetriever(this.Credentials));
     pipeline.AddHandlerAfter<Amazon.Runtime.Internal.Marshaller>(new Amazon.CognitoSync.Internal.AmazonCognitoSyncPostMarshallHandler());
     pipeline.AddHandlerAfter<Amazon.Runtime.Internal.Signer>(new Amazon.CognitoSync.Internal.AmazonCognitoSyncPostSignHandler());
 }    
Beispiel #58
0
        public void Customize(Type type, RuntimePipeline pipeline)
        {
            var handler = new HandlerFactory().GetInstace(type);

            pipeline.AddHandler(handler);
        }
 protected virtual void CustomizeRuntimePipeline(RuntimePipeline pipeline)
 {
 }
 void ValidatePipeline(RuntimePipeline pipeline,params IPipelineHandler[] handlers)
 {
     Assert.AreEqual(pipeline.Handler, handlers[0]);
     for (int index = 0; index < handlers.Length; index++)
     {
         if (index>0)
         {
             Assert.AreEqual(handlers[index - 1], handlers[index].OuterHandler);
         }
         if (index < handlers.Length - 1)
         {
             Assert.AreEqual(handlers[index + 1], handlers[index].InnerHandler);
         }
     }
 }