summaryrefslogtreecommitdiff
path: root/java/systests
diff options
context:
space:
mode:
authorAndrew Donald Kennedy <grkvlt@apache.org>2010-07-22 16:09:40 +0000
committerAndrew Donald Kennedy <grkvlt@apache.org>2010-07-22 16:09:40 +0000
commitc67cfe6cc625835ea7ed4b3af661c4a92989a57f (patch)
treeb5fed59c3e4d267f0ab42ff9877399d9e1c4796a /java/systests
parent4a3228c8799af99f073d8a1e215058d23a6eb0da (diff)
downloadqpid-python-c67cfe6cc625835ea7ed4b3af661c4a92989a57f.tar.gz
QPID-2657: Make Exceptions propagate to client for 0-10
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@966722 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/systests')
-rw-r--r--java/systests/src/main/java/org/apache/qpid/server/security/acl/SimpleACLTest.java33
-rw-r--r--java/systests/src/main/java/org/apache/qpid/systest/GlobalQueuesTest.java1
-rw-r--r--java/systests/src/main/java/org/apache/qpid/systest/TestingBaseCase.java24
-rw-r--r--java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java2
4 files changed, 21 insertions, 39 deletions
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 ee2938f2fe..28125f2f19 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
@@ -38,6 +38,7 @@ import org.apache.qpid.AMQException;
import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQSession;
import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.protocol.AMQConstant;
import org.apache.qpid.url.URLSyntaxException;
/**
@@ -59,7 +60,7 @@ import org.apache.qpid.url.URLSyntaxException;
*/
public class SimpleACLTest extends AbstractACLTestCase
{
- public void testAccessAuthorized() throws AMQException, URLSyntaxException, Exception
+ public void testAccessAuthorizedSuccess() throws AMQException, URLSyntaxException, Exception
{
try
{
@@ -78,7 +79,7 @@ public class SimpleACLTest extends AbstractACLTestCase
}
}
- public void testAccessVhostAuthorisedGuest() throws IOException, Exception
+ public void testAccessVhostAuthorisedGuestSuccess() throws IOException, Exception
{
//The 'guest' user has no access to the 'test' vhost, as tested below in testAccessNoRights(), and so
//is unable to perform actions such as connecting (and by extension, creating a queue, and consuming
@@ -117,8 +118,7 @@ public class SimpleACLTest extends AbstractACLTestCase
}
}
- // XXX one
- public void testAccessNoRights() throws Exception
+ public void testAccessNoRightsFailure() throws Exception
{
try
{
@@ -131,13 +131,14 @@ public class SimpleACLTest extends AbstractACLTestCase
}
catch (JMSException e)
{
- // XXX JMSException -> linkedException -> cause = AMQException.403
+ // JMSException -> linkedException -> cause = AMQException (403 or 320)
Exception linkedException = e.getLinkedException();
assertNotNull("There was no linked exception", linkedException);
Throwable cause = linkedException.getCause();
assertNotNull("Cause was null", cause);
- assertTrue("Wrong linked exception type",cause instanceof AMQException);
- assertEquals("Incorrect error code received", 403, ((AMQException) cause).getErrorCode().getCode());
+ assertTrue("Wrong linked exception type", cause instanceof AMQException);
+ AMQConstant errorCode = isBroker010() ? AMQConstant.CONTEXT_IN_USE : AMQConstant.ACCESS_REFUSED;
+ assertEquals("Incorrect error code received", errorCode, ((AMQException) cause).getErrorCode());
}
}
@@ -166,7 +167,6 @@ public class SimpleACLTest extends AbstractACLTestCase
}
}
- // XXX two
public void testServerDeleteQueueFailure() throws Exception
{
try
@@ -188,12 +188,12 @@ public class SimpleACLTest extends AbstractACLTestCase
}
catch (JMSException e)
{
- // XXX JMSException -> linedException = AMQException.403
+ // JMSException -> linedException = AMQException.403
check403Exception(e.getLinkedException());
}
}
- public void testClientConsumeFromTempQueueValid() throws AMQException, URLSyntaxException, Exception
+ public void testClientConsumeFromTempQueueSuccess() throws AMQException, URLSyntaxException, Exception
{
try
{
@@ -213,7 +213,7 @@ public class SimpleACLTest extends AbstractACLTestCase
}
}
- public void testClientConsumeFromNamedQueueInvalid() throws NamingException, Exception
+ public void testClientConsumeFromNamedQueueFailure() throws NamingException, Exception
{
try
{
@@ -225,8 +225,6 @@ public class SimpleACLTest extends AbstractACLTestCase
sess.createConsumer(sess.createQueue("IllegalQueue"));
- conn.close();
-
fail("Test failed as consumer was created.");
}
catch (JMSException e)
@@ -235,7 +233,7 @@ public class SimpleACLTest extends AbstractACLTestCase
}
}
- public void testClientCreateTemporaryQueue() throws JMSException, URLSyntaxException, Exception
+ public void testClientCreateTemporaryQueueSuccess() throws JMSException, URLSyntaxException, Exception
{
try
{
@@ -257,7 +255,7 @@ public class SimpleACLTest extends AbstractACLTestCase
}
}
- public void testClientCreateNamedQueue() throws NamingException, JMSException, AMQException, Exception
+ public void testClientCreateNamedQueueFailure() throws NamingException, JMSException, AMQException, Exception
{
try
{
@@ -275,7 +273,6 @@ public class SimpleACLTest extends AbstractACLTestCase
}
catch (AMQException e)
{
- // XXX AMQException.403
check403Exception(e);
}
}
@@ -405,8 +402,6 @@ public class SimpleACLTest extends AbstractACLTestCase
conn.start();
sess.createConsumer(sess.createQueue("Invalid"));
-
- conn.close();
fail("Test failed as consumer was created.");
}
@@ -520,7 +515,7 @@ public class SimpleACLTest extends AbstractACLTestCase
/**
* This test uses both the cilent and sender to validate that the Server is able to publish to a temporary queue.
- * The reason the client must be in volved is that the Serve is unable to create its own Temporary Queues.
+ * The reason the client must be involved is that the Server is unable to create its own Temporary Queues.
*
* @throws AMQException
* @throws URLSyntaxException
diff --git a/java/systests/src/main/java/org/apache/qpid/systest/GlobalQueuesTest.java b/java/systests/src/main/java/org/apache/qpid/systest/GlobalQueuesTest.java
index e0934faf44..9ff143daf3 100644
--- a/java/systests/src/main/java/org/apache/qpid/systest/GlobalQueuesTest.java
+++ b/java/systests/src/main/java/org/apache/qpid/systest/GlobalQueuesTest.java
@@ -61,6 +61,7 @@ public class GlobalQueuesTest extends TestingBaseCase
*/
+
/**
* VirtualHost Plugin Configuration
diff --git a/java/systests/src/main/java/org/apache/qpid/systest/TestingBaseCase.java b/java/systests/src/main/java/org/apache/qpid/systest/TestingBaseCase.java
index 9831c74574..08a7b7a6e5 100644
--- a/java/systests/src/main/java/org/apache/qpid/systest/TestingBaseCase.java
+++ b/java/systests/src/main/java/org/apache/qpid/systest/TestingBaseCase.java
@@ -172,22 +172,8 @@ public class TestingBaseCase extends QpidBrokerTestCase implements ExceptionList
startPublisher(_destination);
boolean disconnected = _disconnectionLatch.await(DISCONNECTION_WAIT, TimeUnit.SECONDS);
-
- if (!disconnected && isBroker010())
- {
- try
- {
- ((AMQSession_0_10) session).sync();
- }
- catch (AMQException amqe)
- {
- JMSException jmsException = new JMSException(amqe.getMessage());
- jmsException.setLinkedException(amqe);
- jmsException.initCause(amqe);
- _connectionException = jmsException;
- }
- }
-
+
+ assertTrue("Client was not disconnected", disconnected);
assertTrue("Client was not disconnected.", _connectionException != null);
Exception linked = _connectionException.getLinkedException();
@@ -209,11 +195,11 @@ public class TestingBaseCase extends QpidBrokerTestCase implements ExceptionList
assertNotNull("No linked exception set on:" + _connectionException.getMessage(), linked);
- assertEquals("Incorrect linked exception received.", AMQChannelClosedException.class, linked.getClass());
+ assertTrue("Incorrect linked exception received.", linked instanceof AMQException);
- AMQChannelClosedException ccException = (AMQChannelClosedException) linked;
+ AMQException amqException = (AMQException) linked;
- assertEquals("Channel was not closed with correct code.", AMQConstant.RESOURCE_ERROR, ccException.getErrorCode());
+ assertEquals("Channel was not closed with correct code.", AMQConstant.RESOURCE_ERROR, amqException.getErrorCode());
}
diff --git a/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java b/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java
index fb23d80843..8bb588a036 100644
--- a/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java
+++ b/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/ConnectionTest.java
@@ -145,7 +145,7 @@ public class ConnectionTest extends QpidBrokerTestCase
catch (AMQConnectionFailureException amqe)
{
assertNotNull("No cause set:" + amqe.getMessage(), amqe.getCause());
- assertEquals("Exception was wrong type", AMQAuthenticationException.class, amqe.getCause().getClass());
+ assertTrue("Exception was wrong type", amqe.getCause() instanceof AMQException);
}
finally
{