/**
  * @covers WindowsAzure\Common\Internal\Utilities::booleanToString
  */
 public function testBooleanToString()
 {
     // Setup
     $expected = 'true';
     $value = true;
     // Test
     $actual = Utilities::booleanToString($value);
     // Assert
     $this->assertEquals($expected, $actual);
 }
Example #2
0
 /**
  * Converts this object to array with XML tags
  * 
  * @return array. 
  */
 public function toArray()
 {
     $array = array('Enabled' => Utilities::booleanToString($this->_enabled));
     if (isset($this->_days)) {
         $array['Days'] = strval($this->_days);
     }
     return $array;
 }
Example #3
0
 /**
  * Converts this object to array with XML tags
  * 
  * @return array. 
  */
 public function toArray()
 {
     $array = array('Version' => $this->_version, 'Enabled' => Utilities::booleanToString($this->_enabled));
     if ($this->_enabled) {
         $array['IncludeAPIs'] = Utilities::booleanToString($this->_includeAPIs);
     }
     $array['RetentionPolicy'] = !empty($this->_retentionPolicy) ? $this->_retentionPolicy->toArray() : null;
     return $array;
 }
Example #4
0
 /**
  * Converts this object to array with XML tags
  * 
  * @return array. 
  */
 public function toArray()
 {
     return array('Version' => $this->_version, 'Delete' => Utilities::booleanToString($this->_delete), 'Read' => Utilities::booleanToString($this->_read), 'Write' => Utilities::booleanToString($this->_write), 'RetentionPolicy' => !empty($this->_retentionPolicy) ? $this->_retentionPolicy->toArray() : null);
 }
 /**
  * Cancels an in progress configuration change (update) or upgrade and returns
  * the deployment to its state before the upgrade or configuration change was
  * started.
  *
  * Note that you can rollback update or upgrade either by specifying the
  * deployment environment (staging or production), or by specifying the
  * deployment's unique name.
  *
  * @param string               $name    The hosted service name.
  * @param string               $mode    Specifies whether the rollback
  * should proceed automatically or not. Auto, The rollback proceeds without
  * further user input. Manual, You must call the walkUpgradeDomain API to apply
  * the rollback to each upgrade domain.
  * @param boolean              $force   Specifies whether the rollback
  * should proceed even when it will cause local data to be lost from some role
  * instances. True if the rollback should proceed; otherwise false if the
  * rollback should fail.
  * @param GetDeploymentOptions $options The optional parameters.
  *
  * @return none
  *
  * @see http://msdn.microsoft.com/en-us/library/windowsazure/hh403977.aspx
  */
 public function rollbackUpdateOrUpgrade($name, $mode, $force, $options)
 {
     Validate::isString($name, 'name');
     Validate::notNullOrEmpty($name, 'name');
     Validate::isString($mode, 'mode');
     Validate::isTrue(Mode::isValid($mode), Resources::INVALID_CHANGE_MODE_MSG);
     Validate::isBoolean($force, 'force');
     Validate::notNullOrEmpty($force, 'force');
     Validate::notNullOrEmpty($options, 'options');
     $xmlElements = array(Resources::XTAG_MODE => $mode, Resources::XTAG_FORCE => Utilities::booleanToString($force));
     $body = $this->_createRequestXml($xmlElements, Resources::XTAG_ROLLBACK_UPDATE_OR_UPGRADE);
     $context = new HttpCallContext();
     $context->setMethod(Resources::HTTP_POST);
     $context->setPath($this->_getDeploymentPath($name, $options) . '/');
     $context->addStatusCode(Resources::STATUS_ACCEPTED);
     $context->addQueryParameter(Resources::QP_COMP, Resources::QPV_ROLLBACK);
     $context->setBody($body);
     $context->addHeader(Resources::CONTENT_TYPE, Resources::XML_CONTENT_TYPE);
     assert(Utilities::endsWith($context->getPath(), '/'));
     $response = $this->sendContext($context);
     return AsynchronousOperationResult::create($response->getHeader());
 }