コード例 #1
0
 /**
  * @covers WindowsAzure\Queue\QueueRestProxy::listQueues
  */
 public function testListQueuesWithInvalidNextMarkerFail()
 {
     $this->skipIfEmulated();
     // Setup
     $queue1 = 'listqueueswithinvalidnextmarker1';
     $queue2 = 'listqueueswithinvalidnextmarker2';
     $queue3 = 'listqueueswithinvalidnextmarker3';
     parent::createQueue($queue1);
     parent::createQueue($queue2);
     parent::createQueue($queue3);
     $options = new ListQueuesOptions();
     $options->setMaxResults(2);
     $this->setExpectedException(get_class(new ServiceException('409')));
     // Test
     $this->restProxy->listQueues($options);
     $options->setMarker('wrong marker');
     $this->restProxy->listQueues($options);
 }
コード例 #2
0
 public static function getInterestingListQueuesOptions()
 {
     $ret = array();
     $options = new ListQueuesOptions();
     array_push($ret, $options);
     $options = new ListQueuesOptions();
     $options->setMaxResults(2);
     $options->setMaxResults('2');
     array_push($ret, $options);
     $options = new ListQueuesOptions();
     $options->setTimeout(10);
     array_push($ret, $options);
     $options = new ListQueuesOptions();
     $options->setTimeout(-10);
     array_push($ret, $options);
     $options = new ListQueuesOptions();
     $options->setPrefix(self::$nonExistQueuePrefix);
     array_push($ret, $options);
     $options = new ListQueuesOptions();
     $options->setPrefix(self::$testUniqueId);
     array_push($ret, $options);
     $options = new ListQueuesOptions();
     // Cannot set Marker to arbitrary values. Must only use if the previous request returns a NextMarker.
     //            $options->setMarker('abc');
     // So, add logic in listQueuesWorker to loop and setMarker if there is a NextMarker.
     $options->setMaxResults(2);
     $options->setPrefix(self::$testUniqueId);
     $options->setTimeout(10);
     array_push($ret, $options);
     $options = new ListQueuesOptions();
     $options->setMaxResults(3);
     $options->setPrefix(self::$testUniqueId);
     $options->setTimeout(10);
     array_push($ret, $options);
     $options = new ListQueuesOptions();
     $options->setMaxResults(4);
     $options->setPrefix(self::$testUniqueId);
     $options->setTimeout(10);
     array_push($ret, $options);
     return $ret;
 }
コード例 #3
0
 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');
 }
コード例 #4
0
 /**
  * @covers WindowsAzure\Queue\Models\ListQueuesOptions::getMaxResults
  */
 public function testGetMaxResults()
 {
     // Setup
     $options = new ListQueuesOptions();
     $expected = '3';
     $options->setMaxResults($expected);
     // Test
     $actual = $options->getMaxResults();
     // Assert
     $this->assertEquals($expected, $actual);
 }
コード例 #5
0
 /**
  * @covers WindowsAzure\Queue\QueueRestProxy::listQueues
  */
 public function testListQueuesWithOptionsWorks()
 {
     // Arrange
     // Act
     $opts = new ListQueuesOptions();
     $opts->setMaxResults(3);
     $opts->setIncludeMetadata(true);
     $opts->setPrefix(self::$testQueuesPrefix);
     $result = $this->restProxy->listQueues($opts);
     $opts = new ListQueuesOptions();
     $opts->setMarker($result->getNextMarker());
     $opts->setIncludeMetadata(false);
     $opts->setPrefix(self::$testQueuesPrefix);
     $result2 = $this->restProxy->listQueues($opts);
     // Assert
     $this->assertNotNull($result, '$result');
     $this->assertNotNull($result->getQueues(), '$result->getQueues');
     $this->assertEquals(3, count($result->getQueues()), 'count($result->getQueues');
     $this->assertEquals(3, $result->getMaxResults(), '$result->getMaxResults');
     // TODO: Uncomment when the following issue is fixed:
     // https://github.com/WindowsAzure/azure-sdk-for-php/issues/98
     // $this->assertNotNull($result->getAccountName(), '$result->getAccountName()');
     $this->assertNull($result->getMarker(), '$result->getMarker');
     $queue0 = $result->getQueues();
     $queue0 = $queue0[0];
     $this->assertNotNull($queue0, '$queue0');
     $this->assertNotNull($queue0->getMetadata(), '$queue0->getMetadata' . ' (https://github.com/WindowsAzure/azure-sdk-for-php/issues/252)');
     $this->assertNotNull($queue0->getName(), '$queue0->getName');
     $this->assertNotNull($queue0->getUrl(), '$queue0->getUrl');
     $this->assertNotNull($result2, '$result2');
     $this->assertNotNull($result2->getQueues(), '$result2->getQueues');
     $this->assertTrue(count(self::$testQueues) - 3 <= count($result2->getQueues()), 'count');
     $this->assertEquals(0, $result2->getMaxResults(), '$result2->getMaxResults');
     // TODO: Uncomment when the following issue is fixed:
     // https://github.com/WindowsAzure/azure-sdk-for-php/issues/98
     // $this->assertNotNull($result2->getAccountName(), '$result2->getAccountName()');
     $this->assertEquals($result->getNextMarker(), $result2->getMarker(), '$result2->getMarker');
     $queue20 = $result2->getQueues();
     $queue20 = $queue20[0];
     $this->assertNotNull($queue20, '$queue20');
     $this->assertNotNull($queue20->getMetadata(), '$queue20->getMetadata');
     $this->assertEquals(0, count($queue20->getMetadata()), 'count($queue20->getMetadata)');
     $this->assertNotNull($queue20->getName(), '$queue20->getName');
     $this->assertNotNull($queue20->getUrl(), '$queue20->getUrl');
 }
