Пример #1
0
        /// <summary>
        /// Validate Request status of the submited request.
        /// </summary>
        /// <param name="blastParameters">Ebi blast service config parameters</param>
        /// <returns></returns>
        private TestCaseOutput GetRequestStatusTest(Dictionary <string, object> blastParameters)
        {
            // Get the input query string
            string   sequenceString = blastParameters[Constants.QuerySeqString] as string;
            string   alphabetName   = blastParameters[Constants.AlphabetString] as string;
            Sequence sequence       = new Sequence(Utility.GetAlphabet(alphabetName),
                                                   sequenceString);

            // create Ebi Blast service object.
            IBlastServiceHandler service = null;
            object reqInfoObject         = null;

            try
            {
                service = new EbiWuBlastHandler();
                ConfigParameters configParams = new ConfigParameters();
                configParams.UseBrowserProxy = true;
                service.Configuration        = configParams;

                BlastParameters blastSearchPams = blastParameters[Constants.BlastParmsConst]
                                                  as BlastParameters;

                // Create a request without passing sequence.
                string reqId = service.SubmitRequest(sequence, blastSearchPams);

                // validate request identifier.
                Assert.IsNotNull(reqId);

                // query the status
                reqInfoObject = service.GetRequestStatus(reqId);
            }
            finally
            {
                if (service != null)
                {
                    ((IDisposable)service).Dispose();
                }
            }

            return(new TestCaseOutput(reqInfoObject, false));
        }
Пример #2
0
        /// <summary>
        /// Validate general http request status by
        /// differnt parameters for Ebi web service..
        /// <param name="nodeName">different alphabet node name</param>
        /// </summary>
        void ValidateEbiGeneralGetRequestStatusMethod(string nodeName,
                                                      string alphabet)
        {
            // Gets the search query parameter and their values.
            string querySequence = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.QuerySequency);
            string queryDatabaseValue = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.DatabaseValue);
            string queryProgramValue = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.ProgramValue);
            string queryDatabaseParameter = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.DatabaseParameter);
            string queryProgramParameter = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.ProgramParameter);
            string emailParameter = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.Emailparameter);
            string email = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.EmailAdress);

            string reqId = string.Empty;

            // Create a sequence.
            Sequence seq = new Sequence(Utility.GetAlphabet(alphabet),
                                        querySequence);

            // Set Service confiruration parameters true.
            IBlastServiceHandler ebiBlastService = new EbiWuBlastHandler();

            ConfigParameters configParameters = new ConfigParameters();

            configParameters.UseBrowserProxy = true;
            ebiBlastService.Configuration    = configParameters;

            // Create search parameters object.
            BlastParameters queryParams = new BlastParameters();

            queryParams.Add(queryDatabaseParameter, queryDatabaseValue);
            queryParams.Add(queryProgramParameter, queryProgramValue);
            queryParams.Add(emailParameter, email);
            queryParams.Add("SequenceType", alphabet.ToLower(CultureInfo.CurrentCulture).Replace("ambiguous", ""));

            // Create a request
            reqId = ebiBlastService.SubmitRequest(seq, queryParams);

            // validate request identifier.
            Assert.IsNotNull(reqId);

            // submit request identifier and get the status
            ServiceRequestInformation reqInfo = ebiBlastService.GetRequestStatus(reqId);

            // Validate job status.
            if (reqInfo.Status != ServiceRequestStatus.Waiting &&
                reqInfo.Status != ServiceRequestStatus.Ready)
            {
                string error = ApplicationLog.WriteLine(
                    string.Concat("Unexpected error", reqInfo.Status));
                Assert.Fail(error);
                Console.WriteLine(string.Concat(
                                      "Unexpected error ", reqInfo.Status));
            }
            else
            {
                Console.WriteLine(string.Concat(
                                      "Request status ", reqInfo.Status));
            }
        }
