/**
  * @covers WindowsAzure\ServiceBus\ServiceBusRestProxy::createQueue
  */
 public function testCreateQueueWorks()
 {
     // Act
     $queue = null;
     $queue = new QueueInfo('TestCreateQueueWorks');
     $queueDescription = new QueueDescription();
     $queueDescription->setMaxSizeInMegabytes(1024);
     $queue->setQueueDescription($queueDescription);
     $saved = $this->restProxy->createQueue($queue);
     // Assert
     $this->assertNotNull($saved, '$saved');
     $this->assertNotSame($queue, $saved, 'queue and saved');
     $this->assertEquals('TestCreateQueueWorks', $saved->getTitle(), '$saved->getTitle()');
 }
示例#2
0
 /**
  * Sets the message count.
  *
  * @param string $messageCount The count of the message.
  * 
  * @return none
  */
 public function setMessageCount($messageCount)
 {
     $this->_queueDescription->setMessageCount($messageCount);
 }
示例#3
0
 /**
  * Creates a queue description object with specified XML string.
  *
  * @param string $queueDescriptionXml A XML based string describing
  * the queue. 
  * 
  * @return none
  */
 public static function create($queueDescriptionXml)
 {
     $queueDescription = new QueueDescription();
     $root = simplexml_load_string($queueDescriptionXml);
     $queueDescriptionArray = (array) $root;
     if (array_key_exists('LockDuration', $queueDescriptionArray)) {
         $queueDescription->setLockDuration((string) $queueDescriptionArray['LockDuration']);
     }
     if (array_key_exists('MaxSizeInMegabytes', $queueDescriptionArray)) {
         $queueDescription->setMaxSizeInMegabytes((int) $queueDescriptionArray['MaxSizeInMegabytes']);
     }
     if (array_key_exists('RequiresDuplicateDetection', $queueDescriptionArray)) {
         $queueDescription->setRequiresDuplicateDetection((bool) $queueDescriptionArray['RequiresDuplicateDetection']);
     }
     if (array_key_exists('RequiresSession', $queueDescriptionArray)) {
         $queueDescription->setRequiresSession((bool) $queueDescriptionArray['RequiresSession']);
     }
     if (array_key_exists('DefaultMessageTimeToLive', $queueDescriptionArray)) {
         $queueDescription->setDefaultMessageTimeToLive((string) $queueDescriptionArray['DefaultMessageTimeToLive']);
     }
     if (array_key_exists('DeadLetteringOnMessageExpiration', $queueDescriptionArray)) {
         $queueDescription->setDeadLetteringOnMessageExpiration((string) $queueDescriptionArray['DeadLetteringOnMessageExpiration']);
     }
     if (array_key_exists('DuplicateDetectionHistoryTimeWindow', $queueDescriptionArray)) {
         $queueDescription->setDuplicateDetectionHistoryTimeWindow((string) $queueDescriptionArray['DuplicateDetectionHistoryTimeWindow']);
     }
     if (array_key_exists('MaxDeliveryCount', $queueDescriptionArray)) {
         $queueDescription->setMaxDeliveryCount((int) $queueDescriptionArray['MaxDeliveryCount']);
     }
     if (array_key_exists('EnableBatchedOperations', $queueDescriptionArray)) {
         $queueDescription->setEnableBatchedOperations((bool) $queueDescriptionArray['EnableBatchedOperations']);
     }
     if (array_key_exists('SizeInBytes', $queueDescriptionArray)) {
         $queueDescription->setSizeInBytes((int) $queueDescriptionArray['SizeInBytes']);
     }
     if (array_key_exists('MessageCount', $queueDescriptionArray)) {
         $queueDescription->setMessageCount((int) $queueDescriptionArray['MessageCount']);
     }
     return $queueDescription;
 }
 /** 
  * @covers WindowsAzure\ServiceBus\Models\QueueDescription::getMessageCount
  * @covers WindowsAzure\ServiceBus\Models\QueueDescription::setMessageCount
  */
 public function testGetSetMessageCount()
 {
     // Setup
     $expected = 'testMessageCount';
     $queueDescription = new QueueDescription();
     // Test
     $queueDescription->setMessageCount($expected);
     $actual = $queueDescription->getMessageCount();
     // Assert
     $this->assertEquals($expected, $actual);
 }