Ejemplo n.º 1
0
        public void S3_RemoveApplication_NotPublished_Fail()
        {
            // remove the published application
            ServerDataModel.ResetPublishedEndpoint();
            // trigger the client to remove an application asynchronously
            // so that it does not block the main thread
            var sut = AsyncSutAdapter.TriggerRemoveApplicationAsync();

            TestSite.Log.Add(LogEntryKind.Comment, "Triggering proxy client to remove a web application");

            // start receiving client request
            // when request comes, forward it to the corresponding handler
            while ((CurrentRequest = ClientAdapter.ExpectRequest()) != null)
            {
                TestSite.Log.Add(LogEntryKind.Comment, "Received request for " + CurrentRequest.RequestUri.AbsolutePath);

                CurrentHandler = (ProxyRequestHandlerBase)Factory.GetRequestHandler(CurrentRequest);
                TestSite.Assert.IsTrue(CurrentHandler.VerifyRequest(out VerifyMessage), VerifyMessage);

                if (CurrentHandler is DeleteProxyPublishSettingsRequestHandler)
                {
                    CurrentResponse = ((DeleteProxyPublishSettingsRequestHandler)CurrentHandler)
                                      .GetNotFoundResponse();
                }
                else
                {
                    CurrentResponse = CurrentHandler.GetResponse();
                }

                ClientAdapter.SendResponse(CurrentResponse);
                TestSite.Log.Add(LogEntryKind.Comment, "Response has been sent to the client.");
            }

            TestSite.Assert.IsFalse(sut.Result.Return, "Client acted correctly with 404 response.");
        }
Ejemplo n.º 2
0
        public void S3_RemoveApplication_Success()
        {
            // trigger the client to remove an application asynchronously
            // so that it does not block the main thread
            var sut = AsyncSutAdapter.TriggerRemoveApplicationAsync();

            TestSite.Log.Add(LogEntryKind.Comment, "Triggering proxy client to remove a web application");

            // start receiving client request
            // when request comes, forward it to the corresponding handler
            while ((CurrentRequest = ClientAdapter.ExpectRequest()) != null)
            {
                TestSite.Log.Add(LogEntryKind.Comment, "Received request for " + CurrentRequest.RequestUri.AbsolutePath);

                CurrentHandler = (ProxyRequestHandlerBase)Factory.GetRequestHandler(CurrentRequest);
                TestSite.Assert.IsTrue(CurrentHandler.VerifyRequest(out VerifyMessage), VerifyMessage);

                CurrentResponse = CurrentHandler.GetResponse();
                ClientAdapter.SendResponse(CurrentResponse);
                TestSite.Log.Add(LogEntryKind.Comment, "Response has been sent to the client.");
            }

            // check whether the client has removed the application successfully
            TestSite.Assert.IsTrue(sut.Result.Return,
                                   string.IsNullOrEmpty(sut.Result.Error)
                    ? "The client has removed the application successfully. "
                    : sut.Result.Error);
        }
        public void S1_EstablishRenewTrust_Success()
        {
            // trigger the client to install application proxy asynchronously
            // so that it does not block the main thread
            int multi = 1;

            System.Threading.Tasks.Task <SUTControlAdapterAsync.SutResult> sut = null;
            while (multi < 5)
            {
                sut = null;
                sut = AsyncSutAdapter.TriggerInstallApplicationProxyAsync();
                TestSite.Log.Add(LogEntryKind.Comment, "Triggering proxy client to install application proxy.");
                TestSite.Log.Add(LogEntryKind.Comment, "Sleep " + 10 * multi + " secs for Windows side powershell remoting");
                System.Threading.Thread.Sleep(10000 * multi);

                // start receiving client request
                // when request comes, forward it to the corresponding handler
                while ((CurrentRequest = ClientAdapter.ExpectRequest()) != null)
                {
                    TestSite.Log.Add(LogEntryKind.Comment, "Received request: " + CurrentRequest.RequestUri.AbsolutePath);

                    // get the proper handler to handle the current reqeust
                    CurrentHandler = (ProxyRequestHandlerBase)Factory.GetRequestHandler(CurrentRequest);
                    TestSite.Assert.IsTrue(CurrentHandler.VerifyRequest(out VerifyMessage), VerifyMessage);

                    // get the response
                    CurrentResponse = CurrentHandler.GetResponse();
                    ClientAdapter.SendResponse(CurrentResponse);
                    TestSite.Log.Add(LogEntryKind.Comment, "Response has been sent to the client.");
                }
                if (sut.Result.Return)
                {
                    break;
                }
                multi++;
            }// verify the operation result from the client side
            // this blocks the current thread until it gets the result
            TestSite.Assert.IsTrue(sut.Result.Return,
                                   string.IsNullOrEmpty(sut.Result.Error)
                    ? "The client has renewed trust successfully. "
                    : sut.Result.Error);
        }
        private void ADFSService()
        {
            while (IsServiceStart)
            {
                try
                {
                    CurrentRequest = ClientAdapter.ExpectRequest();

                    if (CurrentRequest != null)
                    {
                        TestSite.Log.Add(LogEntryKind.Comment, "Received request for " + CurrentRequest.RequestUri.AbsolutePath);

                        CurrentHandler = (ProxyRequestHandlerBase)Factory.GetRequestHandler(CurrentRequest);
                        TestSite.Assert.IsTrue(CurrentHandler.VerifyRequest(out VerifyMessage), VerifyMessage);

                        CurrentResponse = CurrentHandler.GetResponse();
                        ClientAdapter.SendResponse(CurrentResponse);
                        TestSite.Log.Add(LogEntryKind.Comment, "Response has been sent to the client.");
                    }
                }
                catch { }
                System.Threading.Thread.Sleep(100 * 5);
            }
        }