qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1770514 [3/3] - in /qpid/java/trunk: broker-core/src/main/java/org/apache/qpid/server/protocol/ broker-core/src/main/java/org/apache/qpid/server/transport/ broker-core/src/test/java/org/apache/qpid/server/consumer/ broker-core/src/test/jav...
Date Sat, 19 Nov 2016 21:19:12 GMT
Modified: qpid/java/trunk/jca/src/main/java/org/apache/qpid/ra/inflow/QpidExceptionHandler.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/jca/src/main/java/org/apache/qpid/ra/inflow/QpidExceptionHandler.java?rev=1770514&r1=1770513&r2=1770514&view=diff
==============================================================================
--- qpid/java/trunk/jca/src/main/java/org/apache/qpid/ra/inflow/QpidExceptionHandler.java
(original)
+++ qpid/java/trunk/jca/src/main/java/org/apache/qpid/ra/inflow/QpidExceptionHandler.java
Sat Nov 19 21:19:11 2016
@@ -38,13 +38,14 @@ import javax.naming.InitialContext;
 import javax.resource.ResourceException;
 import javax.resource.spi.endpoint.MessageEndpointFactory;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import org.apache.qpid.AMQException;
 import org.apache.qpid.client.AMQDestination;
-import org.apache.qpid.protocol.AMQConstant;
+import org.apache.qpid.protocol.ErrorCodes;
 import org.apache.qpid.ra.QpidResourceAdapter;
 import org.apache.qpid.ra.Util;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public abstract class QpidExceptionHandler implements ExceptionListener
 {
@@ -197,7 +198,7 @@ public abstract class QpidExceptionHandl
      */
     protected boolean doesNotExist(final Throwable failure)
     {
-       return (failure instanceof AMQException) && (((AMQException)failure).getErrorCode()
== AMQConstant.NOT_FOUND) ;
+       return (failure instanceof AMQException) && (((AMQException)failure).getErrorCode()
== ErrorCodes.NOT_FOUND) ;
     }
 
     protected boolean isXA()

Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/client/session/ExchangeDeleteTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/client/session/ExchangeDeleteTest.java?rev=1770514&r1=1770513&r2=1770514&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/test/java/org/apache/qpid/client/session/ExchangeDeleteTest.java
(original)
+++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/client/session/ExchangeDeleteTest.java
Sat Nov 19 21:19:11 2016
@@ -27,7 +27,7 @@ import javax.jms.Session;
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.configuration.ClientProperties;
 import org.apache.qpid.exchange.ExchangeDefaults;
-import org.apache.qpid.protocol.AMQConstant;
+import org.apache.qpid.protocol.ErrorCodes;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
 
 public class ExchangeDeleteTest extends QpidBrokerTestCase
@@ -70,7 +70,7 @@ public class ExchangeDeleteTest extends
         {
             // PASS
             assertEquals("Expecting exchange not found",
-                         String.valueOf(AMQConstant.NOT_FOUND.getCode()),
+                         String.valueOf(ErrorCodes.NOT_FOUND),
                          e.getErrorCode());
         }
 

Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/client/session/QueueDeleteTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/client/session/QueueDeleteTest.java?rev=1770514&r1=1770513&r2=1770514&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/test/java/org/apache/qpid/client/session/QueueDeleteTest.java
(original)
+++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/client/session/QueueDeleteTest.java
Sat Nov 19 21:19:11 2016
@@ -29,7 +29,7 @@ import javax.jms.Session;
 import org.apache.qpid.client.AMQDestination;
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.configuration.ClientProperties;
-import org.apache.qpid.protocol.AMQConstant;
+import org.apache.qpid.protocol.ErrorCodes;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
 
 public class QueueDeleteTest extends QpidBrokerTestCase
@@ -72,7 +72,7 @@ public class QueueDeleteTest extends Qpi
         {
             // PASS
             assertEquals("Expecting queue not found",
-                         String.valueOf(AMQConstant.NOT_FOUND.getCode()),
+                         String.valueOf(ErrorCodes.NOT_FOUND),
                          e.getErrorCode());
         }
 
@@ -92,7 +92,7 @@ public class QueueDeleteTest extends Qpi
         {
             // PASS
             assertEquals("Expecting queue not found",
-                         String.valueOf(AMQConstant.NOT_FOUND.getCode()),
+                         String.valueOf(ErrorCodes.NOT_FOUND),
                          e.getErrorCode());
         }
 

Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/logging/AccessControlLoggingTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/logging/AccessControlLoggingTest.java?rev=1770514&r1=1770513&r2=1770514&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/logging/AccessControlLoggingTest.java
(original)
+++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/logging/AccessControlLoggingTest.java
Sat Nov 19 21:19:11 2016
@@ -18,15 +18,16 @@
  */
 package org.apache.qpid.server.logging;
 
-import org.apache.qpid.AMQException;
-import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.server.security.acl.AbstractACLTestCase;
+import java.util.List;
 
 import javax.jms.Connection;
 import javax.jms.JMSException;
 import javax.jms.Session;
-import java.util.List;
+
+import org.apache.qpid.AMQException;
+import org.apache.qpid.client.AMQSession;
+import org.apache.qpid.protocol.ErrorCodes;
+import org.apache.qpid.server.security.acl.AbstractACLTestCase;
 
 /**
  * ACL version 2/3 file testing to verify that ACL actor logging works correctly.
@@ -131,7 +132,7 @@ public class AccessControlLoggingTest ex
         catch (AMQException amqe)
         {
             // Denied, so exception thrown
-            assertEquals("Expected ACCESS_REFUSED error code", AMQConstant.ACCESS_REFUSED,
amqe.getErrorCode());
+            assertEquals("Expected ACCESS_REFUSED error code", ErrorCodes.ACCESS_REFUSED,
amqe.getErrorCode());
         }
 
         List<String> matches = findMatches(ACL_LOG_PREFIX + 1002);
@@ -168,7 +169,7 @@ public class AccessControlLoggingTest ex
         catch (AMQException amqe)
         {
             // Denied, so exception thrown
-            assertEquals("Expected ACCESS_REFUSED error code", AMQConstant.ACCESS_REFUSED,
amqe.getErrorCode());
+            assertEquals("Expected ACCESS_REFUSED error code", ErrorCodes.ACCESS_REFUSED,
amqe.getErrorCode());
         }
 
         List<String> matches = findMatches(ACL_LOG_PREFIX + 1002);

Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/security/acl/AbstractACLTestCase.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/security/acl/AbstractACLTestCase.java?rev=1770514&r1=1770513&r2=1770514&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/security/acl/AbstractACLTestCase.java
(original)
+++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/security/acl/AbstractACLTestCase.java
Sat Nov 19 21:19:11 2016
@@ -36,7 +36,7 @@ import org.apache.qpid.AMQException;
 import org.apache.qpid.client.AMQConnection;
 import org.apache.qpid.client.AMQConnectionURL;
 import org.apache.qpid.jms.ConnectionListener;
-import org.apache.qpid.protocol.AMQConstant;
+import org.apache.qpid.protocol.ErrorCodes;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
 import org.apache.qpid.url.URLSyntaxException;
 
@@ -176,13 +176,13 @@ public abstract class AbstractACLTestCas
     }
 
     /**
-     * Convenience method to validate a JMS exception with a linked {@link AMQConstant#ACCESS_REFUSED}
403 error code exception.
+     * Convenience method to validate a JMS exception with a linked {@link ErrorCodes#ACCESS_REFUSED}
403 error code exception.
      */
     public void check403Exception(Throwable t) throws Exception
     {
         assertNotNull("There was no linked exception", t);
         assertTrue("Wrong linked exception type : " + t.getClass(), t instanceof AMQException);
-        assertEquals("Incorrect error code received", 403, ((AMQException) t).getErrorCode().getCode());
+        assertEquals("Incorrect error code received", 403, ((AMQException) t).getErrorCode());
 
         //use the latch to ensure the control thread waits long enough for the exception
thread
         //to have done enough to mark the connection closed before teardown commences

Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/security/acl/ExhaustiveACLTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/security/acl/ExhaustiveACLTest.java?rev=1770514&r1=1770513&r2=1770514&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/security/acl/ExhaustiveACLTest.java
(original)
+++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/security/acl/ExhaustiveACLTest.java
Sat Nov 19 21:19:11 2016
@@ -27,7 +27,7 @@ import org.apache.qpid.QpidException;
 import org.apache.qpid.AMQException;
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.configuration.ClientProperties;
-import org.apache.qpid.protocol.AMQConstant;
+import org.apache.qpid.protocol.ErrorCodes;
 
 /**
  * ACL version 2/3 file testing to verify that ACL entries control queue creation with specific
properties.
@@ -75,7 +75,7 @@ public class ExhaustiveACLTest extends A
 
 	/**
 	 * Calls {@link #createQueue(String, String, String, boolean, boolean)} with the provided
parameters and checks that
-	 * the exception thrown was an {@link AMQConstant#ACCESS_REFUSED} or 403 error code.
+	 * the exception thrown was an {@link ErrorCodes#ACCESS_REFUSED} or 403 error code.
 	 */
 	private void createQueueFailure(String vhost, String user, String name, boolean autoDelete,
boolean durable) throws Exception
 	{
@@ -87,7 +87,7 @@ public class ExhaustiveACLTest extends A
 		}
 		catch (AMQException e)
 		{
-			assertEquals("Should be an ACCESS_REFUSED error", 403, e.getErrorCode().getCode());
+			assertEquals("Should be an ACCESS_REFUSED error", 403, e.getErrorCode());
 		}
 	}
 

Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/security/acl/ExternalACLTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/security/acl/ExternalACLTest.java?rev=1770514&r1=1770513&r2=1770514&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/security/acl/ExternalACLTest.java
(original)
+++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/server/security/acl/ExternalACLTest.java
Sat Nov 19 21:19:11 2016
@@ -35,7 +35,7 @@ import org.apache.qpid.QpidException;
 import org.apache.qpid.AMQException;
 import org.apache.qpid.client.AMQDestination;
 import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.protocol.AMQConstant;
+import org.apache.qpid.protocol.ErrorCodes;
 import org.apache.qpid.url.URLSyntaxException;
 
 /**
@@ -84,7 +84,7 @@ public class ExternalACLTest extends Abs
         Throwable cause = linkedException.getCause();
         assertNotNull("Cause was null", cause);
         assertTrue("Wrong linked exception type", cause instanceof QpidException);
-        AMQConstant errorCode = isBroker010() ? AMQConstant.CONNECTION_FORCED : AMQConstant.ACCESS_REFUSED;
+        int errorCode = isBroker010() ? ErrorCodes.CONNECTION_FORCED : ErrorCodes.ACCESS_REFUSED;
         assertEquals("Incorrect error code received", errorCode, ((AMQException) cause).getErrorCode());
     }
 

Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/client/UnroutableMessageTestExceptionListener.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/client/UnroutableMessageTestExceptionListener.java?rev=1770514&r1=1770513&r2=1770514&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/client/UnroutableMessageTestExceptionListener.java
(original)
+++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/client/UnroutableMessageTestExceptionListener.java
Sat Nov 19 21:19:11 2016
@@ -38,7 +38,7 @@ import org.slf4j.LoggerFactory;
 import org.apache.qpid.AMQException;
 import org.apache.qpid.client.AMQNoConsumersException;
 import org.apache.qpid.client.AMQNoRouteException;
-import org.apache.qpid.protocol.AMQConstant;
+import org.apache.qpid.protocol.ErrorCodes;
 
 /**
  * Provides utility methods for checking exceptions that are thrown on the client side when
a message is
@@ -120,7 +120,7 @@ public class UnroutableMessageTestExcept
         AMQException noRouteException = (AMQException) exception.getLinkedException();
         assertNotNull("AMQException should be linked to JMSException", noRouteException);
 
-        assertEquals(AMQConstant.NO_ROUTE, noRouteException.getErrorCode());
+        assertEquals(ErrorCodes.NO_ROUTE, noRouteException.getErrorCode());
         assertTrue(
                 "Linked exception " + noRouteException + " message should contain intended
queue name",
                 noRouteException.getMessage().contains(intendedQueueName));

Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java?rev=1770514&r1=1770513&r2=1770514&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java
(original)
+++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/client/destination/AddressBasedDestinationTest.java
Sat Nov 19 21:19:11 2016
@@ -56,7 +56,7 @@ import org.apache.qpid.client.AMQSession
 import org.apache.qpid.client.message.QpidMessageProperties;
 import org.apache.qpid.jndi.PropertiesFileInitialContextFactory;
 import org.apache.qpid.messaging.Address;
-import org.apache.qpid.protocol.AMQConstant;
+import org.apache.qpid.protocol.ErrorCodes;
 import org.apache.qpid.test.utils.BrokerHolder;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
 import org.apache.qpid.transport.ExecutionErrorCode;
@@ -399,12 +399,12 @@ public class AddressBasedDestinationTest
                 //for. We can't do the rest of the test as a result of the exception, just
stop.
                 return;
             }
-            else if(useNonsenseExchangeType && (e.getErrorCode().equals(String.valueOf(AMQConstant.NOT_FOUND.getCode()))))
+            else if(useNonsenseExchangeType && (e.getErrorCode().equals(String.valueOf(ErrorCodes.NOT_FOUND))))
             {
                 return;
             }
             else if((useNonsenseExchangeType || useNonsenseArguments) && !isBroker010()
-                    && String.valueOf(AMQConstant.COMMAND_INVALID.getCode()).equals(e.getErrorCode()))
+                    && String.valueOf(ErrorCodes.COMMAND_INVALID).equals(e.getErrorCode()))
             {
                 return;
             }

Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/client/queue/QueuePolicyTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/client/queue/QueuePolicyTest.java?rev=1770514&r1=1770513&r2=1770514&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/client/queue/QueuePolicyTest.java
(original)
+++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/client/queue/QueuePolicyTest.java
Sat Nov 19 21:19:11 2016
@@ -20,13 +20,6 @@
 */
 package org.apache.qpid.test.client.queue;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.test.utils.QpidBrokerTestCase;
-
 import javax.jms.Connection;
 import javax.jms.Destination;
 import javax.jms.MessageConsumer;
@@ -34,6 +27,13 @@ import javax.jms.MessageProducer;
 import javax.jms.Session;
 import javax.jms.TextMessage;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.qpid.AMQException;
+import org.apache.qpid.client.AMQSession;
+import org.apache.qpid.test.utils.QpidBrokerTestCase;
+
 public class QueuePolicyTest extends QpidBrokerTestCase
 {
     private static final Logger _logger = LoggerFactory.getLogger(QueuePolicyTest.class);
@@ -83,7 +83,7 @@ public class QueuePolicyTest extends Qpi
         }
         catch (AMQException e)
         {
-           assertTrue("The correct error code is not set",e.getErrorCode().toString().contains("506"));
+           assertEquals("The correct error code is not set",506, e.getErrorCode());
         }
     }
     

Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/AMQSessionTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/AMQSessionTest.java?rev=1770514&r1=1770513&r2=1770514&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/AMQSessionTest.java
(original)
+++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/AMQSessionTest.java
Sat Nov 19 21:19:11 2016
@@ -20,6 +20,10 @@
  */
 package org.apache.qpid.test.unit.client;
 
