Skip to content

Commit b5121ae

Browse files
author
Emile Joubert
committed
Merged bug24523 into default
2 parents cfb4a02 + 3a56102 commit b5121ae

17 files changed

+12
-82
lines changed

test/src/com/rabbitmq/client/test/functional/Transactions.java

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

test/src/com/rabbitmq/examples/ChannelCreationPerformance.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
// Copyright (c) 2007-2011 VMware, Inc. All rights reserved.
1515
//
1616

17-
1817
package com.rabbitmq.examples;
1918

2019
import com.rabbitmq.client.*;
@@ -32,27 +31,27 @@ static Connection connect() throws Exception{
3231

3332
abstract static class PerformanceTest{
3433
String name;
35-
Connection c;
34+
Connection c;
3635
int i;
3736

3837
PerformanceTest(String name){
3938
this.name = name;
4039
}
41-
40+
4241
void run() throws Exception{
4342
System.out.println(name);
4443
for(i = START; i <= CHANNEL_MAX ; i += STEP){
4544
c = connect();
46-
long start = System.currentTimeMillis();
47-
body();
45+
long start = System.currentTimeMillis();
46+
body();
4847
long time = System.currentTimeMillis() - start;
4948
System.out.println(i + "\t" + time + " (" + (1000 * i / ((double)time)) + " channels/s)");
5049
c.close();
5150
}
52-
}
51+
}
5352

5453
abstract void body() throws Exception;
55-
54+
5655
}
5756

5857
public static void main(String[] args) throws Exception{
@@ -62,22 +61,22 @@ void body() throws Exception{
6261
c.createChannel();
6362
}
6463
}
65-
}.run();
64+
}.run();
6665

6766
new PerformanceTest("Sequential creation followed by close:"){
6867
void body() throws Exception{
6968
for(int j = 1; j <= i; j++){
7069
c.createChannel().close();
7170
}
7271
}
73-
}.run();
72+
}.run();
7473

7574
new PerformanceTest("Sequential creation then bulk close:"){
7675
void body() throws Exception{
7776
ArrayList<Channel> channels = new ArrayList<Channel>();
7877
for(int j = 1; j <= i; j++){
7978
channels.add(c.createChannel());
80-
}
79+
}
8180
for(Channel chan : channels) chan.close();
8281
}
8382
}.run();
@@ -87,7 +86,7 @@ void body() throws Exception{
8786
ArrayList<Channel> channels = new ArrayList<Channel>();
8887
for(int j = 1; j <= i; j++){
8988
channels.add(c.createChannel());
90-
}
89+
}
9190
Collections.shuffle(channels);
9291
for(Channel chan : channels) chan.close();
9392
}

test/src/com/rabbitmq/examples/FileConsumer.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.apache.commons.cli.Option;
2929
import org.apache.commons.cli.Options;
3030

31-
import com.rabbitmq.client.AMQP;
3231
import com.rabbitmq.client.Channel;
3332
import com.rabbitmq.client.Connection;
3433
import com.rabbitmq.client.ConnectionFactory;
@@ -121,8 +120,4 @@ public static void main(String[] args) {
121120
private static String strArg(CommandLine cmd, char opt, String def) {
122121
return cmd.getOptionValue(opt, def);
123122
}
124-
125-
private static int intArg(CommandLine cmd, char opt, int def) {
126-
return Integer.parseInt(cmd.getOptionValue(opt, Integer.toString(def)));
127-
}
128123
}

test/src/com/rabbitmq/examples/FileProducer.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.apache.commons.cli.Option;
2929
import org.apache.commons.cli.Options;
3030

31-
import com.rabbitmq.client.AMQP;
3231
import com.rabbitmq.client.Channel;
3332
import com.rabbitmq.client.Connection;
3433
import com.rabbitmq.client.ConnectionFactory;
@@ -96,8 +95,4 @@ public static void main(String[] args) {
9695
private static String strArg(CommandLine cmd, char opt, String def) {
9796
return cmd.getOptionValue(opt, def);
9897
}
99-
100-
private static int intArg(CommandLine cmd, char opt, int def) {
101-
return Integer.parseInt(cmd.getOptionValue(opt, Integer.toString(def)));
102-
}
10398
}

test/src/com/rabbitmq/examples/HelloClient.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@
1414
// Copyright (c) 2007-2011 VMware, Inc. All rights reserved.
1515
//
1616

17-
1817
package com.rabbitmq.examples;
1918

20-
import com.rabbitmq.client.AMQP;
2119
import com.rabbitmq.client.Channel;
2220
import com.rabbitmq.client.Connection;
2321
import com.rabbitmq.client.ConnectionFactory;

test/src/com/rabbitmq/examples/HelloJsonClient.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@
1414
// Copyright (c) 2007-2011 VMware, Inc. All rights reserved.
1515
//
1616

17-
1817
package com.rabbitmq.examples;
1918

20-
import com.rabbitmq.client.AMQP;
2119
import com.rabbitmq.client.Channel;
2220
import com.rabbitmq.client.Connection;
2321
import com.rabbitmq.client.ConnectionFactory;

test/src/com/rabbitmq/examples/HelloJsonServer.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@
1414
// Copyright (c) 2007-2011 VMware, Inc. All rights reserved.
1515
//
1616

17-
1817
package com.rabbitmq.examples;
1918

20-
import com.rabbitmq.client.AMQP;
2119
import com.rabbitmq.client.Channel;
2220
import com.rabbitmq.client.Connection;
2321
import com.rabbitmq.client.ConnectionFactory;

test/src/com/rabbitmq/examples/LogTail.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@
1414
// Copyright (c) 2007-2011 VMware, Inc. All rights reserved.
1515
//
1616

17-
1817
package com.rabbitmq.examples;
1918

20-
import com.rabbitmq.client.AMQP;
2119
import com.rabbitmq.client.Channel;
2220
import com.rabbitmq.client.Connection;
2321
import com.rabbitmq.client.ConnectionFactory;

test/src/com/rabbitmq/examples/ManyConnections.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@
1414
// Copyright (c) 2007-2011 VMware, Inc. All rights reserved.
1515
//
1616

17-
1817
package com.rabbitmq.examples;
1918

20-
import com.rabbitmq.client.AMQP;
2119
import com.rabbitmq.client.Channel;
2220
import com.rabbitmq.client.ConnectionFactory;
2321
import com.rabbitmq.client.Connection;

0 commit comments

Comments
 (0)