Skip to content

Commit 6d8fed2

Browse files
committed
amqp interop client
1 parent 497c75b commit 6d8fed2

8 files changed

Lines changed: 62 additions & 63 deletions

File tree

‎pkg/amqp-ext/Symfony/AmqpTransportFactory.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Enqueue\AmqpExt\AmqpConnectionFactory;
66
use Enqueue\AmqpExt\AmqpContext;
7-
use Enqueue\AmqpExt\Client\AmqpDriver;
7+
use Enqueue\Client\Amqp\AmqpDriver;
88
use Enqueue\Symfony\DriverFactoryInterface;
99
use Enqueue\Symfony\TransportFactoryInterface;
1010
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

‎pkg/amqp-ext/Symfony/RabbitMqAmqpTransportFactory.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Enqueue\AmqpExt\Symfony;
44

5-
use Enqueue\AmqpExt\Client\RabbitMqDriver;
5+
use Enqueue\Client\Amqp\RabbitMqDriver;
66
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
77
use Symfony\Component\DependencyInjection\ContainerBuilder;
88
use Symfony\Component\DependencyInjection\Definition;

‎pkg/amqp-ext/Tests/Symfony/AmqpTransportFactoryTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
namespace Enqueue\AmqpExt\Tests\Symfony;
44

55
use Enqueue\AmqpExt\AmqpConnectionFactory;
6-
use Enqueue\AmqpExt\Client\AmqpDriver;
76
use Enqueue\AmqpExt\Symfony\AmqpTransportFactory;
7+
use Enqueue\Client\Amqp\AmqpDriver;
88
use Enqueue\Symfony\TransportFactoryInterface;
99
use Enqueue\Test\ClassExtensionTrait;
1010
use PHPUnit\Framework\TestCase;

‎pkg/amqp-ext/Tests/Symfony/RabbitMqAmqpTransportFactoryTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
namespace Enqueue\AmqpExt\Tests\Symfony;
44

55
use Enqueue\AmqpExt\AmqpConnectionFactory;
6-
use Enqueue\AmqpExt\Client\RabbitMqDriver;
76
use Enqueue\AmqpExt\Symfony\AmqpTransportFactory;
87
use Enqueue\AmqpExt\Symfony\RabbitMqAmqpTransportFactory;
8+
use Enqueue\Client\Amqp\RabbitMqDriver;
99
use Enqueue\Symfony\TransportFactoryInterface;
1010
use Enqueue\Test\ClassExtensionTrait;
1111
use PHPUnit\Framework\TestCase;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?php
22

3-
namespace Enqueue\AmqpExt\Client;
3+
namespace Enqueue\Client\Amqp;
44

5-
use Enqueue\AmqpExt\AmqpContext;
65
use Enqueue\Client\Config;
76
use Enqueue\Client\DriverInterface;
87
use Enqueue\Client\Message;
98
use Enqueue\Client\Meta\QueueMetaRegistry;
9+
use Interop\Amqp\AmqpContext;
1010
use Interop\Amqp\AmqpMessage;
1111
use Interop\Amqp\AmqpQueue;
1212
use Interop\Amqp\AmqpTopic;

pkg/amqp-ext/Client/RabbitMqDriver.php renamed to pkg/enqueue/Client/Amqp/RabbitMqDriver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22

3-
namespace Enqueue\AmqpExt\Client;
3+
namespace Enqueue\Client\Amqp;
44

5-
use Enqueue\AmqpExt\AmqpContext;
65
use Enqueue\Client\Config;
76
use Enqueue\Client\Message;
87
use Enqueue\Client\MessagePriority;
98
use Enqueue\Client\Meta\QueueMetaRegistry;
109
use Enqueue\Consumption\Exception\LogicException;
10+
use Interop\Amqp\AmqpContext;
1111
use Interop\Amqp\AmqpMessage;
1212
use Interop\Amqp\AmqpQueue;
1313
use Interop\Amqp\AmqpTopic;

