/**
  * @covers WindowsAzure\ServiceManagement\Models\UpdateServiceOptions::setLabel
  * @covers WindowsAzure\ServiceManagement\Models\UpdateServiceOptions::getLabel
  */
 public function testSetLabel()
 {
     // Setup
     $options = new UpdateServiceOptions();
     $expected = 'Label';
     // Test
     $options->setLabel($expected);
     // Assert
     $this->assertEquals($expected, $options->getLabel());
 }
Exemplo n.º 2
0
 /**
  * Updates the label and/or the description for a storage account in Windows
  * Azure.
  *
  * @param string               $name    The storage account name.
  * @param UpdateServiceOptions $options The optional parameters.
  *
  * @return none
  *
  * @see http://msdn.microsoft.com/en-us/library/windowsazure/hh264516.aspx
  */
 public function updateStorageService($name, $options)
 {
     Validate::isString($name, 'name');
     Validate::notNullOrEmpty($name, 'name');
     $label = $options->getLabel();
     $description = $options->getDescription();
     Validate::isTrue(!empty($label) || !empty($description), Resources::INVALID_UPDATE_SERVICE_OPTIONS_MSG);
     $storageService = new StorageService();
     $storageService->setLabel($options->getLabel());
     $storageService->setDescription($options->getDescription());
     $storageService->addSerializationProperty(XmlSerializer::ROOT_NAME, Resources::XTAG_UPDATE_STORAGE_SERVICE_INPUT);
     $context = new HttpCallContext();
     $context->setMethod(Resources::HTTP_PUT);
     $context->setPath($this->_getStorageServicePath($name));
     $context->addStatusCode(Resources::STATUS_OK);
     $context->setBody($storageService->serialize($this->dataSerializer));
     $context->addHeader(Resources::CONTENT_TYPE, Resources::XML_CONTENT_TYPE);
     $this->sendContext($context);
 }
 /**
  * @covers WindowsAzure\ServiceManagement\ServiceManagementRestProxy::updateHostedService
  * @covers WindowsAzure\ServiceManagement\ServiceManagementRestProxy::_getHostedServicePath
  * @covers WindowsAzure\ServiceManagement\ServiceManagementRestProxy::_getPath
  * @group HostedService
  */
 public function testUpdateHostedService()
 {
     // Setup
     $name = $this->getTestName();
     $this->createHostedService($name);
     $options = new UpdateServiceOptions();
     $expectedDesc = 'My description';
     $expectedLabel = base64_encode('new label');
     $options->setDescription($expectedDesc);
     $options->setLabel($expectedLabel);
     // Test
     $this->restProxy->updateHostedService($name, $options);
     // Assert
     $result = $this->restProxy->getHostedServiceProperties($name);
     $this->assertEquals($expectedDesc, $result->getHostedService()->getDescription());
     $this->assertEquals($expectedLabel, $result->getHostedService()->getLabel());
 }