@@ -165,21 +165,42 @@ public void testTopicRouting() throws Exception {
165
165
}
166
166
167
167
public void testUnbind () throws Exception {
168
- AMQP .Queue .DeclareOk ok = channel .queueDeclare ();
169
- String queue = ok .getQueue ();
170
168
171
- String routingKey = "quay" ;
172
169
String x = "amq.direct" ;
170
+ String q = "testUnbind" ;
171
+ String routingKey = "quay" ;
173
172
174
- channel .queueBind (queue , x , routingKey );
173
+ AMQP .Queue .DeclareOk ok = channel .queueDeclare (q );
174
+ channel .queueBind (q , x , routingKey );
175
175
channel .basicPublish (x , routingKey , null , "foobar" .getBytes ());
176
- checkGet (queue , true );
176
+ checkGet (q , true );
177
+
178
+ String [][] tests = new String [][] {
179
+ new String [] {"unknown_queue" , x , routingKey },
180
+ new String [] {q , "unknown_exchange" , routingKey },
181
+ new String [] {"unknown_queue" , "unknown_exchange" , routingKey },
182
+ // see bug 20633
183
+ // new String[] {q, x, "unknown_rk"},
184
+ new String [] {"unknown_queue" , "unknown_exchange" , "unknown_rk" }
185
+ };
186
+
187
+ for (int i = 0 ; i < tests .length ; i ++) {
188
+
189
+ String [] test = tests [i ];
190
+ try {
191
+ channel .queueUnbind (test [0 ], test [1 ], test [2 ]);
192
+ fail ("expected not_found in test " + i );
193
+ } catch (IOException ee ) {
194
+ checkShutdownSignal (AMQP .NOT_FOUND , ee );
195
+ openChannel ();
196
+ }
197
+ }
177
198
178
- channel .queueUnbind (queue , x , routingKey );
199
+ channel .queueUnbind (q , x , routingKey );
179
200
180
201
channel .basicPublish (x , routingKey , null , "foobar" .getBytes ());
181
- checkGet (queue , false );
202
+ checkGet (q , false );
182
203
183
- channel .queueDelete (queue );
204
+ channel .queueDelete (q );
184
205
}
185
206
}
0 commit comments