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.");
        }
        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);
        }
Esempio n. 3
0
            public void  Dispose()
            {
                ClientAdapter.Dispose();
                ServerAdapter.Dispose();
                ((IDisposable)Graph).Dispose();

                GeneralUtils.AbortThread(NegotiationThread);
            }
Esempio n. 4
0
        public virtual void Connect(IPAddress publicIP, ushort port)
        {
            if (CoreSystem.IsServer)
            {
                throw new InvalidOperationException("This instance of CoreNetworkSystem is a server!  It cannot be told to connect to a remote client; the client must be told to connect here.");
            }

            ClientAdapter.Connect(new IPEndPoint(publicIP, port));
        }
        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);
            }
        }
Esempio n. 7
0
        /*
         *  Alteramos o nome da classe 'Client' para 'ClientAdapter'.
         *
         *  Implementamos uma composição entre 'ClientAdapter' e 'MySqlCommands'
         *  para poder acessar os métodos da classe 'MySqlCommands' mesmo usando
         *  a interface 'IDb'.
         *
         *  A adaptação aqui ocorre na classe 'ClientAdapter'.
         */

        static void Main(string[] args)
        {
            var client = new ClientAdapter(new MySqlCommands());

            client.Insert();
        }
Esempio n. 8
0
 public LoginService(IUserRepository userRepository, ITerminalRepository terminalRepository, ClientAdapter clientAdapter)
 {
     _userRepository     = userRepository;
     _terminalRepository = terminalRepository;
     _clientAdapter      = clientAdapter;
 }