Skip to content

Commit a675909

Browse files
committed
AC-14558::Migration form RabbitMQ to Apache ActiveMQ
1 parent 7361b1d commit a675909

File tree

6 files changed

+31
-18
lines changed

6 files changed

+31
-18
lines changed

dev/tests/integration/testsuite/Magento/Framework/MessageQueue/UseCase/RemoteServiceCommunicationTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public function testRemoteServiceCommunication()
4545

4646
$input = 'Input value';
4747
/** @var ServiceInterface $generatedRemoteService */
48+
/** @phpstan-ignore-next-line */
4849
$generatedRemoteService = $this->objectManager->get(ServiceInterface::class);
4950
$response = $generatedRemoteService->execute($input);
5051
$this->assertEquals($input . ' processed by RPC handler', $response);

lib/internal/Magento/Framework/MessageQueue/Consumer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2015 Adobe
4+
* All Rights Reserved.
55
*/
66

77
namespace Magento\Framework\MessageQueue;

lib/internal/Magento/Framework/MessageQueue/Test/Unit/BatchConsumerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2017 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

lib/internal/Magento/Framework/MessageQueue/Test/Unit/ConsumerTest.php

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2017 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -199,7 +199,15 @@ public function testProcessWithNotFoundException()
199199
$envelope->expects($this->once())->method('getProperties')->willReturn($properties);
200200
$this->communicationConfig->expects($this->once())->method('getTopic')->with($properties['topic_name'])
201201
->willReturn($topicConfig);
202-
$this->configuration->expects($this->once())->method('getConsumerName')->willReturn($consumerName);
202+
$this->configuration->expects($this->atLeastOnce())->method('getConsumerName')->willReturn($consumerName);
203+
$consumerConfigItem = $this->getMockBuilder(
204+
\Magento\Framework\MessageQueue\Consumer\Config\ConsumerConfigItemInterface::class
205+
)
206+
->disableOriginalConstructor()
207+
->getMockForAbstractClass();
208+
$consumerConfigItem->expects($this->once())->method('getConnection')->willReturn('connection_name');
209+
$this->consumerConfig->expects($this->once())->method('getConsumer')->with($consumerName)
210+
->willReturn($consumerConfigItem);
203211
$this->messageController->expects($this->once())->method('lock')->with($envelope, $consumerName)
204212
->willThrowException(
205213
new NotFoundException(
@@ -227,6 +235,16 @@ public function testProcessWithGetMaxIdleTimeAndGetSleepConsumerConfigurations()
227235
$queue->expects($this->atMost(2))->method('dequeue')->willReturn(null);
228236
$this->configuration->expects($this->once())->method('getMaxIdleTime')->willReturn('2');
229237
$this->configuration->expects($this->once())->method('getSleep')->willReturn('2');
238+
$consumerName = 'consumer.name';
239+
$this->configuration->expects($this->once())->method('getConsumerName')->willReturn($consumerName);
240+
$consumerConfigItem = $this->getMockBuilder(
241+
\Magento\Framework\MessageQueue\Consumer\Config\ConsumerConfigItemInterface::class
242+
)
243+
->disableOriginalConstructor()
244+
->getMockForAbstractClass();
245+
$consumerConfigItem->expects($this->once())->method('getConnection')->willReturn('connection_name');
246+
$this->consumerConfig->expects($this->once())->method('getConsumer')->with($consumerName)
247+
->willReturn($consumerConfigItem);
230248
$this->consumer->process($numberOfMessages);
231249
}
232250
}

lib/internal/Magento/Framework/MessageQueue/Test/Unit/_files/queue_publisher/valid.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2016 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

lib/internal/Magento/Framework/Stomp/Diagnostics.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public function __construct(
6161
*
6262
* @param string|null $connectionName
6363
* @return array
64+
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
6465
*/
6566
public function runDiagnostics(?string $connectionName = null): array
6667
{
@@ -88,9 +89,6 @@ public function runDiagnostics(?string $connectionName = null): array
8889

8990
// Test additional STOMP connections
9091
if (isset($queueConfig['connections'])) {
91-
/**
92-
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
93-
*/
9492
foreach ($queueConfig['connections'] as $name => $config) {
9593
$results['connections'][$name] = $this->testStompConnection($name);
9694
}
@@ -320,12 +318,10 @@ private function testNetworkConnectivity(string $host, int $port): array
320318
*
321319
* @param string $connectionName
322320
* @return array
321+
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
323322
*/
324323
private function testStompClientCreation(string $connectionName): array
325324
{
326-
/**
327-
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
328-
*/
329325
try {
330326
$config = new Config($this->deploymentConfig, $connectionName);
331327
$client = $this->stompClientFactory->create();
@@ -347,13 +343,11 @@ private function testStompClientCreation(string $connectionName): array
347343
*
348344
* @param string $connectionName
349345
* @return array
346+
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
350347
*/
351348
private function testStompBasicOperations(string $connectionName): array
352349
{
353350
try {
354-
/**
355-
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
356-
*/
357351
$config = new Config($this->deploymentConfig, $connectionName);
358352
$client = $this->stompClientFactory->create();
359353

0 commit comments

Comments
 (0)