/** 
  * @covers WindowsAzure\ServiceBus\Models\BrokerProperties::getLockedUntilUtc
  * @covers WindowsAzure\ServiceBus\Models\BrokerProperties::setLockedUntilUtc
  */
 public function testGetSetLockedUntilUtc()
 {
     // Setup
     $expected = 'testLockedUntilUtc';
     $brokerProperties = new BrokerProperties();
     // Test
     $brokerProperties->setLockedUntilUtc($expected);
     $actual = $brokerProperties->getLockedUntilUtc();
     // Assert
     $this->assertEquals($expected, $actual);
 }
Example #2
0
 /**
  * Creates a broker properties instance with specified JSON message.  
  *
  * @param string $brokerPropertiesJson A JSON message representing a 
  * broker properties.
  * 
  * @return none
  */
 public static function create($brokerPropertiesJson)
 {
     Validate::isString($brokerPropertiesJson, 'brokerPropertiesJson');
     $brokerProperties = new BrokerProperties();
     $brokerPropertiesArray = (array) json_decode($brokerPropertiesJson);
     if (array_key_exists('CorrelationId', $brokerPropertiesArray)) {
         $brokerProperties->setCorrelationId($brokerPropertiesArray['CorrelationId']);
     }
     if (array_key_exists('SessionId', $brokerPropertiesArray)) {
         $brokerProperties->setSessionId($brokerPropertiesArray['SessionId']);
     }
     if (array_key_exists('DeliveryCount', $brokerPropertiesArray)) {
         $brokerProperties->setDeliveryCount($brokerPropertiesArray['DeliveryCount']);
     }
     if (array_key_exists('LockedUntilUtc', $brokerPropertiesArray)) {
         $brokerProperties->setLockedUntilUtc(\DateTime::createFromFormat(Resources::AZURE_DATE_FORMAT, $brokerPropertiesArray['LockedUntilUtc']));
     }
     if (array_key_exists('LockToken', $brokerPropertiesArray)) {
         $brokerProperties->setLockToken($brokerPropertiesArray['LockToken']);
     }
     if (array_key_exists('MessageId', $brokerPropertiesArray)) {
         $brokerProperties->setMessageId($brokerPropertiesArray['MessageId']);
     }
     if (array_key_exists('Label', $brokerPropertiesArray)) {
         $brokerProperties->setLabel($brokerPropertiesArray['Label']);
     }
     if (array_key_exists('ReplyTo', $brokerPropertiesArray)) {
         $brokerProperties->setReplyTo($brokerPropertiesArray['ReplyTo']);
     }
     if (array_key_exists('SequenceNumber', $brokerPropertiesArray)) {
         $brokerProperties->setSequenceNumber($brokerPropertiesArray['SequenceNumber']);
     }
     if (array_key_exists('TimeToLive', $brokerPropertiesArray)) {
         $brokerProperties->setTimeToLive(doubleval($brokerPropertiesArray['TimeToLive']));
     }
     if (array_key_exists('To', $brokerPropertiesArray)) {
         $brokerProperties->setTo($brokerPropertiesArray['To']);
     }
     if (array_key_exists('ScheduledEnqueueTimeUtc', $brokerPropertiesArray)) {
         $brokerProperties->setScheduledEnqueueTimeUtc(\DateTime::createFromFormat(Resources::AZURE_DATE_FORMAT, $brokerPropertiesArray['ScheduledEnqueueTimeUtc']));
     }
     if (array_key_exists('ReplyToSessionId', $brokerPropertiesArray)) {
         $brokerProperties->setReplyToSessionId($brokerPropertiesArray['ReplyToSessionId']);
     }
     if (array_key_exists('MessageLocation', $brokerPropertiesArray)) {
         $brokerProperties->setMessageLocation($brokerPropertiesArray['MessageLocation']);
     }
     if (array_key_exists('LockLocation', $brokerPropertiesArray)) {
         $brokerProperties->setLockLocation($brokerPropertiesArray['LockLocation']);
     }
     return $brokerProperties;
 }
 /**
  * Sets the time of locked until UTC. 
  * 
  * @param string $lockedUntilUtc The time of locked until UTC.
  * 
  * @return none
  */
 public function setLockedUntilUtc($lockedUntilUtc)
 {
     $this->_brokerProperties->setLockedUntilUtc($lockedUntilUtc);
 }
 private function createIssueMessage($issueId, $issueBody, $label, $messageLocation)
 {
     $message = new BrokeredMessage($issueBody);
     $bp = new BrokerProperties();
     $bp->setLabel($label);
     //        $bp->setMessageLocation($messageLocation);
     $bp->setReplyTo('*****@*****.**');
     $bp->setMessageId($issueId);
     $bp->setCorrelationId('correlationid' + $label);
     $bp->setDeliveryCount(1);
     $bp->setLockedUntilUtc(new \DateTime('2/4/1984'));
     $bp->setLockLocation($label + 'locallocation');
     $bp->setLockToken($label + 'locltoken');
     $bp->setSequenceNumber(12);
     $message->setBrokerProperties($bp);
     $message->setContentType('text/xml');
     $message->setLabel($label);
     $message->setReplyTo('*****@*****.**');
     $message->setMessageId($issueId);
     $customProperties = $this->getCustomProperties(1);
     foreach ($customProperties as $key => $value) {
         $message->setProperty($key, $value);
     }
     return $message;
 }