Skip to content

Commit d7f801d

Browse files
author
Emile Joubert
committed
Exercise exchange binding
1 parent 36abca8 commit d7f801d

File tree

4 files changed

+141
-2
lines changed

4 files changed

+141
-2
lines changed

docs/specs/amqp0-9-1.stripped.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
262262
<field name="no-wait" domain="no-wait"/>
263263
<field name="arguments" domain="table"/>
264264
</method>
265-
<method name="unbind-ok" synchronous="1" index="41">
265+
<method name="unbind-ok" synchronous="1" index="51">
266266
<chassis name="client" implement="MUST"/>
267267
</method>
268268
</class>

docs/specs/amqp0-9-1.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1546,7 +1546,7 @@
15461546
</field>
15471547
</method>
15481548

1549-
<method name = "unbind-ok" synchronous = "1" index = "41"
1549+
<method name = "unbind-ok" synchronous = "1" index = "51"
15501550
label = "confirm unbind successful">
15511551
<doc>This method confirms that the unbind was successful.</doc>
15521552
<chassis name = "client" implement = "MUST"/>
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// This source code is dual-licensed under the Apache License, version
2+
// 2.0, and the Mozilla Public License, version 1.1.
3+
//
4+
// The APL v2.0:
5+
//
6+
//---------------------------------------------------------------------------
7+
// Copyright (C) 2007-2011 VMware, Inc.
8+
//
9+
// Licensed under the Apache License, Version 2.0 (the "License");
10+
// you may not use this file except in compliance with the License.
11+
// You may obtain a copy of the License at
12+
//
13+
// http://www.apache.org/licenses/LICENSE-2.0
14+
//
15+
// Unless required by applicable law or agreed to in writing, software
16+
// distributed under the License is distributed on an "AS IS" BASIS,
17+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
// See the License for the specific language governing permissions and
19+
// limitations under the License.
20+
//---------------------------------------------------------------------------
21+
//
22+
// The MPL v1.1:
23+
//
24+
//---------------------------------------------------------------------------
25+
// The contents of this file are subject to the Mozilla Public License
26+
// Version 1.1 (the "License"); you may not use this file except in
27+
// compliance with the License. You may obtain a copy of the License
28+
// at http://www.mozilla.org/MPL/
29+
//
30+
// Software distributed under the License is distributed on an "AS IS"
31+
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
32+
// the License for the specific language governing rights and
33+
// limitations under the License.
34+
//
35+
// The Original Code is RabbitMQ.
36+
//
37+
// The Initial Developer of the Original Code is VMware, Inc.
38+
// Copyright (c) 2007-2011 VMware, Inc. All rights reserved.
39+
//---------------------------------------------------------------------------
40+
41+
using NUnit.Framework;
42+
43+
namespace RabbitMQ.Client.Unit
44+
{
45+
46+
public class IntegrationFixture
47+
{
48+
protected IConnection Conn;
49+
protected IModel Model;
50+
51+
[SetUp]
52+
public void Init()
53+
{
54+
ConnectionFactory connFactory = new ConnectionFactory();
55+
Conn = connFactory.CreateConnection();
56+
Model = Conn.CreateModel();
57+
}
58+
59+
[TearDown]
60+
public void Dispose()
61+
{
62+
Model.Close();
63+
Conn.Close();
64+
}
65+
}
66+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// This source code is dual-licensed under the Apache License, version
2+
// 2.0, and the Mozilla Public License, version 1.1.
3+
//
4+
// The APL v2.0:
5+
//
6+
//---------------------------------------------------------------------------
7+
// Copyright (C) 2007-2011 VMware, Inc.
8+
//
9+
// Licensed under the Apache License, Version 2.0 (the "License");
10+
// you may not use this file except in compliance with the License.
11+
// You may obtain a copy of the License at
12+
//
13+
// http://www.apache.org/licenses/LICENSE-2.0
14+
//
15+
// Unless required by applicable law or agreed to in writing, software
16+
// distributed under the License is distributed on an "AS IS" BASIS,
17+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
// See the License for the specific language governing permissions and
19+
// limitations under the License.
20+
//---------------------------------------------------------------------------
21+
//
22+
// The MPL v1.1:
23+
//
24+
//---------------------------------------------------------------------------
25+
// The contents of this file are subject to the Mozilla Public License
26+
// Version 1.1 (the "License"); you may not use this file except in
27+
// compliance with the License. You may obtain a copy of the License
28+
// at http://www.mozilla.org/MPL/
29+
//
30+
// Software distributed under the License is distributed on an "AS IS"
31+
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
32+
// the License for the specific language governing rights and
33+
// limitations under the License.
34+
//
35+
// The Original Code is RabbitMQ.
36+
//
37+
// The Initial Developer of the Original Code is VMware, Inc.
38+
// Copyright (c) 2007-2011 VMware, Inc. All rights reserved.
39+
//---------------------------------------------------------------------------
40+
41+
using System;
42+
using System.Threading;
43+
using NUnit.Framework;
44+
45+
namespace RabbitMQ.Client.Unit
46+
{
47+
[TestFixture]
48+
public class TestExtensions : IntegrationFixture
49+
{
50+
[Test]
51+
public void TestExchangeBinding()
52+
{
53+
Model.ExchangeDeclare("src", ExchangeType.Direct, false, false, null);
54+
Model.ExchangeDeclare("dest", ExchangeType.Direct, false, false, null);
55+
String queue = Model.QueueDeclare();
56+
57+
Model.ExchangeBind("dest", "src", String.Empty);
58+
Model.QueueBind(queue, "dest", String.Empty);
59+
60+
Model.BasicPublish("src", String.Empty, null, new byte[] { });
61+
Thread.Sleep(100);
62+
Assert.IsNotNull(Model.BasicGet(queue, true));
63+
64+
Model.ExchangeUnbind("dest", "src", String.Empty);
65+
Model.BasicPublish("src", String.Empty, null, new byte[] { });
66+
Thread.Sleep(100);
67+
Assert.IsNull(Model.BasicGet(queue, true));
68+
69+
Model.ExchangeDelete("src");
70+
Model.ExchangeDelete("dest");
71+
}
72+
}
73+
}

0 commit comments

Comments
 (0)