@@ -56,7 +56,7 @@ private static boolean[] expected(String key) {
5656 return expected ;
5757 }
5858
59- protected void setUp () throws IOException {
59+ @ Override protected void setUp () throws IOException {
6060 super .setUp ();
6161 channel .setReturnListener (new ReturnListener () {
6262 public void handleBasicReturn (int replyCode ,
@@ -71,6 +71,18 @@ public void handleBasicReturn(int replyCode,
7171 });
7272 }
7373
74+ @ Override protected void createResources () throws IOException {
75+ for (String q : resources ) {
76+ channel .queueDeclare (q );
77+ }
78+ }
79+
80+ @ Override protected void releaseResources () throws IOException {
81+ for (String q : resources ) {
82+ channel .queueDelete (q );
83+ }
84+ }
85+
7486 protected void setupRouting (String x , String ume ) throws IOException {
7587 Map <String , Object > args = new HashMap <String , Object >();
7688 if (ume != null ) args .put ("ume" , ume );
@@ -122,10 +134,6 @@ protected void check(String key, boolean ret) throws IOException {
122134
123135 public void testUme () throws IOException {
124136
125- for (String q : resources ) {
126- channel .queueDeclare (q , false , false , true , false , null );
127- }
128-
129137 //check various cases of missing UMEs - we expect to see some
130138 //warnings in the server logs
131139
@@ -167,11 +175,22 @@ public void testUme() throws IOException {
167175 }
168176
169177 //cleanup
170- for (String r : resources ) {
171- channel .exchangeDelete (r );
172- channel .queueDelete (r );
178+ for (String e : resources ) {
179+ channel .exchangeDelete (e );
173180 }
174181
175182 }
176183
184+ public void testCycleBreaking () throws IOException {
185+ setupRouting ("x" , "u" );
186+ setupRouting ("u" , "v" );
187+ setupRouting ("v" , "x" );
188+
189+ check ("z" , false );
190+
191+ for (String e : resources ) {
192+ channel .exchangeDelete (e );
193+ }
194+ }
195+
177196}
0 commit comments