+import javax.jms.JMSException;
+import javax.jms.QueueReceiver;
+import javax.jms.TopicSubscriber;
+
 import org.apache.qpid.AMQChannelClosedException;
 import org.apache.qpid.client.AMQConnection;
 import org.apache.qpid.client.AMQDestination;
@@ -27,13 +31,9 @@ import org.apache.qpid.client.AMQQueue;
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.client.AMQTopic;
 import org.apache.qpid.configuration.ClientProperties;
-import org.apache.qpid.protocol.AMQConstant;
+import org.apache.qpid.protocol.ErrorCodes;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
 
-import javax.jms.JMSException;
-import javax.jms.QueueReceiver;
-import javax.jms.TopicSubscriber;
-
 
 public class AMQSessionTest extends QpidBrokerTestCase
 {
@@ -130,7 +130,7 @@ public class AMQSessionTest extends Qpid
         }
         catch(AMQChannelClosedException cce)
         {
-            assertEquals(AMQConstant.NOT_FOUND, cce.getErrorCode());
+            assertEquals(ErrorCodes.NOT_FOUND, cce.getErrorCode());
         }
     }
 

Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/DynamicQueueExchangeCreateTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/DynamicQueueExchangeCreateTest.java?rev=1770514&r1=1770513&r2=1770514&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/DynamicQueueExchangeCreateTest.java
(original)
+++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/client/DynamicQueueExchangeCreateTest.java
Sat Nov 19 21:19:11 2016
@@ -36,7 +36,7 @@ import javax.jms.Session;
 import org.apache.qpid.AMQException;
 import org.apache.qpid.client.AMQSession;
 import org.apache.qpid.configuration.ClientProperties;
