Example #1
0
        protected virtual bool ProcessPortResponse()
        {
            bool complete = false;

            TimeoutTimer.Disarm();

            if (Test.Steps[CurrentStep].Response != null)
            {
                if (!string.IsNullOrEmpty(Test.Steps[CurrentStep].Response.Header))
                {
                    int index = ResponseBuffer.LastIndexOf(Test.Steps[CurrentStep].Response.Header);
                    if (index >= 0)
                    {
                        ResponseBuffer = ResponseBuffer.Substring(index);
                    }
                }
            }

            if (!string.IsNullOrEmpty(ResponseBuffer))
            {
                qf4net.QF.Instance.Publish(new RecorderEvent(QFSignal.RecorderRecord, Name, CurrentStep + 1, ResponseBuffer));
            }

            ResponseProcessor.Process(Test.Name, Test.Steps[CurrentStep], ResponseBuffer);
            ResponseBuffer = string.Empty;
            complete       = true;

            return(complete);
        }
Example #2
0
        /// <summary>
        /// Submits a file to be processed (http://docs.scanii.com/v2.1/resources.html#files)
        /// </summary>
        /// <param name="path">file path on the local system</param>
        /// <param name="metadata">optional metadata to be added to this file</param>
        /// <returns>processing result</returns>
        /// <exception cref="ScaniiException"></exception>
        public ScaniiResult Process(string path, Dictionary <string, string> metadata)
        {
            var req = new RestRequest("files", Method.POST);

            // adding payload
            req.AddFile("file", path);

            foreach (var keyValuePair in metadata)
            {
                Log.Logger.Debug("medata item " + keyValuePair);
                req.AddParameter($"metadata[{keyValuePair.Key}]", keyValuePair.Value);
            }

            var resp = RestClient.Execute(req);

            if (resp.StatusCode != HttpStatusCode.Created)
            {
                throw new ScaniiException(
                          $"Invalid HTTP response from service, code: {resp.StatusCode} message: {resp.Content}");
            }

            Log.Logger.Information("response: " + resp.Content);
            Log.Logger.Debug("content " + resp.Content);
            Log.Logger.Debug("status code " + resp.StatusCode);

            return(ResponseProcessor.Process(resp));
        }
Example #3
0
        public override void unloadData()
        {
            log("Unloading", "unloadData");

            GridEnforcer.OnPlacementViolation -= eventPlacementViolation;
            GridEnforcer.OnCleanupViolation   -= eventCleanupViolation;
            GridEnforcer.OnCleanupTimerStart  -= eventCleanupTimerStart;
            GridEnforcer.OnCleanupTimerEnd    -= eventCleanupTimerEnd;
            ControlPoint.OnRewardsDistributed -= notifyPlayersOfCPResults;

            if (m_LocalReceiver != null)
            {
                m_MailMan.localMsgSent -= m_LocalReceiver.incomming;
                m_LocalReceiver.unload();
                m_LocalReceiver = null;
            }

            m_MailMan.unload();

            if (!MyAPIGateway.Utilities.IsDedicated)
            {
                m_CmdProc.shutdown();
            }

            m_RoundTimer.Dispose();
            m_RoundTimer = null;
            m_SaveTimer.Dispose();
            m_SaveTimer = null;

            s_Logger = null;
        }
Example #4
0
        /// <summary>
        /// Makes a fetch call to scanii (http://docs.scanii.com/v2.1/resources.html#files)
        /// </summary>
        /// <param name="location">location (URL) of the content to be processed</param>
        /// <param name="callback">location (URL) to be notified and receive the result</param>
        /// <param name="metadata">optional metadata to be added to this file</param>
        /// <returns></returns>
        /// <exception cref="ScaniiException"></exception>
        public ScaniiResult Fetch(string location, string callback, Dictionary <string, string> metadata)
        {
            var req = new RestRequest("files/fetch", Method.POST);

            if (location != null)
            {
                req.AddParameter("location", location);
            }

            if (callback != null)
            {
                req.AddParameter("callback", callback);
            }

            foreach (var keyValuePair in metadata)
            {
                Log.Logger.Debug("medata item " + keyValuePair);
                req.AddParameter($"metadata[{keyValuePair.Key}]", keyValuePair.Value);
            }

            var resp = RestClient.Execute(req);

            if (resp.StatusCode != HttpStatusCode.Accepted)
            {
                throw new ScaniiException(
                          $"Invalid HTTP response from service, code: {resp.StatusCode} message: {resp.Content}");
            }

            Log.Logger.Information("response: " + resp.Content);
            Log.Logger.Debug("content " + resp.Content);
            Log.Logger.Debug("status code " + resp.StatusCode);

            return(ResponseProcessor.Process(resp));
        }