pkg/amqp-ext/Tests/Client/AmqpDriverTest.php renamed to pkg/enqueue/Tests/Client/Amqp/AmqpDriverTest.php

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<?php
22

3-
namespace Enqueue\AmqpExt\Tests\Client;
3+
namespace Enqueue\Tests\Client\Amqp;
44

5-
use Enqueue\AmqpExt\AmqpContext;
6-
use Enqueue\AmqpExt\Client\AmqpDriver;
5+
use Enqueue\Client\Amqp\AmqpDriver;
76
use Enqueue\Client\Config;
87
use Enqueue\Client\DriverInterface;
98
use Enqueue\Client\Message;
109
use Enqueue\Client\Meta\QueueMetaRegistry;
1110
use Enqueue\Test\ClassExtensionTrait;
11+
use Interop\Amqp\AmqpContext;
12+
use Interop\Amqp\AmqpProducer;
1213
use Interop\Amqp\Impl\AmqpBind;
1314
use Interop\Amqp\Impl\AmqpMessage;
1415
use Interop\Amqp\Impl\AmqpQueue;
1516
use Interop\Amqp\Impl\AmqpTopic;
16-
use Interop\Queue\PsrProducer;
1717
use PHPUnit\Framework\TestCase;
1818

1919
class AmqpDriverTest extends TestCase
@@ -28,7 +28,7 @@ public function testShouldImplementsDriverInterface()
2828
public function testCouldBeConstructedWithRequiredArguments()
2929
{
3030
new AmqpDriver(
31-
$this->createPsrContextMock(),
31+
$this->createAmqpContextMock(),
3232
$this->createDummyConfig(),
3333
$this->createDummyQueueMetaRegistry()
3434
);
@@ -38,7 +38,7 @@ public function testShouldReturnConfigObject()
3838
{
3939
$config = $this->createDummyConfig();
4040

41-
$driver = new AmqpDriver($this->createPsrContextMock(), $config, $this->createDummyQueueMetaRegistry());
41+
$driver = new AmqpDriver($this->createAmqpContextMock(), $config, $this->createDummyQueueMetaRegistry());
4242

4343
$this->assertSame($config, $driver->getConfig());
4444
}
@@ -47,7 +47,7 @@ public function testShouldCreateAndReturnQueueInstance()
4747
{
4848
$expectedQueue = new AmqpQueue('aName');
4949

50-
$context = $this->createPsrContextMock();
50+
$context = $this->createAmqpContextMock();
5151
$context
5252
->expects($this->once())
5353
->method('createQueue')
@@ -69,7 +69,7 @@ public function testShouldCreateAndReturnQueueInstanceWithHardcodedTransportName
6969
{
7070
$expectedQueue = new AmqpQueue('aName');
7171

72-
$context = $this->createPsrContextMock();
72+
$context = $this->createAmqpContextMock();
7373
$context
7474
->expects($this->once())
7575
->method('createQueue')
@@ -98,7 +98,7 @@ public function testShouldConvertTransportMessageToClientMessage()
9898
$transportMessage->setCorrelationId('theCorrelationId');
9999

100100
$driver = new AmqpDriver(
101-
$this->createPsrContextMock(),
101+
$this->createAmqpContextMock(),
102102
$this->createDummyConfig(),
103103
$this->createDummyQueueMetaRegistry()
104104
);
@@ -133,7 +133,7 @@ public function testShouldThrowExceptionIfExpirationIsNotNumeric()
133133
$transportMessage->setHeader('expiration', 'is-not-numeric');
134134

135135
$driver = new AmqpDriver(
136-
$this->createPsrContextMock(),
136+
$this->createAmqpContextMock(),
137137
$this->createDummyConfig(),
138138
$this->createDummyQueueMetaRegistry()
139139
);
@@ -157,7 +157,7 @@ public function testShouldConvertClientMessageToTransportMessage()
157157
$clientMessage->setReplyTo('theReplyTo');
158158
$clientMessage->setCorrelationId('theCorrelationId');
159159

160-
$context = $this->createPsrContextMock();
160+
$context = $this->createAmqpContextMock();
161161
$context
162162
->expects($this->once())
163163
->method('createMessage')
@@ -198,13 +198,13 @@ public function testShouldSendMessageToRouter()
198198
$topic = new AmqpTopic('');
199199
$transportMessage = new AmqpMessage();
200200

201-
$producer = $this->createPsrProducerMock();
201+
$producer = $this->createAmqpProducerMock();
202202
$producer
203203
->expects($this->once())
204204
->method('send')
205205
->with($this->identicalTo($topic), $this->identicalTo($transportMessage))
206206
;
207-
$context = $this->createPsrContextMock();
207+
$context = $this->createAmqpContextMock();
208208
$context
209209
->expects($this->once())
210210
->method('createTopic')
@@ -236,7 +236,7 @@ public function testShouldSendMessageToRouter()
236236
public function testShouldThrowExceptionIfTopicParameterIsNotSet()
237237
{
238238
$driver = new AmqpDriver(
239-
$this->createPsrContextMock(),
239+
$this->createAmqpContextMock(),
240240
$this->createDummyConfig(),
241241
$this->createDummyQueueMetaRegistry()
242242
);
@@ -252,13 +252,13 @@ public function testShouldSendMessageToProcessor()
252252
$queue = new AmqpQueue('');
253253
$transportMessage = new AmqpMessage();
254254

255-
$producer = $this->createPsrProducerMock();
255+
$producer = $this->createAmqpProducerMock();
256256
$producer
257257
->expects($this->once())
258258
->method('send')
259259
->with($this->identicalTo($queue), $this->identicalTo($transportMessage))
260260
;
261-
$context = $this->createPsrContextMock();
261+
$context = $this->createAmqpContextMock();
262262
$context
263263
->expects($this->once())
264264
->method('createQueue')
@@ -291,7 +291,7 @@ public function testShouldSendMessageToProcessor()
291291
public function testShouldThrowExceptionIfProcessorNameParameterIsNotSet()
292292
{
293293
$driver = new AmqpDriver(
294-
$this->createPsrContextMock(),
294+
$this->createAmqpContextMock(),
295295
$this->createDummyConfig(),
296296
$this->createDummyQueueMetaRegistry()
297297
);
@@ -305,7 +305,7 @@ public function testShouldThrowExceptionIfProcessorNameParameterIsNotSet()
305305
public function testShouldThrowExceptionIfProcessorQueueNameParameterIsNotSet()
306306
{
307307
$driver = new AmqpDriver(
308-
$this->createPsrContextMock(),
308+
$this->createAmqpContextMock(),
309309
$this->createDummyConfig(),
310310
$this->createDummyQueueMetaRegistry()
311311
);
@@ -326,7 +326,7 @@ public function testShouldSetupBroker()
326326

327327
$processorQueue = new AmqpQueue('');
328328

329-
$context = $this->createPsrContextMock();
329+
$context = $this->createAmqpContextMock();
330330
// setup router
331331
$context
332332
->expects($this->at(0))
@@ -381,17 +381,17 @@ public function testShouldSetupBroker()
381381
/**
382382
* @return \PHPUnit_Framework_MockObject_MockObject|AmqpContext
383383
*/
384-
private function createPsrContextMock()
384+
private function createAmqpContextMock()
385385
{
386386
return $this->createMock(AmqpContext::class);
387387
}
388388

389389
/**
390-
* @return \PHPUnit_Framework_MockObject_MockObject|PsrProducer
390+
* @return \PHPUnit_Framework_MockObject_MockObject|AmqpProducer
391391
*/
392-
private function createPsrProducerMock()
392+
private function createAmqpProducerMock()
393393
{
394-
return $this->createMock(PsrProducer::class);
394+
return $this->createMock(AmqpProducer::class);
395395
}
396396

397397
/**

0 commit comments

Comments
 (0)