Skip to content

Commit 52451f3

Browse files
committed
Added test for bug19356
1 parent 551481a commit 52451f3

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed

test/src/com/rabbitmq/client/test/AllTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public static TestSuite suite() {
4444
suite.addTest(ValueOrExceptionTest.suite());
4545
suite.addTest(BrokenFramesTest.suite());
4646
suite.addTestSuite(Bug20004Test.class);
47+
suite.addTestSuite(Bug19356Test.class);
4748
return suite;
4849
}
4950
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
// The contents of this file are subject to the Mozilla Public License
2+
// Version 1.1 (the "License"); you may not use this file except in
3+
// compliance with the License. You may obtain a copy of the License at
4+
// http://www.mozilla.org/MPL/
5+
//
6+
// Software distributed under the License is distributed on an "AS IS"
7+
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
8+
// License for the specific language governing rights and limitations
9+
// under the License.
10+
//
11+
// The Original Code is RabbitMQ.
12+
//
13+
// The Initial Developers of the Original Code are LShift Ltd,
14+
// Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
15+
//
16+
// Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
17+
// Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
18+
// are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
19+
// Technologies LLC, and Rabbit Technologies Ltd.
20+
//
21+
// Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
22+
// Ltd. Portions created by Cohesive Financial Technologies LLC are
23+
// Copyright (C) 2007-2009 Cohesive Financial Technologies
24+
// LLC. Portions created by Rabbit Technologies Ltd are Copyright
25+
// (C) 2007-2009 Rabbit Technologies Ltd.
26+
//
27+
// All Rights Reserved.
28+
//
29+
// Contributor(s): ______________________________________.
30+
//
31+
package com.rabbitmq.client.test;
32+
33+
import java.io.IOException;
34+
import java.security.NoSuchAlgorithmException;
35+
import java.security.KeyManagementException;
36+
37+
import com.rabbitmq.client.GetResponse;
38+
import com.rabbitmq.client.AMQP;
39+
40+
import com.rabbitmq.client.test.functional.BrokerTestCase;
41+
42+
/**
43+
* Test for bug 19356 - SSL Support in rabbitmq
44+
*
45+
*/
46+
public class Bug19356Test extends BrokerTestCase {
47+
48+
public Exception caughtException = null;
49+
public boolean completed = false;
50+
public boolean created = false;
51+
52+
public void openConnection()
53+
throws IOException
54+
{
55+
try {
56+
connectionFactory.useSslProtocol();
57+
} catch (NoSuchAlgorithmException ex) {
58+
throw new IOException(ex);
59+
} catch (KeyManagementException ex) {
60+
throw new IOException(ex);
61+
}
62+
63+
64+
if (connection == null) {
65+
connection = connectionFactory.newConnection("localhost", 5673);
66+
}
67+
}
68+
69+
protected void releaseResources()
70+
throws IOException
71+
{
72+
if (created) {
73+
channel.queueDelete("Bug19356Test");
74+
}
75+
}
76+
77+
public void testBug19356()
78+
throws IOException
79+
{
80+
channel.queueDeclare("Bug19356Test");
81+
channel.basicPublish("", "Bug19356Test", null, "SSL".getBytes());
82+
83+
GetResponse chResponse = channel.basicGet("rabbitmq-java-test", false);
84+
assertTrue(chResponse != null);
85+
86+
AMQP.BasicProperties props = chResponse.getProps();
87+
byte[] body = chResponse.getBody();
88+
assertEquals("SSL", new String(body));
89+
}
90+
}

0 commit comments

Comments
 (0)