Exemplo n.º 1
0
 /**
  * @covers Aws\Emr\EmrClient::factory
  */
 public function testFactoryInitializesClient()
 {
     $client = EmrClient::factory(array('key' => 'foo', 'secret' => 'bar', 'region' => 'us-west-2'));
     $this->assertInstanceOf('Aws\\Common\\Signature\\SignatureV2', $client->getSignature());
     $this->assertInstanceOf('Aws\\Common\\Credentials\\Credentials', $client->getCredentials());
     $this->assertEquals('https://elasticmapreduce.us-west-2.amazonaws.com', $client->getBaseUrl());
 }
Exemplo n.º 2
0
 public function testCreateAndDeleteJobFlow()
 {
     self::log('Create a job flow');
     $jobFlowName = 'php-integ-test-job-flow';
     $result = $this->client->getCommand('RunJobFlow', array('Name' => $jobFlowName, 'Instances' => array('InstanceCount' => 2, 'KeepJobFlowAliveWhenNoSteps' => true, 'MasterInstanceType' => InstanceType::M1_SMALL, 'SlaveInstanceType' => InstanceType::M1_SMALL)))->getResult();
     $jobFlowId = $result->get('JobFlowId');
     self::log('Describe the job flows and make sure the job flow is there');
     $found = false;
     foreach ($this->client->getIterator('DescribeJobFlows') as $jobFlow) {
         if ($jobFlow['Name'] === $jobFlowName) {
             $found = true;
             break;
         }
     }
     $this->assertTrue($found);
     self::log('Delete the job flow');
     $this->client->getCommand('TerminateJobFlows', array('JobFlowIds' => array($jobFlowId)))->execute();
     self::log('Describe the job flows again and make sure the job flow is no longer there');
     $state = $this->client->getCommand('DescribeJobFlows')->getResult()->getPath('JobFlows/0/ExecutionStatusDetail/State');
     $this->assertContains($state, array(JobFlowExecutionState::SHUTTING_DOWN, JobFlowExecutionState::TERMINATED));
 }