/// <summary>
        /// Initialize SUT control adapter.
        /// </summary>
        /// <param name="testSite">The test site instance associated with the current adapter.</param>
        public override void Initialize(ITestSite testSite)
        {
            base.Initialize(testSite);
            AdapterHelper.Initialize(testSite);

            this.listsService = new ListsSoap();

            string transportType = Common.GetConfigurationPropertyValue("TransportType", testSite);

            this.listsService.Url = Common.GetConfigurationPropertyValue("MSLISTSWSServiceUrl", testSite);

            string domain       = Common.GetConfigurationPropertyValue("Domain", testSite);
            string userName     = Common.GetConfigurationPropertyValue("UserName", testSite);
            string userPassword = Common.GetConfigurationPropertyValue("Password", testSite);

            this.listsService.Credentials = new NetworkCredential(userName, userPassword, domain);

            SoapVersion soapVersion = Common.GetConfigurationPropertyValue <SoapVersion>("SoapVersion", this.Site);

            switch (soapVersion)
            {
            case SoapVersion.SOAP11:
                this.listsService.SoapVersion = SoapProtocolVersion.Soap11;
                break;

            default:
                this.listsService.SoapVersion = SoapProtocolVersion.Soap12;
                break;
            }

            if (string.Compare(transportType, "https", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
            {
                Common.AcceptServerCertificate();
            }
        }
示例#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;
        }
示例#3
0
        /// <summary>
        /// This method is used to check out the specified file using the specified credential.
        /// </summary>
        /// <param name="fileUrl">Specify the absolute URL of a file which needs to be checked out.</param>
        /// <param name="userName">Specify the name of the user who checks out the file.</param>
        /// <param name="password">Specify the password of the user.</param>
        /// <param name="domain">Specify the domain of the user.</param>
        /// <returns>Return true if the check out succeeds, otherwise return false.</returns>
        public bool CheckOutFile(string fileUrl, string userName, string password, string domain)
        {
            string targetSiteCollectionUrl = Common.Common.GetConfigurationPropertyValue("TargetSiteCollectionUrl", this.Site);
            string fullFileUri             = string.Format("{0}/_vti_bin/lists.asmx", targetSiteCollectionUrl);

            if (fullFileUri.StartsWith("HTTPS", System.StringComparison.OrdinalIgnoreCase))
            {
                Common.Common.AcceptServerCertificate();
            }
            ListsSoap listsProxy = new ListsSoap();

            listsProxy.Url         = fullFileUri;
            listsProxy.Credentials = new NetworkCredential(userName, password, domain);
            return(listsProxy.CheckOutFile(fileUrl, "False", null));
        }
        /// <summary>
        /// Initialize SUT control adapter.
        /// </summary>
        /// <param name="testSite">The test site instance associated with the current adapter.</param>
        public override void Initialize(ITestSite testSite)
        {
            base.Initialize(testSite);

            this.listsService = new ListsSoap();

            string domain       = Common.GetConfigurationPropertyValue("Domain", testSite);
            string userName     = Common.GetConfigurationPropertyValue("UserName", testSite);
            string userPassword = Common.GetConfigurationPropertyValue("Password", testSite);

            this.listsService.Credentials = new NetworkCredential(userName, userPassword, domain);
            this.listsService.Url         = Common.GetConfigurationPropertyValue("ListwsServiceUrl", testSite);
            this.listsService.SoapVersion = Common.GetConfigurationPropertyValue <SoapProtocolVersion>("SoapVersion", this.Site);
            TransportProtocol transport = Common.GetConfigurationPropertyValue <TransportProtocol>("TransportType", this.Site);

            if (transport == TransportProtocol.HTTPS)
            {
                Common.AcceptServerCertificate();
            }
        }
        /// <summary>
        /// Initialize the adapter instance.
        /// </summary>
        /// <param name="testSite">A parameter represents a ITestSite instance which is used to get/operate current test suite context.</param>
        public override void Initialize(ITestSite testSite)
        {
            base.Initialize(testSite);

            // Initialize the proxy.
            this.listProxy = new ListsSoap();

            // Get target service fully qualified URL
            this.listProxy.Url = Common.GetConfigurationPropertyValue("ListsServiceUrl", this.Site);
            string userName = Common.GetConfigurationPropertyValue("UserName", this.Site);
            string password = Common.GetConfigurationPropertyValue("Password", this.Site);
            string domain = Common.GetConfigurationPropertyValue("Domain", this.Site);
            this.listProxy.Credentials = new NetworkCredential(userName, password, domain);

            // Set soap version according to the configuration file.
            this.SetSoapVersion();

            if (TransportProtocol.HTTPS == Common.GetConfigurationPropertyValue<TransportProtocol>("TransportType", this.Site))
            {
                Common.AcceptServerCertificate();
            }
        }
示例#6
0
        /// <summary>
        /// The Overridden Initialize method
        /// </summary>
        /// <param name="testSite">The ITestSite member of ManagedAdapterBase</param>
        public override void Initialize(ITestSite testSite)
        {
            base.Initialize(testSite);

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

            // Initialize the ListsSoap proxy class instance without the schema validation.
            this.listsProxy = Proxy.CreateProxy <ListsSoap>(this.Site, false, false, true);

            // Merge the common configuration into local configuration
            string conmmonConfigFileName = Common.GetConfigurationPropertyValue("CommonConfigurationFileName", this.Site);

            Common.MergeGlobalConfig(conmmonConfigFileName, this.Site);

            Common.CheckCommonProperties(this.Site, true);

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

            this.listsProxy.Url = this.GetTargetServiceUrl();
            string userName = Common.GetConfigurationPropertyValue("UserName", this.Site);
            string password = Common.GetConfigurationPropertyValue("Password", this.Site);
            string domain   = Common.GetConfigurationPropertyValue("Domain", this.Site);

            this.listsProxy.Credentials = new NetworkCredential(userName, password, domain);
            this.SetSoapVersion();
            if (TransportProtocol.HTTPS == Common.GetConfigurationPropertyValue <TransportProtocol>("TransportType", this.Site))
            {
                Common.AcceptServerCertificate();
            }

            // Configure the service timeout.
            int soapTimeOut = Common.GetConfigurationPropertyValue <int>("ServiceTimeOut", this.Site);

            // 60000 means the configure SOAP Timeout is in minute.
            this.listsProxy.Timeout = soapTimeOut * 60000;
        }
        /// <summary>
        /// Initialize the adapter instance.
        /// </summary>
        /// <param name="testSite">A parameter represents a ITestSite instance which is used to get/operate current test suite context.</param>
        public override void Initialize(ITestSite testSite)
        {
            base.Initialize(testSite);

            // Initialize the proxy.
            this.listProxy = new ListsSoap();

            // Get target service fully qualified URL
            this.listProxy.Url = Common.GetConfigurationPropertyValue("ListsServiceUrl", this.Site);
            string userName = Common.GetConfigurationPropertyValue("UserName", this.Site);
            string password = Common.GetConfigurationPropertyValue("Password", this.Site);
            string domain   = Common.GetConfigurationPropertyValue("Domain", this.Site);

            this.listProxy.Credentials = new NetworkCredential(userName, password, domain);

            // Set soap version according to the configuration file.
            this.SetSoapVersion();

            if (TransportProtocol.HTTPS == Common.GetConfigurationPropertyValue <TransportProtocol>("TransportType", this.Site))
            {
                Common.AcceptServerCertificate();
            }
        }