From 0d871420b20d4e98fde5b959883ec2a8f4eb4d5c Mon Sep 17 00:00:00 2001 From: Martin Ritchie Date: Thu, 21 Aug 2008 13:17:30 +0000 Subject: QPID-1225 : Changed SimpleACLTest to use QpidTestCase so the failing test can be excluded. This change DOES NOT mean the test will run agains the exteranl brokers. The test explicitly shutsdown the QTC broker during the setUp and only runs InVM currently. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@687743 13f79535-47bb-0310-9956-ffa450edef68 --- .../qpid/server/security/acl/SimpleACLTest.java | 33 ++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'java') diff --git a/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java b/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java index a85faa230f..1740d37e38 100644 --- a/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java +++ b/java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java @@ -28,6 +28,7 @@ import org.apache.qpid.framing.AMQShortString; import org.apache.qpid.server.registry.ApplicationRegistry; import org.apache.qpid.server.registry.ConfigurationFileApplicationRegistry; import org.apache.qpid.AMQException; +import org.apache.qpid.test.utils.QpidTestCase; import org.apache.qpid.jms.ConnectionListener; import org.apache.qpid.url.URLSyntaxException; @@ -35,12 +36,15 @@ import javax.jms.*; import javax.jms.IllegalStateException; import java.io.File; -public class SimpleACLTest extends TestCase implements ConnectionListener +public class SimpleACLTest extends QpidTestCase implements ConnectionListener { private String BROKER = "vm://:1";//"tcp://localhost:5672"; public void setUp() throws Exception { + //Shutdown the QTC broker + stopBroker(); + // Initialise ACLs. final String QpidExampleHome = System.getProperty("QPID_EXAMPLE_HOME"); final File defaultaclConfigFile = new File(QpidExampleHome, "etc/acl.config.xml"); @@ -426,7 +430,32 @@ public class SimpleACLTest extends TestCase implements ConnectionListener } } - public void testServerCreateTemporyQueueInvalid() throws JMSException, URLSyntaxException, AMQException + public void testServerCreateTemporaryQueueInvalid() throws JMSException, URLSyntaxException, AMQException + { + try + { + Connection conn = new AMQConnection(createConnectionString("server", "guest", BROKER)); + + Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); + + conn.start(); + + session.createTemporaryQueue(); + + fail("Test failed as creation succeded."); + //conn will be automatically closed + } + catch (JMSException e) + { + Throwable cause = e.getLinkedException(); + + assertNotNull("There was no liked exception", cause); + assertEquals("Wrong linked exception type", AMQAuthenticationException.class, cause.getClass()); + assertEquals("Incorrect error code received", 403, ((AMQAuthenticationException) cause).getErrorCode().getCode()); + } + } + + public void testServerCreateAutoDeleteQueueInvalid() throws JMSException, URLSyntaxException, AMQException { try { -- cgit v1.2.1