Example #5
0
        private static void Bind(DataLayer.Test test, string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                path = Environment.CurrentDirectory;
            }
            else if (!Directory.Exists(path))
            {
                throw new ArgumentException("Path " + path + " does not exist.", "path");
            }

            DirectoryInfo directories = new DirectoryInfo(path);

            FileInfo[] files = directories.GetFiles("*.dll").Where(f => f.Name.StartsWith("TruePosition.Test.Custom")).ToArray();

            foreach (FileInfo info in files)
            {
                try
                {
                    Assembly.LoadFile(info.FullName);
                }
                catch (Exception ex) { }
            }

            foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                ResponseProcessor.BindEvents(test, assembly);
            }
        }
Example #6
0
        public void UUTCOCommandTest()
        {
            TestSets testCollections = Hydrator.Hydrate("CO Command Test", COCommandXML);

            ResponseProcessor.BindEvents(testCollections["Bootup"], Assembly.GetAssembly(typeof(TruePosition.Test.Custom.CSharp.CustomCommandEvents)));
            //ResponseProcessor.BindEvents(testCollections["Bootup"], Assembly.LoadFile(@"C:\Development\Kapsoft\True Position\Test Components\Output\Out.dll"));

            QFManager.Port.Create(PortType.Serial, "COM1");
            QFManager.Port.Receive("COM1", port_DataReceived);
            QFManager.Port.Error("COM1", port_Error);
            QFManager.Port.ReceiveTimeout("COM1", port_ReceiveTimeoutExpired);
            QFManager.Port.Open("COM1");

            Test test = testCollections["Bootup"]["1A"];

            QFManager.Test.Load(test, UUTTestMode.Direct);
            QFManager.Test.Stepping(test.Name, test_Stepping);
            QFManager.Test.TestStepped(test.Name, test_Stepped);
            QFManager.Test.Passed(test.Name, test_Passed);
            QFManager.Test.Failed(test.Name, test_Failed);

            QFManager.UUT.Load("LMU1", @"..\..\..\Documents\\UUT CO Response.xml", test, UUTTestMode.Direct);
            QFManager.UUT.Failed("LMU1", uut_Failed);
            QFManager.UUT.Passed("LMU1", uut_Passed);

            QFManager.UUT.Run("LMU1");
            QFManager.Test.Run(test.Name);

            System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
        }
Example #7
0
        private void ProcessQueue()
        {
            lock (m_ActionQueueLock)
            {
                if (m_ActionQueue.Count == 0)
                {
                    return;
                }
            }

            while (true)
            {
                ResponseProcessor action = null;
                bool bEmpty = false;
                lock (m_ActionQueueLock)
                {
                    action = m_ActionQueue.Dequeue();
                    bEmpty = m_ActionQueue.Count == 0;
                }
                action.Process();
                action.Dispose();

                if (bEmpty)
                {
                    break;
                }
            }
        }
Example #8
0
 private void QueueAction(ResponseProcessor inAction)
 {
     lock (m_ActionQueueLock)
     {
         m_ActionQueue.Enqueue(inAction);
     }
 }
Example #9
0
        private static async void BotOnMessageReceived(object sender, MessageEventArgs messageEventArgs)
        {
            var Bot     = sender as TelegramBotClient;
            var message = messageEventArgs.Message;

            if (message == null || message.Type != MessageType.TextMessage)
            {
                return;
            }

            MessageParser parser = new MessageParser(message);

            var parsedMessage = parser.Parse();

            if (parsedMessage.IsMessageForMe)
            {
                ResponseProcessor processor = new ResponseProcessor(parsedMessage);

                string response = processor.GetResponse();

                await Bot.SendTextMessageAsync(message.Chat.Id, response,
                                               replyMarkup : new ReplyKeyboardHide());
            }

            await Task.FromResult(true);
        }
