Skip to content

Commit a5427e5

Browse files
author
Alexandru Scvortov
committed
add missing test
remove misleading comments
1 parent 95d584d commit a5427e5

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

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

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
package com.rabbitmq.client.test.functional;
3333

3434
import com.rabbitmq.client.test.BrokerTestCase;
35+
import com.rabbitmq.client.AMQP;
3536
import com.rabbitmq.client.AckListener;
37+
import com.rabbitmq.client.Channel;
3638
import com.rabbitmq.client.DefaultConsumer;
3739
import com.rabbitmq.client.GetResponse;
3840
import com.rabbitmq.client.MessageProperties;
@@ -174,7 +176,6 @@ public void testConfirmBasicRejectRequeue()
174176
/* wait confirms to go through the broker */
175177
Thread.sleep(1000);
176178

177-
/* duplicate confirms mean requeued messages were confirmed */
178179
channel.basicConsume("confirm-test-noconsumer", true,
179180
new DefaultConsumer(channel));
180181

@@ -196,13 +197,44 @@ public void testConfirmBasicRecover()
196197

197198
Thread.sleep(1000);
198199

199-
/* duplicate confirms mean recovered messages were confirmed */
200200
channel.basicConsume("confirm-test-noconsumer", true,
201201
new DefaultConsumer(channel));
202202

203203
waitAcks();
204204
}
205205

206+
public void testConfirmSelect()
207+
throws IOException
208+
{
209+
try {
210+
Channel ch = connection.createChannel();
211+
ch.confirmSelect(false);
212+
ch.txSelect();
213+
fail();
214+
} catch (IOException ioe) {
215+
checkShutdownSignal(AMQP.PRECONDITION_FAILED, ioe);
216+
}
217+
try {
218+
Channel ch = connection.createChannel();
219+
ch.txSelect();
220+
ch.confirmSelect(false);
221+
fail();
222+
} catch (IOException ioe) {
223+
checkShutdownSignal(AMQP.PRECONDITION_FAILED, ioe);
224+
}
225+
try {
226+
Channel ch = connection.createChannel();
227+
ch.confirmSelect(true);
228+
ch.confirmSelect(false);
229+
fail();
230+
} catch (IOException ioe) {
231+
checkShutdownSignal(AMQP.PRECONDITION_FAILED, ioe);
232+
}
233+
Channel ch = connection.createChannel();
234+
ch.confirmSelect(true);
235+
ch.confirmSelect(true);
236+
}
237+
206238
/* Publish NUM_MESSAGES persistent messages and wait for
207239
* confirmations. */
208240
public void confirmTest(String exchange, String queueName,

0 commit comments

Comments
 (0)