-
Notifications
You must be signed in to change notification settings - Fork 574
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Log warning when receiving basic.cancel for unknown consumer
- Loading branch information
1 parent
be57b26
commit 6081628
Showing
3 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright (c) 2019 Pivotal Software, Inc. All rights reserved. | ||
// | ||
// This software, the RabbitMQ Java client library, is triple-licensed under the | ||
// Mozilla Public License 1.1 ("MPL"), the GNU General Public License version 2 | ||
// ("GPL") and the Apache License version 2 ("ASL"). For the MPL, please see | ||
// LICENSE-MPL-RabbitMQ. For the GPL, please see LICENSE-GPL2. For the ASL, | ||
// please see LICENSE-APACHE2. | ||
// | ||
// This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, | ||
// either express or implied. See the LICENSE file for specific language governing | ||
// rights and limitations of this software. | ||
// | ||
// If you have any questions regarding licensing, please contact us at | ||
// info@rabbitmq.com. | ||
|
||
package com.rabbitmq.client.test; | ||
|
||
import com.rabbitmq.client.Method; | ||
import com.rabbitmq.client.impl.*; | ||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.mockito.Mockito; | ||
|
||
import java.util.concurrent.ExecutorService; | ||
import java.util.concurrent.Executors; | ||
|
||
public class ChannelNTest { | ||
|
||
ConsumerWorkService consumerWorkService; | ||
ExecutorService executorService; | ||
|
||
@Before public void init() { | ||
executorService = Executors.newSingleThreadExecutor(); | ||
consumerWorkService = new ConsumerWorkService(executorService, null, 1000, 1000); | ||
} | ||
|
||
@After public void tearDown() { | ||
consumerWorkService.shutdown(); | ||
executorService.shutdownNow(); | ||
} | ||
|
||
@Test | ||
public void cancelUnknownConsumerDoesNotThrowException() throws Exception { | ||
AMQConnection connection = Mockito.mock(AMQConnection.class); | ||
ChannelN channel = new ChannelN(connection, 1, consumerWorkService); | ||
Method method = new AMQImpl.Basic.Cancel.Builder().consumerTag("does-not-exist").build(); | ||
channel.processAsync(new AMQCommand(method)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters