コード例 #1
0
 public function __construct()
 {
     $config = new Configuration();
     $blobUri = 'http://' . TestResources::accountName() . '.blob.core.windows.net';
     $config->setProperty(BlobSettings::ACCOUNT_KEY, TestResources::accountKey());
     $config->setProperty(BlobSettings::ACCOUNT_NAME, TestResources::accountName());
     $config->setProperty(BlobSettings::URI, $blobUri);
     $blobRestProxy = BlobService::create($config);
     parent::__construct($config, $blobRestProxy);
     $this->_createdContainers = array();
 }
コード例 #2
0
 /**
  * @covers WindowsAzure\Blob\BlobService::create
  */
 public function testCreateWithConfig()
 {
     // Setup
     $uri = 'http://' . TestResources::accountName() . '.blob.core.windows.net';
     $config = new Configuration();
     $config->setProperty(BlobSettings::ACCOUNT_KEY, TestResources::accountKey());
     $config->setProperty(BlobSettings::ACCOUNT_NAME, TestResources::accountName());
     $config->setProperty(BlobSettings::URI, $uri);
     // Test
     $blobRestProxy = BlobService::create($config);
     // Assert
     $this->assertInstanceOf('WindowsAzure\\Blob\\Internal\\IBlob', $blobRestProxy);
 }
コード例 #3
0
 /**
  * Constructs CloudStorageService using the provided parameters.
  * 
  * @param string $name      The storage service name.
  * @param string $key       The storage service access key.
  * @param array  $endpoints The storage service endpoints.
  * @throws \InvalidArgumentException 
  */
 public function __construct($name, $key, $endpoints)
 {
     $queueUri = null;
     $blobUri = null;
     $tableUri = null;
     foreach ($endpoints as $value) {
         if (substr_count($value, 'queue.core')) {
             $queueUri = $value;
         } else {
             if (substr_count($value, 'table.core')) {
                 $tableUri = $value;
             } else {
                 if (substr_count($value, 'blob.core')) {
                     $blobUri = $value;
                 } else {
                     throw new \InvalidArgumentException(ErrorMessages::INVALID_ENDPOINT);
                 }
             }
         }
     }
     $config = new Configuration();
     $config->setProperty(TableSettings::ACCOUNT_NAME, $name);
     $config->setProperty(TableSettings::ACCOUNT_KEY, $key);
     $config->setProperty(TableSettings::URI, $tableUri);
     $config->setProperty(BlobSettings::ACCOUNT_NAME, $name);
     $config->setProperty(BlobSettings::ACCOUNT_KEY, $key);
     $config->setProperty(BlobSettings::URI, $tableUri);
     $config->setProperty(QueueSettings::ACCOUNT_NAME, $name);
     $config->setProperty(QueueSettings::ACCOUNT_KEY, $key);
     $config->setProperty(QueueSettings::URI, $tableUri);
     $this->_tableProxy = TableService::create($config);
     $this->_blobProxy = BlobService::create($config);
     $this->_queueProxy = QueueService::create($config);
 }