@@ -62,9 +62,34 @@ protected void releaseResources() throws IOException {
6262 this .channel .exchangeDelete (TTL_EXCHANGE );
6363 }
6464
65- public void testCreateQueueWithTTL () throws IOException {
66- AMQP .Queue .DeclareOk declareOk = declareQueue (TTL_QUEUE_NAME , 2000L );
67- assertNotNull (declareOk );
65+ public void testCreateQueueWithByteTTL () throws IOException {
66+ try {
67+ declareQueue (TTL_QUEUE_NAME , (byte )200 );
68+ } catch (IOException ex ) {
69+ fail ("Should be able to use long for queue TTL" );
70+ }
71+ }
72+ public void testCreateQueueWithShortTTL () throws IOException {
73+ try {
74+ declareQueue (TTL_QUEUE_NAME , (short )200 );
75+ } catch (IOException ex ) {
76+ fail ("Should be able to use long for queue TTL" );
77+ }
78+ }
79+ public void testCreateQueueWithIntTTL () throws IOException {
80+ try {
81+ declareQueue (TTL_QUEUE_NAME , 200 );
82+ } catch (IOException ex ) {
83+ fail ("Should be able to use long for queue TTL" );
84+ }
85+ }
86+
87+ public void testCreateQueueWithLongTTL () throws IOException {
88+ try {
89+ declareQueue (TTL_QUEUE_NAME , 200L );
90+ } catch (IOException ex ) {
91+ fail ("Should be able to use long for queue TTL" );
92+ }
6893 }
6994
7095 public void testCreateQueueWithInvalidTTL () throws Exception {
@@ -76,7 +101,7 @@ public void testCreateQueueWithInvalidTTL() throws Exception {
76101 }
77102 }
78103
79- public void testCreateQueueWithZeroTTL () throws Exception {
104+ public void testTTLMustBeGtZero () throws Exception {
80105 try {
81106 declareQueue (TTL_INVALID_QUEUE_NAME , 0 );
82107 fail ("Should not be able to declare a queue with zero for x-message-ttl" );
@@ -85,6 +110,24 @@ public void testCreateQueueWithZeroTTL() throws Exception {
85110 }
86111 }
87112
113+ public void testTTLMustBePositive () throws Exception {
114+ try {
115+ declareQueue (TTL_INVALID_QUEUE_NAME , -10 );
116+ fail ("Should not be able to declare a queue with zero for x-message-ttl" );
117+ } catch (IOException e ) {
118+ assertNotNull (e );
119+ }
120+ }
121+
122+ public void testQueueRedeclareEquivalence () throws Exception {
123+ declareQueue (TTL_QUEUE_NAME , 10 );
124+ try {
125+ declareQueue (TTL_QUEUE_NAME , 20 );
126+ } catch (IOException ex ) {
127+ checkShutdownSignal (AMQP .NOT_ALLOWED , ex );
128+ }
129+ }
130+
88131 /*
89132 * Test messages expire when using basic get.
90133 */
0 commit comments