/**
  * @param string $domainName
  *
  * @return Domain
  */
 public function get($domainName)
 {
     $request = array('name' => $domainName);
     $domainDescriptionModel = $this->awsSwfClient->describeDomain($request);
     $domain = new Domain();
     $domain->fromModel($domainDescriptionModel);
     return $domain;
 }
예제 #2
0
 /**
  * @covers Aws\Swf\SwfClient::factory
  */
 public function testFactoryInitializesClient()
 {
     $client = SwfClient::factory(array('key' => 'foo', 'secret' => 'bar', 'region' => 'us-west-2'));
     $this->assertInstanceOf('Aws\\Common\\Signature\\SignatureV4', $client->getSignature());
     $this->assertInstanceOf('Aws\\Common\\Credentials\\Credentials', $client->getCredentials());
     $this->assertEquals('https://swf.us-west-2.amazonaws.com', $client->getBaseUrl());
 }
 public function __construct()
 {
     # Check if preper env vars are setup
     if (!($region = getenv("AWS_DEFAULT_REGION"))) {
         throw new CpeSdk\CpeException("Set 'AWS_DEFAULT_REGION' environment variable!");
     }
     // SWF client
     $this->swf = SwfClient::factory(array('region' => $region));
 }
예제 #4
0
 public function testBasicOperations()
 {
     $registeredDomain = 'php-integ-swf-domain';
     $deprecatedDomain = 'php-integ-swf-domain-deprecated';
     self::log('Create a SWF domain to use for testing.');
     try {
         $this->swf->getCommand('RegisterDomain', array('name' => $registeredDomain, 'description' => 'For integration testing in the AWS SDK for PHP', 'workflowExecutionRetentionPeriodInDays' => '10'))->execute();
     } catch (DomainAlreadyExistsException $e) {
         self::log('The domain is already created.');
     }
     self::log('Make sure the domain is there with the correct status.');
     $result = $this->swf->getCommand('DescribeDomain', array('name' => $registeredDomain))->getResult();
     $this->assertEquals(RegistrationStatus::REGISTERED, $result->getPath('domainInfo/status'));
     self::log('Create a second SWF domain to use for testing.');
     try {
         $this->swf->getCommand('RegisterDomain', array('name' => $deprecatedDomain, 'description' => 'For integration testing in the AWS SDK for PHP', 'workflowExecutionRetentionPeriodInDays' => '10'))->execute();
     } catch (DomainAlreadyExistsException $e) {
         self::log('The second domain is already created.');
     }
     self::log('Deprecate the second SWF domain for testing.');
     try {
         $this->swf->getCommand('DeprecateDomain', array('name' => $deprecatedDomain))->execute();
     } catch (DomainDeprecatedException $e) {
         self::log('The second domain is already deprecated.');
     }
     self::log('Make sure the second domain is there with the correct deprecated status.');
     $result = $this->swf->getCommand('DescribeDomain', array('name' => $deprecatedDomain))->getResult();
     $this->assertEquals(RegistrationStatus::DEPRECATED, $result->getPath('domainInfo/status'));
     self::log('List the domains using iterators and make sure the two domains are there.');
     $domains = new AppendIterator();
     $domains->append($this->swf->getIterator('ListDomains', array('reverseOrder' => true, 'registrationStatus' => RegistrationStatus::REGISTERED)));
     $domains->append($this->swf->getIterator('ListDomains', array('registrationStatus' => RegistrationStatus::DEPRECATED)));
     $domains = new FilterIterator($domains, function (array $domain) {
         return strpos($domain['name'], 'php-integ-swf') === 0;
     });
     $domains = new MapIterator($domains, function (array $domain) {
         return $domain['name'];
     });
     $this->assertEquals(2, iterator_count($domains));
     $domainNames = array();
     foreach ($domains as $domain) {
         $domainNames[] = $domain;
     }
     $this->assertEquals(array($registeredDomain, $deprecatedDomain), $domainNames);
 }
예제 #5
0
 /**
  * @param array $testData
  * @dataProvider respondDecisionTaskCompleteDataProvider
  */
 public function testRespondDecisionTaskComplete(array $testData)
 {
     $this->swfClientMock->expects($this->once())->method('respondDecisionTaskCompleted')->with($testData[static::INDEX_SWF_CLIENT_REQUEST_MOCK]);
     $this->createTestObject()->respondDecisionTaskComplete($testData[static::INDEX_INPUT]);
 }
예제 #6
0
 /**
  * @param DecisionResult $request
  */
 public function respondDecisionTaskComplete(DecisionResult $request)
 {
     $this->swfClient->respondDecisionTaskCompleted($request->convertToArray());
 }
 public function getWorkflowExecutionHistory(array $args = array())
 {
     return $this->client->getWorkflowExecutionHistory($args);
 }