Skip to content

Commit 3e26c82

Browse files
committed
Merge bug21987 into default
2 parents 282acea + 75c53fe commit 3e26c82

29 files changed

+612
-511
lines changed

build.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,9 @@
327327
</fail>
328328
</target>
329329

330-
<target name="test-suite-run" depends="test, test-ssl, test-persister-restart, test-functional, test-main-silent"/>
330+
<target name="test-suite-run" depends="test-client, test-ssl, test-server, test-functional, test-main-silent"/>
331331

332-
<target name="test" depends="test-build">
332+
<target name="test-client" depends="test-build">
333333
<junit printSummary="withOutAndErr"
334334
haltOnFailure="${haltOnFailureJunit}"
335335
failureproperty="test.failure"
@@ -338,7 +338,7 @@
338338

339339
<formatter type="plain"/>
340340
<formatter type="xml"/>
341-
<test todir="${build.out}" name="com.rabbitmq.client.test.AllTest"/>
341+
<test todir="${build.out}" name="com.rabbitmq.client.test.ClientTests"/>
342342
</junit>
343343
</target>
344344

@@ -375,7 +375,7 @@
375375
</junit>
376376
</target>
377377

378-
<target name="test-persister-restart" depends="test-build">
378+
<target name="test-server" depends="test-build">
379379
<junit printSummary="withOutAndErr"
380380
haltOnFailure="${haltOnFailureJunit}"
381381
failureproperty="test.failure"
@@ -384,7 +384,7 @@
384384
<formatter type="plain"/>
385385
<formatter type="xml"/>
386386
<test todir="${build.out}"
387-
name="com.rabbitmq.client.test.functional.PersisterRestartTests"/>
387+
name="com.rabbitmq.client.test.server.ServerTests"/>
388388
</junit>
389389
</target>
390390

test/src/com/rabbitmq/client/test/functional/BrokerTestCase.java renamed to test/src/com/rabbitmq/client/test/BrokerTestCase.java

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
// Contributor(s): ______________________________________.
3030
//
3131

32-
package com.rabbitmq.client.test.functional;
32+
package com.rabbitmq.client.test;
3333

3434
import java.io.IOException;
3535

@@ -39,6 +39,8 @@
3939
import com.rabbitmq.client.Command;
4040
import com.rabbitmq.client.Connection;
4141
import com.rabbitmq.client.ConnectionFactory;
42+
import com.rabbitmq.client.GetResponse;
43+
import com.rabbitmq.client.MessageProperties;
4244
import com.rabbitmq.client.ShutdownSignalException;
4345

4446
import com.rabbitmq.client.AMQP;
@@ -137,4 +139,64 @@ public void checkShutdownSignal(int expectedCode, IOException ioe) {
137139
assertEquals(expectedCode, closeMethod.getReplyCode());
138140
}
139141
}
142+
143+
protected void assertDelivered(String q, int count) throws IOException {
144+
assertDelivered(q, count, false);
145+
}
146+
147+
protected void assertDelivered(String q, int count, boolean redelivered) throws IOException {
148+
GetResponse r;
149+
for (int i = 0; i < count; i++) {
150+
r = basicGet(q);
151+
assertNotNull(r);
152+
assertEquals(r.getEnvelope().isRedeliver(), redelivered);
153+
}
154+
assertNull(basicGet(q));
155+
}
156+
157+
protected GetResponse basicGet(String q) throws IOException {
158+
return channel.basicGet(q, true);
159+
}
160+
161+
protected void basicPublishPersistent(String q) throws IOException {
162+
channel.basicPublish("", q, MessageProperties.PERSISTENT_TEXT_PLAIN, "persistent message".getBytes());
163+
}
164+
165+
protected void basicPublishPersistent(String x, String routingKey) throws IOException {
166+
channel.basicPublish(x, routingKey, MessageProperties.PERSISTENT_TEXT_PLAIN, "persistent message".getBytes());
167+
}
168+
169+
protected void basicPublishVolatile(String q) throws IOException {
170+
channel.basicPublish("", q, MessageProperties.TEXT_PLAIN, "not persistent message".getBytes());
171+
}
172+
173+
protected void basicPublishVolatile(String x, String routingKey) throws IOException {
174+
channel.basicPublish(x, routingKey, MessageProperties.TEXT_PLAIN, "not persistent message".getBytes());
175+
}
176+
177+
protected void declareAndBindDurableQueue(String q, String x, String r) throws IOException {
178+
declareDurableQueue(q);
179+
channel.queueBind(q, x, r);
180+
}
181+
182+
protected void declareDurableDirectExchange(String x) throws IOException {
183+
channel.exchangeDeclare(x, "direct", true);
184+
}
185+
186+
protected void declareDurableQueue(String q) throws IOException {
187+
channel.queueDeclare(q, true);
188+
}
189+
190+
protected void declareDurableTopicExchange(String x) throws IOException {
191+
channel.exchangeDeclare(x, "topic", true);
192+
}
193+
194+
protected void deleteExchange(String x) throws IOException {
195+
channel.exchangeDelete(x);
196+
}
197+
198+
protected void deleteQueue(String q) throws IOException {
199+
channel.queueDelete(q);
200+
}
201+
140202
}

test/src/com/rabbitmq/client/test/functional/Bug20004Test.java renamed to test/src/com/rabbitmq/client/test/Bug20004Test.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828
//
2929
// Contributor(s): ______________________________________.
3030
//
31-
package com.rabbitmq.client.test.functional;
31+
package com.rabbitmq.client.test;
3232

33+
import com.rabbitmq.client.test.functional.*;
3334
import java.io.IOException;
3435

3536
/**

test/src/com/rabbitmq/client/test/AllTest.java renamed to test/src/com/rabbitmq/client/test/ClientTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,17 @@
3434
import junit.framework.TestCase;
3535
import junit.framework.TestSuite;
3636

37-
public class AllTest extends TestCase {
37+
public class ClientTests extends TestCase {
3838
public static TestSuite suite() {
39-
TestSuite suite = new TestSuite("all");
39+
TestSuite suite = new TestSuite("client");
4040
suite.addTest(TableTest.suite());
4141
suite.addTest(BlockingCellTest.suite());
4242
suite.addTest(TruncatedInputStreamTest.suite());
4343
suite.addTest(AMQConnectionTest.suite());
4444
suite.addTest(ValueOrExceptionTest.suite());
4545
suite.addTest(BrokenFramesTest.suite());
4646
suite.addTest(ClonePropertiesTest.suite());
47+
suite.addTestSuite(Bug20004Test.class);
4748
return suite;
4849
}
4950
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
package com.rabbitmq.client.test.functional;
3333

34+
import com.rabbitmq.client.test.BrokerTestCase;
3435
import com.rabbitmq.client.AMQP;
3536
import com.rabbitmq.client.ReturnListener;
3637
import com.rabbitmq.client.GetResponse;

0 commit comments

Comments
 (0)