/** * Test retry policy - noRetry */ public function testNoRetry() { $this->_executedRetries = 0; $policy = Microsoft_WindowsAzure_RetryPolicy_RetryPolicyAbstract::noRetry(); $retries = $policy->execute( array($this, '_countRetries') ); $this->assertEquals(1, $retries); }
/** * Inits storage client object * * @param string $error * @return boolean */ function _init(&$error) { if (empty($this->_config['user'])) { $error = 'Empty account name.'; return false; } if (empty($this->_config['key'])) { $error = 'Empty account key.'; return false; } if (empty($this->_config['container'])) { $error = 'Empty container name.'; return false; } set_include_path(get_include_path() . PATH_SEPARATOR . W3TC_LIB_DIR); require_once 'Microsoft/WindowsAzure/Storage/Blob.php'; $this->_client = new Microsoft_WindowsAzure_Storage_Blob(Microsoft_WindowsAzure_Storage::URL_CLOUD_BLOB, $this->_config['user'], $this->_config['key'], false, Microsoft_WindowsAzure_RetryPolicy_RetryPolicyAbstract::noRetry()); return true; }
/** * Set retry policy to use when making requests * * @param Microsoft_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy Retry policy to use when making requests */ public function setRetryPolicy(Microsoft_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy = null) { $this->_retryPolicy = $retryPolicy; if (is_null($this->_retryPolicy)) { $this->_retryPolicy = Microsoft_WindowsAzure_RetryPolicy_RetryPolicyAbstract::noRetry(); } }
/** * Creates a new Microsoft_SqlAzure_Management_Client instance * * @param string $subscriptionId Subscription ID * @param string $certificatePath Management certificate path (.PEM) * @param string $certificatePassphrase Management certificate passphrase * @param Microsoft_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy Retry policy to use when making requests */ public function __construct($subscriptionId, $certificatePath, $certificatePassphrase, Microsoft_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy = null) { $this->_subscriptionId = $subscriptionId; $this->_certificatePath = $certificatePath; $this->_certificatePassphrase = $certificatePassphrase; $this->_retryPolicy = $retryPolicy; if (is_null($this->_retryPolicy)) { $this->_retryPolicy = Microsoft_WindowsAzure_RetryPolicy_RetryPolicyAbstract::noRetry(); } // Setup default Microsoft_Http_Client channel $options = array('adapter' => 'Microsoft_Http_Client_Adapter_Socket', 'ssltransport' => 'ssl', 'sslcert' => $this->_certificatePath, 'sslpassphrase' => $this->_certificatePassphrase, 'sslusecontext' => true); if (function_exists('curl_init')) { // Set cURL options if cURL is used afterwards $options['curloptions'] = array(CURLOPT_FOLLOWLOCATION => true, CURLOPT_TIMEOUT => 120); } $this->_httpClientChannel = new Microsoft_Http_Client(null, $options); }