Skip to content

Commit ca408a0

Browse files
author
Alexandru Scvortov
committed
refactor
1 parent 91db59e commit ca408a0

File tree

1 file changed

+17
-28
lines changed

1 file changed

+17
-28
lines changed

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

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -76,55 +76,49 @@ public void handleAck(long seqNo,
7676
}
7777

7878
public void testConfirmTransient() throws IOException, InterruptedException {
79-
confirmTest("confirm-test", false, false, false);
79+
confirmTest("", "confirm-test", false, false, false);
8080
}
8181

8282
public void testConfirmPersistentSimple()
8383
throws IOException, InterruptedException
8484
{
85-
confirmTest("confirm-test", true, false, false);
85+
confirmTest("", "confirm-test", true, false, false);
8686
}
8787

8888
public void testConfirmNonDurable()
8989
throws IOException, InterruptedException
9090
{
91-
confirmTest("confirm-test-nondurable", true, false, false);
91+
confirmTest("", "confirm-test-nondurable", true, false, false);
9292
}
9393

9494
public void testConfirmPersistentImmediate()
9595
throws IOException, InterruptedException
9696
{
97-
confirmTest("confirm-test", true, false, true);
97+
confirmTest("", "confirm-test", true, false, true);
9898
}
9999

100100
public void testConfirmPersistentImmediateNoConsumer()
101101
throws IOException, InterruptedException
102102
{
103-
confirmTest("confirm-test-noconsumer", true, false, true);
103+
confirmTest("", "confirm-test-noconsumer", true, false, true);
104104
}
105105

106106
public void testConfirmPersistentMandatory()
107107
throws IOException, InterruptedException
108108
{
109-
confirmTest("confirm-test", true, true, false);
109+
confirmTest("", "confirm-test", true, true, false);
110110
}
111111

112112
public void testConfirmPersistentMandatoryReturn()
113113
throws IOException, InterruptedException
114114
{
115-
confirmTest("confirm-test-doesnotexist", true, true, false);
115+
confirmTest("", "confirm-test-doesnotexist", true, true, false);
116116
}
117117

118118
public void testConfirmMultipleQueues()
119119
throws IOException, InterruptedException
120120
{
121-
for (long i = 0; i < NUM_MESSAGES; i++) {
122-
publish("amq.direct", "confirm-multiple-queues", true, false, false);
123-
ackSet.add(i);
124-
}
125-
126-
while (ackSet.size() > 0)
127-
Thread.sleep(10);
121+
confirmTest("amq.direct", "confirm-multiple-queues", true, false, false);
128122
}
129123

130124
/* For testConfirmQueueDelete and testConfirmQueuePurge to be
@@ -136,52 +130,47 @@ public void testConfirmQueueDelete()
136130
throws IOException, InterruptedException
137131
{
138132
for (long i = 0; i < NUM_MESSAGES; i++) {
139-
publish("confirm-test-noconsumer", true, false, false);
133+
publish("", "confirm-test-noconsumer", true, false, false);
140134
ackSet.add(i);
141135
}
142136

143137
channel.queueDelete("confirm-test-noconsumer");
144138

145139
while (ackSet.size() > 0)
146-
Thread.sleep(10);
140+
Thread.sleep(10);
147141
}
148142

149143
public void testConfirmQueuePurge()
150144
throws IOException, InterruptedException
151145
{
152146
for (long i = 0; i < NUM_MESSAGES; i++) {
153-
publish("confirm-test-noconsumer", true, false, false);
147+
publish("", "confirm-test-noconsumer", true, false, false);
154148
ackSet.add(i);
155149
}
156150

157151
channel.queuePurge("confirm-test-noconsumer");
158152

159153
while (ackSet.size() > 0)
160-
Thread.sleep(10);
154+
Thread.sleep(10);
161155
}
162156

163157
/* Publish NUM_MESSAGES persistent messages and wait for
164158
* confirmations. */
165-
public void confirmTest(String queueName, boolean persistent,
166-
boolean mandatory, boolean immediate)
159+
public void confirmTest(String exchange, String queueName,
160+
boolean persistent, boolean mandatory,
161+
boolean immediate)
167162
throws IOException, InterruptedException
168163
{
169164
for (long i = 0; i < NUM_MESSAGES; i++) {
170-
publish(queueName, persistent, mandatory, immediate);
165+
publish(exchange, queueName, persistent,
166+
mandatory, immediate);
171167
ackSet.add(i);
172168
}
173169

174170
while (ackSet.size() > 0)
175171
Thread.sleep(10);
176172
}
177173

178-
private void publish(String queueName, boolean persistent,
179-
boolean mandatory, boolean immediate)
180-
throws IOException
181-
{
182-
publish("", queueName, persistent, mandatory, immediate);
183-
}
184-
185174
private void publish(String exchangeName, String queueName,
186175
boolean persistent, boolean mandatory,
187176
boolean immediate)

0 commit comments

Comments
 (0)