@@ -62,9 +62,34 @@ protected void releaseResources() throws IOException {
62
62
this .channel .exchangeDelete (TTL_EXCHANGE );
63
63
}
64
64
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
+ }
68
93
}
69
94
70
95
public void testCreateQueueWithInvalidTTL () throws Exception {
@@ -76,7 +101,7 @@ public void testCreateQueueWithInvalidTTL() throws Exception {
76
101
}
77
102
}
78
103
79
- public void testCreateQueueWithZeroTTL () throws Exception {
104
+ public void testTTLMustBeGtZero () throws Exception {
80
105
try {
81
106
declareQueue (TTL_INVALID_QUEUE_NAME , 0 );
82
107
fail ("Should not be able to declare a queue with zero for x-message-ttl" );
@@ -85,6 +110,24 @@ public void testCreateQueueWithZeroTTL() throws Exception {
85
110
}
86
111
}
87
112
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
+
88
131
/*
89
132
* Test messages expire when using basic get.
90
133
*/
0 commit comments