@@ -30,13 +30,6 @@ public class Transactions extends BrokerTestCase
3030
3131 protected long latestTag = 0L ;
3232
33- protected void setUp ()
34- throws IOException
35- {
36- super .setUp ();
37- closeChannel ();
38- }
39-
4033 protected void createResources () throws IOException {
4134 channel .queueDeclare (Q , false , false , false , null );
4235 }
@@ -101,14 +94,12 @@ private void basicAck()
10194 public void testCommitPublish ()
10295 throws IOException
10396 {
104- openChannel ();
10597 txSelect ();
10698 basicPublish ();
10799 assertNull (basicGet ());
108100 txCommit ();
109101 assertNotNull (basicGet ());
110102 txCommit ();
111- closeChannel ();
112103 }
113104
114105 /*
@@ -117,12 +108,10 @@ public void testCommitPublish()
117108 public void testRollbackPublish ()
118109 throws IOException
119110 {
120- openChannel ();
121111 txSelect ();
122112 basicPublish ();
123113 txRollback ();
124114 assertNull (basicGet ());
125- closeChannel ();
126115 }
127116
128117 /*
@@ -131,13 +120,11 @@ public void testRollbackPublish()
131120 public void testRollbackPublishOnClose ()
132121 throws IOException
133122 {
134- openChannel ();
135123 txSelect ();
136124 basicPublish ();
137125 closeChannel ();
138126 openChannel ();
139127 assertNull (basicGet ());
140- closeChannel ();
141128 }
142129
143130 /*
@@ -146,7 +133,6 @@ public void testRollbackPublishOnClose()
146133 public void testRequeueOnClose ()
147134 throws IOException
148135 {
149- openChannel ();
150136 basicPublish ();
151137 basicPublish ();
152138 txSelect ();
@@ -159,7 +145,6 @@ public void testRequeueOnClose()
159145 basicAck ();
160146 assertNotNull (basicGet ());
161147 basicAck ();
162- closeChannel ();
163148 }
164149
165150 /*
@@ -169,7 +154,6 @@ public void testRequeueOnClose()
169154 public void testCommitAcks ()
170155 throws IOException
171156 {
172- openChannel ();
173157 basicPublish ();
174158 basicPublish ();
175159 txSelect ();
@@ -183,7 +167,6 @@ public void testCommitAcks()
183167 assertNotNull (basicGet ());
184168 basicAck ();
185169 assertNull (basicGet ());
186- closeChannel ();
187170 }
188171
189172 /*
@@ -193,7 +176,6 @@ public void testCommitAcks()
193176 public void testRollbackAcksAndReAck ()
194177 throws IOException
195178 {
196- openChannel ();
197179 basicPublish ();
198180 txSelect ();
199181 basicGet ();
@@ -205,7 +187,6 @@ public void testRollbackAcksAndReAck()
205187 openChannel ();
206188 assertNotNull (basicGet ());
207189 basicAck ();
208- closeChannel ();
209190 }
210191
211192 /*
@@ -214,7 +195,6 @@ public void testRollbackAcksAndReAck()
214195 public void testUnknownTagAck ()
215196 throws IOException
216197 {
217- openChannel ();
218198 basicPublish ();
219199 txSelect ();
220200 basicGet ();
@@ -223,7 +203,6 @@ public void testUnknownTagAck()
223203 // "On a transacted channel, this check MUST be done immediately and
224204 // not delayed until a Tx.Commit."
225205 expectError (AMQP .PRECONDITION_FAILED );
226- openChannel ();
227206 }
228207
229208 /*
@@ -232,7 +211,6 @@ public void testUnknownTagAck()
232211 public void testNoRequeueOnRollback ()
233212 throws IOException
234213 {
235- openChannel ();
236214 basicPublish ();
237215 basicPublish ();
238216 txSelect ();
@@ -241,7 +219,6 @@ public void testNoRequeueOnRollback()
241219 basicGet ();
242220 txRollback ();
243221 assertNull (basicGet ());
244- closeChannel ();
245222 }
246223
247224 /*
@@ -250,14 +227,12 @@ public void testNoRequeueOnRollback()
250227 public void testAutoAck ()
251228 throws IOException
252229 {
253- openChannel ();
254230 basicPublish ();
255231 txSelect ();
256232 basicGet (true );
257233 closeChannel ();
258234 openChannel ();
259235 assertNull (basicGet ());
260- closeChannel ();
261236 }
262237
263238 /*
@@ -266,7 +241,6 @@ public void testAutoAck()
266241 public void testAckAll ()
267242 throws IOException
268243 {
269- openChannel ();
270244 basicPublish ();
271245 basicPublish ();
272246 txSelect ();
@@ -277,13 +251,11 @@ public void testAckAll()
277251 closeChannel ();
278252 openChannel ();
279253 assertNull (basicGet ());
280- closeChannel ();
281254 }
282255
283256 public void testNonTransactedCommit ()
284257 throws IOException
285258 {
286- openChannel ();
287259 try {
288260 txCommit ();
289261 fail ("Expected channel error" );
@@ -295,7 +267,6 @@ public void testNonTransactedCommit()
295267 public void testNonTransactedRollback ()
296268 throws IOException
297269 {
298- openChannel ();
299270 try {
300271 txRollback ();
301272 fail ("Expected channel error" );
@@ -307,7 +278,6 @@ public void testNonTransactedRollback()
307278 public void testRedeliverAckedUncommitted ()
308279 throws IOException
309280 {
310- openChannel ();
311281 txSelect ();
312282 basicPublish ();
313283 txCommit ();
@@ -320,13 +290,11 @@ public void testRedeliverAckedUncommitted()
320290
321291 assertNull ("Acked uncommitted message redelivered" ,
322292 basicGet (true ));
323- closeChannel ();
324293 }
325294
326295 public void testCommitWithDeletedQueue ()
327296 throws IOException
328297 {
329- openChannel ();
330298 txSelect ();
331299 basicPublish ();
332300 releaseResources ();
@@ -338,15 +306,13 @@ public void testCommitWithDeletedQueue()
338306 openChannel ();
339307 fail ("commit failed" );
340308 } finally {
341- createResources ();
342- closeChannel ();
309+ createResources (); // To allow teardown to function cleanly
343310 }
344311 }
345312
346313 public void testShuffleAcksBeforeRollback ()
347314 throws IOException
348315 {
349- openChannel ();
350316 for (int i = 0 ; i < 3 ; i ++) {
351317 basicPublish ();
352318 }
0 commit comments