示例#1
0
 /**
  * Sets up this test case
  *
  * @return void
  */
 public function setUp()
 {
     $this->_amazon = new Zend_Service_Amazon_SimpleDb(constant('TESTS_ZEND_SERVICE_AMAZON_ONLINE_ACCESSKEYID'), constant('TESTS_ZEND_SERVICE_AMAZON_ONLINE_SECRETKEY'));
     $this->_httpClientAdapterSocket = new Zend_Http_Client_Adapter_Socket();
     $this->_amazon->getHttpClient()->setAdapter($this->_httpClientAdapterSocket);
     $this->_testDomainNamePrefix = 'TestsZendServiceAmazonSimpleDbDomain';
     $this->_testItemNamePrefix = 'TestsZendServiceAmazonSimpleDbItem';
     $this->_testAttributeNamePrefix = 'TestsZendServiceAmazonSimpleDbAttribute';
     $this->_wait();
 }
示例#2
0
 public function __construct()
 {
     // Load Amazon Configuration
     $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/amazon.ini', APPLICATION_ENV);
     $access_key = $config->aws->account->access_key;
     $secret_key = $config->aws->account->secret_key;
     parent::__construct($access_key, $secret_key);
     // Load HTTP Configuration
     $httpconfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/http.ini', APPLICATION_ENV);
     $client = new Zend_Http_Client(null, $httpconfig);
     $this->setHttpClient($client);
 }
 /**
  * Query for documents stored in the document service. If a string is passed in
  * $query, the query string will be passed directly to the service.
  *
  * @param  string $collectionName Collection name
  * @param  string $query
  * @param  array $options
  * @return array Zend_Cloud_DocumentService_DocumentSet
  */
 public function query($collectionName, $query, $options = null)
 {
     $returnDocs = isset($options[self::RETURN_DOCUMENTS]) ? (bool) $options[self::RETURN_DOCUMENTS] : true;
     try {
         if ($query instanceof Zend_Cloud_DocumentService_Adapter_SimpleDb_Query) {
             $query = $query->assemble($collectionName);
         }
         $result = $this->_simpleDb->select($query);
     } catch (Zend_Service_Amazon_Exception $e) {
         throw new Zend_Cloud_DocumentService_Exception('Error on document query: ' . $e->getMessage(), $e->getCode(), $e);
     }
     return $this->_getDocumentSetFromResultSet($result, $returnDocs);
 }
示例#4
0
	public function testDeleteDomain() {
	    $domainName = $this->_testDomainNamePrefix . '_testDeleteDomain';
        $this->_amazon->deleteDomain($domainName);
        $this->_amazon->createDomain($domainName);
        try {
            $domainListPage = $this->_amazon->listDomains();
            $this->assertContains($domainName, $domainListPage->getData());
            $this->assertNull($domainListPage->getToken());
            // Delete the domain
            $this->_amazon->deleteDomain($domainName);
            $domainListPage = $this->_amazon->listDomains();
            $this->assertNotContains($domainName, $domainListPage->getData());
        } catch(Exception $e) {
            $this->_amazon->deleteDomain($domainName);
            throw $e;
        }
    }