コード例 #1
0
 /**
  * @covers WindowsAzure\ServiceBus\ServiceBusRestProxy::createQueue
  * @covers WindowsAzure\ServiceBus\ServiceBusRestProxy::deleteQueue
  * @covers WindowsAzure\ServiceBus\ServiceBusRestProxy::getQueue
  * @covers WindowsAzure\ServiceBus\ServiceBusRestProxy::listQueues
  */
 private function setupQueue()
 {
     $options = new ListQueuesOptions();
     $options->setSkip(20);
     $options->setTop(2);
     $queues = $this->restProxy->listQueues($options)->getQueueInfos();
     foreach ($queues as $queue) {
         self::write('Queue name is ' . $queue->getTitle());
     }
     self::write('checking if queue already exists ' . $this->queueName);
     try {
         $this->restProxy->getQueue($this->queueName);
         self::write('Queue already exists deleting it');
         $this->restProxy->deleteQueue($this->queueName);
     } catch (\Exception $e) {
         self::write('could not get an existing queue (' . $e->getCode() . '), proceeding...');
     }
     $q = new QueueInfo($this->queueName);
     $q->setEnableBatchedOperations(true);
     $q->setMaxDeliveryCount(10);
     $q->setMaxSizeInMegabytes(1024);
     $q->setRequiresDuplicateDetection(true);
     self::write('Creating queue ' . $this->queueName);
     $this->restProxy->createQueue($q);
     $this->restProxy->getQueue($this->queueName);
 }
コード例 #2
0
ファイル: ListQueuesResult.php プロジェクト: mat33470/PFA
 /** 
  * Populates the properties with the response from the list queues request.
  * 
  * @param string $response The body of the response of the list queues request. 
  * 
  * @return none
  */
 public function parseXml($response)
 {
     parent::parseXml($response);
     $listQueuesResultXml = new \SimpleXMLElement($response);
     $this->_queueInfos = array();
     foreach ($listQueuesResultXml->entry as $entry) {
         $queueInfo = new QueueInfo();
         $queueInfo->parseXml($entry->asXml());
         $this->_queueInfos[] = $queueInfo;
     }
 }
コード例 #3
0
 /**
  * @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()');
 }
コード例 #4
0
 /**
  * Gets a queue with specified path. 
  *
  * @link http://msdn.microsoft.com/en-us/library/windowsazure/hh780764
  * 
  * @param string $queuePath The path of the queue.
  *
  * @return QueueInfo
  */
 public function getQueue($queuePath)
 {
     $httpCallContext = new HttpCallContext();
     $httpCallContext->setPath($queuePath);
     $httpCallContext->setMethod(Resources::HTTP_GET);
     $httpCallContext->addStatusCode(Resources::STATUS_OK);
     $response = $this->sendContext($httpCallContext);
     $queueInfo = new QueueInfo();
     $queueInfo->parseXml($response->getBody());
     return $queueInfo;
 }
コード例 #5
0
 /** 
  * @covers WindowsAzure\ServiceBus\Models\QueueInfo::getMessageCount
  * @covers WindowsAzure\ServiceBus\Models\QueueInfo::setMessageCount
  */
 public function testGetSetMessageCount()
 {
     // Setup
     $expected = 'testMessageCount';
     $queueInfo = new QueueInfo();
     // Test
     $queueInfo->setMessageCount($expected);
     $actual = $queueInfo->getMessageCount();
     // Assert
     $this->assertEquals($expected, $actual);
 }