/** * Initializes new CloudSubscription object using the provided parameters. * * @param string $subscriptionId The Windows Azure subscription id. * @param string $certificatePath The registered certificate. */ public function __construct($subscriptionId, $certificatePath) { $config = new Configuration(); $config->setProperty(ServiceManagementSettings::SUBSCRIPTION_ID, $subscriptionId); $config->setProperty(ServiceManagementSettings::CERTIFICATE_PATH, $certificatePath); $config->setProperty(ServiceManagementSettings::URI, Resources::SERVICE_MANAGEMENT_URL); $this->_proxy = ServiceManagementService::create($config); }
/** * @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(); $queueUri = TestResources::accountName() . '.queue.core.windows.net'; $config->setProperty(QueueSettings::ACCOUNT_KEY, TestResources::accountKey()); $config->setProperty(QueueSettings::ACCOUNT_NAME, TestResources::accountName()); $config->setProperty(QueueSettings::URI, $queueUri); $queueRestProxy = QueueService::create($config); parent::__construct($config, $queueRestProxy); $this->_createdQueues = array(); }
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(); }
/** * @covers WindowsAzure\ServiceManagement\ServiceManagementService::create */ public function testCreateWithConfig() { // Setup $config = new Configuration(); $config->setProperty(ServiceManagementSettings::SUBSCRIPTION_ID, '1234-45432'); $config->setProperty(ServiceManagementSettings::CERTIFICATE_PATH, '1234'); $config->setProperty(ServiceManagementSettings::URI, Resources::SERVICE_MANAGEMENT_URL); // Test $servicemanagementRestProxy = ServiceManagementService::create($config); // Assert $this->assertInstanceOf('WindowsAzure\\ServiceManagement\\Internal\\IServiceManagement', $servicemanagementRestProxy); }
/** * @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); }
public function __construct() { $config = new Configuration(); $config->setProperty(ServiceManagementSettings::SUBSCRIPTION_ID, TestResources::serviceManagementSubscriptionId()); $config->setProperty(ServiceManagementSettings::URI, Resources::SERVICE_MANAGEMENT_URL); $config->setProperty(ServiceManagementSettings::CERTIFICATE_PATH, TestResources::serviceManagementCertificatePath()); $serviceManagementRestProxy = ServiceManagementService::create($config); parent::__construct($config, $serviceManagementRestProxy); $this->createdStorageServices = array(); $this->createdAffinityGroups = array(); $this->storageCount = count($this->restProxy->listStorageServices()->getStorageServices()); $this->affinityGroupCount = count($this->restProxy->listAffinityGroups()->getAffinityGroups()); }
/** * @covers WindowsAzure\Common\Internal\ServicesBuilder::build * @covers WindowsAzure\Common\Internal\ServicesBuilder::_validateConfig * @covers WindowsAzure\Common\Internal\ServicesBuilder::_validateConfigSetting */ public function testValidateConfigWithEmptyServiceManagementSettingConfig() { $missingValueMsg = sprintf(Resources::MISSING_CONFIG_SETTING_VALUE_MSG, 'ServiceManagementSettings::SUBSCRIPTION_ID'); $config = new Configuration(); $config->setProperty(ServiceManagementSettings::CERTIFICATE_PATH, 'path'); $config->setProperty(ServiceManagementSettings::SUBSCRIPTION_ID, ''); $config->setProperty(ServiceManagementSettings::URI, 'url'); $builder = new ServicesBuilder(); $this->setExpectedException('\\InvalidArgumentException', $missingValueMsg); $builder->build($config, Resources::SERVICE_MANAGEMENT_TYPE_NAME); }
/** * @covers WindowsAzure\Common\Configuration::create * @covers WindowsAzure\Common\Configuration::_useStorageEmulatorConfig */ public function testCreate() { $config = new Configuration(); $config->setProperty(QueueSettings::ACCOUNT_KEY, TestResources::KEY1); $config->setProperty(QueueSettings::ACCOUNT_NAME, TestResources::ACCOUNT_NAME); $config->setProperty(QueueSettings::URI, 'http://' . TestResources::ACCOUNT_NAME . TestResources::QUEUE_URI); $queueRestProxy = $config->create(Resources::QUEUE_TYPE_NAME); $this->assertInstanceOf('WindowsAzure\\Queue\\Internal\\IQueue', $queueRestProxy); }
/** * 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); }