Skip to content

Commit 1e01610

Browse files
author
Rob Harrop
committed
Merge with default
2 parents e64ada6 + 459ee98 commit 1e01610

File tree

3 files changed

+12
-47
lines changed

3 files changed

+12
-47
lines changed

src/com/rabbitmq/client/impl/ValueWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public final void writeTable(Map<String, Object> table)
109109
out.writeInt(0);
110110
} else {
111111
out.writeInt((int)Frame.tableSize(table));
112-
for(Map.Entry<String,Object> entry: table.entrySet()) {
112+
for(Map.Entry<String,Object> entry: table.entrySet()) {
113113
writeShortstr(entry.getKey());
114114
Object value = entry.getValue();
115115
writeFieldValue(value);

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

Lines changed: 10 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,9 @@
1818
package com.rabbitmq.client.test.server;
1919

2020
import java.io.IOException;
21-
import java.util.HashMap;
2221

2322
import com.rabbitmq.client.AMQP;
2423
import com.rabbitmq.client.Channel;
25-
import com.rabbitmq.client.Connection;
26-
import com.rabbitmq.client.ConnectionFactory;
2724
import com.rabbitmq.client.test.BrokerTestCase;
2825
import com.rabbitmq.tools.Host;
2926

@@ -32,13 +29,9 @@
3229
* (following the scenarios given in bug 20578).
3330
*/
3431
public class ExclusiveQueueDurability extends BrokerTestCase {
35-
private Channel secondaryChannel;
36-
private Connection secondaryConnection;
3732

38-
HashMap<String, Object> noArgs = new HashMap<String, Object>();
39-
40-
void verifyQueueMissing(Channel channel, String queueName)
41-
throws IOException {
33+
void verifyQueueMissing(Channel channel, String queueName)
34+
throws IOException {
4235
try {
4336
channel.queueDeclare(queueName, false, false, false, null);
4437
} catch (IOException ioe) {
@@ -47,47 +40,19 @@ void verifyQueueMissing(Channel channel, String queueName)
4740
}
4841
}
4942

50-
@Override
51-
protected void createResources() throws IOException {
52-
super.createResources();
53-
openChannel();
54-
55-
}
56-
57-
// TODO extract some commonality between this and DurableBindingLifecycle
58-
public void openChannel()
59-
throws IOException
60-
{
61-
ConnectionFactory cf2 = connectionFactory.clone();
62-
cf2.setHost("localhost");
63-
cf2.setPort(5673);
64-
secondaryConnection = cf2.newConnection();
65-
secondaryChannel = secondaryConnection.createChannel();
66-
}
67-
68-
@Override
69-
protected void releaseResources() throws IOException {
70-
secondaryChannel.abort();
71-
secondaryChannel = null;
72-
secondaryConnection.abort();
73-
secondaryConnection = null;
74-
super.releaseResources();
75-
}
76-
7743
// 1) connection and queue are on same node, node restarts -> queue
7844
// should no longer exist
7945
public void testConnectionQueueSameNode() throws Exception {
80-
secondaryChannel.queueDeclare("scenario1", true, true, false, noArgs);
81-
restartAbruptly();
82-
verifyQueueMissing(secondaryChannel, "scenario1");
46+
channel.queueDeclare("scenario1", true, true, false, null);
47+
restartPrimaryAbruptly();
48+
verifyQueueMissing(channel, "scenario1");
8349
}
8450

85-
protected void restartAbruptly() throws IOException {
86-
secondaryConnection.abort();
87-
secondaryConnection = null;
88-
secondaryChannel = null;
89-
Host.executeCommand("cd ../rabbitmq-test; make restart-secondary-node");
90-
openChannel();
51+
private void restartPrimaryAbruptly() throws IOException {
52+
connection = null;
53+
channel = null;
54+
Host.executeCommand("cd ../rabbitmq-test; make restart-app");
55+
setUp();
9156
}
9257

9358
/*

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class MessageRecovery extends BrokerTestCase
2525

2626
private final static String Q = "recovery-test";
2727

28-
public void test() throws IOException, InterruptedException {
28+
public void testMessageRecovery() throws IOException, InterruptedException {
2929
channel.confirmSelect();
3030
channel.queueDeclare(Q, true, false, false, null);
3131
channel.basicPublish("", Q, false, false,

0 commit comments

Comments
 (0)