Skip to content

Commit 891c3b1

Browse files
author
Marek Majkowski
committed
bug20570 merged into default
2 parents 6fab1d3 + 8e7c939 commit 891c3b1

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public static TestSuite suite() {
7171
suite.addTestSuite(UnexpectedFrames.class);
7272
suite.addTestSuite(PerQueueTTL.class);
7373
suite.addTestSuite(SaslMechanisms.class);
74+
suite.addTestSuite(UserIDHeader.class);
7475
suite.addTestSuite(InternalExchange.class);
7576
return suite;
7677
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.rabbitmq.client.test.functional;
2+
3+
import com.rabbitmq.client.AMQP;
4+
import com.rabbitmq.client.test.BrokerTestCase;
5+
6+
import java.io.IOException;
7+
8+
public class UserIDHeader extends BrokerTestCase {
9+
public void testValidUserId() throws IOException {
10+
AMQP.BasicProperties properties = new AMQP.BasicProperties();
11+
properties.setUserId("guest");
12+
channel.basicPublish("amq.fanout", "", properties, "".getBytes());
13+
}
14+
15+
public void testInvalidUserId() {
16+
AMQP.BasicProperties properties = new AMQP.BasicProperties();
17+
properties.setUserId("not the guest, honest");
18+
try {
19+
channel.basicPublish("amq.fanout", "", properties, "".getBytes());
20+
channel.queueDeclare(); // To flush the channel
21+
fail("Accepted publish with incorrect user ID");
22+
} catch (IOException e) {
23+
checkShutdownSignal(AMQP.PRECONDITION_FAILED, e);
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)