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.");
        }
Exemplo n.º 2
0
        private bool ExecutePendingDecisions(Func <bool> shouldContinue)
        {
            var resultsToSave = new List <IDecisionHandler>();

            var should = false;

            while (shouldContinue())
            {
                if (CurrentHandler == null || CurrentHandler.HasCompleted)
                {
                    if (_decisionQueue.Count == 0)
                    {
                        should = true;
                        break;
                    }

                    var decision = _decisionQueue.Dequeue();
                    CurrentHandler = decision.CreateHandler(Game);
                }

                CurrentHandler.Execute();
                resultsToSave.Add(CurrentHandler);
            }

            // it's important to save the results only when decision queue is empty
            // if its not the playback will not work, because the decisions not yet
            // executed, can not be saved properly
            foreach (var decision in resultsToSave)
            {
                decision.SaveDecisionResults();
            }

            return(should);
        }
        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);
        }
Exemplo n.º 4
0
        private bool ExecutePendingDecisions(Func <bool> shouldContinue)
        {
            var should = false;

            while (shouldContinue())
            {
                if (CurrentHandler == null || CurrentHandler.HasCompleted)
                {
                    if (_decisionQueue.Count == 0)
                    {
                        should = true;
                        break;
                    }

                    var decision = _decisionQueue.Dequeue();
                    CurrentHandler = decision.CreateHandler(Game);
                }

                // execute is called multiple times, during
                // search tree generation
                CurrentHandler.Execute();
            }

            return(should);
        }
        internal Highlight NextMatch()
        {
            wrapForward = true;
            if (iteratingHandlerPtr == -1)
            {
                iteratingHandlerPtr = 0;
            }

            focussedControlIndex = GetHandlerIndexOfLogicalFocusedControl();
            if (startHandlerIndex == -1)
            {
                startHandlerIndex = focussedControlIndex;
            }


            //in case foccusedControlIndex was -1
            if (startHandlerIndex == -1)
            {
                startHandlerIndex = 0;
            }

            if (focusHasChanged)
            {
                if (CurrentHandler != null)
                {
                    CurrentHandler.ResetIterator();
                }
                startHandlerIndex   = focussedControlIndex;
                iteratingHandlerPtr = 0;
                focusHasChanged     = false;
            }

            if (CurrentHandler == null)
            {
                return(null);
            }

            if (CurrentHandler.NextMatch())
            {
                return(CurrentHandler.CurrentMatch);
            }
            else
            {
                do
                {
                    iteratingHandlerPtr++;
                } while (CurrentHandler != null && !CurrentHandler.NextMatch());

                if (CurrentHandler == null)//ran out
                {
                    iteratingHandlerPtr = -1;
                    return(null);
                }
            }
            return(CurrentHandler.CurrentMatch);
        }
        internal Highlight PreviousMatch()
        {
            wrapForward = false;
            if (iteratingHandlerPtr == -1)
            {
                iteratingHandlerPtr = 0;
            }
            focussedControlIndex = GetHandlerIndexOfLogicalFocusedControl();
            if (startHandlerIndex == -1)
            {
                startHandlerIndex = focussedControlIndex;
            }

            if (startHandlerIndex == -1)
            {
                startHandlerIndex = 0;
            }

            if (focusHasChanged)
            {
                CurrentHandler.ResetIterator();
                //startHandlerIndex = focussedControlIndex+1;//************this appears to work but there is a problem when changing direction, prev to next
                startHandlerIndex = focussedControlIndex;
                //iteratingHandlerPtr = Count - 1;
                iteratingHandlerPtr = 0;
                focusHasChanged     = false;
            }

            if (CurrentHandler.PreviousMatch())
            {
                return(CurrentHandler.CurrentMatch);
            }
            else
            {
                //no matches for current handler, so cycle through handlers until find a match
                do
                {
                    iteratingHandlerPtr++;
                } while (CurrentHandler != null && !CurrentHandler.PreviousMatch());

                if (CurrentHandler == null)//ran out
                {
                    iteratingHandlerPtr = -1;
                    return(null);
                }
            }

            return(CurrentHandler.CurrentMatch);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Обработчик события рисования PictureBox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pbCanvas_Paint(object sender, PaintEventArgs e)
        {
            var g = e.Graphics;

            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

            if (_figures != null)
            {
                foreach (var figure in _figures)
                {
                    FigureDrawer.DrawFigure(figure.Value, g);
                }
            }

            CurrentHandler?.Draw(g);
        }
        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);
            }
        }
Exemplo n.º 10
0
 public static void EndHandler()
 {
     // Commit
     CurrentHandler.Commit();
     CurrentHandler = null;
 }
Exemplo n.º 11
0
 public static DuplicatingIni GetIniFile(string filename)
 {
     return(CurrentHandler.GetFile(filename));
 }
Exemplo n.º 12
0
 /// <summary>
 /// Обработчик отпускания нажатой мышки
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void pbCanvas_MouseUp(object sender, MouseEventArgs e)
 {
     OnMouseUp(e);
     CurrentHandler?.MouseUpDelegate(sender, e);
 }