Example #10
0
        public void SuccessTest()
        {
            var    processor       = new ResponseProcessor();
            string successResponse = processor.ProcessResponseString(successResponseString);

            Assert.IsTrue(successResponse.Contains("from user @TestUser"));
            Assert.IsTrue(successResponse.Contains("at 14:08."));
        }
Example #11
0
        public void ErrorTest()
        {
            var    processor     = new ResponseProcessor();
            string errorResponse = processor.ProcessResponseString(errorResponseString);

            Assert.IsTrue(errorResponse.Contains("Error 140"));
            Assert.IsTrue(errorResponse.Contains("An error occurred."));
        }
Example #12
0
            public void onFailure(AndroidJavaObject inObject)
            {
                if (!Genie.Exists)
                {
                    return;
                }

                Genie.instance.QueueAction(ResponseProcessor.Create(this.Process_Event, inObject));
            }
Example #13
0
            public void onSuccess(AndroidJavaObject inDataExport)
            {
                if (m_DataExportService != null)
                {
                    return;
                }

                Genie.instance.QueueAction(ResponseProcessor.Create(this.onSuccess_Event, inDataExport, false));
            }
Example #14
0
            static public ResponseProcessor Create(Action <AndroidJavaObject> inAction, AndroidJavaObject inObject, bool inbDisposeResponse = true)
            {
                ResponseProcessor processor = s_Pool.Pop();

                processor.Action          = inAction;
                processor.Response        = inObject;
                processor.DisposeResponse = inbDisposeResponse;
                return(processor);
            }
        public void CanProcessResponse()
        {
            var responseProcessor = new ResponseProcessor(Constants.Iv, Constants.SecretKey);
            var testResult        = responseProcessor.Process(
                "cGhnd085RWpRNnJZdjVaVW9hVm9UWkR3cDB1L1Q1NE5LRlZraTlRNVI0a3RiaFczRnZqenBRcGFkU0EvanpPa3lqVVNJaDJjZmZXQ0VhSjJmTmFmMGVHRk5Sc3JVZmFmU2p0L0x3bENNOWdLZFJIa1RvRmtESnV5V1VtcUVmNjlFV3AwZ21TcjNRZW5xYmY0dlVUa29KV2dZeEg1M0tXd3Rja1pPd1IrbW1pZGNFbWJFR1d6dkFyTUVGVThzZW9oOVRkdDluZWo1dThnSHJ5TGxBSEI5TDBwUEFZS20yYUlZZWJsUFRsOU5yQW5ZdGFpcDJublFSNUcwU05Ob3pMR2xRcjFicDlxZ2lJb01pa29TdGRoOWxnUllwbWp2MDJqMER4ZGh0SkxaTjVFU2ZFTXdjRmpIdFM3REtkMnNLeVRvU3kvNTZncWlrc0VuRUlCTFRoUi8zUmp2VmRRbjRTd2IvNVVQRGhxNmpRZ0hYNkVqUVVaSitUZG9NYjR6Ty9VY3FEZjd1K0ZBeXdlR1RPVFh4Wm4wTHZkaFF6TVduYmJvOUREbm80RVBYMWQzMS9JaVM2d1F6dmhWU0UyZnl4ZHF6L3FoYk9WVzNJZS9PMFJ5UXJqemhvOC8zZ1ovWSt0NVJnS3gzeUxLTDBDN1Y3TW1aSlMrL0toUjJjUy9ETXVpenlUOE5hWmRXTy9zUTVOOU9aNm5iM3AwSUJ2TkRyRHV0R09jczJPSk1Jb21zeXFiOEs4ZXBVYnZNS0NURjUvZXhlNDZvMDRuZnN4aVorWkhmNWw4QVJWZzMrc1cvdzh0dmFndEM3NHc2c2Z0c0tzeEQ2ckVORU5zRDBlL0ltK1U3Qmc1UFhMaXhCNjFwdnArRGxRZ1R0bG5ReFlnV1h4SXE3WGhrNlEvL3Zmb2tYQzBCRGZjWm14ZGNHQXNZc2s=");
            var target = JsonConvert.DeserializeObject <PaymentResponse>(
                "{\"checkoutRequestID\":1721,\"totalAmount\":15000,\"accountNumber\":\"214577412301\",\"country\":\"KE\",\"currency\":\"KES\",\"payments\":[{\"payerTransactionID\":\"220055\",\"beepTransactionID\":\"998877\",\"amount\":\"3000\",\"accountNumber\":\"214577412301\",\"MSISDN\":\"254700000001\"},{\"payerTransactionID\":\"220055\",\"beepTransactionID\":\"998878\",\"amount\":\"500\",\"accountNumber\":\"214577412301\",\"MSISDN\":\"254700000001\"},{\"payerTransactionID\":\"220055\",\"beepTransactionID\":\"998879\",\"amount\":\"2000\",\"accountNumber\":\"214577412301\",\"MSISDN\":\"254700000001\"}]}");

            testResult.Should().BeEquivalentTo(target);
        }
