Skip to content

Commit 073f1f6

Browse files
author
Alexandru Scvortov
committed
refactor
1 parent 6c63448 commit 073f1f6

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ public void testConfirmQueueDelete()
138138

139139
channel.queueDelete("confirm-test-noconsumer");
140140

141-
while (ackSet.size() > 0)
142-
Thread.sleep(10);
141+
waitAcks();
143142
}
144143

145144
public void testConfirmQueuePurge()
@@ -149,26 +148,23 @@ public void testConfirmQueuePurge()
149148

150149
channel.queuePurge("confirm-test-noconsumer");
151150

152-
while (ackSet.size() > 0)
153-
Thread.sleep(10);
151+
waitAcks();
154152
}
155153

156154
public void testConfirmBasicReject()
157155
throws IOException, InterruptedException
158156
{
159157
basicRejectCommon(false);
160158

161-
while (ackSet.size() > 0)
162-
Thread.sleep(10);
159+
waitAcks();
163160
}
164161

165162
public void testConfirmQueueTTL()
166163
throws IOException, InterruptedException
167164
{
168165
publishN("", "confirm-ttl", true, false, false);
169166

170-
while (ackSet.size() > 0)
171-
Thread.sleep(10);
167+
waitAcks();
172168
}
173169

174170
public void testConfirmBasicRejectRequeue()
@@ -183,8 +179,7 @@ public void testConfirmBasicRejectRequeue()
183179
channel.basicConsume("confirm-test-noconsumer", true,
184180
new DefaultConsumer(channel));
185181

186-
while (ackSet.size() > 0)
187-
Thread.sleep(10);
182+
waitAcks();
188183
}
189184

190185
/* Publish NUM_MESSAGES persistent messages and wait for
@@ -196,8 +191,7 @@ public void confirmTest(String exchange, String queueName,
196191
{
197192
publishN(exchange, queueName, persistent, mandatory, immediate);
198193

199-
while (ackSet.size() > 0)
200-
Thread.sleep(10);
194+
waitAcks();
201195
}
202196

203197
private void publishN(String exchangeName, String queueName,
@@ -242,4 +236,9 @@ private void basicRejectCommon(boolean requeue)
242236
channel.basicReject(dtag, requeue);
243237
}
244238
}
239+
240+
private void waitAcks() throws InterruptedException {
241+
while (ackSet.size() > 0)
242+
Thread.sleep(10);
243+
}
245244
}

0 commit comments

Comments
 (0)