From ef99cf5da8833eb4a8a456741566b7a55f7ef64b Mon Sep 17 00:00:00 2001 From: Robert Gemmell Date: Tue, 5 Feb 2013 14:22:56 +0000 Subject: QPID-4312: reduce visibility and narrow argument type for new check methods, add some unit testing of config and cleanup IDT systest a little git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1442602 13f79535-47bb-0310-9956-ffa450edef68 --- .../test/unit/basic/InvalidDestinationTest.java | 41 +++++++++------------- 1 file changed, 17 insertions(+), 24 deletions(-) (limited to 'java/systests') diff --git a/java/systests/src/main/java/org/apache/qpid/test/unit/basic/InvalidDestinationTest.java b/java/systests/src/main/java/org/apache/qpid/test/unit/basic/InvalidDestinationTest.java index 05b19c3391..8961574d1e 100644 --- a/java/systests/src/main/java/org/apache/qpid/test/unit/basic/InvalidDestinationTest.java +++ b/java/systests/src/main/java/org/apache/qpid/test/unit/basic/InvalidDestinationTest.java @@ -55,11 +55,8 @@ public class InvalidDestinationTest extends QpidBrokerTestCase super.tearDown(); } - - public void testInvalidDestination() throws Exception { - QueueSession queueSession = _connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); Queue invalidDestination = queueSession.createQueue("unknownQ"); @@ -98,37 +95,39 @@ public class InvalidDestinationTest extends QpidBrokerTestCase sender.close(); sender = queueSession.createSender(validDestination); sender.send(msg); - - - - } - - + /** + * Tests that specifying the {@value ClientProperties#VERIFY_QUEUE_ON_SEND} system property + * results in an exception when sending to an invalid queue destination. + */ public void testInvalidDestinationOnMessageProducer() throws Exception { setTestSystemProperty(ClientProperties.VERIFY_QUEUE_ON_SEND, "true"); final AMQConnection connection = (AMQConnection) getConnection(); doInvalidDestinationOnMessageProducer(connection); - } - + /** + * Tests that specifying the {@value ConnectionURL.OPTIONS_VERIFY_QUEUE_ON_SEND} + * connection URL option property results in an exception when sending to an + * invalid queue destination. + */ public void testInvalidDestinationOnMessageProducerURL() throws Exception { Map options = Collections.singletonMap(ConnectionURL.OPTIONS_VERIFY_QUEUE_ON_SEND, "true"); doInvalidDestinationOnMessageProducer(getConnectionWithOptions(options)); - } private void doInvalidDestinationOnMessageProducer(Connection connection) throws JMSException { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - Queue invalidDestination = session.createQueue("unknownQ"); + String invalidQueueName = getTestQueueName() + "UnknownQ"; + Queue invalidDestination = session.createQueue(invalidQueueName); - Queue validDestination = session.createQueue("knownQ"); + String validQueueName = getTestQueueName() + "KnownQ"; + Queue validDestination = session.createQueue(validQueueName); // This is the only easy way to create and bind a queue from the API :-( session.createConsumer(validDestination); @@ -146,9 +145,8 @@ public class InvalidDestinationTest extends QpidBrokerTestCase // pass } - sender = session.createProducer(null); - invalidDestination = new AMQQueue("amq.direct","unknownQ"); + invalidDestination = new AMQQueue("amq.direct",invalidQueueName); try { @@ -164,15 +162,10 @@ public class InvalidDestinationTest extends QpidBrokerTestCase sender = session.createProducer(validDestination); sender.send(msg); - Topic topic = session.createTopic("randomTopic"); + //Verify sending to an 'invalid' Topic doesn't throw an exception + String invalidTopic = getTestQueueName() + "UnknownT"; + Topic topic = session.createTopic(invalidTopic); sender = session.createProducer(topic); sender.send(msg); } - - - public static junit.framework.Test suite() - { - - return new junit.framework.TestSuite(InvalidDestinationTest.class); - } } -- cgit v1.2.1