Skip to content

Commit cb6760d

Browse files
author
Simon MacMullen
committed
Institutionalise the no-permission tests a bit more.
1 parent 232fded commit cb6760d

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

test/src/com/rabbitmq/client/test/server/Permissions.java

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ public void with(String name) throws IOException {
9696
adminCh.exchangeDeclare(name, "direct");
9797
adminCh.queueDeclare(name, false, false, false, null);
9898
}});
99-
adminCh.exchangeDeclare("no-permission", "direct");
100-
adminCh.queueDeclare("no-permission", false, false, false, null);
10199
}
102100

103101
protected void releaseResources()
@@ -108,8 +106,6 @@ public void with(String name) throws IOException {
108106
adminCh.queueDelete(name);
109107
adminCh.exchangeDelete(name);
110108
}});
111-
adminCh.exchangeDelete("no-permission");
112-
adminCh.queueDelete("no-permission");
113109

114110
adminCh.getConnection().abort();
115111
}
@@ -120,6 +116,7 @@ protected void withNames(WithName action)
120116
action.with("configure");
121117
action.with("write");
122118
action.with("read");
119+
action.with("no-permission");
123120
}
124121

125122
public void testAuth()
@@ -166,11 +163,11 @@ public void with(String name) throws IOException {
166163
}
167164

168165
public void testPassiveDeclaration() throws IOException {
169-
runTest(true, "no-permission", new WithName() {
166+
runTest(true, true, true, true, new WithName() {
170167
public void with(String name) throws IOException {
171168
channel.exchangeDeclarePassive(name);
172169
}});
173-
runTest(true, "no-permission", new WithName() {
170+
runTest(true, true, true, true, new WithName() {
174171
public void with(String name) throws IOException {
175172
channel.queueDeclarePassive(name);
176173
}});
@@ -179,11 +176,11 @@ public void with(String name) throws IOException {
179176
public void testBinding()
180177
throws IOException
181178
{
182-
runTest(false, true, false, new WithName() {
179+
runTest(false, true, false, false, new WithName() {
183180
public void with(String name) throws IOException {
184181
channel.queueBind(name, "read", "");
185182
}});
186-
runTest(false, false, true, new WithName() {
183+
runTest(false, false, true, false, new WithName() {
187184
public void with(String name) throws IOException {
188185
channel.queueBind("write", name, "");
189186
}});
@@ -192,7 +189,7 @@ public void with(String name) throws IOException {
192189
public void testPublish()
193190
throws IOException
194191
{
195-
runTest(false, true, false, new WithName() {
192+
runTest(false, true, false, false, new WithName() {
196193
public void with(String name) throws IOException {
197194
channel.basicPublish(name, "", null, "foo".getBytes());
198195
//followed by a dummy synchronous command in order
@@ -204,7 +201,7 @@ public void with(String name) throws IOException {
204201
public void testGet()
205202
throws IOException
206203
{
207-
runTest(false, false, true, new WithName() {
204+
runTest(false, false, true, false, new WithName() {
208205
public void with(String name) throws IOException {
209206
channel.basicGet(name, true);
210207
}});
@@ -213,7 +210,7 @@ public void with(String name) throws IOException {
213210
public void testConsume()
214211
throws IOException
215212
{
216-
runTest(false, false, true, new WithName() {
213+
runTest(false, false, true, false, new WithName() {
217214
public void with(String name) throws IOException {
218215
channel.basicConsume(name, new QueueingConsumer(channel));
219216
}});
@@ -222,7 +219,7 @@ public void with(String name) throws IOException {
222219
public void testPurge()
223220
throws IOException
224221
{
225-
runTest(false, false, true, new WithName() {
222+
runTest(false, false, true, false, new WithName() {
226223
public void with(String name) throws IOException {
227224
((AMQChannel)channel).exnWrappingRpc(new AMQImpl.Queue.Purge(0, name, false));
228225
}});
@@ -231,11 +228,11 @@ public void with(String name) throws IOException {
231228
public void testAltExchConfiguration()
232229
throws IOException
233230
{
234-
runTest(false, false, false,
231+
runTest(false, false, false, false,
235232
createAltExchConfigTest("configure-me"));
236-
runTest(false, false, false,
233+
runTest(false, false, false, false,
237234
createAltExchConfigTest("configure-and-write-me"));
238-
runTest(false, true, false,
235+
runTest(false, true, false, false,
239236
createAltExchConfigTest("configure-and-read-me"));
240237
}
241238

@@ -336,15 +333,17 @@ protected void runConfigureTest(WithName test)
336333
runTest(true, "configure-me", test);
337334
runTest(false, "write-me", test);
338335
runTest(false, "read-me", test);
336+
runTest(false, "no-permission", test);
339337
}
340338

341-
protected void runTest(boolean expC, boolean expW, boolean expR,
339+
protected void runTest(boolean expC, boolean expW, boolean expR, boolean expN,
342340
WithName test)
343341
throws IOException
344342
{
345343
runTest(expC, "configure", test);
346344
runTest(expW, "write", test);
347345
runTest(expR, "read", test);
346+
runTest(expN, "no-permission", test);
348347
}
349348

350349
protected void runTest(boolean exp, String name, WithName test)

0 commit comments

Comments
 (0)