Skip to content

Commit 87ecd0a

Browse files
author
Matthias Radestock
committed
merge default into bug19662
2 parents 1941b77 + 2f128bc commit 87ecd0a

File tree

3 files changed

+72
-52
lines changed

3 files changed

+72
-52
lines changed

src/com/rabbitmq/client/ConnectionFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public void useSslProtocol(String protocol, TrustManager trustManager)
128128
{
129129
SSLContext c = SSLContext.getInstance(protocol);
130130
c.init(null, new TrustManager[] { trustManager }, null);
131-
setSocketFactory(c.getSocketFactory());
131+
useSslProtocol(c);
132132
}
133133

134134
/**

src/com/rabbitmq/client/ConnectionParameters.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ private static String safeGetProperty(String key, String def) {
6363
public static final int DEFAULT_FRAME_MAX = 0;
6464

6565
/** Default value for desired heartbeat interval; zero for none */
66-
public static final int DEFAULT_HEARTBEAT = 3;
66+
public static final int DEFAULT_HEARTBEAT = 0;
6767

6868
private String _userName = DEFAULT_USER;
6969
private String _password = DEFAULT_PASS;

test/src/com/rabbitmq/client/test/functional/Routing.java

Lines changed: 70 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
import java.io.IOException;
3838
import java.util.List;
3939
import java.util.ArrayList;
40-
import java.util.Hashtable;
40+
import java.util.HashMap;
41+
import java.util.Map;
4142

4243
public class Routing extends BrokerTestCase
4344
{
@@ -166,55 +167,74 @@ public void testTopicRouting() throws Exception {
166167
}
167168

168169
public void testHeadersRouting() throws Exception {
169-
Hashtable<String, Object> spec = new Hashtable<String, Object>();
170-
spec.put("h1", "12345");
171-
spec.put("h2", "bar");
172-
// See bug 20154: no current way to add a "Void"-typed spec pattern.
173-
spec.put("x-match", "all");
174-
channel.queueBind(Q1, "amq.match", "", spec);
175-
spec.put("x-match", "any");
176-
channel.queueBind(Q2, "amq.match", "", spec);
177-
178-
AMQP.BasicProperties props = new AMQP.BasicProperties();
179-
180-
channel.basicPublish("amq.match", "", null, "0".getBytes());
181-
channel.basicPublish("amq.match", "", props, "0b".getBytes());
182-
183-
props.setHeaders(new Hashtable<String, Object>());
184-
props.getHeaders().put("h1", "12345");
185-
channel.basicPublish("amq.match", "", props, "1".getBytes());
186-
187-
props.setHeaders(new Hashtable<String, Object>());
188-
props.getHeaders().put("h1", 12345);
189-
channel.basicPublish("amq.match", "", props, "1b".getBytes());
190-
191-
props.setHeaders(new Hashtable<String, Object>());
192-
props.getHeaders().put("h2", "bar");
193-
channel.basicPublish("amq.match", "", props, "2".getBytes());
194-
195-
props.setHeaders(new Hashtable<String, Object>());
196-
props.getHeaders().put("h1", "12345");
197-
props.getHeaders().put("h2", "bar");
198-
channel.basicPublish("amq.match", "", props, "3".getBytes());
199-
200-
props.setHeaders(new Hashtable<String, Object>());
201-
props.getHeaders().put("h1", "12345");
202-
props.getHeaders().put("h2", "quux");
203-
channel.basicPublish("amq.match", "", props, "4".getBytes());
204-
205-
props.setHeaders(new Hashtable<String, Object>());
206-
props.getHeaders().put("h1", "zot");
207-
props.getHeaders().put("h2", "quux");
208-
channel.basicPublish("amq.match", "", props, "5".getBytes());
209-
210-
checkGet(Q1, true); // 3
211-
checkGet(Q1, false);
212-
213-
checkGet(Q2, true); // 1
214-
checkGet(Q2, true); // 2
215-
checkGet(Q2, true); // 3
216-
checkGet(Q2, true); // 4
217-
checkGet(Q2, false);
170+
Map<String, Object> spec = new HashMap<String, Object>();
171+
spec.put("h1", "12345");
172+
spec.put("h2", "bar");
173+
spec.put("h3", null);
174+
spec.put("x-match", "all");
175+
channel.queueBind(Q1, "amq.match", "", spec);
176+
spec.put("x-match", "any");
177+
channel.queueBind(Q2, "amq.match", "", spec);
178+
179+
AMQP.BasicProperties props = new AMQP.BasicProperties();
180+
181+
channel.basicPublish("amq.match", "", null, "0".getBytes());
182+
channel.basicPublish("amq.match", "", props, "0b".getBytes());
183+
184+
props.setHeaders(new HashMap<String, Object>());
185+
props.getHeaders().put("h1", "12345");
186+
channel.basicPublish("amq.match", "", props, "1".getBytes());
187+
188+
props.setHeaders(new HashMap<String, Object>());
189+
props.getHeaders().put("h1", 12345);
190+
channel.basicPublish("amq.match", "", props, "1b".getBytes());
191+
192+
props.setHeaders(new HashMap<String, Object>());
193+
props.getHeaders().put("h2", "bar");
194+
channel.basicPublish("amq.match", "", props, "2".getBytes());
195+
196+
props.setHeaders(new HashMap<String, Object>());
197+
props.getHeaders().put("h1", "12345");
198+
props.getHeaders().put("h2", "bar");
199+
channel.basicPublish("amq.match", "", props, "3".getBytes());
200+
201+
props.setHeaders(new HashMap<String, Object>());
202+
props.getHeaders().put("h1", "12345");
203+
props.getHeaders().put("h2", "bar");
204+
props.getHeaders().put("h3", null);
205+
channel.basicPublish("amq.match", "", props, "4".getBytes());
206+
207+
props.setHeaders(new HashMap<String, Object>());
208+
props.getHeaders().put("h1", "12345");
209+
props.getHeaders().put("h2", "quux");
210+
channel.basicPublish("amq.match", "", props, "5".getBytes());
211+
212+
props.setHeaders(new HashMap<String, Object>());
213+
props.getHeaders().put("h1", "zot");
214+
props.getHeaders().put("h2", "quux");
215+
props.getHeaders().put("h3", null);
216+
channel.basicPublish("amq.match", "", props, "6".getBytes());
217+
218+
props.setHeaders(new HashMap<String, Object>());
219+
props.getHeaders().put("h3", null);
220+
channel.basicPublish("amq.match", "", props, "7".getBytes());
221+
222+
props.setHeaders(new HashMap<String, Object>());
223+
props.getHeaders().put("h1", "zot");
224+
props.getHeaders().put("h2", "quux");
225+
channel.basicPublish("amq.match", "", props, "8".getBytes());
226+
227+
checkGet(Q1, true); // 4
228+
checkGet(Q1, false);
229+
230+
checkGet(Q2, true); // 1
231+
checkGet(Q2, true); // 2
232+
checkGet(Q2, true); // 3
233+
checkGet(Q2, true); // 4
234+
checkGet(Q2, true); // 5
235+
checkGet(Q2, true); // 6
236+
checkGet(Q2, true); // 7
237+
checkGet(Q2, false);
218238
}
219239

220240
}

0 commit comments

Comments
 (0)