コード例 #1
0
 public function testGetAdapterWithConfig()
 {
     // EC2 adapter
     $Ec2Adapter = Zend_Cloud_Infrastructure_Factory::getAdapter(new Zend_Config(Zend_Cloud_Infrastructure_Adapter_Ec2Test::getConfigArray()));
     $this->assertEquals('Zend_Cloud_Infrastructure_Adapter_Ec2', get_class($Ec2Adapter));
     // Rackspace adapter
     $rackspaceAdapter = Zend_Cloud_Infrastructure_Factory::getAdapter(new Zend_Config(Zend_Cloud_Infrastructure_Adapter_RackspaceTest::getConfigArray()));
     $this->assertEquals('Zend_Cloud_Infrastructure_Adapter_Rackspace', get_class($rackspaceAdapter));
 }
コード例 #2
0
ファイル: Ec2Test.php プロジェクト: jsnshrmn/Suma
 /**
  * Setup for each test
  */
 public function setUp()
 {
     $this->infrastructure = Zend_Cloud_Infrastructure_Factory::getAdapter(array(Zend_Cloud_Infrastructure_Factory::INFRASTRUCTURE_ADAPTER_KEY => 'Zend_Cloud_Infrastructure_Adapter_Ec2', Zend_Cloud_Infrastructure_Adapter_Ec2::AWS_ACCESS_KEY => 'foo', Zend_Cloud_Infrastructure_Adapter_Ec2::AWS_SECRET_KEY => 'bar', Zend_Cloud_Infrastructure_Adapter_Ec2::AWS_REGION => 'us-east-1'));
     $this->httpClientAdapterTest = new Zend_Http_Client_Adapter_Test();
     // load the HTTP response (from a file)
     $shortClassName = substr(__CLASS__, strlen('Zend_Cloud_Infrastructure_Adapter_'));
     $filename = dirname(__FILE__) . '/_files/' . $shortClassName . '_' . $this->getName() . '.response';
     if (file_exists($filename)) {
         $this->httpClientAdapterTest->setResponse($this->loadResponse($filename));
     }
     $adapter = $this->infrastructure->getAdapter();
     $client = new Zend_Http_Client(null, array('adapter' => $this->httpClientAdapterTest));
     call_user_func(array($adapter, 'setHttpClient'), $client);
 }
コード例 #3
0
 /**
  * Setup for each test
  */
 public function setUp()
 {
     $this->infrastructure = Zend_Cloud_Infrastructure_Factory::getAdapter(array(Zend_Cloud_Infrastructure_Factory::INFRASTRUCTURE_ADAPTER_KEY => 'Zend_Cloud_Infrastructure_Adapter_Rackspace', Zend_Cloud_Infrastructure_Adapter_Rackspace::RACKSPACE_USER => 'foo', Zend_Cloud_Infrastructure_Adapter_Rackspace::RACKSPACE_KEY => 'bar', Zend_Cloud_Infrastructure_Adapter_Rackspace::RACKSPACE_REGION => 'USA'));
     $this->httpClientAdapterTest = new Zend_Http_Client_Adapter_Test();
     $this->infrastructure->getAdapter()->getHttpClient()->setAdapter($this->httpClientAdapterTest);
     // load the HTTP response (from a file)
     $shortClassName = 'RackspaceTest';
     $filename = dirname(__FILE__) . '/_files/' . $shortClassName . '_' . $this->getName() . '.response';
     if (file_exists($filename)) {
         // authentication (from file)
         $content = dirname(__FILE__) . '/_files/' . $shortClassName . '_testAuthenticate.response';
         $this->httpClientAdapterTest->setResponse($this->loadResponse($content));
         $this->assertTrue($this->infrastructure->getAdapter()->authenticate(), 'Authentication failed');
         $this->httpClientAdapterTest->setResponse($this->loadResponse($filename));
     }
 }
コード例 #4
0
 public function setUp()
 {
     $this->_config = $this->_getConfig();
     $this->_commonInfrastructure = Zend_Cloud_Infrastructure_Factory::getAdapter($this->_config);
     parent::setUp();
 }