Skip to content

Commit 8e34df2

Browse files
author
Tim Watson
committed
cosmetic
1 parent 0677b2d commit 8e34df2

File tree

1 file changed

+67
-75
lines changed

1 file changed

+67
-75
lines changed

test/src/com/rabbitmq/client/test/BrokerTestCase.java

Lines changed: 67 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,22 @@
3333
import com.rabbitmq.client.AMQP;
3434
import com.rabbitmq.tools.Host;
3535

36-
public class BrokerTestCase extends TestCase
37-
{
36+
public class BrokerTestCase extends TestCase {
3837
protected ConnectionFactory connectionFactory = new ConnectionFactory();
3938

4039
protected Connection connection;
4140
protected Channel channel;
4241

4342
protected void setUp()
44-
throws IOException
45-
{
43+
throws IOException {
4644
openConnection();
4745
openChannel();
4846

4947
createResources();
5048
}
5149

5250
protected void tearDown()
53-
throws IOException
54-
{
51+
throws IOException {
5552
closeChannel();
5653
closeConnection();
5754

@@ -68,8 +65,8 @@ protected void tearDown()
6865
* connection and channel have been opened.
6966
*/
7067
protected void createResources()
71-
throws IOException
72-
{}
68+
throws IOException {
69+
}
7370

7471
/**
7572
* Should destroy any AMQP resources that were created by the
@@ -79,43 +76,38 @@ protected void createResources()
7976
* completes, the connection and channel will be closed again.
8077
*/
8178
protected void releaseResources()
82-
throws IOException
83-
{}
79+
throws IOException {
80+
}
8481

8582
protected void restart()
86-
throws IOException
87-
{
83+
throws IOException {
8884
tearDown();
8985
Host.executeCommand("cd ../rabbitmq-test; make restart-app");
9086
setUp();
9187
}
9288

9389
public void openConnection()
94-
throws IOException
95-
{
90+
throws IOException {
9691
if (connection == null) {
9792
connection = connectionFactory.newConnection();
9893
}
9994
}
10095

10196
public void closeConnection()
102-
throws IOException
103-
{
97+
throws IOException {
10498
if (connection != null) {
10599
connection.abort();
106100
connection = null;
107101
}
108102
}
109103

110104
public void openChannel()
111-
throws IOException
112-
{
105+
throws IOException {
113106
channel = connection.createChannel();
114107
}
115108

116109
public void closeChannel()
117-
throws IOException
118-
{
110+
throws IOException {
119111
if (channel != null) {
120112
channel.abort();
121113
channel = null;
@@ -160,79 +152,79 @@ public void expectError(int error) {
160152
}
161153
}
162154

163-
protected void assertDelivered(String q, int count) throws IOException {
164-
assertDelivered(q, count, false);
165-
}
155+
protected void assertDelivered(String q, int count) throws IOException {
156+
assertDelivered(q, count, false);
157+
}
166158

167-
protected void assertDelivered(String q, int count, boolean redelivered) throws IOException {
168-
GetResponse r;
169-
for (int i = 0; i < count; i++) {
170-
r = basicGet(q);
171-
assertNotNull(r);
172-
assertEquals(redelivered, r.getEnvelope().isRedeliver());
159+
protected void assertDelivered(String q, int count, boolean redelivered) throws IOException {
160+
GetResponse r;
161+
for (int i = 0; i < count; i++) {
162+
r = basicGet(q);
163+
assertNotNull(r);
164+
assertEquals(redelivered, r.getEnvelope().isRedeliver());
165+
}
166+
assertNull(basicGet(q));
173167
}
174-
assertNull(basicGet(q));
175-
}
176168

177-
protected GetResponse basicGet(String q) throws IOException {
178-
return channel.basicGet(q, true);
179-
}
169+
protected GetResponse basicGet(String q) throws IOException {
170+
return channel.basicGet(q, true);
171+
}
180172

181-
protected void basicPublishPersistent(String q) throws IOException {
182-
basicPublishPersistent("persistent message".getBytes(), q);
183-
}
173+
protected void basicPublishPersistent(String q) throws IOException {
174+
basicPublishPersistent("persistent message".getBytes(), q);
175+
}
184176

185-
protected void basicPublishPersistent(byte[] msg, String q) throws IOException {
186-
basicPublishPersistent(msg, "", q);
187-
}
177+
protected void basicPublishPersistent(byte[] msg, String q) throws IOException {
178+
basicPublishPersistent(msg, "", q);
179+
}
188180

189-
protected void basicPublishPersistent(String x, String routingKey) throws IOException {
190-
basicPublishPersistent("persistent message".getBytes(), x, routingKey);
181+
protected void basicPublishPersistent(String x, String routingKey) throws IOException {
182+
basicPublishPersistent("persistent message".getBytes(), x, routingKey);
191183
}
192184

193185

194-
protected void basicPublishPersistent(byte[] msg, String x, String routingKey) throws IOException {
195-
channel.basicPublish(x, routingKey, MessageProperties.PERSISTENT_TEXT_PLAIN, msg);
186+
protected void basicPublishPersistent(byte[] msg, String x, String routingKey) throws IOException {
187+
channel.basicPublish(x, routingKey, MessageProperties.PERSISTENT_TEXT_PLAIN, msg);
196188
}
197189

198-
protected void basicPublishVolatile(String q) throws IOException {
199-
basicPublishVolatile("not persistent message".getBytes(), q);
200-
}
190+
protected void basicPublishVolatile(String q) throws IOException {
191+
basicPublishVolatile("not persistent message".getBytes(), q);
192+
}
201193

202-
protected void basicPublishVolatile(byte[] msg, String q) throws IOException {
203-
basicPublishVolatile(msg, "", q);
204-
}
194+
protected void basicPublishVolatile(byte[] msg, String q) throws IOException {
195+
basicPublishVolatile(msg, "", q);
196+
}
205197

206-
protected void basicPublishVolatile(String x, String routingKey) throws IOException {
207-
basicPublishVolatile("not persistent message".getBytes(), x, routingKey);
208-
}
198+
protected void basicPublishVolatile(String x, String routingKey) throws IOException {
199+
basicPublishVolatile("not persistent message".getBytes(), x, routingKey);
200+
}
209201

210-
protected void basicPublishVolatile(byte[] msg, String x, String routingKey) throws IOException {
211-
channel.basicPublish(x, routingKey, MessageProperties.TEXT_PLAIN, msg);
212-
}
202+
protected void basicPublishVolatile(byte[] msg, String x, String routingKey) throws IOException {
203+
channel.basicPublish(x, routingKey, MessageProperties.TEXT_PLAIN, msg);
204+
}
213205

214-
protected void declareAndBindDurableQueue(String q, String x, String r) throws IOException {
215-
declareDurableQueue(q);
216-
channel.queueBind(q, x, r);
217-
}
206+
protected void declareAndBindDurableQueue(String q, String x, String r) throws IOException {
207+
declareDurableQueue(q);
208+
channel.queueBind(q, x, r);
209+
}
218210

219-
protected void declareDurableDirectExchange(String x) throws IOException {
220-
channel.exchangeDeclare(x, "direct", true);
221-
}
211+
protected void declareDurableDirectExchange(String x) throws IOException {
212+
channel.exchangeDeclare(x, "direct", true);
213+
}
222214

223-
protected void declareDurableQueue(String q) throws IOException {
224-
channel.queueDeclare(q, true, false, false, null);
225-
}
215+
protected void declareDurableQueue(String q) throws IOException {
216+
channel.queueDeclare(q, true, false, false, null);
217+
}
226218

227-
protected void declareDurableTopicExchange(String x) throws IOException {
228-
channel.exchangeDeclare(x, "topic", true);
229-
}
219+
protected void declareDurableTopicExchange(String x) throws IOException {
220+
channel.exchangeDeclare(x, "topic", true);
221+
}
230222

231-
protected void deleteExchange(String x) throws IOException {
232-
channel.exchangeDelete(x);
233-
}
223+
protected void deleteExchange(String x) throws IOException {
224+
channel.exchangeDelete(x);
225+
}
234226

235-
protected void deleteQueue(String q) throws IOException {
236-
channel.queueDelete(q);
237-
}
227+
protected void deleteQueue(String q) throws IOException {
228+
channel.queueDelete(q);
229+
}
238230
}

0 commit comments

Comments
 (0)