This class used to support required functions for test class initialization and clean up.
        /// <summary>
        /// Overrides the ManagedAdapterBase class' Initialize() method, it is used to initialize the adapter.
        /// </summary>
        /// <param name="testSite">A parameter represents the ITestSite instance, which is used to visit the test context.</param>
        public override void Initialize(ITestSite testSite)
        {
            base.Initialize(testSite);

            // Set the protocol name of current test suite
            Site.DefaultProtocolDocShortName = "MS-COPYS";

            TestSuiteManageHelper.Initialize(this.Site);

            // Merge the SHOULDMAY configuration file.
            Common.MergeSHOULDMAYConfig(this.Site);

            this.currentUser           = TestSuiteManageHelper.DefaultUser;
            this.domainOfCurrentUser   = TestSuiteManageHelper.DomainOfDefaultUser;
            this.passwordOfCurrentUser = TestSuiteManageHelper.PasswordOfDefaultUser;

            // Initialize the proxy class
            this.copySoapService = Proxy.CreateProxy <CopySoap>(this.Site, true, true, true);

            // Set service URL.
            this.copySoapService.Url = this.GetTargetServiceUrl(this.currentServiceLocation);

            // Set credential
            this.copySoapService.Credentials = TestSuiteManageHelper.DefaultUserCredential;

            // Set SOAP version
            this.copySoapService.SoapVersion = TestSuiteManageHelper.GetSoapProtoclVersionByCurrentSetting();

            // Accept Certificate
            TestSuiteManageHelper.AcceptServerCertificate();

            // set the service timeout.
            this.copySoapService.Timeout = TestSuiteManageHelper.CurrentSoapTimeOutValue;
        }
Exemple #2
0
        /// <summary>
        /// Initialize the adapter instance.
        /// </summary>
        /// <param name="testSite">A return value represents the ITestSite instance which contains the test context.</param>
        public override void Initialize(ITestSite testSite)
        {
            base.Initialize(testSite);
            TestSuiteManageHelper.Initialize(this.Site);
            TestSuiteManageHelper.AcceptServerCertificate();

            // Initial the listsws proxy without schema validation.
            if (null == this.listswsProxy)
            {
                this.listswsProxy = Proxy.CreateProxy <ListsSoap>(testSite, true, false, false);
            }

            FileUrlHelper.ValidateFileUrl(TestSuiteManageHelper.TargetServiceUrlOfMSCOPYS);

            // Point to listsws service according to the MS-COPYS service URL.
            string targetServiceUrl = Path.GetDirectoryName(TestSuiteManageHelper.TargetServiceUrlOfMSCOPYS);

            targetServiceUrl = Path.Combine(targetServiceUrl, @"lists.asmx");

            // Work around for local path format mapping to URL path format.
            targetServiceUrl = targetServiceUrl.Replace(@"\", @"/");
            targetServiceUrl = targetServiceUrl.Replace(@":/", @"://");

            // Setting the properties of listsws service proxy.
            this.listswsProxy.Url         = targetServiceUrl;
            this.listswsProxy.Credentials = TestSuiteManageHelper.DefaultUserCredential;
            this.listswsProxy.SoapVersion = TestSuiteManageHelper.GetSoapProtoclVersionByCurrentSetting();

            // 60000 means the configure SOAP Timeout is in minute.
            this.listswsProxy.Timeout = TestSuiteManageHelper.CurrentSoapTimeOutValue;
        }
Exemple #3
0
        /// <summary>
        /// A method used to record a SOAP Exception information into the log.
        /// </summary>
        /// <param name="soapEx">A parameter represents the SoapException instance which will be record.</param>
        /// <param name="testSiteInstance">A parameter represents the ITestSite instance which contains test context.</param>
        private static void RecordSoapExceptionInfor(SoapException soapEx, ITestSite testSiteInstance)
        {
            string detailOutPut = string.Empty;

            if (null == soapEx.Detail || string.IsNullOrEmpty(soapEx.Detail.OuterXml))
            {
                detailOutPut = "None";
            }
            else
            {
                detailOutPut = soapEx.Detail.OuterXml;
            }

            TestSuiteManageHelper.Initialize(testSiteInstance);
            testSiteInstance.Log.Add(
                LogEntryKind.Debug,
                @"There is a SoapException generated. Information:\r\nMessage:[{0}]\r\nStackTrace:[{1}]\r\ndetail:[{2}]\r\nSoapVersion:[{3}]\r\nUrl:[{4}]",
                soapEx.Message,
                soapEx.StackTrace,
                detailOutPut,
                TestSuiteManageHelper.CurrentSoapVersion,
                string.IsNullOrEmpty(soapEx.Role) ? "None/Empty" : soapEx.Role);
        }