diff options
| author | Rafael H. Schloming <rhs@apache.org> | 2007-07-31 22:34:12 +0000 |
|---|---|---|
| committer | Rafael H. Schloming <rhs@apache.org> | 2007-07-31 22:34:12 +0000 |
| commit | 902481c5caf3a72538586a68cb779ddb9aa60c58 (patch) | |
| tree | 6efbbe527de4a95a34a0033d9e87b3d848a90bcd /java/client/src/test | |
| parent | c11f9a79eec63da7aa6e6dac248a689a9d461beb (diff) | |
| download | qpid-python-902481c5caf3a72538586a68cb779ddb9aa60c58.tar.gz | |
Rolled back revision 561365 and commented out some broken code in ClientSession.java. The trunk should now build.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@561578 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client/src/test')
3 files changed, 56 insertions, 104 deletions
diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/CloseWithBlockingReceiveTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/CloseWithBlockingReceiveTest.java index 9600d1e9d3..d19a6095d5 100644 --- a/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/CloseWithBlockingReceiveTest.java +++ b/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/CloseWithBlockingReceiveTest.java @@ -1,21 +1,18 @@ /* * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Copyright (c) 2006 The Apache Software Foundation * - * http://www.apache.org/licenses/LICENSE-2.0 + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. * */ package org.apache.qpid.test.unit.client.channelclose; diff --git a/java/client/src/test/java/org/apache/qpid/test/unit/client/forwardall/CombinedTest.java b/java/client/src/test/java/org/apache/qpid/test/unit/client/forwardall/CombinedTest.java index 9cde24dd92..9c354ee260 100644 --- a/java/client/src/test/java/org/apache/qpid/test/unit/client/forwardall/CombinedTest.java +++ b/java/client/src/test/java/org/apache/qpid/test/unit/client/forwardall/CombinedTest.java @@ -21,7 +21,9 @@ package org.apache.qpid.test.unit.client.forwardall; import junit.framework.TestCase; + import org.apache.qpid.testutil.VMBrokerSetup; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,7 +34,6 @@ import org.slf4j.LoggerFactory; public class CombinedTest extends TestCase { private static final Logger _logger = LoggerFactory.getLogger(CombinedTest.class); - private int run = 0; protected void setUp() throws Exception { @@ -47,18 +48,14 @@ public class CombinedTest extends TestCase public void testForwardAll() throws Exception { - while (run < 10) - { - int services = 2; - ServiceCreator.start("vm://:1", services); - - _logger.info("Starting " + ++run + " client..."); + int services = 2; + ServiceCreator.start("vm://:1", services); - new Client("vm://:1", services).shutdownWhenComplete(); + _logger.info("Starting client..."); + new Client("vm://:1", services).shutdownWhenComplete(); - _logger.info("Completed " + run + " successfully!"); - } + _logger.info("Completed successfully!"); } public static junit.framework.Test suite() 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 1a45773907..df2a38d0fc 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 @@ -21,10 +21,12 @@ package org.apache.qpid.test.unit.transacted; import junit.framework.TestCase; + import org.apache.qpid.AMQException; import org.apache.qpid.client.AMQConnection; import org.apache.qpid.client.transport.TransportConnection; import org.apache.qpid.url.URLSyntaxException; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -55,9 +57,6 @@ public class CommitRollbackTest extends TestCase private static final Logger _logger = LoggerFactory.getLogger(CommitRollbackTest.class); private static final String BROKER = "vm://:1"; - private boolean _gotone = false; - private boolean _gottwo = false; - private boolean _gottwoRedelivered = false; protected void setUp() throws Exception { @@ -341,98 +340,57 @@ public class CommitRollbackTest extends TestCase * * @throws Exception On error */ - public void testSend2ThenRollback() throws Exception + /*public void testSend2ThenRollback() throws Exception { - int run = 0; - while (run < 10) - { - run++; - _logger.info("Run:" + run); - assertTrue("session is not transacted", _session.getTransacted()); - assertTrue("session is not transacted", _pubSession.getTransacted()); - - _logger.info("sending two test messages"); - _publisher.send(_pubSession.createTextMessage("1")); - _publisher.send(_pubSession.createTextMessage("2")); - _pubSession.commit(); - - _logger.info("getting test message"); - assertEquals("1", ((TextMessage) _consumer.receive(1000)).getText()); - - _logger.info("rolling back"); - _session.rollback(); - - _logger.info("receiving result"); - Message result = _consumer.receive(1000); - - assertNotNull("test message was consumed and rolled back, but is gone", result); - - // Message Order is: + assertTrue("session is not transacted", _session.getTransacted()); + assertTrue("session is not transacted", _pubSession.getTransacted()); - // Send 1 , 2 - // Retrieve 1 and then rollback - // Receieve 1 (redelivered) , 2 (may or may not be redelivered??) + _logger.info("sending two test messages"); + _publisher.send(_pubSession.createTextMessage("1")); + _publisher.send(_pubSession.createTextMessage("2")); + _pubSession.commit(); - verifyMessages(result); + _logger.info("getting test message"); + assertEquals("1", ((TextMessage) _consumer.receive(1000)).getText()); - // Occassionally get message 2 first! -// assertEquals("Should get message one first", "1", ((TextMessage) result).getText()); -// assertTrue("Message is not marked as redelivered", result.getJMSRedelivered()); -// -// result = _consumer.receive(1000); -// assertEquals("Second message should be message 2", "2", ((TextMessage) result).getText()); -// assertTrue("Message is not marked as redelivered", result.getJMSRedelivered()); -// -// result = _consumer.receive(1000); -// assertNull("There should be no more messages", result); + _logger.info("rolling back"); + _session.rollback(); - _session.commit(); - } - } + _logger.info("receiving result"); + Message result = _consumer.receive(1000); - private void verifyMessages(Message result) throws JMSException - { + assertNotNull("test message was consumed and rolled back, but is gone", result); - if (result == null) - { - assertTrue("Didn't receive redelivered message one", _gotone); - assertTrue("Didn't receive message two at all", _gottwo | _gottwoRedelivered); - _gotone = false; - _gottwo = false; - _gottwoRedelivered = false; - return; - } - if (((TextMessage) result).getText().equals("1")) + if (((TextMessage) result).getText().equals("2")) { - _logger.info("Got 1 redelivered"); - assertTrue("Message is not marked as redelivered", result.getJMSRedelivered()); - assertFalse("Already received message one", _gotone); - _gotone = true; + assertTrue("Messasge is marked as redelivered", !result.getJMSRedelivered()); + result = _consumer.receive(1000); + assertEquals("1", ((TextMessage) result).getText()); + assertTrue("Messasge is not marked as redelivered", result.getJMSRedelivered()); } else { + assertEquals("1", ((TextMessage) result).getText()); + assertTrue("Messasge is not marked as redelivered", result.getJMSRedelivered()); + result = _consumer.receive(1000); + assertNotNull("test message was consumed and rolled back, but is gone", result); assertEquals("2", ((TextMessage) result).getText()); + assertTrue("Messasge is not marked as redelivered", result.getJMSRedelivered()); + } - if (result.getJMSRedelivered()) - { - _logger.info("Got 2 redelivered, message was prefetched"); - assertFalse("Already received message redelivered two", _gottwoRedelivered); - - _gottwoRedelivered = true; - } - else - { - _logger.warn("Got 2, message prefetched wasn't cleared or messages was in transit when rollback occured"); - assertFalse("Already received message two", _gottwo); + result = _consumer.receive(1000); - _gottwo = true; - } + if (result != null) + { + assertEquals("2", ((TextMessage) result).getText()); + assertTrue("Messasge is not marked as redelivered", result.getJMSRedelivered()); + result = _consumer.receive(1000); } - verifyMessages(_consumer.receive(1000)); - } + assertNull("test message should be null", result); + }*/ public void testSend2ThenCloseAfter1andTryAgain() throws Exception { @@ -459,12 +417,12 @@ public class CommitRollbackTest extends TestCase _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. + // 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 + // 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()); |
