Пример #1
0
 /**
  * Creates WrapAccesTokenResult object from parsed XML response.
  *
  * @param array $response The get WRAP access token response.
  * 
  * @return WindowsAzure\ServiceBus\Internal\WrapAccessTokenResult.
  */
 public static function create($response)
 {
     $wrapAccessTokenResult = new WrapAccessTokenResult();
     parse_str($response, $parsedResponse);
     $wrapAccessTokenResult->setAccessToken(Utilities::tryGetValue($parsedResponse, Resources::WRAP_ACCESS_TOKEN));
     $wrapAccessTokenResult->setExpiresIn(Utilities::tryGetValue($parsedResponse, Resources::WRAP_ACCESS_TOKEN_EXPIRES_IN));
     return $wrapAccessTokenResult;
 }
 /**
  * @covers WindowsAzure\ServiceBus\Internal\WrapAccessTokenResult::getExpiresIn
  * @covers WindowsAzure\ServiceBus\Internal\WrapAccessTokenResult::setExpiresIn
  */
 public function testGetExpiresIn()
 {
     // Setup
     $wrapAccessTokenResult = new WrapAccessTokenResult();
     $expected = 1000;
     // Test
     $wrapAccessTokenResult->setExpiresIn($expected);
     // Assert
     $actual = $wrapAccessTokenResult->getExpiresIn();
     $this->assertEquals($expected, $actual);
 }
 public function wrapAccessToken($uri, $name, $password, $scope)
 {
     if (!Utilities::startsWith($scope, 'http://test/scope2')) {
         ++$this->count1;
         $id = '1-' . $this->count1;
     } else {
         ++$this->count2;
         $id = '2-' . $this->count2;
     }
     $wrapResponse = new WrapAccessTokenResult();
     $wrapResponse->setExpiresIn(WrapTokenManagerTest::EXPIRES_IN_SEC);
     $wrapResponse->setAccessToken('testaccesstoken' . $id);
     return $wrapResponse;
 }