@@ -66,21 +66,21 @@ public void testCreateQueueWithByteTTL() throws IOException {
66
66
try {
67
67
declareQueue (TTL_QUEUE_NAME , (byte )200 );
68
68
} catch (IOException ex ) {
69
- fail ("Should be able to use long for queue TTL" );
69
+ fail ("Should be able to use byte for queue TTL" );
70
70
}
71
71
}
72
72
public void testCreateQueueWithShortTTL () throws IOException {
73
73
try {
74
74
declareQueue (TTL_QUEUE_NAME , (short )200 );
75
75
} catch (IOException ex ) {
76
- fail ("Should be able to use long for queue TTL" );
76
+ fail ("Should be able to use short for queue TTL" );
77
77
}
78
78
}
79
79
public void testCreateQueueWithIntTTL () throws IOException {
80
80
try {
81
81
declareQueue (TTL_QUEUE_NAME , 200 );
82
82
} catch (IOException ex ) {
83
- fail ("Should be able to use long for queue TTL" );
83
+ fail ("Should be able to use int for queue TTL" );
84
84
}
85
85
}
86
86
@@ -97,7 +97,7 @@ public void testCreateQueueWithInvalidTTL() throws Exception {
97
97
declareQueue (TTL_INVALID_QUEUE_NAME , "foobar" );
98
98
fail ("Should not be able to declare a queue with a non-long value for x-message-ttl" );
99
99
} catch (IOException e ) {
100
- assertNotNull ( e );
100
+ checkShutdownSignal ( AMQP . PRECONDITION_FAILED , e );
101
101
}
102
102
}
103
103
@@ -106,7 +106,7 @@ public void testTTLMustBeGtZero() throws Exception {
106
106
declareQueue (TTL_INVALID_QUEUE_NAME , 0 );
107
107
fail ("Should not be able to declare a queue with zero for x-message-ttl" );
108
108
} catch (IOException e ) {
109
- assertNotNull ( e );
109
+ checkShutdownSignal ( AMQP . PRECONDITION_FAILED , e );
110
110
}
111
111
}
112
112
@@ -115,7 +115,7 @@ public void testTTLMustBePositive() throws Exception {
115
115
declareQueue (TTL_INVALID_QUEUE_NAME , -10 );
116
116
fail ("Should not be able to declare a queue with zero for x-message-ttl" );
117
117
} catch (IOException e ) {
118
- assertNotNull ( e );
118
+ checkShutdownSignal ( AMQP . PRECONDITION_FAILED , e );
119
119
}
120
120
}
121
121
@@ -140,13 +140,13 @@ public void testPublishAndGetWithExpiry() throws Exception {
140
140
byte [] msg2 = "two" .getBytes ();
141
141
byte [] msg3 = "three" .getBytes ();
142
142
143
- this . channel . basicPublish ( TTL_EXCHANGE , TTL_QUEUE_NAME , null , msg1 );
143
+ basicPublishVolatile ( msg1 , TTL_EXCHANGE , TTL_QUEUE_NAME );
144
144
Thread .sleep (1500 );
145
145
146
- this . channel . basicPublish ( TTL_EXCHANGE , TTL_QUEUE_NAME , null , msg2 );
146
+ basicPublishVolatile ( msg2 , TTL_EXCHANGE , TTL_QUEUE_NAME );
147
147
Thread .sleep (1000 );
148
148
149
- this . channel . basicPublish ( TTL_EXCHANGE , TTL_QUEUE_NAME , null , msg3 );
149
+ basicPublishVolatile ( msg3 , TTL_EXCHANGE , TTL_QUEUE_NAME );
150
150
151
151
assertEquals ("two" , new String (get ()));
152
152
assertEquals ("three" , new String (get ()));
@@ -166,10 +166,10 @@ public void testTransactionalPublishWithGet() throws Exception {
166
166
167
167
this .channel .txSelect ();
168
168
169
- this . channel . basicPublish ( TTL_EXCHANGE , TTL_QUEUE_NAME , null , msg1 );
169
+ basicPublishVolatile ( msg1 , TTL_EXCHANGE , TTL_QUEUE_NAME );
170
170
Thread .sleep (1500 );
171
171
172
- this . channel . basicPublish ( TTL_EXCHANGE , TTL_QUEUE_NAME , null , msg2 );
172
+ basicPublishVolatile ( msg2 , TTL_EXCHANGE , TTL_QUEUE_NAME );
173
173
this .channel .txCommit ();
174
174
Thread .sleep (500 );
175
175
@@ -181,7 +181,7 @@ public void testTransactionalPublishWithGet() throws Exception {
181
181
182
182
183
183
private byte [] get () throws IOException {
184
- GetResponse response = this . channel . basicGet (TTL_QUEUE_NAME , false );
184
+ GetResponse response = basicGet (TTL_QUEUE_NAME );
185
185
if (response == null ) {
186
186
return null ;
187
187
}
0 commit comments