Пример #1
0
 public function testGetAdapterWithConfig()
 {
     // EC2 adapter
     $Ec2Adapter = CloudFactory::getAdapter(new Config(Ec2OfflineTest::getConfigArray(), true));
     $this->assertEquals('ZendCloud\\Infrastructure\\Adapter\\Ec2', get_class($Ec2Adapter));
     // Rackspace adapter
     $rackspaceAdapter = CloudFactory::getAdapter(new Config(RackspaceOfflineTest::getConfigArray(), true));
     $this->assertEquals('ZendCloud\\Infrastructure\\Adapter\\Rackspace', get_class($rackspaceAdapter));
 }
Пример #2
0
 /**
  * Setup for each test
  */
 public function setUp()
 {
     $this->infrastructure = CloudFactory::getAdapter(array(CloudFactory::INFRASTRUCTURE_ADAPTER_KEY => 'ZendCloud\\Infrastructure\\Adapter\\Ec2', Ec2::AWS_ACCESS_KEY => '0123456789', Ec2::AWS_SECRET_KEY => 'test', Ec2::AWS_REGION => 'us-east-1'));
     $this->httpClientAdapterTest = new HttpTest();
     // load the HTTP response (from a file)
     $shortClassName = 'Ec2Test';
     $filename = dirname(__FILE__) . '/_files/' . $shortClassName . '_' . $this->getName() . '.response';
     if (file_exists($filename)) {
         $this->httpClientAdapterTest->setResponse(file_get_contents($filename));
     }
     $adapter = $this->infrastructure->getAdapter();
     $client = new HttpClient(null, array('adapter' => $this->httpClientAdapterTest));
     call_user_func(array($adapter, 'setHttpClient'), $client);
 }
 /**
  * Setup for each test
  */
 public function setUp()
 {
     $this->infrastructure = CloudFactory::getAdapter(array(CloudFactory::INFRASTRUCTURE_ADAPTER_KEY => 'ZendCloud\\Infrastructure\\Adapter\\Rackspace', Rackspace::RACKSPACE_USER => 'test', Rackspace::RACKSPACE_KEY => 'test', Rackspace::RACKSPACE_REGION => 'USA'));
     $this->httpClientAdapterTest = new HttpTest();
     $this->infrastructure->getAdapter()->getHttpClient()->setAdapter($this->httpClientAdapterTest);
     $shortClassName = 'RackspaceTest';
     // load the HTTP response (from a file)
     $filename = dirname(__FILE__) . '/_files/' . $shortClassName . '_' . $this->getName() . '.response';
     if (file_exists($filename)) {
         // authentication (from file)
         $content = file_get_contents(dirname(__FILE__) . '/_files/' . $shortClassName . '_testAuthenticate.response');
         $this->httpClientAdapterTest->setResponse($content);
         $this->assertTrue($this->infrastructure->getAdapter()->authenticate(), 'Authentication failed');
         // set the specific API response
         $content = file_get_contents($filename);
         $this->httpClientAdapterTest->setResponse($content);
     }
 }
Пример #4
0
 public function setUp()
 {
     $this->_config = $this->_getConfig();
     $this->_commonInfrastructure = \ZendCloud\Infrastructure\Factory::getAdapter($this->_config);
     parent::setUp();
 }