Example #16
0
        public void TempuratureResponseTest()
        {
            XElement exerpt = XElement.Parse("<TestSets>" +
                                             "<TestSet Name=\"Bootup\">" +
                                             "<Test Type=\"Bootup\" Name=\"1A\">" +
                                             "<Step Type=\"Bootup\">" +
                                             "<Command>pro</Command>" +
                                             "<Response Delimiter=\"&#xA;\">" +
                                             "<Element>" +
                                             "<KeyExpression>value like 'TEMPERATURES:*'</KeyExpression>" +
                                             "<Expected Trim=\"true\">" +
                                             "<KeyExpression>value like '*recvr*'</KeyExpression>" +
                                             "<Expression>value &gt;= -10</Expression>" +
                                             "<Expression>value &lt;= 70</Expression>" +
                                             "<Destination>" +
                                             "<Name></Name>" +
                                             "<Default></Default>" +
                                             "</Destination>" +
                                             "<FailureMessage>Receiver Temperature outside limits</FailureMessage>" +
                                             "</Expected>" +
                                             "<Expected Trim=\"true\"> Trim=\"true\"" +
                                             "<KeyExpression>value like '*bdc*'</KeyExpression>" +
                                             "<Expression>value &gt;= -10</Expression>" +
                                             "<Expression>value &lt;= 28</Expression>" +
                                             "<Destination>" +
                                             "<Name></Name>" +
                                             "<Default></Default>" +
                                             "</Destination>" +
                                             "<FailureMessage>Receiver Temperature outside limits</FailureMessage>" +
                                             "</Expected>" +
                                             "<Expected Trim=\"true\">" +
                                             "<KeyExpression>value like '*power supply*'</KeyExpression>" +
                                             "<Expression>value &gt;= -10</Expression>" +
                                             "<Expression>value &lt;= 35</Expression>" +
                                             "<Destination>" +
                                             "<Name></Name>" +
                                             "<Default></Default>" +
                                             "</Destination>" +
                                             "<FailureMessage>Receiver Temperature outside limits</FailureMessage>" +
                                             "</Expected>" +
                                             "</Element>" +
                                             "</Response>" +
                                             "<Timeout>180</Timeout>" +
                                             "<BeginState>BOOT</BeginState>" +
                                             "<EndState>DSHELL</EndState>" +
                                             "<Retries>0</Retries>" +
                                             "</Step>" +
                                             "</Test>" +
                                             "</TestSet>" +
                                             "</TestSets>");

            TestSets collections = Hydrator.Hydrate("Test", exerpt);

            ResponseProcessor.Process("First Test", collections["Bootup"]["1A"].Steps[0], "TEMPERATURES: recvr 31 bdc 28 power supply 35");
        }
