/**
  * 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);
 }
Esempio n. 2
0
 /**
  * Creates new object based on the builder type in the $config.
  *
  * @param WindowsAzure\Common\Configuration             $config  The config
  * object.
  * @param WindowsAzure\Common\Internal\IServicesBuilder $builder The builder
  * object.
  * 
  * @return WindowsAzure\Blob\BlobRestProxy
  */
 public static function create($config, $builder = null)
 {
     Validate::isTrue($config instanceof Configuration, Resources::INVALID_CONFIG_MSG);
     if (!is_null($builder)) {
         Validate::isTrue($builder instanceof IServiceBuilder, Resources::INVALID_BUILDER_MSG);
     }
     return $config->create(Resources::BLOB_TYPE_NAME, $builder);
 }
Esempio n. 3
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();
     $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());
 }
 public static function tearDownAfterClass()
 {
     parent::tearDownAfterClass();
     $service = self::createService();
     if (!Configuration::isEmulated()) {
         $serviceProperties = QueueServiceFunctionalTestData::getDefaultServiceProperties();
         $service->setServiceProperties($serviceProperties);
     }
     foreach (QueueServiceFunctionalTestData::$TEST_QUEUE_NAMES as $name) {
         self::staticSafeDeleteQueue($service, $name);
     }
 }
 public static function tearDownAfterClass()
 {
     parent::tearDownAfterClass();
     $service = self::createService();
     if (!Configuration::isEmulated()) {
         $serviceProperties = TableServiceFunctionalTestData::getDefaultServiceProperties();
         $service->setServiceProperties($serviceProperties);
     }
     foreach (TableServiceFunctionalTestData::$TEST_TABLE_NAMES as $name) {
         try {
             $service->deleteTable($name);
         } catch (\Exception $e) {
             // Ignore exception and continue.
             error_log($e->getMessage());
         }
     }
 }