Пример #3
0
        /// <summary>
        /// Validate general fetching results.by passing
        /// differnt parameters for Ebi web service..
        /// <param name="nodeName">xml node name.</param>
        /// <param name="isFetchSynchronous">Is Fetch Synchronous?</param>
        /// </summary>
        void ValidateEBIWuBlastResultsFetch(
            string nodeName,
            bool isFetchSynchronous)
        {
            // Gets the search query parameter and their values.
            string alphabetName = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.AlphabetNameNode);
            string querySequence = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.QuerySequency);
            string queryDatabaseValue = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.DatabaseValue);
            string emailParameter = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.Emailparameter);
            string email = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.EmailAdress);
            string queryProgramValue = utilityObj.xmlUtil.GetTextValue(
                Constants.EbiAsynchronousResultsNode, Constants.ProgramValue);
            string queryDatabaseParameter = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.DatabaseParameter);
            string queryProgramParameter = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.ProgramParameter);
            string expectedHitId = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.HitID);
            string expectedAccession = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.HitAccession);
            string expectedResultCount = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.ResultsCount);
            string expectedHitsCount = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.HitsCount);
            string expectedEntropyStatistics = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.EntropyStatistics);
            string expectedKappaStatistics = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.KappaStatistics);
            string expectedLambdaStatistics = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.LambdaStatistics);
            string expectedLength = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.Length);

            object   responseResults = null;
            Sequence seq             = new Sequence(Utility.GetAlphabet(alphabetName),
                                                    querySequence);

            // create Ebi Blast service object.
            IBlastServiceHandler service      = new EbiWuBlastHandler();
            ConfigParameters     configParams = new ConfigParameters();

            configParams.UseBrowserProxy = true;
            service.Configuration        = configParams;

            BlastParameters searchParams = new BlastParameters();

            // Set Request parameters.
            searchParams.Add(queryDatabaseParameter, queryDatabaseValue);
            searchParams.Add(queryProgramParameter, queryProgramValue);
            searchParams.Add(emailParameter, email);
            searchParams.Add("SequenceType",
                             alphabetName.ToLower(CultureInfo.CurrentCulture).Replace("ambiguous", ""));

            // Create a request without passing sequence.
            string reqId = service.SubmitRequest(seq, searchParams);

            // validate request identifier.
            Assert.IsNotNull(reqId);

            // query the status
            ServiceRequestInformation info = service.GetRequestStatus(reqId);

            if (info.Status != ServiceRequestStatus.Waiting &&
                info.Status != ServiceRequestStatus.Ready)
            {
                string err =
                    ApplicationLog.WriteLine("Unexpected status: '{0}'", info.Status);
                Assert.Fail(err);
            }

            // get async results, poll until ready
            int maxAttempts = 20;
            int attempt     = 1;

            while (attempt <= maxAttempts &&
                   info.Status != ServiceRequestStatus.Error &&
                   info.Status != ServiceRequestStatus.Ready)
            {
                if (isFetchSynchronous)
                {
                    info = service.GetRequestStatus(reqId);
                    Thread.Sleep(info.Status == ServiceRequestStatus.Waiting ||
                                 info.Status == ServiceRequestStatus.Queued
                        ? 20000 * attempt : 0);
                }
                else
                {
                    Thread.Sleep(info.Status == ServiceRequestStatus.Waiting ? 20000 : 0);
                    info = service.GetRequestStatus(reqId);
                }
                ++attempt;
            }

            IBlastParser blastXmlParser = new BlastXmlParser();

            responseResults = blastXmlParser.Parse(
                new StringReader(service.GetResult(reqId, searchParams)));

            // Validate blast results.
            Assert.IsNotNull(responseResults);
            List <BlastResult> eBlastResults = responseResults as List <BlastResult>;

            Assert.IsNotNull(eBlastResults);

            Assert.AreEqual(eBlastResults.Count.ToString(
                                (IFormatProvider)null), expectedResultCount);
            Assert.AreEqual(eBlastResults[0].Records.Count.ToString((
                                                                        IFormatProvider)null), expectedResultCount);
            BlastSearchRecord record = eBlastResults[0].Records[0];

            Assert.AreEqual(record.Statistics.Kappa.ToString(
                                (IFormatProvider)null), expectedKappaStatistics);
            Assert.AreEqual(record.Statistics.Lambda.ToString(
                                (IFormatProvider)null), expectedLambdaStatistics);
            Assert.AreEqual(record.Statistics.Entropy.ToString(
                                (IFormatProvider)null), expectedEntropyStatistics);
            Assert.AreEqual(record.Hits.Count.ToString(
                                (IFormatProvider)null), expectedHitsCount);
            Hit hit = record.Hits[0];

            Assert.AreEqual(hit.Accession, expectedAccession);
            Assert.AreEqual(hit.Length.ToString((IFormatProvider)null), expectedLength);
            Assert.AreEqual(hit.Id.ToString((IFormatProvider)null), expectedHitId);
            Assert.AreEqual(hit.Hsps.Count.ToString((IFormatProvider)null),
                            expectedResultCount);
            Console.WriteLine(string.Format((IFormatProvider)null,
                                            "Ebi Blast BVT: Hits count '{0}'.", eBlastResults.Count));
            Console.WriteLine(string.Format((IFormatProvider)null,
                                            "Ebi Blast BVT: Accession '{0}'.", hit.Accession));
            Console.WriteLine(string.Format((IFormatProvider)null,
                                            "Ebi Blast BVT: Hit Id '{0}'.", hit.Id));
            Console.WriteLine(string.Format((IFormatProvider)null,
                                            "Ebi Blast BVT: Hits Count '{0}'.", hit.Hsps.Count));

            // Validate the results Synchronously with the results got earlier.
            if (isFetchSynchronous)
            {
                IList <BlastResult> syncBlastResults =
                    service.FetchResultsSync(reqId, searchParams) as List <BlastResult>;
                Assert.IsNotNull(syncBlastResults);
                if (null != eBlastResults[0].Records[0].Hits &&
                    0 < eBlastResults[0].Records[0].Hits.Count &&
                    null != eBlastResults[0].Records[0].Hits[0].Hsps &&
                    0 < eBlastResults[0].Records[0].Hits[0].Hsps.Count)
                {
                    Assert.AreEqual(eBlastResults[0].Records[0].Hits[0].Hsps[0].QuerySequence,
                                    syncBlastResults[0].Records[0].Hits[0].Hsps[0].QuerySequence);
                }
                else
                {
                    ApplicationLog.WriteLine(
                        "No significant hits found with the these parameters.");
                    Console.WriteLine("No significant hits found with the these parameters.");
                }
            }
        }
Пример #4
0
        public void ValidateProcessRequestThread()
        {
            // Gets the search query parameter and their values.
            string alphabetName = utilityObj.xmlUtil.GetTextValue(
                Constants.EbiSynchronousResults, Constants.AlphabetNameNode);
            string querySequence = utilityObj.xmlUtil.GetTextValue(
                Constants.EbiSynchronousResults, Constants.QuerySequency);
            string queryDatabaseValue = utilityObj.xmlUtil.GetTextValue(
                Constants.EbiSynchronousResults, Constants.DatabaseValue);
            string emailParameter = utilityObj.xmlUtil.GetTextValue(
                Constants.EbiSynchronousResults, Constants.Emailparameter);
            string email = utilityObj.xmlUtil.GetTextValue(
                Constants.EbiSynchronousResults, Constants.EmailAdress);
            string queryProgramValue = utilityObj.xmlUtil.GetTextValue(
                Constants.EbiAsynchronousResultsNode, Constants.ProgramValue);
            string queryDatabaseParameter = utilityObj.xmlUtil.GetTextValue(
                Constants.EbiSynchronousResults, Constants.DatabaseParameter);
            string queryProgramParameter = utilityObj.xmlUtil.GetTextValue(
                Constants.EbiSynchronousResults, Constants.ProgramParameter);

            Sequence seq = new Sequence(Utility.GetAlphabet(alphabetName),
                                        querySequence);
            // create Ebi Blast service object.
            EbiWuBlastHandler service = new EbiWuBlastHandler();

            try
            {
                service.RequestCompleted += new EventHandler <BlastRequestCompletedEventArgs>(ebiBlastService_RequestCompleted);

                ConfigParameters configParams = new ConfigParameters();
                configParams.UseBrowserProxy = true;
                service.Configuration        = configParams;

                BlastParameters searchParams = new BlastParameters();

                // Set Request parameters.
                searchParams.Add(queryDatabaseParameter, queryDatabaseValue);
                searchParams.Add(queryProgramParameter, queryProgramValue);
                searchParams.Add(emailParameter, email);
                searchParams.Add("SequenceType",
                                 alphabetName.ToLower(CultureInfo.CurrentCulture).Replace("ambiguous", ""));

                // Create a request without passing sequence.
                string reqId = service.SubmitRequest(seq, searchParams);

                // validate request identifier.
                Assert.IsNotNull(reqId);

                // query the status
                ServiceRequestInformation info = service.GetRequestStatus(reqId);
                if (info.Status != ServiceRequestStatus.Waiting &&
                    info.Status != ServiceRequestStatus.Ready)
                {
                    string err =
                        ApplicationLog.WriteLine("Unexpected status: '{0}'", info.Status);
                    Assert.Fail(err);
                }
            }
            catch (Exception ex) { Assert.Fail(ex.Message); }
            finally
            {
                if (service != null)
                {
                    service.Dispose();
                }
            }
        }
Пример #5
0
        /// <summary>
        /// Validate general http request status by
        /// differnt parameters for Ebi web service..
        /// <param name="nodeName">different alphabet node name</param>
        /// </summary>
        static void ValidateEbiGeneralGetRequestStatusMethod(string nodeName)
        {
            if (_IsWebServiceAvailable)
            {
                // Gets the search query parameter and their values.
                string alphabetName = Utility._xmlUtil.GetTextValue(
                    nodeName, Constants.AlphabetNameNode);
                string querySequence = Utility._xmlUtil.GetTextValue(
                    nodeName, Constants.QuerySequency);
                string queryDatabaseValue = Utility._xmlUtil.GetTextValue(
                    nodeName, Constants.DatabaseValue);
                string queryProgramValue = Utility._xmlUtil.GetTextValue(
                    nodeName, Constants.ProgramValue);
                string queryDatabaseParameter = Utility._xmlUtil.GetTextValue(
                    nodeName, Constants.DatabaseParameter);
                string queryProgramParameter = Utility._xmlUtil.GetTextValue(
                    nodeName, Constants.ProgramParameter);
                string emailParameter = Utility._xmlUtil.GetTextValue(
                    nodeName, Constants.Emailparameter);
                string email = Utility._xmlUtil.GetTextValue(
                    nodeName, Constants.EmailAdress);
                string reqId = string.Empty;

                // Create a sequence.
                Sequence seq = new Sequence(Utility.GetAlphabet(alphabetName),
                                            querySequence);

                // Set Service confiruration parameters true.
                IBlastServiceHandler ebiBlastService = new EbiWuBlastHandler();

                ConfigParameters configParameters = new ConfigParameters();
                configParameters.UseBrowserProxy = true;
                ebiBlastService.Configuration    = configParameters;

                // Create search parameters object.
                BlastParameters queryParams = new BlastParameters();

                // Add mandatory parameter values to search query parameters.
                queryParams.Add(queryDatabaseParameter, queryDatabaseValue);
                queryParams.Add(queryProgramParameter, queryProgramValue);
                queryParams.Add(emailParameter, email);

                // Create a request
                reqId = ebiBlastService.SubmitRequest(seq, queryParams);

                // validate request identifier.
                Assert.IsNotNull(reqId);

                // submit request identifier and get the status
                ServiceRequestInformation reqInfo = ebiBlastService.GetRequestStatus(reqId);

                // Validate job status.
                if (reqInfo.Status != ServiceRequestStatus.Waiting &&
                    reqInfo.Status != ServiceRequestStatus.Ready)
                {
                    string error = ApplicationLog.WriteLine(string.Format(
                                                                null, "Unexpected error", reqInfo.Status));
                    Assert.Fail(error);
                    Console.WriteLine(string.Format(null,
                                                    "Unexpected error", reqInfo.Status));
                }
                else
                {
                    Console.WriteLine(string.Format(null,
                                                    "Request status {0} ", reqInfo.Status));
                }
            }
            else
            {
                Assert.Ignore("The test case ignored due to connection failure");
            }
        }
Пример #6
0
        public void EBIWuBlastResultsWithQueryParams()
        {
            // Gets the search query parameter and their values.
            string alphabetName = Utility._xmlUtil.GetTextValue(
                Constants.EbiAsynchronousResultsNode, Constants.AlphabetNameNode);
            string querySequence = Utility._xmlUtil.GetTextValue(
                Constants.EbiAsynchronousResultsNode, Constants.QuerySequency);
            string queryDatabaseValue = Utility._xmlUtil.GetTextValue(
                Constants.EbiAsynchronousResultsNode, Constants.DatabaseValue);
            string emailParameter = Utility._xmlUtil.GetTextValue(
                Constants.EbiAsynchronousResultsNode, Constants.Emailparameter);
            string email = Utility._xmlUtil.GetTextValue(
                Constants.EbiAsynchronousResultsNode, Constants.EmailAdress);
            string queryProgramValue = Utility._xmlUtil.GetTextValue(
                Constants.EbiAsynchronousResultsNode, Constants.ProgramValue);
            string queryDatabaseParameter = Utility._xmlUtil.GetTextValue(
                Constants.EbiAsynchronousResultsNode, Constants.DatabaseParameter);
            string queryProgramParameter = Utility._xmlUtil.GetTextValue(
                Constants.EbiAsynchronousResultsNode, Constants.ProgramParameter);
            string expectedHitId = Utility._xmlUtil.GetTextValue(
                Constants.EbiAsynchronousResultsNode, Constants.HitID);
            string expectedAccession = Utility._xmlUtil.GetTextValue(
                Constants.EbiAsynchronousResultsNode, Constants.HitAccession);
            string expectedResultCount = Utility._xmlUtil.GetTextValue(
                Constants.EbiAsynchronousResultsNode, Constants.ResultsCount);
            string expectedHitsCount = Utility._xmlUtil.GetTextValue(
                Constants.EbiAsynchronousResultsNode, Constants.HitsCount);
            string expectedEntropyStatistics = Utility._xmlUtil.GetTextValue(
                Constants.EbiAsynchronousResultsNode, Constants.EntropyStatistics);
            string expectedKappaStatistics = Utility._xmlUtil.GetTextValue(
                Constants.EbiAsynchronousResultsNode, Constants.KappaStatistics);
            string expectedLambdaStatistics = Utility._xmlUtil.GetTextValue(
                Constants.EbiAsynchronousResultsNode, Constants.LambdaStatistics);
            string expectedLength = Utility._xmlUtil.GetTextValue(
                Constants.EbiAsynchronousResultsNode, Constants.Length);

            object responseResults = null;

            Sequence seq = new Sequence(Utility.GetAlphabet(alphabetName),
                                        querySequence);

            // create Ebi Blast service object.
            IBlastServiceHandler service      = new EbiWuBlastHandler();
            ConfigParameters     configParams = new ConfigParameters();

            configParams.UseBrowserProxy = true;
            service.Configuration        = configParams;

            BlastParameters searchParams = new BlastParameters();

            // Set Request parameters.
            searchParams.Add(queryDatabaseParameter, queryDatabaseValue);
            searchParams.Add(queryProgramParameter, queryProgramValue);
            searchParams.Add(emailParameter, email);

            // Create a request without passing sequence.
            string reqId = service.SubmitRequest(seq, searchParams);

            // validate request identifier.
            Assert.IsNotNull(reqId);

            // query the status
            ServiceRequestInformation info = service.GetRequestStatus(reqId);

            if (info.Status != ServiceRequestStatus.Waiting &&
                info.Status != ServiceRequestStatus.Ready)
            {
                string err = ApplicationLog.WriteLine("Unexpected status: '{0}'", info.Status);
                Assert.Fail(err);
            }

            // get async results, poll until ready
            int maxAttempts = 15;
            int attempt     = 1;

            while (attempt <= maxAttempts &&
                   info.Status != ServiceRequestStatus.Error &&
                   info.Status != ServiceRequestStatus.Ready)
            {
                Thread.Sleep(
                    info.Status == ServiceRequestStatus.Waiting ? 20000 : 0);
                info = service.GetRequestStatus(reqId);
                ++attempt;
            }

            IBlastParser blastXmlParser = new BlastXmlParser();

            responseResults = blastXmlParser.Parse(
                new StringReader(service.GetResult(reqId, searchParams)));

            // Validate blast results.
            Assert.IsNotNull(responseResults);
            List <BlastResult> eBlastResults = responseResults as List <BlastResult>;

            Assert.IsNotNull(eBlastResults);
            Assert.AreEqual(eBlastResults.Count.ToString(
                                (IFormatProvider)null), expectedResultCount);
            Assert.AreEqual(eBlastResults[0].Records.Count.ToString((
                                                                        IFormatProvider)null), expectedResultCount);
            BlastSearchRecord record = eBlastResults[0].Records[0];

            Assert.AreEqual(record.Statistics.Kappa.ToString(
                                (IFormatProvider)null), expectedKappaStatistics);
            Assert.AreEqual(record.Statistics.Lambda.ToString(
                                (IFormatProvider)null), expectedLambdaStatistics);
            Assert.AreEqual(record.Statistics.Entropy.ToString(
                                (IFormatProvider)null), expectedEntropyStatistics);
            Assert.AreEqual(record.Hits.Count.ToString(
                                (IFormatProvider)null), expectedHitsCount);
            Hit hit = record.Hits[0];

            Assert.AreEqual(hit.Accession, expectedAccession);
            Assert.AreEqual(hit.Length.ToString(), expectedLength);
            Assert.AreEqual(hit.Id.ToString((IFormatProvider)null), expectedHitId);
            Assert.AreEqual(hit.Hsps.Count.ToString((IFormatProvider)null), expectedResultCount);
            Console.WriteLine(string.Format(null,
                                            "Ebi Blast BVT: Hits count '{0}'.", eBlastResults.Count));
            Console.WriteLine(string.Format(null,
                                            "Ebi Blast BVT: Accession '{0}'.", hit.Accession));
            Console.WriteLine(string.Format(null,
                                            "Ebi Blast BVT: Hit Id '{0}'.", hit.Id));
            Console.WriteLine(string.Format(null,
                                            "Ebi Blast BVT: Hits Count '{0}'.", hit.Hsps.Count));
            Console.WriteLine(string.Format(null,
                                            "Ebi Blast BVT: Hits Length '{0}'.", hit.Length));
        }
