@@ -56,6 +56,20 @@ public void testDeclareQueueWithNonExistingDeadLetterExchange()
56
56
declareQueue ("some.random.exchange.name" );
57
57
}
58
58
59
+ public void testDeclareQueueWithEquivalentDeadLetterExchange ()
60
+ throws IOException
61
+ {
62
+ declareQueue (DLX );
63
+ declareQueue (DLX );
64
+ }
65
+
66
+ public void testDeclareQueueWithEquivalentDeadLetterRoutingKey ()
67
+ throws IOException
68
+ {
69
+ declareQueue (TEST_QUEUE_NAME , DLX , "routing_key" , null );
70
+ declareQueue (TEST_QUEUE_NAME , DLX , "routing_key" , null );
71
+ }
72
+
59
73
public void testDeclareQueueWithInvalidDeadLetterExchangeArg ()
60
74
throws IOException
61
75
{
@@ -67,6 +81,19 @@ public void testDeclareQueueWithInvalidDeadLetterExchangeArg()
67
81
}
68
82
}
69
83
84
+ public void testRedeclareQueueWithInvalidDeadLetterExchangeArg ()
85
+ throws IOException
86
+ {
87
+ declareQueue ("inequivalent_dlx_name" , "dlx_foo" , null , null );
88
+ try {
89
+ declareQueue ("inequivalent_dlx_name" , 133 , null , null );
90
+ fail ("x-dead-letter-exchange must be a valid exchange name " +
91
+ "and must not change in subsequent declarations" );
92
+ } catch (IOException ex ) {
93
+ checkShutdownSignal (AMQP .PRECONDITION_FAILED , ex );
94
+ }
95
+ }
96
+
70
97
public void testDeclareQueueWithInvalidDeadLetterRoutingKeyArg ()
71
98
throws IOException
72
99
{
@@ -78,6 +105,19 @@ public void testDeclareQueueWithInvalidDeadLetterRoutingKeyArg()
78
105
}
79
106
}
80
107
108
+ public void testRedeclareQueueWithInvalidDeadLetterRoutingKeyArg ()
109
+ throws IOException
110
+ {
111
+ declareQueue ("inequivalent_dlx_rk" , "amq.direct" , "dlx_rk" , null );
112
+ try {
113
+ declareQueue ("inequivalent_dlx_rk" , "amq.direct" , 144 , null );
114
+ fail ("x-dead-letter-routing-key must be a string and must not " +
115
+ "change in subsequent declarations" );
116
+ } catch (IOException ex ) {
117
+ checkShutdownSignal (AMQP .PRECONDITION_FAILED , ex );
118
+ }
119
+ }
120
+
81
121
public void testDeclareQueueWithRoutingKeyButNoDeadLetterExchange ()
82
122
throws IOException
83
123
{
@@ -90,7 +130,23 @@ public void testDeclareQueueWithRoutingKeyButNoDeadLetterExchange()
90
130
} catch (IOException ex ) {
91
131
checkShutdownSignal (AMQP .PRECONDITION_FAILED , ex );
92
132
}
133
+ }
93
134
135
+ public void testRedeclareQueueWithRoutingKeyButNoDeadLetterExchange ()
136
+ throws IOException
137
+ {
138
+ try {
139
+ Map <String , Object > args = new HashMap <String , Object >();
140
+ channel .queueDeclare ("bar" , false , true , false , args );
141
+
142
+ args .put (DLX_RK_ARG , "foo" );
143
+
144
+ channel .queueDeclare ("bar" , false , true , false , args );
145
+ fail ("x-dead-letter-exchange must be specified if " +
146
+ "x-dead-letter-routing-key is set" );
147
+ } catch (IOException ex ) {
148
+ checkShutdownSignal (AMQP .PRECONDITION_FAILED , ex );
149
+ }
94
150
}
95
151
96
152
public void testDeadLetterQueueTTLExpiredMessages () throws Exception {
0 commit comments