summaryrefslogtreecommitdiff
path: root/qpid/java
diff options
context:
space:
mode:
authorKeith Wall <kwall@apache.org>2011-12-26 18:59:29 +0000
committerKeith Wall <kwall@apache.org>2011-12-26 18:59:29 +0000
commit2a6647a3afe5993bcc642bf2c9d80691d331cd49 (patch)
tree5b831d2532b82be9b9f6fc8a9b1dbec75bf54386 /qpid/java
parentb4d100beab624744c910a4cca3db4a40e09c8c54 (diff)
downloadqpid-python-2a6647a3afe5993bcc642bf2c9d80691d331cd49.tar.gz
QPID-3713: remove redundant failover test cases
The following tests/test cases have been identified: 1) QueueBrowserAutoAckTest#testFailover*. These tests were running against Java 0-9-1 profiles and excluded against Java/CPP 0-10. New test cases FailoverBehaviourTest#testTransactedQueueBrowserCloseWhileFailover/testClientAcknowledge test the same code paths. 2) AcknowledgeAfterFailoverOnMessageTest/AcknowledgeAfterFailoverTest. These tests were globally excluded (Excludes file). New tests FBT.testClientAcknowledgedSessionCloseAfterFailover/testTransactedSessionCloseAfterFailover/testAcknowledgeAfterFailoverForAsynchronousConsumer cover these scenarios. 3) MessageDisappearWithIOExceptionTest. Tests were added after a defect arising from Java Broker use of MINA. Test scenario covered by FBT.testRecoverAfterFailoverInAutoAcknowledgeMode. 4) FailoverBeforeConsumingRecoverTest. Test case seemed weak: merely caused a failover then repeated the same tests as its super (RecoverTest). FBT.testRecoverAfterFailover and testRecoverWithConsumedMessagesAfterFailover are superior replacements. 5) QuickAcking. Test exercised same code paths as FBT.testMessageProducingAndRollbackAfterFailover. CloseAfterConnectionFailureTest duplicates FailoverMethodTest#testNoFailover. The testcase was actually excluded from all profiles. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1224788 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/server/failover/MessageDisappearWithIOExceptionTest.java336
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java104
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/AcknowledgeAfterFailoverOnMessageTest.java429
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/AcknowledgeAfterFailoverTest.java317
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/AcknowledgeTest.java4
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/FailoverBeforeConsumingRecoverTest.java40
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/QuickAcking.java148
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/RecoverTest.java3
-rw-r--r--qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/CloseAfterConnectionFailureTest.java124
-rwxr-xr-xqpid/java/test-profiles/CPPExcludes21
-rw-r--r--qpid/java/test-profiles/CPPNoPrefetchExcludes7
-rw-r--r--qpid/java/test-profiles/Excludes12
-rwxr-xr-xqpid/java/test-profiles/Java010Excludes18
-rw-r--r--qpid/java/test-profiles/JavaExcludes3
14 files changed, 6 insertions, 1560 deletions
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/MessageDisappearWithIOExceptionTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/MessageDisappearWithIOExceptionTest.java
deleted file mode 100644
index fd33266414..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/server/failover/MessageDisappearWithIOExceptionTest.java
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- *
- * 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
- *
- * 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.server.failover;
-
-import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.client.protocol.AMQProtocolSession;
-import org.apache.qpid.jms.ConnectionListener;
-import org.apache.qpid.test.utils.FailoverBaseCase;
-
-import javax.jms.Destination;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Test case based on user reported error.
- *
- * Summary:
- * A user has reported message loss from their application. On bouncing of
- * the broker the 'lost' messages are delivered to the broker.
- *
- * Note:
- * The client was using Spring so that may influence the situation.
- *
- * Issue:
- * The log files show 7 instances of the following which result in 7
- * missing messages.
- *
- * The client log files show:
- *
- * The broker log file show:
- *
- *
- * 7 missing messages have delivery tags 5-11. Which says that they are
- * sequentially the next message from the broker.
- *
- * The only way for the 'without a handler' log to occur is if the consumer
- * has been removed from the look up table of the dispatcher.
- * And the only way for the 'null message' log to occur on the broker is is
- * if the message does not exist in the unacked-map
- *
- * The consumer is only removed from the list during session
- * closure and failover.
- *
- * If the session was closed then the broker would requeue the unacked
- * messages so the potential exists to have an empty map but the broker
- * will not send a message out after the unacked map has been cleared.
- *
- * When failover occurs the _consumer map is cleared and the consumers are
- * resubscribed. This is down without first stopping any existing
- * dispatcher so there exists the potential to receive a message after
- * the _consumer map has been cleared which is how the 'without a handler'
- * log statement occurs.
- *
- * Scenario:
- *
- * Looking over logs the sequence that best fits the events is as follows:
- * - Something causes Mina to be delayed causing the WriteTimoutException.
- * - This exception is recevied by AMQProtocolHandler#exceptionCaught
- * - As the WriteTimeoutException is an IOException this will cause
- * sessionClosed to be called to start failover.
- * + This is potentially the issues here. All IOExceptions are treated
- * as connection failure events.
- * - Failover Runs
- * + Failover assumes that the previous connection has been closed.
- * + Failover binds the existing objects (AMQConnection/Session) to the
- * new connection objects.
- * - Everything is reported as being successfully failed over.
- * However, what is neglected is that the original connection has not
- * been closed.
- * + So what occurs is that the broker sends a message to the consumer on
- * the original connection, as it was not notified of the client
- * failing over.
- * As the client failover reuses the original AMQSession and Dispatcher
- * the new messages the broker sends to the old consumer arrives at the
- * client and is processed by the same AMQSession and Dispatcher.
- * However, as the failover process cleared the _consumer map and
- * resubscribe the consumers the Dispatcher does not recognise the
- * delivery tag and so logs the 'without a handler' message.
- * - The Dispatcher then attempts to reject the message, however,
- * + The AMQSession/Dispatcher pair have been swapped to using a new Mina
- * ProtocolSession as part of the failover process so the reject is
- * sent down the second connection. The broker receives the Reject
- * request but as the Message was sent on a different connection the
- * unacknowledgemap is empty and a 'message is null' log message
- * produced.
- *
- * Test Strategy:
- *
- * It should be easy to demonstrate if we can send an IOException to
- * AMQProtocolHandler#exceptionCaught and then try sending a message.
- *
- * The current unknowns here are the type of consumers that are in use.
- * If it was an exclusive queue(Durable Subscription) then why did the
- * resubscribe not fail.
- *
- * If it was not exclusive then why did the messages not round robin?
- */
-public class MessageDisappearWithIOExceptionTest extends FailoverBaseCase implements ConnectionListener
-{
- private CountDownLatch _failoverOccured = new CountDownLatch(1);
- AMQConnection _connection;
- Session _session;
- Queue _queue;
- MessageConsumer _consumer;
-
- public void setUp() throws Exception
- {
- super.setUp();
- stopBroker(getFailingPort());
-
- }
-
- /**
- * Test Summary:
- *
- * Create a queue consumer and send 10 messages to the broker.
- *
- * Consume the first message.
- * This will pull the rest into the prefetch
- *
- * Send an IOException to the MinaProtocolHandler.
- *
- * This will force failover to occur.
- *
- * 9 messages would normally be expected but it is expected that none will
- * arrive. As they are still in the prefetch of the first session.
- *
- * To free the messages we need to close all connections.
- * - Simply doing connection.close() and retesting will not be enough as
- * the original connection's IO layer will still exist and is nolonger
- * connected to the connection object as a result of failover.
- *
- * - Test will need to retain a reference to the original connection IO so
- * that it can be closed releasing the messages to validate that the
- * messages have indeed been 'lost' on that sesssion.
- */
- public void test() throws Exception
- {
- initialiseConnection();
-
- // Create Producer
- // Send 10 messages
- List<Message> messages = sendNumberedBytesMessage(_session, _queue, 10);
-
- // Consume first messasge
- Message received = _consumer.receive(2000);
-
- // Verify received messages
- assertNotNull("First message not received.", received);
- assertEquals("Incorrect message Received",
- messages.remove(0).getIntProperty("count"),
- received.getIntProperty("count"));
-
- // When the Exception is received by the underlying IO layer it will
- // initiate failover. The first step of which is to ensure that the
- // existing conection is closed. So in this situation the connection
- // will be flushed casuing the above ACK to be sent to the broker.
- //
- // That said:
- // when the socket close is detected on the server it will rise up the
- // Mina filter chain and interrupt processing.
- // this has been raised as QPID-2138
- _session.createConsumer(_session.createTemporaryQueue()).close();
-
- //Retain IO Layer
- AMQProtocolSession protocolSession = _connection.getProtocolHandler().getProtocolSession();
-
- // Send IO Exception - causing failover
- _connection.getProtocolHandler().
- exception(new IOException("IOException to cause failover."));
-
- // Verify Failover occured through ConnectionListener
- assertTrue("Failover did not occur",
- _failoverOccured.await(4000, TimeUnit.MILLISECONDS));
-
- /***********************************/
- // This verifies that the bug has been resolved
-
- // Attempt to consume again. Expect 9 messages
- for (int count = 1; count < 10; count++)
- {
- received = _consumer.receive(2000);
- assertNotNull("Expected message not received:" + count, received);
- assertEquals(messages.remove(0).getIntProperty("count"),
- received.getIntProperty("count"));
- }
-
- //Verify there are no more messages
- received = _consumer.receive(1000);
- assertNull("Message receieved when there should be none:" + received,
- received);
-
-// /***********************************/
-// // This verifies that the bug exists
-//
-// // Attempt to consume remaining 9 messages.. Expecting NONE.
-// // receiving just one message should fail so no need to fail 9 times
-// received = _consumer.receive(1000);
-// assertNull("Message receieved when it should be null:" + received, received);
-//
-//// //Close the Connection which you would assume would free the messages
-//// _connection.close();
-////
-//// // Reconnect
-//// initialiseConnection();
-////
-//// // We should still be unable to receive messages
-//// received = _consumer.receive(1000);
-//// assertNull("Message receieved when it should be null:" + received, received);
-////
-//// _connection.close();
-//
-// // Close original IO layer. Expecting messages to be released
-// protocolSession.closeProtocolSession();
-//
-// // Reconnect and all should be good.
-//// initialiseConnection();
-//
-// // Attempt to consume again. Expect 9 messages
-// for (int count = 1; count < 10; count++)
-// {
-// received = _consumer.receive(2000);
-// assertNotNull("Expected message not received:" + count, received);
-// assertEquals(messages.remove(0).getIntProperty("count"),
-// received.getIntProperty("count"));
-// }
-//
-// //Verify there are no more messages
-// received = _consumer.receive(1000);
-// assertNull("Message receieved when there should be none:" + received,
-// received);
- }
-
- private void initialiseConnection()
- throws Exception
- {
- //Create Connection using the default connection URL. i.e. not the Failover URL that would be used by default
- _connection = (AMQConnection) getConnectionFactory("default").createConnection("guest", "guest");
- // The default connection does not have any retries configured so
- // Allow this connection to retry so that we can block on the failover.
- // The alternative would be to use the getConnection() default. However,
- // this would add additional complexity in the logging as a second
- // broker is defined in that url. We do not need it for this test.
- _connection.getFailoverPolicy().getCurrentMethod().setRetries(1);
- _connection.setConnectionListener(this);
-
- _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- _queue = _session.createQueue(getTestQueueName());
-
- // Create Consumer
- _consumer = _session.createConsumer(_queue);
-
- //Start connection
- _connection.start();
- }
-
- /** QpidTestCase back port to this release */
-
- // modified from QTC as sendMessage is not testable.
- // - should be renamed sendBlankBytesMessage
- // - should be renamed sendNumberedBytesMessage
- public List<Message> sendNumberedBytesMessage(Session session, Destination destination,
- int count) throws Exception
- {
- List<Message> messages = new ArrayList<Message>(count);
-
- MessageProducer producer = session.createProducer(destination);
-
- for (int i = 0; i < count; i++)
- {
- Message next = session.createMessage();
-
- next.setIntProperty("count", i);
-
- producer.send(next);
-
- messages.add(next);
- }
-
- producer.close();
- return messages;
- }
-
- public void bytesSent(long count)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public void bytesReceived(long count)
- {
- }
-
- public boolean preFailover(boolean redirect)
- {
- //Allow failover to occur
- return true;
- }
-
- public boolean preResubscribe()
- {
- //Allow failover to occur
- return true;
- }
-
- public void failoverComplete()
- {
- _failoverOccured.countDown();
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java
index 4eb328f091..f2ac590a3c 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/client/QueueBrowserAutoAckTest.java
@@ -25,6 +25,7 @@ import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQDestination;
import org.apache.qpid.client.AMQSession;
import org.apache.qpid.test.utils.FailoverBaseCase;
+import org.apache.qpid.test.utils.QpidBrokerTestCase;
import javax.jms.Connection;
import javax.jms.JMSException;
@@ -39,13 +40,12 @@ import javax.naming.NamingException;
import java.util.Enumeration;
import java.util.Random;
-public class QueueBrowserAutoAckTest extends FailoverBaseCase
+public class QueueBrowserAutoAckTest extends QpidBrokerTestCase
{
protected Connection _clientConnection;
protected Session _clientSession;
protected Queue _queue;
protected static final String MESSAGE_ID_PROPERTY = "MessageIDProperty";
- protected boolean CLUSTERED = Boolean.getBoolean("profile.clustered");
public void setUp() throws Exception
{
@@ -94,22 +94,6 @@ public class QueueBrowserAutoAckTest extends FailoverBaseCase
sendMessages(producerConnection, num);
}
- protected void sendMessages(String connection, int num) throws JMSException
- {
- Connection producerConnection = null;
- try
- {
- producerConnection = getConnectionFactory(connection).createConnection("guest", "guest");
- }
- catch (Exception e)
- {
- e.printStackTrace();
- fail("Unable to lookup connection in JNDI.");
- }
- sendMessages(producerConnection, num);
- }
-
-
protected void sendMessages(Connection producerConnection, int messageSendCount) throws JMSException
{
producerConnection.start();
@@ -440,88 +424,4 @@ public class QueueBrowserAutoAckTest extends FailoverBaseCase
validate(messages);
}
- /**
- * Testing that a QueueBrowser doesn't actually consume messages from a broker when it fails over.
- * @throws JMSException
- */
- public void testFailoverWithQueueBrowser() throws JMSException
- {
- int messages = 5;
-
- sendMessages("connection1", messages);
- if (!CLUSTERED)
- {
- sendMessages("connection2", messages);
- }
-
- checkQueueDepth(messages);
-
- _logger.info("Creating Queue Browser");
- QueueBrowser queueBrowser = _clientSession.createBrowser(_queue);
-
- long queueDepth = 0;
-
- try
- {
- queueDepth = ((AMQSession) _clientSession).getQueueDepth((AMQDestination) _queue);
- }
- catch (AMQException e)
- {
- fail("Caught exception getting queue depth: " + e.getMessage());
- }
-
- assertEquals("Session reports Queue depth not as expected", messages, queueDepth);
-
- int msgCount = 0;
- int failPoint = 0;
-
- failPoint = new Random().nextInt(messages) + 1;
-
- Enumeration msgs = queueBrowser.getEnumeration();
- while (msgs.hasMoreElements())
- {
- msgs.nextElement();
- msgCount++;
-
- if (msgCount == failPoint)
- {
- failBroker(getFailingPort());
- }
- }
-
- assertTrue("We should get atleast " + messages + " msgs (found " + msgCount +").", msgCount >= messages);
-
- if (_logger.isDebugEnabled())
- {
- _logger.debug("QBAAT Found " + msgCount + " messages total in browser");
- }
-
- //Close browser
- queueBrowser.close();
-
- _logger.info("Closed Queue Browser, validating messages on broker.");
-
- //Validate all messages still on Broker
- validate(messages);
- }
-
- public void testFailoverAsQueueBrowserCreated() throws JMSException
- {
- // The IoServiceListenerSupport seems to get stuck in with a managedSession that isn't closing when requested.
- // So it hangs waiting for the session.
- int messages = 50;
-
- sendMessages("connection1", messages);
- if (!CLUSTERED)
- {
- sendMessages("connection2", messages);
- }
-
- failBroker(getFailingPort());
-
- checkQueueDepth(messages);
-
- //Validate all messages still on Broker 1
- validate(messages);
- }
}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/AcknowledgeAfterFailoverOnMessageTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/AcknowledgeAfterFailoverOnMessageTest.java
deleted file mode 100644
index d73d012250..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/AcknowledgeAfterFailoverOnMessageTest.java
+++ /dev/null
@@ -1,429 +0,0 @@
-/*
- *
- * 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
- *
- * 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.ack;
-
-import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.client.AMQDestination;
-import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.jms.ConnectionListener;
-import org.apache.qpid.util.FileUtils;
-
-import javax.jms.Connection;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.Session;
-import javax.jms.TransactionRolledBackException;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.io.File;
-
-/**
- * The AcknowlegeAfterFailoverOnMessageTests
- *
- * Extends the OnMessage AcknowledgeTests to validate that after the client has
- * failed over that the client can still receive and ack messages.
- *
- * All the AcknowledgeTest ack modes are exercised here though some are disabled
- * due to know issues (e.g. DupsOk, AutoAck : QPID-143 and the clientAck
- * and dirtyClientAck due to QPID-1816)
- *
- * This class has two main test structures, overrides of AcknowledgeOnMessageTest
- * to perform the clean acking based on session ack mode and a series of dirty
- * ack tests that test what happends if you receive a message then try and ack
- * AFTER you have failed over.
- *
- *
- */
-public class AcknowledgeAfterFailoverOnMessageTest extends AcknowledgeOnMessageTest implements ConnectionListener
-{
-
- protected CountDownLatch _failoverCompleted = new CountDownLatch(1);
- private MessageListener _listener = null;
-
- @Override
- public void setUp() throws Exception
- {
- super.setUp();
- NUM_MESSAGES = 10;
- }
-
- /**
- * Override default init to add connectionListener so we can verify that
- * failover took place
- *
- * @param transacted create a transacted session for this test
- * @param mode if not transacted what ack mode to use for this test
- *
- * @throws Exception if a problem occured during test setup.
- */
- @Override
- public void init(boolean transacted, int mode) throws Exception
- {
- super.init(transacted, mode);
- ((AMQConnection) _connection).setConnectionListener(this);
- // Override the listener for the dirtyAck testing.
- if (_listener != null)
- {
- _consumer.setMessageListener(_listener);
- }
- }
-
- /**
- * Prepare the broker for the next round.
- *
- * Called after acknowledging the messsage this method shuts the current
- * broker down connnects to the new broker and send a new message for the
- * client to failover to and receive.
- *
- * It ends by restarting the orignal broker so that the cycle can repeat.
- *
- * When we are able to cluster the java broker then will not need to do the
- * message repopulation or QPID_WORK clearing. All that we will need to do
- * is send the initial NUM_MESSAGES during startup and then bring the
- * brokers down at the right time to cause the client to fail between them.
- *
- * @param index
- * @throws Exception
- */
- protected void prepBroker(int index) throws Exception
- {
- // Alternate killing the broker based on the message index we are at.
-
- if (index % 2 == 0)
- {
- failBroker(getFailingPort());
- // Clean up the failed broker
- FileUtils.delete(new File(System.getProperty("QPID_WORK") + "/" + getFailingPort()), true);
- }
- else
- {
- failBroker(getPort());
- // Clean up the failed broker
- FileUtils.delete(new File(System.getProperty("QPID_WORK") + "/" + getPort()), true);
- }
-
- _failoverCompleted = new CountDownLatch(1);
-
- _logger.info("AAFOMT: prepNewBroker for message send");
- Connection connection = getConnection();
-
- try
- {
-
- //Stop the connection whilst we repopulate the broker, or the no_ack
- // test will drain the msgs before we can check we put the right number
- // back on again.
-
- Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
- // ensure destination is created.
- session.createConsumer(_queue).close();
-
-
- // If this is the last message then we can skip the send.
- // But we MUST ensure that we have created the queue with the
- // above createConsumer(_queue).close() as the test will end by
- // testing the queue depth which will fail if we don't ensure we
- // declare the queue.
- // index is 0 based so we need to check +1 against NUM_MESSAGES
- if ((index + 1) == NUM_MESSAGES)
- {
- return;
- }
-
-
- sendMessage(session, _queue, 1, index + 1, 0);
-
- // Validate that we have the message on the queue
- // In NoAck mode though the messasge may already have been sent to
- // the client so we have to skip the vaildation.
- if (_consumerSession.getAcknowledgeMode() != AMQSession.NO_ACKNOWLEDGE)
- {
- assertEquals("Wrong number of messages on queue", 1,
- ((AMQSession) session).getQueueDepth((AMQDestination) _queue));
- }
-
-
- }
- catch (Exception e)
- {
- fail("Unable to prep new broker," + e.getMessage());
- }
- finally
- {
- connection.close();
- }
-
- try
- {
-
- //Restart the broker
- if (index % 2 == 0)
- {
- startBroker(getFailingPort());
- }
- else
- {
- startBroker(getPort());
- }
- }
- catch (Exception e)
- {
- fail("Unable to start failover broker," + e.getMessage());
- }
-
- }
-
- @Override
- public void doAcknowlegement(Message msg) throws JMSException
- {
- //Acknowledge current message
- super.doAcknowlegement(msg);
-
- try
- {
- prepBroker(msg.getIntProperty(INDEX));
- }
- catch (Exception e)
- {
- // Provide details of what went wrong with the stack trace
- e.printStackTrace();
- fail("Unable to prep new broker," + e);
- }
- }
-
- // Instance varilable for DirtyAcking test
- int _msgCount = 0;
- boolean _cleaned = false;
-
- class DirtyAckingHandler implements MessageListener
- {
- /**
- * Validate first message but do nothing with it.
- *
- * Failover
- *
- * The receive the message again
- *
- * @param message
- */
- public void onMessage(Message message)
- {
- // Stop processing if we have an error and had to stop running.
- if (_receivedAll.getCount() == 0)
- {
- _logger.debug("Dumping msgs due to error(" + _causeOfFailure.get().getMessage() + "):" + message);
- return;
- }
-
- try
- {
- // Check we have the next message as expected
- assertNotNull("Message " + _msgCount + " not correctly received.", message);
- assertEquals("Incorrect message received", _msgCount, message.getIntProperty(INDEX));
-
- if (_msgCount == 0 && _failoverCompleted.getCount() != 0)
- {
- // This is the first message we've received so lets fail the broker
-
- failBroker(getFailingPort());
-
- repopulateBroker();
-
- _logger.error("Received first msg so failing over");
-
- return;
- }
-
- _msgCount++;
-
- // Don't acknowlege the first message after failover so we can commit
- // them together
- if (_msgCount == 1)
- {
- _logger.error("Received first msg after failover ignoring:" + _msgCount);
-
- // Acknowledge the first message if we are now on the cleaned pass
- if (_cleaned)
- {
- _receivedAll.countDown();
- }
-
- return;
- }
-
- if (_consumerSession.getTransacted())
- {
- try
- {
- _consumerSession.commit();
- if (!_cleaned)
- {
- fail("Session is dirty we should get an TransactionRolledBackException");
- }
- }
- catch (TransactionRolledBackException trbe)
- {
- //expected path
- }
- }
- else
- {
- try
- {
- message.acknowledge();
- if (!_cleaned)
- {
- fail("Session is dirty we should get an IllegalStateException");
- }
- }
- catch (javax.jms.IllegalStateException ise)
- {
- assertEquals("Incorrect Exception thrown", "has failed over", ise.getMessage());
- // Recover the sesion and try again.
- _consumerSession.recover();
- }
- }
-
- // Acknowledge the last message if we are in a clean state
- // this will then trigger test teardown.
- if (_cleaned)
- {
- _receivedAll.countDown();
- }
-
- //Reset message count so we can try again.
- _msgCount = 0;
- _cleaned = true;
- }
- catch (Exception e)
- {
- // If something goes wrong stop and notifiy main thread.
- fail(e);
- }
- }
- }
-
- /**
- * Test that Acking/Committing a message received before failover causes
- * an exception at commit/ack time.
- *
- * Expected behaviour is that in:
- * * tx mode commit() throws a transacted RolledBackException
- * * client ack mode throws an IllegalStateException
- *
- * @param transacted is this session trasacted
- * @param mode What ack mode should be used if not trasacted
- *
- * @throws Exception if something goes wrong.
- */
- protected void testDirtyAcking(boolean transacted, int mode) throws Exception
- {
- NUM_MESSAGES = 2;
- _listener = new DirtyAckingHandler();
-
- super.testAcking(transacted, mode);
- }
-
- public void testDirtyClientAck() throws Exception
- {
- testDirtyAcking(false, Session.CLIENT_ACKNOWLEDGE);
- }
-
- public void testDirtyAckingTransacted() throws Exception
- {
- testDirtyAcking(true, Session.SESSION_TRANSACTED);
- }
-
- private void repopulateBroker() throws Exception
- {
- // Repopulate this new broker so we can test what happends after failover
-
- //Get the connection to the first (main port) broker.
- Connection connection = getConnection();
- // Use a transaction to send messages so we can be sure they arrive.
- Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
- // ensure destination is created.
- session.createConsumer(_queue).close();
-
- sendMessage(session, _queue, NUM_MESSAGES);
-
- assertEquals("Wrong number of messages on queue", NUM_MESSAGES,
- ((AMQSession) session).getQueueDepth((AMQDestination) _queue));
-
- connection.close();
- }
-
- // AMQConnectionListener Interface.. used so we can validate that we
- // actually failed over.
-
- public void bytesSent(long count)
- {
- }
-
- public void bytesReceived(long count)
- {
- }
-
- public boolean preFailover(boolean redirect)
- {
- //Allow failover
- return true;
- }
-
- public boolean preResubscribe()
- {
- //Allow failover
- return true;
- }
-
- public void failoverComplete()
- {
- _failoverCompleted.countDown();
- }
-
- /**
- * Override so we can block until failover has completd
- *
- * @param port
- */
- @Override
- public void failBroker(int port)
- {
- super.failBroker(port);
-
- try
- {
- if (!_failoverCompleted.await(DEFAULT_FAILOVER_TIME, TimeUnit.MILLISECONDS))
- {
- // Use an exception so that we use our local fail() that notifies the main thread of failure
- throw new Exception("Failover did not occur in specified time:" + DEFAULT_FAILOVER_TIME);
- }
-
- }
- catch (Exception e)
- {
- // Use an exception so that we use our local fail() that notifies the main thread of failure
- fail(e);
- }
- }
-
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/AcknowledgeAfterFailoverTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/AcknowledgeAfterFailoverTest.java
deleted file mode 100644
index acc7d5a4c1..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/AcknowledgeAfterFailoverTest.java
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
-*
-* 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
-*
-* 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.ack;
-
-import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.client.AMQDestination;
-import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.jms.ConnectionListener;
-import org.apache.qpid.util.FileUtils;
-
-import javax.jms.Connection;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-import javax.jms.TransactionRolledBackException;
-import java.io.File;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-/**
- *
- */
-public class AcknowledgeAfterFailoverTest extends AcknowledgeTest implements ConnectionListener
-{
-
- protected CountDownLatch _failoverCompleted = new CountDownLatch(1);
-
- @Override
- public void setUp() throws Exception
- {
- super.setUp();
- // This must be even for the test to run correctly.
- // Otherwise we will kill the standby broker
- // not the one we are connected to.
- // The test will still pass but it will not be exactly
- // as described.
- NUM_MESSAGES = 6;
- }
-
- /**
- * Override default init to add connectionListener so we can verify that
- * failover took place
- *
- * @param transacted create a transacted session for this test
- * @param mode if not transacted what ack mode to use for this test
- * @throws Exception if a problem occured during test setup.
- */
- @Override
- protected void init(boolean transacted, int mode) throws Exception
- {
- super.init(transacted, mode);
- ((AMQConnection) _connection).setConnectionListener(this);
- }
-
- protected void prepBroker(int index) throws Exception
- {
- // If this is the last message then we can skip the prep.
- if (index == NUM_MESSAGES)
- {
- return;
- }
-
- if (index % 2 == 0)
- {
- failBroker(getFailingPort());
- // Clean up the failed broker
- FileUtils.delete(new File(System.getProperty("QPID_WORK") + "/" + getFailingPort()), true);
- }
- else
- {
- failBroker(getPort());
- // Clean up the failed broker
- FileUtils.delete(new File(System.getProperty("QPID_WORK") + "/" + getPort()), true);
- }
-
- // Ensure we have the right data on the broker
- Connection connection = getConnection();
- Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
- // ensure destination is created.
- session.createConsumer(_queue).close();
-
- sendMessage(session, _queue, 1, index + 1, 0);
-
- if (_consumerSession.getAcknowledgeMode() != AMQSession.NO_ACKNOWLEDGE)
- {
- assertEquals("Wrong number of messages on queue", 1,
- ((AMQSession) session).getQueueDepth((AMQDestination) _queue));
- }
-
- connection.close();
-
- try
- {
- if (index % 2 == 0)
- {
- startBroker(getFailingPort());
- }
- else
- {
- startBroker(getPort());
- }
- }
- catch (Exception e)
- {
- fail("Unable to start failover broker," + e.getMessage());
- }
- }
-
- @Override
- public void doAcknowlegement(Message msg) throws JMSException
- {
- //Acknowledge current message
- super.doAcknowlegement(msg);
-
- try
- {
- prepBroker(msg.getIntProperty(INDEX));
- }
- catch (Exception e)
- {
- fail("Unable to prep new broker," + e.getMessage());
- }
-
- }
-
- /**
- * Test that Acking/Committing a message received before failover causes
- * an exception at commit/ack time.
- * <p/>
- * Expected behaviour is that in:
- * * tx mode commit() throws a transacted RolledBackException
- * * client ack mode throws an IllegalStateException
- *
- * @param transacted is this session trasacted
- * @param mode What ack mode should be used if not trasacted
- * @throws Exception if something goes wrong.
- */
- protected void testDirtyAcking(boolean transacted, int mode) throws Exception
- {
- NUM_MESSAGES = 2;
- //Test Dirty Failover Fails
- init(transacted, mode);
-
- _connection.start();
-
- Message msg = _consumer.receive(1500);
-
- int count = 0;
- assertNotNull("Message " + count + " not correctly received.", msg);
- assertEquals("Incorrect message received", count, msg.getIntProperty(INDEX));
-
- //Don't acknowledge just prep the next broker. Without changing count
- // Prep the new broker to have all all the messages so we can validate
- // that they can all be correctly received.
- try
- {
-
- //Stop the connection so we can validate the number of message count
- // on the queue is correct after failover
- _connection.stop();
- failBroker(getFailingPort());
-
- //Get the connection to the first (main port) broker.
- Connection connection = getConnection();//getConnectionFactory("connection1").getConnectionURL());
- // Use a transaction to send messages so we can be sure they arrive.
- Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
- // ensure destination is created.
- session.createConsumer(_queue).close();
-
- sendMessage(session, _queue, NUM_MESSAGES);
-
- assertEquals("Wrong number of messages on queue", NUM_MESSAGES,
- ((AMQSession) session).getQueueDepth((AMQDestination) _queue));
-
- connection.close();
-
- //restart connection
- _connection.start();
- }
- catch (Exception e)
- {
- fail("Unable to prep new broker," + e.getMessage());
- }
-
- // Consume the next message - don't check what it is as a normal would
- // assume it is msg 1 but as we've fallen over it is msg 0 again.
- msg = _consumer.receive(1500);
-
- if (_consumerSession.getTransacted())
- {
- try
- {
- _consumerSession.commit();
- fail("Session is dirty we should get an TransactionRolledBackException");
- }
- catch (TransactionRolledBackException trbe)
- {
- //expected path
- }
- }
- else
- {
- try
- {
- msg.acknowledge();
- fail("Session is dirty we should get an IllegalStateException");
- }
- catch (javax.jms.IllegalStateException ise)
- {
- assertEquals("Incorrect Exception thrown", "has failed over", ise.getMessage());
- // Recover the sesion and try again.
- _consumerSession.recover();
- }
- }
-
- msg = _consumer.receive(1500);
- // Validate we now get the first message back
- assertEquals(0, msg.getIntProperty(INDEX));
-
- msg = _consumer.receive(1500);
- // and the second message
- assertEquals(1, msg.getIntProperty(INDEX));
-
- // And now verify that we can now commit the clean session
- if (_consumerSession.getTransacted())
- {
- _consumerSession.commit();
- }
- else
- {
- msg.acknowledge();
- }
-
- assertEquals("Wrong number of messages on queue", 0,
- ((AMQSession) _consumerSession).getQueueDepth((AMQDestination) _queue));
- }
-
- public void testDirtyClientAck() throws Exception
- {
- testDirtyAcking(false, Session.CLIENT_ACKNOWLEDGE);
- }
-
- public void testDirtyAckingTransacted() throws Exception
- {
- testDirtyAcking(true, Session.SESSION_TRANSACTED);
- }
-
- // AMQConnectionListener Interface.. used so we can validate that we
- // actually failed over.
-
- public void bytesSent(long count)
- {
- }
-
- public void bytesReceived(long count)
- {
- }
-
- public boolean preFailover(boolean redirect)
- {
- //Allow failover
- return true;
- }
-
- public boolean preResubscribe()
- {
- //Allow failover
- return true;
- }
-
- public void failoverComplete()
- {
- _failoverCompleted.countDown();
- }
-
- /**
- * Override so we can block until failover has completd
- *
- * @param port
- */
- @Override
- public void failBroker(int port)
- {
- super.failBroker(port);
-
- try
- {
- if (!_failoverCompleted.await(DEFAULT_FAILOVER_TIME, TimeUnit.MILLISECONDS))
- {
- fail("Failover did not occur in specified time:" + DEFAULT_FAILOVER_TIME);
- }
- }
- catch (InterruptedException e)
- {
- fail("Failover was interrupted");
- }
- }
-
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/AcknowledgeTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/AcknowledgeTest.java
index efea57e5d2..12039caf25 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/AcknowledgeTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/AcknowledgeTest.java
@@ -23,7 +23,7 @@ package org.apache.qpid.test.unit.ack;
import org.apache.qpid.client.AMQDestination;
import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.test.utils.FailoverBaseCase;
+import org.apache.qpid.test.utils.QpidBrokerTestCase;
import javax.jms.Connection;
import javax.jms.JMSException;
@@ -39,7 +39,7 @@ import javax.jms.MessageProducer;
*
* The ack mode is provided from the various test methods.
*/
-public class AcknowledgeTest extends FailoverBaseCase
+public class AcknowledgeTest extends QpidBrokerTestCase
{
protected int NUM_MESSAGES;
protected Connection _connection;
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/FailoverBeforeConsumingRecoverTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/FailoverBeforeConsumingRecoverTest.java
deleted file mode 100644
index 834b17430b..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/FailoverBeforeConsumingRecoverTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *
- * 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
- *
- * 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.ack;
-
-import org.apache.qpid.jms.Session;
-
-import javax.jms.Message;
-import javax.jms.Queue;
-
-public class FailoverBeforeConsumingRecoverTest extends RecoverTest
-{
-
- @Override
- protected void initTest() throws Exception
- {
- super.initTest();
- failBroker(getFailingPort());
-
- Queue queue = _consumerSession.createQueue(getTestQueueName());
- sendMessage(_connection.createSession(false, Session.AUTO_ACKNOWLEDGE), queue, SENT_COUNT);
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/QuickAcking.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/QuickAcking.java
deleted file mode 100644
index 13c78c1e14..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/QuickAcking.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- *
- * 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
- *
- * 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.ack;
-
-import java.util.concurrent.CountDownLatch;
-import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.jms.ConnectionListener;
-import org.apache.qpid.test.utils.QpidBrokerTestCase;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-
-/**
- * This is a quick manual test to validate acking after failover with a
- * transacted session.
- *
- * Start an external broker then run this test. Std Err will print.
- * Sent Message: 1
- * Received Message: 1
- *
- * You can then restart the external broker, which will cause failover, which
- * will be complete when the following appears.
- *
- * Failover Complete
- *
- * A second message send/receive cycle is then done to validate that the
- * connection/session are still working.
- *
- */
-public class QuickAcking extends QpidBrokerTestCase implements ConnectionListener
-{
- protected AMQConnection _connection;
- protected Queue _queue;
- protected Session _session;
- protected MessageConsumer _consumer;
- private CountDownLatch _failedOver;
- private static final String INDEX = "INDEX";
- private int _count = 0;
-
- public void setUp()
- {
- // Prevent broker startup. Broker must be run manually.
- }
-
- public void test() throws Exception
- {
- _failedOver = new CountDownLatch(1);
-
- _connection = new AMQConnection("amqp://guest:guest@client/test?brokerlist='localhost?retries='20'&connectdelay='2000''");
-
- _session = _connection.createSession(true, Session.SESSION_TRANSACTED);
- _queue = _session.createQueue("QAtest");
- _consumer = _session.createConsumer(_queue);
- _connection.setConnectionListener(this);
- _connection.start();
-
- sendAndReceive();
-
- _failedOver.await();
-
- sendAndReceive();
-
- }
-
- private void sendAndReceive()
- throws Exception
- {
- sendMessage();
-
- Message message = _consumer.receive();
-
- if (message.getIntProperty(INDEX) != _count)
- {
- throw new Exception("Incorrect message recieved:" + _count);
- }
-
- if (_session.getTransacted())
- {
- _session.commit();
- }
- System.err.println("Recevied Message:" + _count);
- }
-
- private void sendMessage() throws JMSException
- {
- MessageProducer producer = _session.createProducer(_queue);
- Message message = _session.createMessage();
- _count++;
- message.setIntProperty(INDEX, _count);
-
- producer.send(message);
- if (_session.getTransacted())
- {
- _session.commit();
- }
- producer.close();
-
- System.err.println("Sent Message:" + _count);
- }
-
- public void bytesSent(long count)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public void bytesReceived(long count)
- {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public boolean preFailover(boolean redirect)
- {
- return true;
- }
-
- public boolean preResubscribe()
- {
- return true;
- }
-
- public void failoverComplete()
- {
- System.err.println("Failover Complete");
- _failedOver.countDown();
- }
-}
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/RecoverTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/RecoverTest.java
index 0c4a5e07d5..2fd3811cb4 100644
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/RecoverTest.java
+++ b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/ack/RecoverTest.java
@@ -25,6 +25,7 @@ import org.apache.qpid.configuration.ClientProperties;
import org.apache.qpid.framing.AMQShortString;
import org.apache.qpid.jms.Session;
import org.apache.qpid.test.utils.FailoverBaseCase;
+import org.apache.qpid.test.utils.QpidBrokerTestCase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -41,7 +42,7 @@ import javax.jms.TextMessage;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
-public class RecoverTest extends FailoverBaseCase
+public class RecoverTest extends QpidBrokerTestCase
{
static final Logger _logger = LoggerFactory.getLogger(RecoverTest.class);
diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/CloseAfterConnectionFailureTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/CloseAfterConnectionFailureTest.java
deleted file mode 100644
index 91e681131f..0000000000
--- a/qpid/java/systests/src/main/java/org/apache/qpid/test/unit/client/connection/CloseAfterConnectionFailureTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- *
- * 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
- *
- * 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.connection;
-
-import org.apache.qpid.AMQException;
-import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.client.AMQConnectionURL;
-import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.test.utils.QpidBrokerTestCase;
-import org.apache.qpid.url.URLSyntaxException;
-
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.MessageConsumer;
-import javax.jms.Session;
-import java.util.concurrent.CountDownLatch;
-
-public class CloseAfterConnectionFailureTest extends QpidBrokerTestCase implements ExceptionListener
-{
- private int sessionCount = 0;
- AMQConnection connection;
- Session session;
- MessageConsumer consumer;
- private CountDownLatch _latch = new CountDownLatch(1);
- private JMSException _fail;
-
- public void testNoFailover() throws URLSyntaxException, Exception,
- InterruptedException, JMSException
- {
- //This test uses hard coded connection string so only runs on InVM case
- if (!isExternalBroker())
- {
- String connectionString = "amqp://guest:guest@/test?brokerlist='vm://:1?connectdelay='500',retries='3'',failover='nofailover'";
-
- AMQConnectionURL url = new AMQConnectionURL(connectionString);
-
- try
- {
- //Start the connection so it will use the retries
- connection = new AMQConnection(url);
-
- connection.setExceptionListener(this);
-
- session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- consumer = session.createConsumer(session.createQueue(this.getName()));
-
- //Kill connection
- stopBroker();
-
- _latch.await();
-
- if (_fail != null)
- {
- _fail.printStackTrace(System.out);
- fail("Exception thrown:" + _fail.getMessage());
- }
- }
- catch (AMQException e)
- {
- fail(e.getMessage());
- }
- }
- }
-
- public void onException(JMSException e)
- {
- System.out.println("Connection isClosed after connection Falure?:" + connection.isClosed());
- try
- {
- consumer.close();
- }
- catch (JMSException jmse)
- {
- System.out.println("Consumer close failed with:" + jmse.getMessage());
- _fail = jmse;
- }
- System.out.println("Connection isClosed after connection Falure?:" + connection.isClosed());
- try
- {
- //Note that if we actually do session.close() we will lock up as the session will never receive a frame
- // from the
- ((AMQSession) session).close(10);
- }
- catch (JMSException jmse)
- {
- System.out.println("Session close failed with:" + jmse.getMessage());
- _fail = jmse;
- }
- System.out.println("Connection isClosed after connection Falure?:" + connection.isClosed());
-
- try
- {
- connection.close();
- }
- catch (JMSException jmse)
- {
- System.out.println("Session close failed with:" + jmse.getMessage());
- _fail = jmse;
- }
- System.out.println("Connection isClosed after connection Falure?:" + connection.isClosed());
-
- _latch.countDown();
-
- }
-
-}
diff --git a/qpid/java/test-profiles/CPPExcludes b/qpid/java/test-profiles/CPPExcludes
index eb130b27b7..66a20bcfc1 100755
--- a/qpid/java/test-profiles/CPPExcludes
+++ b/qpid/java/test-profiles/CPPExcludes
@@ -89,9 +89,6 @@ org.apache.qpid.test.client.QueueBrowsingFlowToDiskTest#*
// This test currently does not pick up the runtime location of the nonVm queueBacking store.
org.apache.qpid.test.unit.close.FlowToDiskBackingQueueDeleteTest#*
-// This test may use QpidTestCase but it is not using the getConnection and is hardwired to InVM
-org.apache.qpid.test.unit.client.connection.CloseAfterConnectionFailureTest#*
-
//QPID-1818 : 0-10 Client code path does not correctly restore a transacted session after failover.
org.apache.qpid.server.persistent.NoLocalAfterRecoveryTest#*
@@ -140,13 +137,6 @@ org.apache.qpid.test.client.message.SelectorTest#testRuntimeSelectorError
//QPID-942 : Implemented Channel.Flow based Producer Side flow control to the Java Broker (not in CPP Broker)
org.apache.qpid.server.queue.ProducerFlowControlTest#*
-//QPID-1950 : Commit to test this failure. This is a MINA only failure so it cannot be tested when using 010.
-org.apache.qpid.server.failover.MessageDisappearWithIOExceptionTest#*
-
-// These are recent test additions that are failing with the c++ broker
-// Temporarily disabling until properly investigated.
-org.apache.qpid.test.unit.ack.FailoverBeforeConsumingRecoverTest#*
-
org.apache.qpid.test.client.RollbackOrderTest#testOrderingAfterRollbackOnMessage#*
//Excluded due to QPID-1447 : CPP broker does not have SlowConsumer Disconnection
@@ -182,14 +172,3 @@ org.apache.qpid.server.management.AMQUserManagementMBeanTest#*
// QPID-3133: On 0-10, the exception listener is currently not invoked when reconnection fails to occurs.
org.apache.qpid.server.failover.FailoverMethodTest#*
-//QPID-3468: exclude QueueBrowser related failover tests
-org.apache.qpid.test.client.QueueBrowserAutoAckTest#testFailoverWithQueueBrowser
-org.apache.qpid.test.client.QueueBrowserAutoAckTest#testFailoverAsQueueBrowserCreated
-org.apache.qpid.test.client.QueueBrowserClientAckTest#testFailoverWithQueueBrowser
-org.apache.qpid.test.client.QueueBrowserClientAckTest#testFailoverAsQueueBrowserCreated
-org.apache.qpid.test.client.QueueBrowserNoAckTest#testFailoverWithQueueBrowser
-org.apache.qpid.test.client.QueueBrowserNoAckTest#testFailoverAsQueueBrowserCreated
-org.apache.qpid.test.client.QueueBrowserPreAckTest#testFailoverWithQueueBrowser
-org.apache.qpid.test.client.QueueBrowserPreAckTest#testFailoverAsQueueBrowserCreated
-org.apache.qpid.test.client.QueueBrowserDupsOkTest#testFailoverWithQueueBrowser
-org.apache.qpid.test.client.QueueBrowserDupsOkTest#testFailoverAsQueueBrowserCreated
diff --git a/qpid/java/test-profiles/CPPNoPrefetchExcludes b/qpid/java/test-profiles/CPPNoPrefetchExcludes
index ebcd430161..e10b2fa659 100644
--- a/qpid/java/test-profiles/CPPNoPrefetchExcludes
+++ b/qpid/java/test-profiles/CPPNoPrefetchExcludes
@@ -19,13 +19,6 @@
org.apache.qpid.test.unit.transacted.TransactedTest#testRollback
-org.apache.qpid.test.client.QueueBrowserAutoAckTest#testFailoverWithQueueBrowser
-org.apache.qpid.test.client.QueueBrowserClientAckTest#testFailoverWithQueueBrowser
-org.apache.qpid.test.client.QueueBrowserDupsOkTest#testFailoverWithQueueBrowser
-org.apache.qpid.test.client.QueueBrowserNoAckTest#testFailoverWithQueueBrowser
-org.apache.qpid.test.client.QueueBrowserPreAckTest#testFailoverWithQueueBrowser
-org.apache.qpid.test.client.QueueBrowserTransactedTest#testFailoverWithQueueBrowser
-
org.apache.qpid.test.unit.topic.DurableSubscriptionTest#testDurabilityNOACK
org.apache.qpid.test.unit.topic.DurableSubscriptionTest#testDurabilityNOACKSessionPerConnection
org.apache.qpid.test.unit.xa.TopicTest#testMigrateDurableSubscriber
diff --git a/qpid/java/test-profiles/Excludes b/qpid/java/test-profiles/Excludes
index b1edd07f87..8cad91ef2d 100644
--- a/qpid/java/test-profiles/Excludes
+++ b/qpid/java/test-profiles/Excludes
@@ -29,18 +29,6 @@ org.apache.qpid.server.logging.MemoryMessageStoreLoggingTest#testMessageStoreClo
// QPID-3424 : Test fails to start external broker due to Derby Exception.
org.apache.qpid.server.logging.DerbyMessageStoreLoggingTest#*
-// QPID-1816 : Client Ack has not been addressed
-org.apache.qpid.test.unit.ack.AcknowledgeAfterFailoverOnMessageTest#testDirtyClientAck
-org.apache.qpid.test.unit.ack.AcknowledgeAfterFailoverOnMessageTest#testClientAck
-org.apache.qpid.test.unit.ack.AcknowledgeAfterFailoverTest#testDirtyClientAck
-org.apache.qpid.test.unit.ack.AcknowledgeAfterFailoverTest#testClientAck
-
-
-// QPID-143 : Failover can occur between receive and ack but we don't stop the ack.
-// Just fully disable both tests as they are highlighting to many Java Client race conditions
-org.apache.qpid.test.unit.ack.AcknowledgeAfterFailoverOnMessageTest#*
-org.apache.qpid.test.unit.ack.AcknowledgeAfterFailoverTest#*
-
// QPID-2418 : The queue backing the dur sub is not currently deleted at subscription change, so the test will fail.
org.apache.qpid.test.unit.ct.DurableSubscriberTest#testResubscribeWithChangedSelectorAndRestart
diff --git a/qpid/java/test-profiles/Java010Excludes b/qpid/java/test-profiles/Java010Excludes
index c687574409..59cb5066f1 100755
--- a/qpid/java/test-profiles/Java010Excludes
+++ b/qpid/java/test-profiles/Java010Excludes
@@ -48,9 +48,6 @@ org.apache.qpid.test.unit.close.JavaServerCloseRaceConditionTest#*
//QPID-942 : Implemented Channel.Flow based Producer Side flow control to the Java Broker (not in CPP Broker)
org.apache.qpid.server.queue.ProducerFlowControlTest#*
-//QPID-1950 : Commit to test this failure. This is a MINA only failure so it cannot be tested when using 010.
-org.apache.qpid.server.failover.MessageDisappearWithIOExceptionTest#*
-
//QPID-1864: rollback with subscriptions does not work in 0-10 yet
org.apache.qpid.test.client.RollbackOrderTest#testOrderingAfterRollbackOnMessage
@@ -67,22 +64,7 @@ org.apache.qpid.server.failover.FailoverMethodTest#*
org.apache.qpid.test.client.destination.AddressBasedDestinationTest#testCreateExchangeWithArgs
org.apache.qpid.test.client.destination.AddressBasedDestinationTest#testSessionCreateTopicWithExchangeArgs
-// QPID-1935: the following tests are failing on 0.10 profiles
-org.apache.qpid.test.client.QueueBrowserTransactedTest#testFailoverAsQueueBrowserCreated
-org.apache.qpid.test.client.QueueBrowserTransactedTest#testFailoverWithQueueBrowser
-
// QPID-3432: These tests test the behaviour of 0-8..-0-9-1 specific system property (amqj.default_syncwrite_timeout)
org.apache.qpid.test.client.timeouts.SyncWaitTimeoutDelayTest#*
org.apache.qpid.test.client.timeouts.SyncWaitDelayTest#*
-//QPID-3468: exclude QueueBrowser related failover tests
-org.apache.qpid.test.client.QueueBrowserAutoAckTest#testFailoverWithQueueBrowser
-org.apache.qpid.test.client.QueueBrowserAutoAckTest#testFailoverAsQueueBrowserCreated
-org.apache.qpid.test.client.QueueBrowserClientAckTest#testFailoverWithQueueBrowser
-org.apache.qpid.test.client.QueueBrowserClientAckTest#testFailoverAsQueueBrowserCreated
-org.apache.qpid.test.client.QueueBrowserNoAckTest#testFailoverWithQueueBrowser
-org.apache.qpid.test.client.QueueBrowserNoAckTest#testFailoverAsQueueBrowserCreated
-org.apache.qpid.test.client.QueueBrowserPreAckTest#testFailoverWithQueueBrowser
-org.apache.qpid.test.client.QueueBrowserPreAckTest#testFailoverAsQueueBrowserCreated
-org.apache.qpid.test.client.QueueBrowserDupsOkTest#testFailoverWithQueueBrowser
-org.apache.qpid.test.client.QueueBrowserDupsOkTest#testFailoverAsQueueBrowserCreated
diff --git a/qpid/java/test-profiles/JavaExcludes b/qpid/java/test-profiles/JavaExcludes
index 9f25fcb7b0..08e16ff216 100644
--- a/qpid/java/test-profiles/JavaExcludes
+++ b/qpid/java/test-profiles/JavaExcludes
@@ -28,9 +28,6 @@ org.apache.qpid.test.client.queue.QueuePolicyTest#testRejectPolicy
//Moved from JavaStandaloneExcludes when it was removed
///////////////////////////////////////////////////////
-// This test may use QpidTestCase but it is not using the getConnection and is hardwired to InVM
-org.apache.qpid.test.unit.client.connection.CloseAfterConnectionFailureTest#*
-
//QPID-1818, QPID-1821 : Client code path does not correctly restore a transacted session after failover.
org.apache.qpid.server.persistent.NoLocalAfterRecoveryTest#*