Skip to content

Commit eace42c

Browse files
author
Simon MacMullen
committed
Rewrite passive declaration tests to be more similar in style to the rest.
1 parent bd34d6b commit eace42c

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ 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);
99101
}
100102

101103
protected void releaseResources()
@@ -106,6 +108,9 @@ public void with(String name) throws IOException {
106108
adminCh.queueDelete(name);
107109
adminCh.exchangeDelete(name);
108110
}});
111+
adminCh.exchangeDelete("no-permission");
112+
adminCh.queueDelete("no-permission");
113+
109114
adminCh.getConnection().abort();
110115
}
111116

@@ -161,14 +166,14 @@ public void with(String name) throws IOException {
161166
}
162167

163168
public void testPassiveDeclaration() throws IOException {
164-
adminCh.exchangeDeclare("xxx", "direct");
165-
adminCh.queueDeclare("xxx", false, false, false, null);
166-
// We have no permissions on these but should be able to passive
167-
// declare them anyway
168-
channel.exchangeDeclarePassive("xxx");
169-
channel.queueDeclarePassive("xxx");
170-
adminCh.exchangeDelete("xxx");
171-
adminCh.queueDelete("xxx");
169+
runTest(true, "no-permission", new WithName() {
170+
public void with(String name) throws IOException {
171+
channel.exchangeDeclarePassive(name);
172+
}});
173+
runTest(true, "no-permission", new WithName() {
174+
public void with(String name) throws IOException {
175+
channel.queueDeclarePassive(name);
176+
}});
172177
}
173178

174179
public void testBinding()

0 commit comments

Comments
 (0)