예제 #1
0
 /**
  * Lists all queues in the storage account.
  * 
  * @param ListQueuesOptions $options The optional list queue options.
  * 
  * @return WindowsAzure\Queue\Models\ListQueuesResult
  */
 public function listQueues($options = null)
 {
     $method = Resources::HTTP_GET;
     $headers = array();
     $postParams = array();
     $queryParams = array();
     $path = Resources::EMPTY_STRING;
     $statusCode = Resources::STATUS_OK;
     if (is_null($options)) {
         $options = new ListQueuesOptions();
     }
     $timeout = $options->getTimeout();
     $maxResults = $options->getMaxResults();
     $include = $options->getIncludeMetadata();
     $include = $include ? 'metadata' : null;
     $prefix = $options->getPrefix();
     $marker = $options->getMarker();
     $this->addOptionalQueryParam($queryParams, Resources::QP_TIMEOUT, $timeout);
     $this->addOptionalQueryParam($queryParams, Resources::QP_COMP, 'list');
     $this->addOptionalQueryParam($queryParams, Resources::QP_PREFIX, $prefix);
     $this->addOptionalQueryParam($queryParams, Resources::QP_MARKER, $marker);
     $this->addOptionalQueryParam($queryParams, Resources::QP_INCLUDE, $include);
     $this->addOptionalQueryParam($queryParams, Resources::QP_MAX_RESULTS, $maxResults);
     $response = $this->send($method, $headers, $queryParams, $postParams, $path, $statusCode);
     $parsed = $this->dataSerializer->unserialize($response->getBody());
     return ListQueuesResult::create($parsed);
 }
 /**
  * @covers WindowsAzure\ServiceBus\ServiceBusRestProxy::listQueues
  */
 private function listQueuesWorker($options)
 {
     $finished = false;
     while (!$finished) {
         try {
             $ret = is_null($options) ? $this->restProxy->listQueues() : $this->restProxy->listQueues($options);
             if (is_null($options)) {
                 $options = new ListQueuesOptions();
             }
             if (!is_null($options->getTimeout()) && $options->getTimeout() < 1) {
                 $this->assertTrue(false, 'Expect negative timeouts ' . $options->getTimeout() . ' in $options to throw');
             }
             $this->verifyListQueuesWorker($ret, $options);
             if (strlen($ret->getNextMarker()) == 0) {
                 self::println('Done with this loop');
                 $finished = true;
             } else {
                 self::println('Cycling to get the next marker: ' . $ret->getNextMarker());
                 $options->setMarker($ret->getNextMarker());
             }
         } catch (ServiceException $e) {
             $finished = true;
             if (!is_null($options->getTimeout()) && $options->getTimeout() < 1) {
                 $this->assertEquals(TestResources::STATUS_INTERNAL_SERVER_ERROR, $e->getCode(), 'getCode');
             } else {
                 throw $e;
             }
         }
     }
 }
 public function testCheckListQueuesOptions()
 {
     $options = new ListQueuesOptions();
     $this->assertNull($options->getIncludeMetadata(), 'Default ListQueuesOptions->getIncludeMetadata');
     $this->assertNull($options->getMarker(), 'Default ListQueuesOptions->getMarker');
     $this->assertEquals(0, $options->getMaxResults(), 'Default ListQueuesOptions->getMaxResults');
     $this->assertNull($options->getPrefix(), 'Default ListQueuesOptions->getPrefix');
     $this->assertNull($options->getTimeout(), 'Default ListQueuesOptions->getTimeout');
     $options->setIncludeMetadata(true);
     $options->setMarker('foo');
     $options->setMaxResults(-10);
     $options->setPrefix('bar');
     $options->setTimeout(self::INT_MAX_VALUE);
     $this->assertTrue($options->getIncludeMetadata(), 'Set ListQueuesOptions->getIncludeMetadata');
     $this->assertEquals('foo', $options->getMarker(), 'Set ListQueuesOptions->getMarker');
     $this->assertEquals(-10, $options->getMaxResults(), 'Set ListQueuesOptions->getMaxResults');
     $this->assertEquals('bar', $options->getPrefix(), 'Set ListQueuesOptions->getPrefix');
     $this->assertEquals(self::INT_MAX_VALUE, $options->getTimeout(), 'Set ListQueuesOptions->getTimeout');
 }
 public function testCheckListQueuesOptions()
 {
     $options = new ListQueuesOptions();
     $this->assertNull($options->getIncludeMetadata(), 'Default ListQueuesOptions->getIncludeMetadata');
     $this->assertNull($options->getMarker(), 'Default ListQueuesOptions->getMarker');
     $this->assertEquals(0, $options->getMaxResults(), 'Default ListQueuesOptions->getMaxResults');
     $this->assertNull($options->getPrefix(), 'Default ListQueuesOptions->getPrefix');
     $this->assertNull($options->getTimeout(), 'Default ListQueuesOptions->getTimeout');
     $options->setIncludeMetadata(true);
     $options->setMarker('foo');
     // TODO: Revert this change when fixed
     // https://github.com/WindowsAzure/azure-sdk-for-php/issues/69
     // $options->setMaxResults(-10);
     $options->setMaxResults('-10');
     $options->setPrefix('bar');
     $options->setTimeout(self::IntegerMAX_VALUE);
     $this->assertTrue($options->getIncludeMetadata(), 'Set ListQueuesOptions->getIncludeMetadata');
     $this->assertEquals('foo', $options->getMarker(), 'Set ListQueuesOptions->getMarker');
     $this->assertEquals(-10, $options->getMaxResults(), 'Set ListQueuesOptions->getMaxResults');
     $this->assertEquals('bar', $options->getPrefix(), 'Set ListQueuesOptions->getPrefix');
     $this->assertEquals(self::IntegerMAX_VALUE, $options->getTimeout(), 'Set ListQueuesOptions->getTimeout');
 }