File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
test/src/com/rabbitmq/client/test/functional Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments