public void InvalidateEbiCancelRequest() { IBlastServiceHandler service = null; // Validate ServiceMeta ctor by passing null config. try { service = new EbiWuBlastHandler(); service.CancelRequest(null); Assert.Fail(); } catch (Exception) { ApplicationLog.WriteLine( "EbiWebService P2 : Successfully validated the exception"); Console.WriteLine( "EbiWebService P2 : Successfully validated the exception"); } finally { if (service != null) { ((IDisposable)service).Dispose(); } } }
/// <summary> /// Validate Cancel submitted job by passing job id. /// <param name="nodeName">different alphabet node name</param> /// </summary> static void ValidateCancelSubmittedJob(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 emailParameter = Utility._xmlUtil.GetTextValue( nodeName, Constants.Emailparameter); string email = Utility._xmlUtil.GetTextValue( nodeName, Constants.EmailAdress); string queryProgramValue = Utility._xmlUtil.GetTextValue( nodeName, Constants.ProgramValue); string queryDatabaseParameter = Utility._xmlUtil.GetTextValue( nodeName, Constants.DatabaseParameter); string queryProgramParameter = Utility._xmlUtil.GetTextValue( nodeName, Constants.ProgramParameter); 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); // Cancel subitted job. bool result = service.CancelRequest(reqId); // validate the cancelled job. Assert.IsTrue(result); Console.WriteLine(string.Format(null, "EBI Blast P1 : Submitted job cancelled was successfully.", queryProgramValue)); } else { Assert.Ignore("The test case ignored due to connection failure"); } }
/// <summary> /// Validate Cancel submitted job by passing job id. /// <param name="nodeName">different alphabet node name</param> /// </summary> void ValidateCancelSubmittedJob(string nodeName) { // 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( nodeName, Constants.ProgramValue); string queryDatabaseParameter = utilityObj.xmlUtil.GetTextValue( nodeName, Constants.DatabaseParameter); string queryProgramParameter = utilityObj.xmlUtil.GetTextValue( nodeName, Constants.ProgramParameter); Sequence seq = new Sequence(Utility.GetAlphabet(alphabetName), querySequence); // create Ebi Blast service object. IBlastServiceHandler service = null; try { 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); // Cancel subitted job. bool result = service.CancelRequest(reqId); // validate the cancelled job. Assert.IsTrue(result); Console.WriteLine(string.Concat( "EBI Blast P1 : Submitted job cancelled was successfully.", queryProgramValue)); } catch (Exception ex) { Assert.Fail(ex.Message); } finally { if (service != null) { ((IDisposable)service).Dispose(); } } }