diff options
| author | Rafael H. Schloming <rhs@apache.org> | 2008-04-16 13:32:13 +0000 |
|---|---|---|
| committer | Rafael H. Schloming <rhs@apache.org> | 2008-04-16 13:32:13 +0000 |
| commit | d054b41aaa1466b65c9dc2acf1b22ca98ec3128c (patch) | |
| tree | 08055eba3020d3dcad5c9a9587d98b15d0b97c89 /java/client/src/test | |
| parent | f375be1908ad22329fe9ed21a8c196475ade7e59 (diff) | |
| download | qpid-python-d054b41aaa1466b65c9dc2acf1b22ca98ec3128c.tar.gz | |
QPID-901: updates to the java client to use the 0-10 final spec instead of the 0-10 preview spec; this includes improvements to the codegen process as well as some modifications to the shared code path in the client to not lose per message state when consumers are closed.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@648692 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client/src/test')
4 files changed, 16 insertions, 35 deletions
diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/ack/RecoverTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/ack/RecoverTest.java index 283db2a95b..216bbedef3 100644 --- a/java/client/src/test/java/org/apache/qpid/test/unit/ack/RecoverTest.java +++ b/java/client/src/test/java/org/apache/qpid/test/unit/ack/RecoverTest.java @@ -287,7 +287,7 @@ public class RecoverTest extends QpidTestCase con.start(); - long waitTime = 300000L; + long waitTime = 30000L; long waitUntilTime = System.currentTimeMillis() + waitTime; synchronized (lock) diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/close/TopicPublisherCloseTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/close/TopicPublisherCloseTest.java index 2535692b5e..4957d700e6 100644 --- a/java/client/src/test/java/org/apache/qpid/test/unit/close/TopicPublisherCloseTest.java +++ b/java/client/src/test/java/org/apache/qpid/test/unit/close/TopicPublisherCloseTest.java @@ -50,6 +50,9 @@ public class TopicPublisherCloseTest extends QpidTestCase public void testAllMethodsThrowAfterConnectionClose() throws Exception { + // give external brokers a chance to start up + Thread.sleep(3000); + AMQConnection connection = (AMQConnection) getConnection("guest", "guest"); Topic destination1 = new AMQTopic(connection, "t1"); diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/transacted/CommitRollbackTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/transacted/CommitRollbackTest.java index cae8634f37..495cc98f31 100644 --- a/java/client/src/test/java/org/apache/qpid/test/unit/transacted/CommitRollbackTest.java +++ b/java/client/src/test/java/org/apache/qpid/test/unit/transacted/CommitRollbackTest.java @@ -276,7 +276,7 @@ public class CommitRollbackTest extends QpidTestCase _session.commit(); assertNotNull("test message was consumed and rolled back, but is gone", result); assertEquals("test message was correct message", MESSAGE_TEXT, ((TextMessage) result).getText()); - assertTrue("Messasge is not marked as redelivered", result.getJMSRedelivered()); + assertTrue("Message is not marked as redelivered", result.getJMSRedelivered()); } /** @@ -318,7 +318,7 @@ public class CommitRollbackTest extends QpidTestCase _session.commit(); assertNotNull("test message was consumed and rolled back, but is gone", result); assertEquals("test message was correct message", MESSAGE_TEXT, ((TextMessage) result).getText()); - assertTrue("Messasge is not marked as redelivered", result.getJMSRedelivered()); + assertTrue("Message is not marked as redelivered", result.getJMSRedelivered()); } /** @@ -430,7 +430,7 @@ public class CommitRollbackTest extends QpidTestCase _pubSession.commit(); _logger.info("getting test message"); - Message result = _consumer.receive(1000); + Message result = _consumer.receive(5000); assertNotNull("Message received should not be null", result); assertEquals("1", ((TextMessage) result).getText()); @@ -444,39 +444,24 @@ public class CommitRollbackTest extends QpidTestCase _logger.info("receiving result"); -// NOTE: Both msg 1 & 2 will be marked as redelivered as they have both will have been rejected. -// Only the occasion where it is not rejected will it mean it hasn't arrived at the client yet. - result = _consumer.receive(1000); - assertNotNull("test message was consumed and rolled back, but is gone", result); -// The first message back will be either 1 or 2 being redelivered - if (result.getJMSRedelivered()) - { - assertTrue("Messasge is not marked as redelivered" + result, result.getJMSRedelivered()); - } - else // or it will be msg 2 arriving the first time due to latency. - { - _logger.info("Message 2 wasn't prefetched so wasn't rejected"); - assertEquals("2", ((TextMessage) result).getText()); - } + // Message 2 may be marked as redelivered if it was prefetched. + result = _consumer.receive(5000); + assertNotNull("Second message was not consumed, but is gone", result); - result = _consumer.receive(1000); + // The first message back will be 2, message 1 has been received but not committed + // Closing the consumer does not commit the session. - if (isBroker08()) + // if this is message 1 then it should be marked as redelivered + if("1".equals(((TextMessage) result).getText())) { - assertNotNull("test message was consumed and rolled back, but is gone", result); - // assertTrue("Messasge is not marked as redelivered" + result, result.getJMSRedelivered()); - } - else - { - assertNull("test message was consumed and not rolled back, but is redelivered", result); + fail("First message was recieved again"); } result = _consumer.receive(1000); assertNull("test message should be null:" + result, result); _session.commit(); - } public void testPutThenRollbackThenGet() throws Exception diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/transacted/TransactedTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/transacted/TransactedTest.java index 1339cf9060..d96e8546e2 100644 --- a/java/client/src/test/java/org/apache/qpid/test/unit/transacted/TransactedTest.java +++ b/java/client/src/test/java/org/apache/qpid/test/unit/transacted/TransactedTest.java @@ -219,14 +219,7 @@ public class TransactedTest extends QpidTestCase // ensure sent messages are not visible and received messages are requeued expect("RB_A", consumer1.receive(1000), true); expect("RB_B", consumer1.receive(1000), true); - if( isBroker08() ) - { - expect("RB_C", consumer1.receive(1000), true); - } - else - { - expect("RB_C", consumer1.receive(1000), false); - } + expect("RB_C", consumer1.receive(1000), true); _logger.info("Starting new connection"); testCon.start(); testConsumer1 = testSession.createConsumer(queue1); |