Example #17
0
            public void onFailure(AndroidJavaObject inResponse)
            {
                // TODO: Make this more meaningful
                // We're getting onFailure calls here when we're not
                // calling any functions to the service
                if (m_DataExportService != null)
                {
                    return;
                }

                Genie.instance.QueueAction(ResponseProcessor.Create(this.onFailure_Event, inResponse));
            }
Example #18
0
        public void TryProcessError_ShouldReturnFalse_IfResponseStatusCodeIsCreated()
        {
            var mockResp = new Mock <IGitHubResponse>(MockBehavior.Strict);

            mockResp.Setup(r => r.StatusCode)
            .Returns(HttpStatusCode.Created);
            var processor = new ResponseProcessor();

            GitHubException ex = null;

            Assert.IsFalse(processor.TryProcessResponseErrors(mockResp.Object, out ex));
        }
Example #19
0
        public void TryProcessError_ShouldReturnTrue_IfResponseStatusCodeIsNotOKOrCreated()
        {
            var mockResp = new Mock <IGitHubResponse>(MockBehavior.Strict);

            mockResp.Setup(r => r.StatusCode).Returns(HttpStatusCode.Forbidden);
            mockResp.Setup(r => r.ErrorException).Returns <Exception>(null);
            mockResp.Setup(r => r.ResponseStatus).Returns(ResponseStatus.Completed);
            var processor = new ResponseProcessor();

            GitHubException ex = null;

            Assert.IsTrue(processor.TryProcessResponseErrors(mockResp.Object, out ex));
        }
        public void Setup()
        {
            IResponseProcessor p = new ResponseProcessor();

            browser = new Browser(c => c
                                  .Module <RedirectModule>()
                                  .DisableAutoRegistrations()
                                  .Dependency(A.Dummy <IEntitySerializer>())
                                  .Dependency(A.Dummy <INamespaceManager>())
                                  .Dependency(A.Dummy <IContextPathMapper>())
                                  .Dependency <IHydraDocumentationSettings>(A.Dummy <IHydraDocumentationSettings>())
                                  .Dependency <IWikibusConfiguration>(new TestConfiguration()));
        }
Example #21
0
        /// <summary>
        /// Starts up the core on the server
        /// </summary>
        public override void initialize()
        {
            if (MyAPIGateway.Session == null || m_Initialized)
            {
                return;
            }

            if (s_Logger == null)
            {
                s_Logger = new Logger("Conquest Core", "Server");
            }
            log("Conquest core (Server) started");

            s_Settings            = ConquestSettings.getInstance();
            s_DelayedSettingWrite = s_Settings.WriteFailed;
            // Start round timer
            m_RoundTimer = new MyTimer(s_Settings.CPPeriod * 1000, roundEnd);
            m_RoundTimer.Start();
            log("Round timer started with " + s_Settings.CPPeriod + " seconds");

            // Start save timer
            m_SaveTimer = new MyTimer(Constants.SaveInterval * 1000, saveTimer);
            m_SaveTimer.Start();
            log("Save timer started");

            m_MailMan = new RequestProcessor();

            // If the server is a player (non-dedicated) they also need to receive notifications
            if (!MyAPIGateway.Utilities.IsDedicated)
            {
                m_LocalReceiver         = new ResponseProcessor(false);
                m_MailMan.localMsgSent += m_LocalReceiver.incomming;
                m_CmdProc = new CommandProcessor(m_LocalReceiver);
                m_CmdProc.initialize();
                m_LocalReceiver.requestSettings();
                m_Player = MyAPIGateway.Session.Player;
            }

            // Subscribe events
            GridEnforcer.OnPlacementViolation += eventPlacementViolation;
            GridEnforcer.OnCleanupViolation   += eventCleanupViolation;
            GridEnforcer.OnCleanupTimerStart  += eventCleanupTimerStart;
            GridEnforcer.OnCleanupTimerEnd    += eventCleanupTimerEnd;
            ControlPoint.OnRewardsDistributed += notifyPlayersOfCPResults;

            m_CurrentFrame = 0;

            m_Initialized = true;
        }
