/**
  * Test retry policy - noRetry
  */
 public function testNoRetry()
 {
     $this->_executedRetries = 0;
     $policy = Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract::noRetry();
     $retries = $policy->execute(array($this, '_countRetries'));
     $this->assertEquals(1, $retries);
 }
Esempio n. 2
0
 /**
  * Set retry policy to use when making requests
  *
  * @param Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy Retry policy to use when making requests
  */
 public function setRetryPolicy(Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy = null)
 {
     $this->_retryPolicy = $retryPolicy;
     if (is_null($this->_retryPolicy)) {
         $this->_retryPolicy = Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract::noRetry();
     }
 }
Esempio n. 3
0
 /**
  * Creates a new Zend_Service_WindowsAzure_Management instance
  *
  * @param string $subscriptionId Subscription ID
  * @param string $certificatePath Management certificate path (.PEM)
  * @param string $certificatePassphrase Management certificate passphrase
  * @param Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy Retry policy to use when making requests
  */
 public function __construct($subscriptionId, $certificatePath, $certificatePassphrase, Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract $retryPolicy = null)
 {
     $this->_subscriptionId = $subscriptionId;
     $this->_certificatePath = $certificatePath;
     $this->_certificatePassphrase = $certificatePassphrase;
     $this->_retryPolicy = $retryPolicy;
     if (is_null($this->_retryPolicy)) {
         $this->_retryPolicy = Zend_Service_WindowsAzure_RetryPolicy_RetryPolicyAbstract::noRetry();
     }
     // Setup default Zend_Http_Client channel
     $options = array('adapter' => 'Zend_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 Zend_Http_Client(null, $options);
 }