コード例 #1
0
 /**
  * @covers WindowsAzure\ServiceManagement\Models\CreateStorageServiceOptions::setAffinityGroup
  * @covers WindowsAzure\ServiceManagement\Models\CreateStorageServiceOptions::getAffinityGroup
  */
 public function testSetAffinityGroup()
 {
     // Setup
     $options = new CreateStorageServiceOptions();
     $expected = 'MyGroup';
     // Test
     $options->setAffinityGroup($expected);
     // Assert
     $this->assertEquals($expected, $options->getAffinityGroup());
 }
コード例 #2
0
 /**
  * Creates a storage service if it does not exist and waits until it is created.
  * 
  * @param string $name     The storage service name.
  * @param string $execType The execution type for this call.
  * @param type $location   The storage service location. By default West US.
  * 
  * @return CloudStorageService
  */
 public function createStorageService($name, $execType = self::SYNCHRONOUS, $location = Locations::SOUTH_CENTRAL_US)
 {
     $newStorageService = false;
     $cloudStorageService = null;
     if (!$this->storageServiceExists($name)) {
         $options = new CreateStorageServiceOptions();
         $options->setLocation($location);
         $result = $this->_proxy->createStorageService($name, base64_encode($name), $options);
         if ($execType == self::SYNCHRONOUS) {
             $this->_blockUntilAsyncFinish($result->getRequestId());
         }
         $newStorageService = true;
     }
     if (!$newStorageService && $execType != self::ASYNCHRONOUS) {
         $keys = $this->_proxy->getStorageServiceKeys($name);
         $properties = $this->_proxy->getStorageServiceProperties($name);
         $cloudStorageService = new CloudStorageService($name, $keys->getPrimary(), $properties->getEndpoints());
     }
     return $cloudStorageService;
 }
コード例 #3
0
 /**
  * @covers WindowsAzure\ServiceManagement\ServiceManagementRestProxy::createStorageService
  * @covers WindowsAzure\ServiceManagement\ServiceManagementRestProxy::getOperationStatus
  * @covers WindowsAzure\ServiceManagement\ServiceManagementRestProxy::_getOperationPath
  * @covers WindowsAzure\ServiceManagement\ServiceManagementRestProxy::_getStorageServicePath
  * @covers WindowsAzure\ServiceManagement\ServiceManagementRestProxy::_getPath
  * @covers WindowsAzure\ServiceManagement\Models\GetOperationStatusResult::create
  * @covers WindowsAzure\ServiceManagement\Models\StorageService::toArray
  */
 public function testCreateStorageService()
 {
     // Setup
     $name = $this->_storageServiceName;
     $label = base64_encode($name);
     $options = new CreateStorageServiceOptions();
     $options->setLocation('West US');
     // Test
     $result = $this->restProxy->createStorageService($name, $label, $options);
     $this->blockUntilAsyncSucceed($result->getRequestId());
     // Assert
     $this->assertTrue($this->storageServiceExists($name));
 }
コード例 #4
0
 public function createStorageService($name, $options = null)
 {
     $label = base64_encode($name);
     $options = new CreateStorageServiceOptions();
     $options->setLocation('West US');
     $result = $this->restProxy->createStorageService($name, $label, $options);
     $this->blockUntilAsyncSucceed($result->getRequestId());
     $this->createdStorageServices[] = $name;
 }