Example #22
0
        public void TryProcessError_ShouldReturnException_WithNotFoundErrorType_IfResponseStatusCodeIsNotFound()
        {
            var mockResp = new Mock <IGitHubResponse>(MockBehavior.Strict);

            mockResp.Setup(r => r.StatusCode).Returns(HttpStatusCode.NotFound);
            mockResp.Setup(r => r.ErrorException).Returns <Exception>(null);
            mockResp.Setup(r => r.ResponseStatus).Returns(ResponseStatus.Completed);
            var processor = new ResponseProcessor();

            GitHubException ex = null;

            processor.TryProcessResponseErrors(mockResp.Object, out ex);

            Assert.AreEqual(ErrorType.ResourceNotFound, ex.ErrorType);
        }
Example #23
0
        public void TryProcessError_ShouldReturnException_WithNoNetworkErrorType_IfResponseStatusIsError()
        {
            var mockResp = new Mock <IGitHubResponse>(MockBehavior.Strict);

            mockResp.Setup(r => r.StatusCode).Returns(HttpStatusCode.RequestTimeout);
            mockResp.Setup(r => r.ErrorException).Returns <Exception>(null);
            mockResp.Setup(r => r.ResponseStatus).Returns(ResponseStatus.Error);
            var processor = new ResponseProcessor();

            GitHubException ex = null;

            processor.TryProcessResponseErrors(mockResp.Object, out ex);

            Assert.AreEqual(ErrorType.NoNetwork, ex.ErrorType);
        }
Example #24
0
        public override void initialize()
        {
            if (s_Logger == null)
            {
                s_Logger = new Logger("Conquest Core", "Client");
            }

            m_Player       = MyAPIGateway.Session.Player;
            m_CurrentFrame = 0;

            m_MailMan = new ResponseProcessor();

            m_CmdProc = new CommandProcessor(m_MailMan);
            m_CmdProc.initialize();
        }
Example #25
0
        /// <summary>
        /// Fetches the results of a previously processed file (http://docs.scanii.com/v2.1/resources.html#files)
        /// </summary>
        /// <param name="id">id of the content/file to be retrieved</param>
        /// <returns>ScaniiResult</returns>
        /// <exception cref="ScaniiException"></exception>
        public ScaniiResult Retrieve(string id)
        {
            var req = new RestRequest("files/{id}", Method.GET);

            req.AddParameter("id", id, ParameterType.UrlSegment);
            var resp = RestClient.Execute(req);

            if (resp.StatusCode != HttpStatusCode.OK)
            {
                throw new ScaniiException(
                          $"Invalid HTTP response from service, code: {resp.StatusCode} message: {resp.Content}");
            }

            return(ResponseProcessor.Process(resp));
        }
Example #26
0
        /// <summary>
        /// Creates a new temporary authentication token (http://docs.scanii.com/v2.1/resources.html#auth-tokens)
        /// </summary>
        /// <param name="timeoutInSeconds">How long the token should be valid for</param>
        /// <returns>the new auth token</returns>
        /// <exception cref="ScaniiException"></exception>
        public ScaniiResult CreateAuthToken(int timeoutInSeconds = 300)
        {
            var req = new RestRequest("auth/tokens", Method.POST);

            req.AddParameter("timeout", timeoutInSeconds);
            var resp = RestClient.Execute(req);

            if (resp.StatusCode != HttpStatusCode.Created)
            {
                throw new ScaniiException(
                          $"Invalid HTTP response from service, code: {resp.StatusCode} message: {resp.Content}");
            }

            Log.Logger.Information("response: " + resp.Content);
            Log.Logger.Debug("content " + resp.Content);
            Log.Logger.Debug("status code " + resp.StatusCode);

            return(ResponseProcessor.Process(resp));
        }
Example #27
0
        /// <summary>
        /// Retrieves a previously created auth token
        /// </summary>
        /// <param name="id">the id of the token to be retrieved</param>
        /// <returns></returns>
        /// <exception cref="ScaniiException"></exception>
        public ScaniiResult RetrieveAuthToken(string id)
        {
            var req = new RestRequest("auth/tokens/{id}", Method.GET);

            req.AddParameter("id", id, ParameterType.UrlSegment);

            var resp = RestClient.Execute(req);

            if (resp.StatusCode != HttpStatusCode.OK)
            {
                throw new ScaniiException(
                          $"Invalid HTTP response from service, code: {resp.StatusCode} message: {resp.Content}");
            }

            Log.Logger.Information("response: " + resp.Content);
            Log.Logger.Debug("content " + resp.Content);
            Log.Logger.Debug("status code " + resp.StatusCode);

            return(ResponseProcessor.Process(resp));
        }