Пример #7
0
        /// <summary>
        /// Validate Fetch results Asynchronous.
        /// </summary>
        /// <param name="blastParameters">Ebi blast service config parameters</param>
        /// <returns></returns>
        private TestCaseOutput FetchResultsSync(Dictionary <string, object> blastParameters)
        {
            // Get the input query string
            string   sequenceString = blastParameters[Constants.QuerySeqString] as string;
            string   alphabetName   = blastParameters[Constants.AlphabetString] as string;
            Sequence sequence       = new Sequence(Utility.GetAlphabet(alphabetName),
                                                   sequenceString);

            // create Ebi Blast service object.
            IBlastServiceHandler service          = null;
            IList <BlastResult>  syncBlastResults = null;

            try
            {
                service = new EbiWuBlastHandler();
                ConfigParameters configParams = new ConfigParameters();
                configParams.UseBrowserProxy = true;
                service.Configuration        = configParams;

                BlastParameters blastSearchPams = blastParameters[Constants.BlastParmsConst]
                                                  as BlastParameters;

                // Create a request without passing sequence.
                string reqId = service.SubmitRequest(sequence, blastSearchPams);

                // validate request identifier.
                Assert.IsNotNull(reqId);

                // query the status
                ServiceRequestInformation info = service.GetRequestStatus(reqId);
                if (info.Status != ServiceRequestStatus.Waiting &&
                    info.Status != ServiceRequestStatus.Ready)
                {
                    string err =
                        ApplicationLog.WriteLine("Unexpected status: '{0}'", info.Status);
                    Assert.Fail(err);
                }

                // get async results, poll until ready
                int maxAttempts = 3;
                int attempt     = 1;
                while (attempt <= maxAttempts &&
                       info.Status != ServiceRequestStatus.Error &&
                       info.Status != ServiceRequestStatus.Ready)
                {
                    info = service.GetRequestStatus(reqId);
                    Thread.Sleep(info.Status == ServiceRequestStatus.Waiting ||
                                 info.Status == ServiceRequestStatus.Queued
                        ? 20000 * attempt : 0);

                    ++attempt;
                }

                syncBlastResults =
                    service.FetchResultsSync(reqId, blastSearchPams) as List <BlastResult>;
            }
            finally
            {
                if (service != null)
                {
                    ((IDisposable)service).Dispose();
                }
            }
            return(new TestCaseOutput(syncBlastResults, false));
        }