-import org.apache.qpid.protocol.AMQConstant;
+import org.apache.qpid.protocol.ErrorCodes;
 import org.apache.qpid.server.model.Exchange;
 import org.apache.qpid.server.model.LifetimePolicy;
 import org.apache.qpid.systest.rest.RestTestHelper;
@@ -92,7 +92,7 @@ public class DynamicQueueExchangeCreateT
         }
         catch (JMSException e)
         {
-            checkExceptionErrorCode(e, AMQConstant.NOT_FOUND);
+            checkExceptionErrorCode(e, ErrorCodes.NOT_FOUND);
         }
     }
 
@@ -114,7 +114,7 @@ public class DynamicQueueExchangeCreateT
         }
         catch (JMSException e)
         {
-            checkExceptionErrorCode(e, AMQConstant.NOT_FOUND);
+            checkExceptionErrorCode(e, ErrorCodes.NOT_FOUND);
         }
 
         assertFalse("Exchange exists", exchangeExists(exchangeName));
@@ -219,12 +219,12 @@ public class DynamicQueueExchangeCreateT
                     exchangeExists);
     }
 
-    private void checkExceptionErrorCode(JMSException original, AMQConstant code)
+    private void checkExceptionErrorCode(JMSException original, int code)
     {
         Exception linked = original.getLinkedException();
         assertNotNull("Linked exception should have been set", linked);
         assertTrue("Linked exception should be an AMQProtocolException", linked instanceof
AMQException);
-        assertEquals("Error code should be " + code.getCode(), code, ((AMQException) linked).getErrorCode());
+        assertEquals("Error code should be " + code, code, ((AMQException) linked).getErrorCode());
     }
 
     public void testAutoDeleteExchangeDeclarationByProducer() throws Exception

