/// <summary> /// Overrides IAdapter's Initialize(). /// </summary> /// <param name="testSite">A parameter represents an ITestSite instance.</param> public override void Initialize(ITestSite testSite) { base.Initialize(testSite); testSite.DefaultProtocolDocShortName = "MS-ADMINS"; // Initialize the AdminSoap. this.adminService = Proxy.CreateProxy <AdminSoap>(this.Site); // Merge the common configuration into local configuration string conmmonConfigFileName = Common.GetConfigurationPropertyValue("CommonConfigurationFileName", this.Site); // Execute the merge the common configuration Common.MergeGlobalConfig(conmmonConfigFileName, this.Site); Common.CheckCommonProperties(this.Site, true); // Load SHOULDMAY configuration Common.MergeSHOULDMAYConfig(this.Site); TransportProtocol transport = Common.GetConfigurationPropertyValue <TransportProtocol>("TransportType", this.Site); switch (transport) { case TransportProtocol.HTTP: { this.adminService.Url = Common.GetConfigurationPropertyValue("HTTPTargetServiceUrl", this.Site); break; } default: { this.adminService.Url = Common.GetConfigurationPropertyValue("HTTPSTargetServiceUrl", this.Site); // When request Url include HTTPS prefix, avoid closing base connection. // Local client will accept all certificates after executing this function. Common.AcceptServerCertificate(); break; } } string userName = Common.GetConfigurationPropertyValue("UserName", this.Site); string password = Common.GetConfigurationPropertyValue("Password", this.Site); string domain = Common.GetConfigurationPropertyValue("Domain", this.Site); this.adminService.Credentials = new NetworkCredential(userName, password, domain); this.SetSoapVersion(this.adminService); // Configure the service timeout. string soapTimeOut = Common.GetConfigurationPropertyValue("ServiceTimeOut", this.Site); // 60000 means the configure SOAP Timeout is in milliseconds. this.adminService.Timeout = Convert.ToInt32(soapTimeOut) * 60000; }
/// <summary> /// Overrides IAdapter's Initialize(). /// </summary> /// <param name="testSite">A parameter represents an ITestSite instance.</param> public override void Initialize(ITestSite testSite) { base.Initialize(testSite); testSite.DefaultProtocolDocShortName = "MS-ADMINS"; // Initialize the AdminSoap. this.adminService = Proxy.CreateProxy<AdminSoap>(this.Site); // Merge the common configuration into local configuration string conmmonConfigFileName = Common.GetConfigurationPropertyValue("CommonConfigurationFileName", this.Site); // Execute the merge the common configuration Common.MergeGlobalConfig(conmmonConfigFileName, this.Site); Common.CheckCommonProperties(this.Site, true); // Load SHOULDMAY configuration Common.MergeSHOULDMAYConfig(this.Site); TransportProtocol transport = Common.GetConfigurationPropertyValue<TransportProtocol>("TransportType", this.Site); switch (transport) { case TransportProtocol.HTTP: { this.adminService.Url = Common.GetConfigurationPropertyValue("HTTPTargetServiceUrl", this.Site); break; } default: { this.adminService.Url = Common.GetConfigurationPropertyValue("HTTPSTargetServiceUrl", this.Site); // When request Url include HTTPS prefix, avoid closing base connection. // Local client will accept all certificates after executing this function. Common.AcceptServerCertificate(); break; } } string userName = Common.GetConfigurationPropertyValue("UserName", this.Site); string password = Common.GetConfigurationPropertyValue("Password", this.Site); string domain = Common.GetConfigurationPropertyValue("Domain", this.Site); this.adminService.Credentials = new NetworkCredential(userName, password, domain); this.SetSoapVersion(this.adminService); // Configure the service timeout. string soapTimeOut = Common.GetConfigurationPropertyValue("ServiceTimeOut", this.Site); // 60000 means the configure SOAP Timeout is in milliseconds. this.adminService.Timeout = Convert.ToInt32(soapTimeOut) * 60000; }
/// <summary> /// Set the SOAP version according to the SoapVersion property. /// </summary> /// <param name="adminProxy">set admin proxy</param> private void SetSoapVersion(AdminSoap adminProxy) { SoapVersion soapVersion = Common.GetConfigurationPropertyValue <SoapVersion>("SoapVersion", this.Site); switch (soapVersion) { case SoapVersion.SOAP11: { adminProxy.SoapVersion = SoapProtocolVersion.Soap11; break; } default: { adminProxy.SoapVersion = SoapProtocolVersion.Soap12; break; } } }
/// <summary> /// Set the SOAP version according to the SoapVersion property. /// </summary> /// <param name="adminProxy">set admin proxy</param> private void SetSoapVersion(AdminSoap adminProxy) { SoapVersion soapVersion = Common.GetConfigurationPropertyValue<SoapVersion>("SoapVersion", this.Site); switch (soapVersion) { case SoapVersion.SOAP11: { adminProxy.SoapVersion = SoapProtocolVersion.Soap11; break; } default: { adminProxy.SoapVersion = SoapProtocolVersion.Soap12; break; } } }