コード例 #1
0
 private function doOneTimeSetup()
 {
     QueueServiceFunctionalTestData::setupData();
     foreach (QueueServiceFunctionalTestData::$testQueueNames as $name) {
         $this->safeDeleteQueue($name);
     }
     foreach (QueueServiceFunctionalTestData::$testQueueNames as $name) {
         self::println('Creating queue: ' . $name);
         $this->restProxy->createQueue($name);
     }
 }
コード例 #2
0
 public static function tearDownAfterClass()
 {
     parent::tearDownAfterClass();
     $service = self::createService();
     if (!Configuration::isEmulated()) {
         $serviceProperties = QueueServiceFunctionalTestData::getDefaultServiceProperties();
         $service->setServiceProperties($serviceProperties);
     }
     foreach (QueueServiceFunctionalTestData::$TEST_QUEUE_NAMES as $name) {
         self::staticSafeDeleteQueue($service, $name);
     }
 }
コード例 #3
0
 public static function tearDownAfterClass()
 {
     if (self::$isOneTimeSetup) {
         $integrationTestBase = new IntegrationTestBase();
         $integrationTestBase->setUp();
         if (!$integrationTestBase->isEmulated()) {
             $serviceProperties = QueueServiceFunctionalTestData::getDefaultServiceProperties();
             $integrationTestBase->restProxy->setServiceProperties($serviceProperties);
         }
         self::$isOneTimeSetup = false;
     }
     parent::tearDownAfterClass();
 }
コード例 #4
0
 /**
  * @covers WindowsAzure\ServiceBus\ServiceBusRestProxy::clearMessages
  * @covers WindowsAzure\ServiceBus\ServiceBusRestProxy::createMessage
  * @covers WindowsAzure\ServiceBus\ServiceBusRestProxy::listMessages
  */
 private function clearMessagesWorker($options)
 {
     self::println('Trying $options: ' . self::tmptostring($options));
     $queue = QueueServiceFunctionalTestData::$testQueueNames;
     $queue = $queue[0];
     $this->restProxy->clearMessages($queue);
     // Put three messages into the queue.
     $this->restProxy->createMessage($queue, QueueServiceFunctionalTestData::getSimpleMessageText());
     $this->restProxy->createMessage($queue, QueueServiceFunctionalTestData::getSimpleMessageText());
     $this->restProxy->createMessage($queue, QueueServiceFunctionalTestData::getSimpleMessageText());
     // Wait a bit to make sure the messages are there.
     sleep(1);
     // Make sure the messages are there, and use a short visibility timeout to make sure the are visible again later.
     $opts = new ListMessagesOptions();
     $opts->setVisibilityTimeoutInSeconds(1);
     $opts->setNumberOfMessages(32);
     $lmr = $this->restProxy->listMessages($queue, $opts);
     $this->assertEquals(3, count($lmr->getQueueMessages()), 'getQueueMessages() count');
     sleep(2);
     try {
         if (is_null($options)) {
             $this->restProxy->clearMessages($queue);
         } else {
             $this->restProxy->clearMessages($queue, $options);
         }
         if (is_null($options)) {
             $options = new CreateMessageOptions();
         } else {
             if (!is_null($options->getTimeout()) && $options->getTimeout() < 1) {
                 $this->assertTrue(false, 'Expect negative timeouts in $options to throw');
             }
         }
         // Wait 2 seconds to make sure the messages would be visible again.
         $opts = new ListMessagesOptions();
         $opts->setVisibilityTimeoutInSeconds(1);
         $opts->setNumberOfMessages(32);
         $lmr = $this->restProxy->listMessages($queue, $opts);
         $this->assertEquals(0, count($lmr->getQueueMessages()), 'getQueueMessages() count');
     } catch (ServiceException $e) {
         if (is_null($options)) {
             $options = new CreateMessageOptions();
         }
         if (!is_null($options->getTimeout()) && $options->getTimeout() < 1) {
             $this->assertEquals(TestResources::STATUS_INTERNAL_SERVER_ERROR, $e->getCode(), 'getCode');
         } else {
             throw $e;
         }
     }
     $this->restProxy->clearMessages($queue);
 }
 /**
  * @covers WindowsAzure\Queue\QueueRestProxy::clearMessages
  * @covers WindowsAzure\Queue\QueueRestProxy::createMessage
  */
 public function testCreateMessageOptionsNull()
 {
     $queue = QueueServiceFunctionalTestData::$testQueueNames[0];
     $this->restProxy->createMessage($queue, QueueServiceFunctionalTestData::getSimpleMessageText(), null);
     $this->restProxy->clearMessages($queue);
     $this->assertTrue(true, 'Should just work');
 }