Skip to content

Commit 8e133c3

Browse files
author
Matthew Sackman
committed
Merging heads
2 parents 75e5fca + 4e2621d commit 8e133c3

File tree

5 files changed

+120
-30
lines changed

5 files changed

+120
-30
lines changed

nexus-upload.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ set -e
99
# GNUPG_PATH -- the path to the home directory for gnupg
1010

1111
NEXUS_ROOT="http://$CREDS@oss.sonatype.org/service/local/staging/deploy/maven2/com/rabbitmq/amqp-client/$VERSION"
12+
unset http_proxy
13+
unset https_proxy
14+
unset no_proxy
1215

1316
for artifact in $@; do
1417
echo "Uploading $artifact"
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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-2010 LShift
22+
// Ltd. Portions created by Cohesive Financial Technologies LLC are
23+
// Copyright (C) 2007-2010 Cohesive Financial Technologies
24+
// LLC. Portions created by Rabbit Technologies Ltd are Copyright
25+
// (C) 2007-2010 Rabbit Technologies Ltd.
26+
//
27+
// All Rights Reserved.
28+
//
29+
// Contributor(s): ______________________________________.
30+
//
31+
32+
package com.rabbitmq.client.test.functional;
33+
34+
import java.io.IOException;
35+
36+
import com.rabbitmq.client.AMQP;
37+
import com.rabbitmq.client.ShutdownSignalException;
38+
import com.rabbitmq.client.test.BrokerTestCase;
39+
40+
/* Declare an exchange, bind a queue to it, then try to delete it,
41+
* setting if-unused to true. This should throw an exception. */
42+
public class ExchangeDeleteIfUnused extends BrokerTestCase {
43+
private final static String EXCHANGE_NAME = "xchg1";
44+
private final static String ROUTING_KEY = "something";
45+
46+
protected void createResources()
47+
throws IOException
48+
{
49+
super.createResources();
50+
channel.exchangeDeclare(EXCHANGE_NAME, "direct");
51+
String queueName = channel.queueDeclare().getQueue();
52+
channel.queueBind(queueName, EXCHANGE_NAME, ROUTING_KEY);
53+
}
54+
55+
protected void releaseResources()
56+
throws IOException
57+
{
58+
channel.exchangeDelete(EXCHANGE_NAME);
59+
super.releaseResources();
60+
}
61+
62+
/* Attempt to Exchange.Delete(ifUnused = true) a used exchange.
63+
* Should throw an exception. */
64+
public void testExchangeDelete() {
65+
try {
66+
channel.exchangeDelete(EXCHANGE_NAME, true);
67+
fail("Exception expected if exchange in use");
68+
} catch (IOException e) {
69+
checkShutdownSignal(AMQP.PRECONDITION_FAILED, e);
70+
}
71+
}
72+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public static TestSuite suite() {
5050
suite.addTestSuite(DurableOnTransient.class);
5151
suite.addTestSuite(NoRequeueOnCancel.class);
5252
suite.addTestSuite(Bug20004Test.class);
53+
suite.addTestSuite(ExchangeDeleteIfUnused.class);
5354
suite.addTestSuite(QosTests.class);
5455
suite.addTestSuite(AlternateExchange.class);
5556
suite.addTestSuite(ExchangeDeclare.class);

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

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,18 @@
3535
import java.util.HashMap;
3636

3737
import com.rabbitmq.client.Channel;
38+
import com.rabbitmq.client.Connection;
39+
import com.rabbitmq.client.ConnectionFactory;
40+
import com.rabbitmq.client.test.BrokerTestCase;
41+
import com.rabbitmq.tools.Host;
3842

3943
/**
4044
* This tests whether exclusive, durable queues are deleted when appropriate
4145
* (following the scenarios given in bug 20578).
4246
*/
43-
public class ExclusiveQueueDurability extends RestartBase {
47+
public class ExclusiveQueueDurability extends BrokerTestCase {
48+
private Channel secondaryChannel;
49+
private Connection secondaryConnection;
4450

4551
HashMap<String, Object> noArgs = new HashMap<String, Object>();
4652

@@ -54,12 +60,47 @@ void verifyQueueMissing(Channel channel, String queueName)
5460
}
5561
}
5662

63+
@Override
64+
protected void createResources() throws IOException {
65+
super.createResources();
66+
openChannel();
67+
68+
}
69+
70+
// TODO extract some commonality between this and DurableBindingLifecycle
71+
public void openChannel()
72+
throws IOException
73+
{
74+
ConnectionFactory cf2 = connectionFactory.clone();
75+
cf2.setHost("localhost");
76+
cf2.setPort(5673);
77+
secondaryConnection = cf2.newConnection();
78+
secondaryChannel = secondaryConnection.createChannel();
79+
}
80+
81+
@Override
82+
protected void releaseResources() throws IOException {
83+
secondaryChannel.abort();
84+
secondaryChannel = null;
85+
secondaryConnection.abort();
86+
secondaryConnection = null;
87+
super.releaseResources();
88+
}
89+
5790
// 1) connection and queue are on same node, node restarts -> queue
5891
// should no longer exist
5992
public void testConnectionQueueSameNode() throws Exception {
60-
channel.queueDeclare("scenario1", true, true, false, noArgs);
93+
secondaryChannel.queueDeclare("scenario1", true, true, false, noArgs);
6194
restartAbruptly();
62-
verifyQueueMissing(channel, "scenario1");
95+
verifyQueueMissing(secondaryChannel, "scenario1");
96+
}
97+
98+
protected void restartAbruptly() throws IOException {
99+
secondaryConnection.abort();
100+
secondaryConnection = null;
101+
secondaryChannel = null;
102+
Host.executeCommand("cd ../rabbitmq-test; make restart-secondary-node");
103+
openChannel();
63104
}
64105

65106
/*

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

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,10 @@
3535

3636
import java.io.IOException;
3737

38-
import com.rabbitmq.client.GetResponse;
39-
import com.rabbitmq.client.MessageProperties;
4038
import com.rabbitmq.tools.Host;
4139

4240
public class RestartBase extends BrokerTestCase
4341
{
44-
45-
// The time in ms the RabbitMQ persister waits before flushing the
46-
// persister log
47-
//
48-
// This matches the value of LOG_BUNDLE_DELAY in
49-
// rabbit_persister.erl
50-
protected static final int PERSISTER_DELAY = 5;
51-
52-
// The number of entries that the RabbitMQ persister needs to
53-
// write before it takes a snapshot.
54-
//
55-
// This matches the value of MAX_WRAP_ENTRIES in
56-
// rabbit_persister.erl
57-
protected final int PERSISTER_SNAPSHOT_THRESHOLD = 500;
58-
5942
protected void restart()
6043
throws IOException
6144
{
@@ -64,19 +47,9 @@ protected void restart()
6447
setUp();
6548
}
6649

67-
protected void restartAbruptly()
68-
throws IOException
69-
{
70-
Host.executeCommand("cd ../rabbitmq-test; make restart-node");
71-
// we do this so that setUp will reconnect
72-
connection = null;
73-
setUp();
74-
}
75-
7650
protected void forceSnapshot()
7751
throws IOException, InterruptedException
7852
{
7953
Host.executeCommand("cd ../rabbitmq-test; make force-snapshot");
8054
}
81-
8255
}

0 commit comments

Comments
 (0)