/**
  * @covers WindowsAzure\ServiceManagement\Models\GetHostedServicePropertiesOptions::setEmbedDetail
  * @covers WindowsAzure\ServiceManagement\Models\GetHostedServicePropertiesOptions::getEmbedDetail
  * @covers WindowsAzure\ServiceManagement\Models\GetHostedServicePropertiesOptions::__construct
  */
 public function testSetEmbedDetail()
 {
     // Setup
     $service = new GetHostedServicePropertiesOptions();
     $expected = true;
     // Test
     $service->setEmbedDetail($expected);
     // Assert
     $this->assertEquals($expected, $service->getEmbedDetail());
 }
Ejemplo n.º 2
0
 /**
  * Retrieves system properties for the specified hosted service. These properties
  * include the service name and service type; the name of the affinity group to
  * which the service belongs, or its location if it is not part of an affinity
  * group; and optionally, information on the service's deployments.
  *
  * @param string                            $name    The name for the hosted
  * service.
  * @param GetHostedServicePropertiesOptions $options The optional parameters.
  *
  * @return GetHostedServicePropertiesResult
  *
  * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee460806.aspx
  */
 public function getHostedServiceProperties($name, $options = null)
 {
     Validate::isString($name, 'name');
     Validate::notNullOrEmpty($name, 'name');
     if (is_null($options)) {
         $options = new GetHostedServicePropertiesOptions();
     }
     $context = new HttpCallContext();
     $context->setMethod(Resources::HTTP_GET);
     $context->setPath($this->_getHostedServicePath($name));
     $context->addStatusCode(Resources::STATUS_OK);
     $context->addQueryParameter(Resources::QP_EMBED_DETAIL, Utilities::booleanToString($options->getEmbedDetail()));
     $response = $this->sendContext($context);
     $parsed = $this->dataSerializer->unserialize($response->getBody());
     return GetHostedServicePropertiesResult::create($parsed);
 }
 /**
  * @covers WindowsAzure\ServiceManagement\ServiceManagementRestProxy::getHostedServiceProperties
  * @covers WindowsAzure\ServiceManagement\ServiceManagementRestProxy::_getHostedServicePath
  * @covers WindowsAzure\ServiceManagement\ServiceManagementRestProxy::_getPath
  * @covers WindowsAzure\ServiceManagement\Models\GetHostedServicePropertiesResult::create
  * @group HostedService
  */
 public function testGetHostedServicePropertiesWithEmbed()
 {
     // Setup
     $name = $this->getTestName();
     $stagingName = $name . 'staging';
     $options = new GetHostedServicePropertiesOptions();
     $options->setEmbedDetail(true);
     $this->createDeployment($name);
     $this->createDeployment($name, DeploymentSlot::STAGING, $stagingName);
     // Test
     $result = $this->restProxy->getHostedServiceProperties($name, $options);
     // Need to delete the staging deployment manually
     $this->deleteDeployment($name, DeploymentSlot::STAGING);
     // Assert
     $this->assertEquals($name, $result->getHostedService()->getName());
     $this->assertEquals($this->defaultLocation, $result->getHostedService()->getLocation());
     $this->assertEquals(base64_encode($name), $result->getHostedService()->getLabel());
     $this->assertCount(2, $result->getHostedService()->getDeployments());
     $deployments = $result->getHostedService()->getDeployments();
     $deployment1 = $deployments[0];
     $deployment2 = $deployments[1];
     // First deployment
     $this->assertSuspendedDeploymentWithOneRole($deployment1, $name, DeploymentSlot::PRODUCTION, 'WebRole1', 'WebRole1_IN_0');
     // Second deployment
     $this->assertSuspendedDeploymentWithOneRole($deployment2, $stagingName, DeploymentSlot::STAGING, 'WebRole1', 'WebRole1_IN_0');
 }