From ec3333155190e82cf6d50ee103cce9c2eb5f03dc Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Sun, 17 Apr 2011 08:08:33 +0100 Subject: [PATCH] Add extra integration test for vhost --- .../CachingConnectionFactoryIntegrationTests.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/connection/CachingConnectionFactoryIntegrationTests.java b/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/connection/CachingConnectionFactoryIntegrationTests.java index 95380d5d..4e9e3d13 100644 --- a/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/connection/CachingConnectionFactoryIntegrationTests.java +++ b/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/connection/CachingConnectionFactoryIntegrationTests.java @@ -51,6 +51,18 @@ public class CachingConnectionFactoryIntegrationTests { } + @Test + public void testReceiveFromNonExistentVirtualHost() throws Exception { + + connectionFactory.setVirtualHost("non-existent"); + RabbitTemplate template = new RabbitTemplate(connectionFactory); + // Wrong vhost is very unfriendly to client - the exception has no clue (just an EOF) + exception.expect(AmqpIOException.class); + String result = (String) template.receiveAndConvert("foo"); + assertEquals("message", result); + + } + @Test public void testSendAndReceiveFromVolatileQueueAfterImplicitRemoval() throws Exception {