/**
  * Deserializes the role environment data.
  * 
  * @param IInputChannel $inputChannel The input Channel.
  * 
  * @return RoleEnvironmentData
  */
 public function deserialize($inputChannel)
 {
     $document = stream_get_contents($inputChannel);
     $environmentInfo = Utilities::unserialize($document);
     $configurationSettings = $this->_translateConfigurationSettings($environmentInfo);
     $localResources = $this->_translateLocalResources($environmentInfo);
     $currentInstance = $this->_translateCurrentInstance($environmentInfo);
     $roles = $this->_translateRoles($environmentInfo, $currentInstance, $environmentInfo['CurrentInstance']['@attributes']['roleName']);
     return new RoleEnvironmentData($environmentInfo['Deployment']['@attributes']['id'], $configurationSettings, $localResources, $currentInstance, $roles, $environmentInfo['Deployment']['@attributes']['emulated'] == 'true');
 }
 /**
  * Gets the version map.
  * 
  * @param string $connectionPath The connection path.
  * 
  * @return array
  */
 public function getVersionMap($connectionPath)
 {
     $versions = array();
     $input = $this->_inputChannel->getInputStream($connectionPath);
     $contents = stream_get_contents($input);
     $discoveryInfo = Utilities::unserialize($contents);
     $endpoints = $discoveryInfo['RuntimeServerEndpoints']['RuntimeServerEndpoint'];
     if (array_key_exists('@attributes', $endpoints)) {
         $endpoints = array();
         $endpoints[] = $discoveryInfo['RuntimeServerEndpoints']['RuntimeServerEndpoint'];
     }
     foreach ($endpoints as $endpoint) {
         $versions[$endpoint['@attributes']['version']] = $endpoint['@attributes']['path'];
     }
     return $versions;
 }
 /**
  * Deserializes a goal state.
  * 
  * @param string $document The goal state document.
  * 
  * @return GoalState
  */
 public function deserialize($document)
 {
     $goalStateInfo = Utilities::unserialize($document);
     return new GoalState($goalStateInfo['Incarnation'], $goalStateInfo['ExpectedState'], $goalStateInfo['RoleEnvironmentPath'], new \DateTime($goalStateInfo['Deadline']), $goalStateInfo['CurrentStateEndpoint']);
 }
 /**
  * @covers WindowsAzure\Common\Internal\Utilities::unserialize
  * @covers WindowsAzure\Common\Internal\Utilities::_sxml2arr
  */
 public function testUnserialize()
 {
     // Setup
     $propertiesSample = TestResources::getServicePropertiesSample();
     $properties = ServiceProperties::create($propertiesSample);
     $xmlSerializer = new XmlSerializer();
     $xml = $properties->toXml($xmlSerializer);
     $expected = $properties->toArray();
     // Test
     $actual = Utilities::unserialize($xml);
     $this->assertEquals($expected, $actual);
 }
 /**
  * @covers WindowsAzure\Blob\Models\ContainerAcl::toXml
  * @covers WindowsAzure\Blob\Models\ContainerAcl::toArray
  * @depends testCreateMultipleEntries
  */
 public function testToXml($acl)
 {
     // Setup
     $sample = TestResources::getContainerAclMultipleEntriesSample();
     $expected = ContainerAcl::create('container', $sample['SignedIdentifiers']);
     $xmlSerializer = new XmlSerializer();
     // Test
     $xml = $acl->toXml($xmlSerializer);
     // Assert
     $array = Utilities::unserialize($xml);
     $acl = ContainerAcl::create('container', $array);
     $this->assertEquals($expected->getSignedIdentifiers(), $acl->getSignedIdentifiers());
 }
 /**
  * @covers WindowsAzure\Common\Models\ServiceProperties::toXml
  */
 public function testToXml()
 {
     // Setup
     $properties = ServiceProperties::create(TestResources::getServicePropertiesSample());
     $xmlSerializer = new XmlSerializer();
     // Test
     $actual = $properties->toXml($xmlSerializer);
     // Assert
     $actualParsed = Utilities::unserialize($actual);
     $actualProperties = GetServicePropertiesResult::create($actualParsed);
     $this->assertEquals($actualProperties->getValue(), $properties);
 }