Example #28
0
        public void ActiveTestTest()
        {
            TestSets testCollections = Hydrator.Hydrate("CO Command Test", COCommandXML);

            ResponseProcessor.BindEvents(testCollections["Bootup"], Assembly.GetAssembly(typeof(TruePosition.Test.Custom.CSharp.CustomCommandEvents)));

            QFManager.Port.Create(PortType.Serial, "COM1");
            QFManager.Port.Receive("COM1", port_DataReceived);
            QFManager.Port.Error("COM1", port_Error);
            QFManager.Port.ReceiveTimeout("COM1", port_ReceiveTimeoutExpired);
            QFManager.Port.Open("COM1");

            Test test = testCollections["Bootup"]["1A"];

            QFManager.Test.Load(test);
            QFManager.Test.Failed(test.Name, test_Failed);
            QFManager.Test.Passed(test.Name, test_Passed);
            QFManager.Test.Run(test.Name);

            System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
        }
Example #29
0
        private async Task <Response> BuildResponse()
        {
            Response response = null;

            var originalBodyStream = _context.Response.Body;

            using (var responseBody = new MemoryStream())
            {
                _context.Response.Body = responseBody;

                await _next.Invoke(_context);

                string responseBodyData = await ProcessResponseBody(_context);

                _context.Response.Headers.Add("x-documentation-url", _configValues.options.baseLogUrl + "/logs/" + guid);
                ResponseProcessor responseProcessor = new ResponseProcessor(_context.Response, responseBodyData, _configValues);
                response = responseProcessor.ProcessResponse();

                await responseBody.CopyToAsync(originalBodyStream);
            }
            return(response);
        }
Example #30
0
        public void COResponseFileTest()
        {
            TestSets testCollections = Hydrator.Hydrate("CO Command Test", COCommandXML);

            ResponseProcessor.BindEvents(testCollections["Bootup"], Assembly.GetAssembly(typeof(TruePosition.Test.Custom.CSharp.CustomCommandEvents))); //Assembly.GetAssembly(typeof(TruePosition.Test.Custom.CSharp.CustomCommandEvents)));

            ResponseProcessor.Process("1A", testCollections["Bootup"]["1A"].Steps[0], "ESN: " + "\n" +
                                      "GBE_CTLR:     NOT INSTALLED            " + "\n" +
                                      "GBE_LNA:      NOT INSTALLED            " + "\n" +
                                      "GBE:          NOT INSTALLED            " + "\n" +
                                      "GBE CUST ESN: NOT INSTALLED            " + "\n" +
                                      "LMU:          06162200D010082006501DA6 " + "\n" +
                                      "GPS RCVR:     06162200D010082006501DA6 " + "\n" +
                                      "RECEIVER:     06163900B0100820070403C2 " + "\n" +
                                      "BDC:          06164000C11008200704063B " + "\n" +
                                      "PSUPPLY:      06163400G0100820064300C1 " + "\n" +
                                      "CP/DSP:       06164100B1100820064700C2 " + "\n" +
                                      "DCARD:        06160301B010082006440005 " + "\n" +
                                      "EBOARD:       NOT INSTALLED            " + "\n" +
                                      "CUSTESN:      TRULMU5207872AE          " + "\n" +
                                      "TEMPERATURES: recvr 31 bdc 28 power supply 35" + "\n" +
                                      "TPESN:        06630000D010082007050130");
        }
 public HaloAPIService(string apiToken, string baseApiUrl = "https://www.haloapi.com")
 {
     Endpoints.MajorPrefix = baseApiUrl;
     RequestRateHttpClient.SetAPIToken(apiToken);
     _responseProcessor = new ResponseProcessor();
 }