Example #1
0
 /**
  * @param array $config
  */
 public function __construct($config)
 {
     $configObject = new Configuration();
     $configObject->setProperty(TableSettings::ACCOUNT_NAME, $config['account']);
     $configObject->setProperty(TableSettings::ACCOUNT_KEY, $config['key']);
     $configObject->setProperty(TableSettings::URI, "http://{$config['account']}.table.core.windows.net/");
     $this->tableProxy = TableService::create($configObject);
     $this->assertTables();
 }
 public function __construct()
 {
     $config = new Configuration();
     $tableUri = 'http://' . TestResources::accountName() . '.table.core.windows.net';
     $config->setProperty(TableSettings::ACCOUNT_KEY, TestResources::accountKey());
     $config->setProperty(TableSettings::ACCOUNT_NAME, TestResources::accountName());
     $config->setProperty(TableSettings::URI, $tableUri);
     $tableRestProxy = TableService::create($config);
     parent::__construct($config, $tableRestProxy);
     $this->_createdTables = array();
 }
 /**
  * @covers WindowsAzure\Table\TableService::create
  */
 public function testCreateWithConfig()
 {
     // Setup
     $uri = 'http://' . TestResources::accountName() . '.table.core.windows.net';
     $config = new Configuration();
     $config->setProperty(TableSettings::ACCOUNT_KEY, TestResources::accountKey());
     $config->setProperty(TableSettings::ACCOUNT_NAME, TestResources::accountName());
     $config->setProperty(TableSettings::URI, $uri);
     // Test
     $tableRestProxy = TableService::create($config);
     // Assert
     $this->assertInstanceOf('WindowsAzure\\Table\\Internal\\ITable', $tableRestProxy);
 }
 /**
  * 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);
 }