Esempio n. 11
0
 /**
  * Validates that the given config setting exists in the $config and it's value
  * is doesn't satisfy empty().
  * 
  * @param string                            $setting  The config setting name.
  * @param WindowsAzure\Common\Configuration $config   The configuration object. 
  * @param string                            $name     The setting code name.
  * @param string                            $restType The REST type name.
  * 
  * @return none
  */
 private function _validateConfigSetting($setting, $config, $name, $restType)
 {
     $missingKeyMsg = sprintf(Resources::MISSING_CONFIG_SETTING_KEY_MSG, $name, $restType);
     $missingValueMsg = sprintf(Resources::MISSING_CONFIG_SETTING_VALUE_MSG, $name);
     $properties = $config->getProperties();
     Validate::isTrue(array_key_exists($setting, $properties), $missingKeyMsg);
     $value = $config->getProperty($setting);
     $isNullEmpty = empty($value);
     Validate::isTrue(!$isNullEmpty, $missingValueMsg);
 }
 /**
  * @covers WindowsAzure\Table\TableRestProxy::insertOrReplaceEntity
  */
 public function testInsertOrReplaceEntityOptionsNull()
 {
     $table = TableServiceFunctionalTestData::$TEST_TABLE_NAMES[0];
     try {
         $this->restProxy->insertOrReplaceEntity($table, TableServiceFunctionalTestData::getSimpleEntity(), null);
         $this->assertFalse(Configuration::isEmulated(), 'Should fail if and only if in emulator');
     } catch (ServiceException $e) {
         // Expect failure when run this test with emulator, as v1.6 doesn't support this method
         if (Configuration::isEmulated()) {
             $this->assertEquals(404, $e->getCode(), 'getCode');
         }
     }
     $this->clearTable($table);
 }
 /**
  * @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);
 }
 protected function skipIfEmulated()
 {
     if (Configuration::isEmulated()) {
         $this->markTestSkipped(self::NOT_SUPPORTED);
     }
 }
 /**
  * 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);
 }
 private function setServicePropertiesWorker($serviceProperties, $options)
 {
     try {
         if (is_null($options)) {
             $this->restProxy->setServiceProperties($serviceProperties);
         } else {
             $this->restProxy->setServiceProperties($serviceProperties, $options);
         }
         if (is_null($options)) {
             $options = new QueueServiceOptions();
         }
         if (!is_null($options->getTimeout()) && $options->getTimeout() < 1) {
             $this->assertTrue(false, 'Expect negative timeouts in $options to throw');
         } else {
             $this->assertFalse(Configuration::isEmulated(), 'Should succeed when not running in emulator');
         }
         $ret = is_null($options) ? $this->restProxy->getServiceProperties() : $this->restProxy->getServiceProperties($options);
         $this->verifyServicePropertiesWorker($ret, $serviceProperties);
     } catch (ServiceException $e) {
         if (is_null($options)) {
             $options = new QueueServiceOptions();
         }
         if (Configuration::isEmulated()) {
             if (!is_null($options->getTimeout()) && $options->getTimeout() < 1) {
                 $this->assertEquals(500, $e->getCode(), 'getCode');
             } else {
                 $this->assertEquals(400, $e->getCode(), 'getCode');
             }
         } else {
             if (!is_null($options->getTimeout()) && $options->getTimeout() < 1) {
                 $this->assertEquals(500, $e->getCode(), 'getCode');
             } else {
                 $this->assertNull($e, 'Expect positive timeouts in $options to be fine');
             }
         }
     }
 }
 /**
  * @covers WindowsAzure\Queue\QueueRestProxy::setServiceProperties
  */
 public function testSetServicePropertiesNullOptions4()
 {
     $serviceProperties = QueueServiceFunctionalTestData::getDefaultServiceProperties();
     try {
         $this->restProxy->setServiceProperties($serviceProperties, null);
         $this->assertFalse(Configuration::isEmulated(), 'service properties should throw in emulator');
     } catch (ServiceException $e) {
         if (Configuration::isEmulated()) {
             // Setting is not supported in emulator
             $this->assertEquals(400, $e->getCode(), 'getCode');
         } else {
             throw $e;
         }
     }
 }
 private function verifySetContainerACLWorker($ret, $container, $acl, $blobContent)
 {
     $this->assertNotNull($ret->getContainerACL(), '$ret->getContainerACL');
     $this->assertNotNull($ret->getEtag(), '$ret->getContainerACL->getEtag');
     $now = new \DateTime();
     $this->assertTrue(BlobServiceFunctionalTestData::diffInTotalSeconds($ret->getLastModified(), $now) < 10000, 'Last modified date (' . $ret->getLastModified()->format(\DateTime::RFC1123) . ') ' . 'should be within 10 seconds of $now (' . $now->format(\DateTime::RFC1123) . ')');
     $this->assertNotNull($ret->getContainerACL()->getSignedIdentifiers(), '$ret->getContainerACL->getSignedIdentifiers');
     $this->assertEquals(is_null($acl->getPublicAccess()) ? '' : $acl->getPublicAccess(), $ret->getContainerACL()->getPublicAccess(), '$ret->getContainerACL->getPublicAccess');
     $expIds = $acl->getSignedIdentifiers();
     $actIds = $ret->getContainerACL()->getSignedIdentifiers();
     $this->assertEquals(count($expIds), count($actIds), '$ret->getContainerACL->getSignedIdentifiers');
     for ($i = 0; $i < count($expIds); $i++) {
         $expId = $expIds[$i];
         $actId = $actIds[$i];
         $this->assertEquals($expId->getId(), $actId->getId(), 'SignedIdentifiers[' + $i + ']->getId');
         $this->assertEquals($expId->getAccessPolicy()->getPermission(), $actId->getAccessPolicy()->getPermission(), 'SignedIdentifiers[' + $i + ']->getAccessPolicy->getPermission');
         $this->assertTrue(BlobServiceFunctionalTestData::diffInTotalSeconds($expId->getAccessPolicy()->getStart(), $actId->getAccessPolicy()->getStart()) < 1, 'SignedIdentifiers[' + $i + ']->getAccessPolicy->getStart should match within 1 second, ' . 'exp=' . $expId->getAccessPolicy()->getStart()->format(\DateTime::RFC1123) . ', ' . 'act=' . $actId->getAccessPolicy()->getStart()->format(\DateTime::RFC1123));
         $this->assertTrue(BlobServiceFunctionalTestData::diffInTotalSeconds($expId->getAccessPolicy()->getExpiry(), $actId->getAccessPolicy()->getExpiry()) < 1, 'SignedIdentifiers[' + $i + ']->getAccessPolicy->getExpiry should match within 1 second, ' . 'exp=' . $expId->getAccessPolicy()->getExpiry()->format(\DateTime::RFC1123) . ', ' . 'act=' . $actId->getAccessPolicy()->getExpiry()->format(\DateTime::RFC1123));
     }
     if (!Configuration::isEmulated()) {
         $containerAddress = $this->config->getProperty(BlobSettings::URI) . '/' . $container;
         $blobListAddress = $containerAddress . '?restype=container&comp=list';
         $blobAddress = $containerAddress . '/test';
         $canDownloadBlobList = $this->canDownloadFromUrl($blobListAddress, "<?xml version=\"1.0\" encoding=\"utf-8\"?" . "><EnumerationResults");
         $canDownloadBlob = $this->canDownloadFromUrl($blobAddress, $blobContent);
         if (!is_null($acl->getPublicAccess()) && $acl->getPublicAccess() == PublicAccessType::CONTAINER_AND_BLOBS) {
             // Full public read access: Container and blob data can be read via anonymous request.
             // Clients can enumerate blobs within the $container via anonymous request,
             // but cannot enumerate containers within the storage account.
             $this->assertTrue($canDownloadBlobList, '$canDownloadBlobList when ' . $acl->getPublicAccess());
             $this->assertTrue($canDownloadBlob, '$canDownloadBlob when ' . $acl->getPublicAccess());
         } else {
             if (!is_null($acl->getPublicAccess()) && $acl->getPublicAccess() == PublicAccessType::BLOBS_ONLY) {
                 // Public read access for blobs only: Blob data within this container
                 // can be read via anonymous request, but $container data is not available.
                 // Clients cannot enumerate blobs within the $container via anonymous request.
                 $this->assertFalse($canDownloadBlobList, '$canDownloadBlobList when ' . $acl->getPublicAccess());
                 $this->assertTrue($canDownloadBlob, '$canDownloadBlob when ' . $acl->getPublicAccess());
             } else {
                 // No public read access: Container and blob data can be read by the account owner only.
                 $this->assertFalse($canDownloadBlobList, '$canDownloadBlobList when ' . $acl->getPublicAccess());
                 $this->assertFalse($canDownloadBlob, '$canDownloadBlob when ' . $acl->getPublicAccess());
             }
         }
     }
 }
 /**
  * @covers WindowsAzure\Table\TableRestProxy::batch
  * @covers WindowsAzure\Table\TableRestProxy::insertEntity
  */
 private function batchPositiveOuter($firstConcurType, $seed)
 {
     // The random here is not to generate random values, but to
     // get a good mix of values in the table entities.
     mt_srand($seed);
     $concurTypes = ConcurType::values();
     $mutatePivots = MutatePivot::values();
     $opTypes = OpType::values();
     // Main loop.
     foreach ($opTypes as $firstOpType) {
         if (!is_null($this->expectConcurrencyFailure($firstOpType, $firstConcurType))) {
             // Want to know there is at least one part that does not fail.
             continue;
         }
         if (Configuration::isEmulated() && ($firstOpType == OpType::insertOrMergeEntity || $firstOpType == OpType::insertOrReplaceEntity)) {
             // Emulator does not support these operations.
             continue;
         }
         $simpleEntities = TableServiceFunctionalTestData::getSimpleEntities(6);
         $configs = array();
         $firstConfig = new BatchWorkerConfig();
         $firstConfig->concurType = $firstConcurType;
         $firstConfig->opType = $firstOpType;
         $firstConfig->ent = $simpleEntities[0];
         $firstConfig->mutatePivot = $mutatePivots[mt_rand(0, count($mutatePivots))];
         array_push($configs, $firstConfig);
         for ($i = 1; $i < count($simpleEntities); $i++) {
             $config = new BatchWorkerConfig();
             while (!is_null($this->expectConcurrencyFailure($config->opType, $config->concurType))) {
                 $config->concurType = $concurTypes[mt_rand(0, count($concurTypes))];
                 $config->opType = $opTypes[mt_rand(0, count($opTypes))];
                 if (Configuration::isEmulated()) {
                     if ($config->opType == OpType::insertOrMergeEntity) {
                         $config->opType = OpType::mergeEntity;
                     }
                     if ($config->opType == OpType::insertOrReplaceEntity) {
                         $config->opType = OpType::updateEntity;
                     }
                 }
             }
             $config->mutatePivot = $mutatePivots[mt_rand(0, count($mutatePivots) - 1)];
             $config->ent = $simpleEntities[$i];
             array_push($configs, $config);
         }
         for ($i = 0; $i <= 1; $i++) {
             $options = $i == 0 ? null : new TableServiceOptions();
             if (Configuration::isEmulated()) {
                 // The emulator has trouble with some batches.
                 for ($j = 0; $j < count($configs); $j++) {
                     $tmpconfigs = array();
                     $tmpconfigs[] = $configs[$j];
                     $this->batchWorker($tmpconfigs, $options);
                 }
             } else {
                 $this->batchWorker($configs, $options);
             }
         }
     }
 }
 /**
  * @covers WindowsAzure\Table\TableRestProxy::batch
  * @covers WindowsAzure\Table\TableRestProxy::insertEntity
  */
 public function testBatchAllOperationsTogetherWorks()
 {
     // Arrange
     $table = self::$TEST_TABLE_8;
     $partitionKey = '001';
     // Insert a few entities to allow updating them in batch
     $entity1 = new Entity();
     $entity1->setPartitionKey($partitionKey);
     $entity1->setRowKey('batchAllOperationsWorks-' . 1);
     $entity1->addProperty('test', EdmType::BOOLEAN, true);
     $entity1->addProperty('test2', EdmType::STRING, 'value');
     $entity1->addProperty('test3', EdmType::INT32, 3);
     $entity1->addProperty('test4', EdmType::INT64, '12345678901');
     $entity1->addProperty('test5', EdmType::DATETIME, new \DateTime());
     $entity1 = $this->restProxy->insertEntity($table, $entity1)->getEntity();
     $entity2 = new Entity();
     $entity2->setPartitionKey($partitionKey);
     $entity2->setRowKey('batchAllOperationsWorks-' . 2);
     $entity2->addProperty('test', EdmType::BOOLEAN, true);
     $entity2->addProperty('test2', EdmType::STRING, 'value');
     $entity2->addProperty('test3', EdmType::INT32, 3);
     $entity2->addProperty('test4', EdmType::INT64, '12345678901');
     $entity2->addProperty('test5', EdmType::DATETIME, new \DateTime());
     $entity2 = $this->restProxy->insertEntity($table, $entity2)->getEntity();
     $entity3 = new Entity();
     $entity3->setPartitionKey($partitionKey);
     $entity3->setRowKey('batchAllOperationsWorks-' . 3);
     $entity3->addProperty('test', EdmType::BOOLEAN, true);
     $entity3->addProperty('test2', EdmType::STRING, 'value');
     $entity3->addProperty('test3', EdmType::INT32, 3);
     $entity3->addProperty('test4', EdmType::INT64, '12345678901');
     $entity3->addProperty('test5', EdmType::DATETIME, new \DateTime());
     $entity3 = $this->restProxy->insertEntity($table, $entity3)->getEntity();
     $entity4 = new Entity();
     $entity4->setPartitionKey($partitionKey);
     $entity4->setRowKey('batchAllOperationsWorks-' . 4);
     $entity4->addProperty('test', EdmType::BOOLEAN, true);
     $entity4->addProperty('test2', EdmType::STRING, 'value');
     $entity4->addProperty('test3', EdmType::INT32, 3);
     $entity4->addProperty('test4', EdmType::INT64, '12345678901');
     $entity4->addProperty('test5', EdmType::DATETIME, new \DateTime());
     $entity4 = $this->restProxy->insertEntity($table, $entity4)->getEntity();
     // Act
     $batchOperations = new BatchOperations();
     $entity = new Entity();
     $entity->setPartitionKey($partitionKey);
     $entity->setRowKey('batchAllOperationsWorks');
     $entity->addProperty('test', EdmType::BOOLEAN, true);
     $entity->addProperty('test2', EdmType::STRING, 'value');
     $entity->addProperty('test3', EdmType::INT32, 3);
     $entity->addProperty('test4', EdmType::INT64, '12345678901');
     $entity->addProperty('test5', EdmType::DATETIME, new \DateTime());
     $batchOperations->addInsertEntity($table, $entity);
     $batchOperations->addDeleteEntity($table, $entity1->getPartitionKey(), $entity1->getRowKey(), $entity1->getEtag());
     $entity2->addProperty('test3', EdmType::INT32, 5);
     $batchOperations->addUpdateEntity($table, $entity2);
     $entity3->addProperty('test3', EdmType::INT32, 5);
     $batchOperations->addMergeEntity($table, $entity3);
     $entity4->addProperty('test3', EdmType::INT32, 5);
     // Use different behavior in the emulator, as v1.6 does not support this method
     if (!Configuration::isEmulated()) {
         $batchOperations->addInsertOrReplaceEntity($table, $entity4);
     } else {
         $batchOperations->addUpdateEntity($table, $entity4);
     }
     $entity5 = new Entity();
     $entity5->setPartitionKey($partitionKey);
     $entity5->setRowKey('batchAllOperationsWorks-' . 5);
     $entity5->addProperty('test', EdmType::BOOLEAN, true);
     $entity5->addProperty('test2', EdmType::STRING, 'value');
     $entity5->addProperty('test3', EdmType::INT32, 3);
     $entity5->addProperty('test4', EdmType::INT64, '12345678901');
     $entity5->addProperty('test5', EdmType::DATETIME, new \DateTime());
     // Use different behavior in the emulator, as v1.6 does not support this method
     if (Configuration::isEmulated()) {
         $batchOperations->addInsertEntity($table, $entity5);
     } else {
         $batchOperations->addInsertOrMergeEntity($table, $entity5);
     }
     $result = $this->restProxy->batch($batchOperations);
     // Assert
     $this->assertNotNull($result, '$result');
     $this->assertEquals(count($batchOperations->getOperations()), count($result->getEntries()), 'count($result->getEntries())');
     $ents = $result->getEntries();
     $this->assertTrue($ents[0] instanceof InsertEntityResult, '$result->getEntries()->get(0)->getClass()');
     $this->assertTrue(is_string($ents[1]), '$result->getEntries()->get(1)->getClass()');
     $this->assertTrue($ents[2] instanceof UpdateEntityResult, '$result->getEntries()->get(2)->getClass()');
     $this->assertTrue($ents[3] instanceof UpdateEntityResult, '$result->getEntries()->get(3)->getClass()');
     $this->assertTrue($ents[4] instanceof UpdateEntityResult, '$result->getEntries()->get(4)->getClass()');
     if (Configuration::isEmulated()) {
         $this->assertTrue($ents[5] instanceof InsertEntityResult, '$result->getEntries()->get(5)->getClass()');
     } else {
         $this->assertTrue($ents[5] instanceof UpdateEntityResult, '$result->getEntries()->get(5)->getClass()');
     }
 }
 static function getInterestingQueryTablesOptions()
 {
     $ret = array();
     $options = new QueryTablesOptions();
     array_push($ret, $options);
     $options = new QueryTablesOptions();
     $options->setTop(2);
     $options->setPrefix(self::$nonExistTablePrefix);
     array_push($ret, $options);
     $options = new QueryTablesOptions();
     $options->setTop(-2);
     array_push($ret, $options);
     $options = new QueryTablesOptions();
     $filter = Filter::applyEq(Filter::applyConstant(self::$TEST_TABLE_NAMES[1]), Filter::applyPropertyName('TableName'));
     $options->setFilter($filter);
     array_push($ret, $options);
     $options = new QueryTablesOptions();
     $filter = Filter::applyEq(Filter::applyConstant(self::$TEST_TABLE_NAMES[2]), Filter::applyPropertyName('TableName'));
     $options->setFilter($filter);
     array_push($ret, $options);
     $options = new QueryTablesOptions();
     $filter = Filter::applyAnd(Filter::applyEq(Filter::applyConstant(self::$TEST_TABLE_NAMES[1]), Filter::applyPropertyName('TableName')), Filter::applyEq(Filter::applyConstant(self::$TEST_TABLE_NAMES[2]), Filter::applyPropertyName('TableName')));
     $options->setFilter($filter);
     array_push($ret, $options);
     $options = new QueryTablesOptions();
     $filter = Filter::applyAnd(Filter::applyGe(Filter::applyPropertyName('TableName'), Filter::applyConstant(self::$TEST_TABLE_NAMES[1])), Filter::applyLe(Filter::applyPropertyName('TableName'), Filter::applyConstant(self::$TEST_TABLE_NAMES[2])));
     $options->setFilter($filter);
     array_push($ret, $options);
     $options = new QueryTablesOptions();
     $filter = Filter::applyOr(Filter::applyGe(Filter::applyPropertyName('TableName'), Filter::applyConstant(self::$TEST_TABLE_NAMES[1])), Filter::applyGe(Filter::applyPropertyName('TableName'), Filter::applyConstant(self::$TEST_TABLE_NAMES[2])));
     $options->setFilter($filter);
     array_push($ret, $options);
     $options = new QueryTablesOptions();
     $filter = Filter::applyAnd(Filter::applyEq(Filter::applyPropertyName('TableName'), Filter::applyConstant(self::$TEST_TABLE_NAMES[1])), Filter::applyGe(Filter::applyPropertyName('TableName'), Filter::applyConstant(self::$TEST_TABLE_NAMES[0])));
     $options->setFilter($filter);
     array_push($ret, $options);
     $options = new QueryTablesOptions();
     $filter = Filter::applyOr(Filter::applyEq(Filter::applyPropertyName('TableName'), Filter::applyConstant(self::$TEST_TABLE_NAMES[1])), Filter::applyGe(Filter::applyPropertyName('TableName'), Filter::applyConstant(self::$TEST_TABLE_NAMES[2])));
     $options->setFilter($filter);
     array_push($ret, $options);
     $options = new QueryTablesOptions();
     $filter = Filter::applyOr(Filter::applyEq(Filter::applyPropertyName('TableName'), Filter::applyConstant(self::$TEST_TABLE_NAMES[1])), Filter::applyEq(Filter::applyPropertyName('TableName'), Filter::applyConstant(self::$TEST_TABLE_NAMES[2])));
     $options->setFilter($filter);
     array_push($ret, $options);
     $options = new QueryTablesOptions();
     $filter = Filter::applyOr(Filter::applyEq(Filter::applyConstant(self::$TEST_TABLE_NAMES[1]), Filter::applyPropertyName('TableName')), Filter::applyEq(Filter::applyConstant(self::$TEST_TABLE_NAMES[2]), Filter::applyPropertyName('TableName')));
     $options->setFilter($filter);
     array_push($ret, $options);
     $options = new QueryTablesOptions();
     $options->setPrefix(self::$nonExistTablePrefix);
     array_push($ret, $options);
     if (!Configuration::isEmulated()) {
         $options = new QueryTablesOptions();
         $options->setPrefix(self::$testUniqueId);
         array_push($ret, $options);
     }
     $options = new QueryTablesOptions();
     $nextTableName = self::$TEST_TABLE_NAMES[1];
     $options->setNextTableName($nextTableName);
     array_push($ret, $options);
     $options = new QueryTablesOptions();
     $nextTableName = self::$nonExistTablePrefix;
     $options->setNextTableName($nextTableName);
     array_push($ret, $options);
     return $ret;
 }
 /**
  * @covers WindowsAzure\Queue\QueueRestProxy::getServiceProperties
  * @covers WindowsAzure\Queue\QueueRestProxy::setServiceProperties
  */
 public function testSetServicePropertiesWorks()
 {
     // Arrange
     // Act
     $shouldReturn = false;
     try {
         $props = $this->restProxy->getServiceProperties()->getValue();
         $this->assertFalse(Configuration::isEmulated(), 'Should succeed when not running in emulator');
     } catch (ServiceException $e) {
         // Expect failure in emulator, as v1.6 doesn't support this method
         if (Configuration::isEmulated()) {
             $this->assertEquals(400, $e->getCode(), 'getCode');
             $shouldReturn = true;
         }
     }
     if ($shouldReturn) {
         return;
     }
     $props->getLogging()->setRead(true);
     $this->restProxy->setServiceProperties($props);
     $props = $this->restProxy->getServiceProperties()->getValue();
     // Assert
     $this->assertNotNull($props, '$props');
     $this->assertNotNull($props->getLogging(), '$props->getLogging');
     $this->assertNotNull($props->getLogging()->getRetentionPolicy(), '$props->getLogging()->getRetentionPolicy');
     $this->assertNotNull($props->getLogging()->getVersion(), '$props->getLogging()->getVersion');
     $this->assertTrue($props->getLogging()->getRead(), '$props->getLogging()->getRead');
     $this->assertNotNull($props->getMetrics()->getRetentionPolicy(), '$props->getMetrics()->getRetentionPolicy');
     $this->assertNotNull($props->getMetrics()->getVersion(), '$props->getMetrics()->getVersion');
 }
 /**
  * @covers WindowsAzure\Common\Configuration::isEmulated
  */
 public function testIsEmulated()
 {
     // Test
     $actual = Configuration::isEmulated();
     // Assert
     $this->assertTrue(isset($actual));
 }