コード例 #6
0
 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');
 }
コード例 #7
0
 public static function getInterestingListQueuesOptions()
 {
     $ret = array();
     $options = new ListQueuesOptions();
     array_push($ret, $options);
     $options = new ListQueuesOptions();
     // TODO: Revert when fixed
     // https://github.com/WindowsAzure/azure-sdk-for-php/issues/69
     // $options->setMaxResults(2);
     $options->setMaxResults('2');
     array_push($ret, $options);
     $options = new ListQueuesOptions();
     // TODO: Revert when fixed
     // https://github.com/WindowsAzure/azure-sdk-for-php/issues/69
     //        $options->setTimeout(10);
     $options->setTimeout('10');
     array_push($ret, $options);
     $options = new ListQueuesOptions();
     // TODO: Revert when fixed
     // https://github.com/WindowsAzure/azure-sdk-for-php/issues/69
     //        $options->setTimeout(-10);
     $options->setTimeout('-10');
     array_push($ret, $options);
     $options = new ListQueuesOptions();
     $options->setPrefix(self::$nonExistQueuePrefix);
     array_push($ret, $options);
     $options = new ListQueuesOptions();
     $options->setPrefix(self::$testUniqueId);
     array_push($ret, $options);
     $options = new ListQueuesOptions();
     // Cannot set Marker to arbitrary values. Must only use if the previous request returns a NextMarker.
     //            $options->setMarker('abc');
     // So, add logic in listQueuesWorker to loop and setMarker if there is a NextMarker.
     // TODO: Revert when fixed
     // https://github.com/WindowsAzure/azure-sdk-for-php/issues/69
     //        $options->setMaxResults(2);
     $options->setMaxResults('2');
     $options->setPrefix(self::$testUniqueId);
     // TODO: Revert when fixed
     // https://github.com/WindowsAzure/azure-sdk-for-php/issues/69
     //        $options->setTimeout(10);
     $options->setTimeout('10');
     array_push($ret, $options);
     $options = new ListQueuesOptions();
     // TODO: Revert when fixed
     // https://github.com/WindowsAzure/azure-sdk-for-php/issues/69
     //        $options->setMaxResults(3);
     $options->setMaxResults('3');
     $options->setPrefix(self::$testUniqueId);
     // TODO: Revert when fixed
     // https://github.com/WindowsAzure/azure-sdk-for-php/issues/69
     //        $options->setTimeout(10);
     $options->setTimeout('10');
     array_push($ret, $options);
     $options = new ListQueuesOptions();
     // TODO: Revert when fixed
     // https://github.com/WindowsAzure/azure-sdk-for-php/issues/69
     //        $options->setMaxResults(4);
     $options->setMaxResults('4');
     $options->setPrefix(self::$testUniqueId);
     // TODO: Revert when fixed
     // https://github.com/WindowsAzure/azure-sdk-for-php/issues/69
     //        $options->setTimeout(10);
     $options->setTimeout('10');
     array_push($ret, $options);
     return $ret;
 }