Exemple #1
0
        /// <summary>
        /// Validate if the connection is successful
        /// </summary>
        /// <returns>True, if connection is successful</returns>
        static bool ValidateWebServiceConnection()
        {
            // Read input from config file
            string filepath = Utility._xmlUtil.GetTextValue(
                Constants.DefaultOptionNode, Constants.FilePathNode);
            string emailId = Utility._xmlUtil.GetTextValue(
                Constants.DefaultOptionNode, Constants.EmailIDNode);
            string clusterOption = Utility._xmlUtil.GetTextValue(
                Constants.DefaultOptionNode, Constants.ClusterOptionNode);
            string actionAlign = Utility._xmlUtil.GetTextValue(
                Constants.DefaultOptionNode, Constants.ActionAlignNode);

            // Initialize with parser and config params
            ConfigParameters configparams  = new ConfigParameters();
            ClustalWParser   clustalparser = new ClustalWParser();

            configparams.UseBrowserProxy = true;
            TestIClustalWServiceHandler handler =
                new TestIClustalWServiceHandler(clustalparser, configparams);
            ClustalWParameters parameters = new ClustalWParameters();

            parameters.Values[ClustalWParameters.Email]         = emailId;
            parameters.Values[ClustalWParameters.ClusterOption] = clusterOption;
            parameters.Values[ClustalWParameters.ActionAlign]   = actionAlign;

            // Get the input sequences
            FastaParser       parser   = new FastaParser();
            IList <ISequence> sequence = parser.Parse(filepath);

            try
            {
                // Submit job and validate it returned valid job id and control id
                ServiceParameters svcparameters =
                    handler.SubmitRequest(sequence, parameters);

                if (string.IsNullOrEmpty(svcparameters.JobId))
                {
                    Console.WriteLine(
                        "ClustalW BVT : Connection not successful with no Job ID");
                    ApplicationLog.WriteLine(
                        "ClustalW BVT : Connection not successful with no Job ID");
                    return(false);
                }

                handler.FetchResultsSync(svcparameters);
            }
            catch (Exception ex)
            {
                Console.WriteLine(string.Format(
                                      "ClustalW BVT : Connection not successful with error '{0}'", ex.Message));
                ApplicationLog.WriteLine(string.Format(
                                             "ClustalW BVT : Connection not successful with error '{0}'", ex.Message));
                return(false);
            }

            Console.WriteLine("ClustalW BVT : Connection Successful");
            return(true);
        }
Exemple #2
0
        /// <summary>
        /// Validate Submit Job and Fetch ResultSync() using multiple input sequences
        /// </summary>
        /// <param name="nodeName">xml node name</param>
        void ValidateFetchResultSync(string nodeName)
        {
            // Read input from config file
            string filepath = _utilityObj._xmlUtil.GetTextValue(
                nodeName, Constants.FilePathNode);
            string emailId = _utilityObj._xmlUtil.GetTextValue(
                nodeName, Constants.EmailIDNode);
            string clusterOption = _utilityObj._xmlUtil.GetTextValue(
                nodeName, Constants.ClusterOptionNode);
            string actionAlign = _utilityObj._xmlUtil.GetTextValue(
                nodeName, Constants.ActionAlignNode);

            // Initialize with parser and config params
            ConfigParameters configparams  = new ConfigParameters();
            ClustalWParser   clustalparser = new ClustalWParser();

            configparams.UseBrowserProxy = true;
            TestIClustalWServiceHandler handler =
                new TestIClustalWServiceHandler(clustalparser, configparams);
            ClustalWParameters parameters = new ClustalWParameters();

            parameters.Values[ClustalWParameters.Email]         = emailId;
            parameters.Values[ClustalWParameters.ClusterOption] = clusterOption;
            parameters.Values[ClustalWParameters.ActionAlign]   = actionAlign;

            IList <ISequence> sequence = null;

            // Get the input sequences
            using (FastaParser parser = new FastaParser())
            {
                sequence = parser.Parse(filepath);
            }

            // Submit job and validate it returned valid job id and control id
            ServiceParameters svcparameters =
                handler.SubmitRequest(sequence, parameters);

            Assert.IsTrue(string.IsNullOrEmpty(svcparameters.JobId));
            Console.WriteLine(string.Concat("JobId", svcparameters.JobId));
            ApplicationLog.WriteLine(string.Concat("JobId", svcparameters.JobId));
            foreach (string key in svcparameters.Parameters.Keys)
            {
                Assert.IsTrue(string.IsNullOrEmpty(svcparameters.Parameters[key].ToString()));
                Console.WriteLine(string.Format((IFormatProvider)null, "{0}:{1}",
                                                key, svcparameters.Parameters[key].ToString()));
                ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "{0}:{1}",
                                                       key, svcparameters.Parameters[key].ToString()));
            }

            // Get the results and validate it is not null.
            ClustalWResult result = handler.FetchResultsSync(svcparameters);

            Assert.IsNotNull(result);
            Assert.IsNotNull(result.SequenceAlignment);
            foreach (IAlignedSequence alignSeq in result.SequenceAlignment.AlignedSequences)
            {
                Console.WriteLine("Aligned Sequence Sequences :");
                ApplicationLog.WriteLine("Aligned Sequence Sequences :");
                foreach (ISequence seq in alignSeq.Sequences)
                {
                    Console.WriteLine(string.Concat("Sequence:", seq.ToString()));
                    ApplicationLog.WriteLine(string.Concat("Sequence:", seq.ToString()));
                }
            }
            Console.WriteLine(@"ClustalWServiceHandler BVT : Submit job and Get Results is 
      successfully completed using FetchResultSync()");
            ApplicationLog.WriteLine(@"ClustalWServiceHandler BVT : Submit job and Get Results 
      is successfully completed using FetchResultSync()");
        }