Modified: qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java?rev=1770514&r1=1770513&r2=1770514&view=diff
==============================================================================
--- qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java
(original)
+++ qpid/java/trunk/systests/src/test/java/org/apache/qpid/test/unit/transacted/TransactionTimeoutTestCase.java
Sat Nov 19 21:19:11 2016
@@ -20,14 +20,10 @@
  */
 package org.apache.qpid.test.unit.transacted;
 
-import junit.framework.TestCase;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.configuration.ClientProperties;
-import org.apache.qpid.protocol.AMQConstant;
-import org.apache.qpid.test.utils.QpidBrokerTestCase;
-import org.apache.qpid.util.LogMonitor;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.jms.Connection;
 import javax.jms.DeliveryMode;
@@ -39,10 +35,15 @@ import javax.jms.MessageProducer;
 import javax.jms.Queue;
 import javax.jms.Session;
 import javax.jms.TextMessage;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
+
+import junit.framework.TestCase;
+
+import org.apache.qpid.AMQException;
+import org.apache.qpid.client.AMQSession;
+import org.apache.qpid.configuration.ClientProperties;
+import org.apache.qpid.protocol.ErrorCodes;
+import org.apache.qpid.test.utils.QpidBrokerTestCase;
+import org.apache.qpid.util.LogMonitor;
 
 /**
  * The {@link TestCase} for transaction timeout testing.
@@ -66,7 +67,7 @@ public abstract class TransactionTimeout
 
     private final CountDownLatch _exceptionListenerLatch = new CountDownLatch(1);
     private final AtomicInteger _exceptionCount = new AtomicInteger(0);
-    private volatile AMQConstant _linkedExceptionCode;
+    private volatile int _linkedExceptionCode;
     private volatile String _linkedExceptionMessage;
 
     /**
@@ -215,8 +216,8 @@ public abstract class TransactionTimeout
         assertNotNull("Linked exception message should not be null", _linkedExceptionMessage);
         assertTrue("Linked exception message '" + _linkedExceptionMessage + "' should contain
'" + reason + "'",
                    _linkedExceptionMessage.contains(reason + " transaction timed out"));
-        assertNotNull("Linked exception should have an error code", _linkedExceptionCode);
-        assertEquals("Linked exception error code should be 506", AMQConstant.RESOURCE_ERROR,
_linkedExceptionCode);
+        assertTrue("Linked exception should have an error code", _linkedExceptionCode !=
0);
+        assertEquals("Linked exception error code should be 506", ErrorCodes.RESOURCE_ERROR,
_linkedExceptionCode);
     }
 
     /** @see javax.jms.ExceptionListener#onException(javax.jms.JMSException) */



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message