public function setUp()
 {
     $config = new Config([]);
     $config->addQueueConfig('test-queue', ['workers_per_server' => 5]);
     $this->message_bank_factory = new MessageBankFactory();
     $this->message_bank_factory->setConfig($config);
 }
Beispiel #2
0
 public function setUp()
 {
     parent::setUp();
     $config = new Config([]);
     $config->addQueueConfig('some-queue-name', []);
     $this->adapter_factory = new Factory($config);
     $this->producer = new Producer($this->adapter_factory);
 }
Beispiel #3
0
 /**
  * @param array $queues
  * @param array $config_overrides
  * @return Config
  */
 public function getConfigAdapter(array $queues, array $config_overrides = [])
 {
     $config = new Config([]);
     foreach ($queues as $queue_key => $queue_config) {
         $config->addQueueConfig($queue_key, array_merge($queue_config, $config_overrides));
     }
     return $config;
 }
Beispiel #4
0
 /**
  * @param string $queue_key
  * @param Config $config
  * @return MessageBank
  */
 private function getMessageBank($queue_key, Config $config)
 {
     if (!empty($this->message_banks[$queue_key])) {
         return $this->message_banks[$queue_key];
     }
     $this->message_banks[$queue_key] = new MessageBank($config->getQueueConfig($queue_key));
     return $this->message_banks[$queue_key];
 }
Beispiel #5
0
 public function setUp()
 {
     parent::setUp();
     $config = new TestingConfig([]);
     $config->addQueueConfig('bufferer-default', ['bufferers_per_server' => 5]);
     $this->test_util = new TestingQueueProvisioner($config);
     $this->buffer_queue_factory = $this->test_util->getBufferQueueFactory();
     $this->buffer_queue = $this->buffer_queue_factory->getQueue('default');
 }
Beispiel #6
0
 public function setUp()
 {
     parent::setUp();
     $config = new TestingConfig([]);
     $config->addQueueConfig('worker-default-worker', ['workers_per_server' => 5]);
     $test_util = new TestingQueueProvisioner($config);
     $this->database = $test_util->getDatabase();
     $this->superqueue = $test_util->getSuperqueue();
     $this->message_bank = $test_util->getMessageBank('worker-default-worker');
 }
Beispiel #7
0
 public function setUp()
 {
     parent::setUp();
     $config = new Config([]);
     $config->addQueueConfig('some-queue-name', []);
     $config->addQueueConfig('multi-message-queue-name', ['max_messages_per_consume' => 5]);
     $config->addQueueConfig('limited-time-queue', ['max_time_per_consume' => 1, 'max_messages_per_consume' => 5]);
     $this->message_bank_factory = new MessageBankFactory();
     $this->adapter_factory = new Factory($config, $this->message_bank_factory);
     $this->consumer = new Consumer($this->adapter_factory);
 }
Beispiel #8
0
 public function setUp()
 {
     parent::setUp();
     $config = new TestingConfig([]);
     $config->addQueueConfig('worker-default-worker', ['workers_per_server' => 5]);
     $test_util = new TestingQueueProvisioner($config);
     $this->message_bank = $test_util->getMessageBank('worker-default-worker');
     $this->consumer = $test_util->getConsumerQueue('worker-default-worker');
     $this->database = $test_util->getDatabase();
     $this->worker_queue_factory = $test_util->getWorkerQueueFactory();
     $this->worker_queue = $this->worker_queue_factory->getQueue('default-worker');
 }
Beispiel #9
0
 /**
  * @covers ::addQueueConfig
  * @covers ::getQueueConfig
  * @dataProvider queueConfigProvider
  * @param string $queue_key
  * @param array $queue_config
  */
 public function testAddedQueueConfigCanBeRetrieved($queue_key, array $queue_config)
 {
     $config = new Config($this->getAdapterFactoryConfig());
     $config->addQueueConfig($queue_key, $queue_config);
     $this->assertEquals($queue_config, $config->getQueueConfig($queue_key));
 }