@@ -0,0 +1,3115 @@
+/**%0A * Licensed to the Apache Software Foundation (ASF) under one or more%0A * contributor license agreements.  See the NOTICE file distributed with%0A * this work for additional information regarding copyright ownership.%0A * The ASF licenses this file to You under the Apache License, Version 2.0%0A * (the %22License%22); you may not use this file except in compliance with%0A * the License.  You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.apache.qpid.jms.failover;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.fail;%0A%0Aimport java.net.URI;%0A%0Aimport javax.jms.DeliveryMode;%0Aimport javax.jms.MessageProducer;%0Aimport javax.jms.Queue;%0Aimport javax.jms.Session;%0Aimport javax.jms.TransactionRolledBackException;%0A%0Aimport org.apache.activemq.broker.jmx.QueueViewMBean;%0Aimport org.apache.qpid.jms.support.AmqpTestSupport;%0Aimport org.junit.Test;%0A%0A/**%0A * Test MessageProducer behavior when in a TX and failover occurs.%0A */%0Apublic class JmsTxProducerFailoverTest extends AmqpTestSupport %7B%0A%0A    @Override%0A    protected boolean isPersistent() %7B%0A        return true;%0A    %7D%0A%0A    @Test%0A    public void testTxProducerSendWorksButCommitFails() throws Exception %7B%0A        URI brokerURI = new URI(%22failover://(%22+ getBrokerAmqpConnectionURI() +%22)?maxReconnectDelay=1000%22);%0A%0A        connection = createAmqpConnection(brokerURI);%0A        connection.start();%0A%0A        final int MSG_COUNT = 20;%0A        final Session session = connection.createSession(true, Session.SESSION_TRANSACTED);%0A        Queue queue = session.createQueue(name.getMethodName());%0A        final MessageProducer producer = session.createProducer(queue);%0A        producer.setDeliveryMode(DeliveryMode.PERSISTENT);%0A%0A        QueueViewMBean proxy = getProxyToQueue(name.getMethodName());%0A        assertEquals(0, proxy.getQueueSize());%0A%0A        for (int i = 0; i %3C MSG_COUNT / 2; ++i) %7B%0A            LOG.debug(%22Producer sening message #%7B%7D%22, i + 1);%0A            producer.send(session.createTextMessage(%22Message: %22 + i));%0A        %7D%0A%0A        assertEquals(0, proxy.getQueueSize());%0A%0A        stopPrimaryBroker();%0A        restartPrimaryBroker();%0A%0A        proxy = getProxyToQueue(name.getMethodName());%0A        assertEquals(0, proxy.getQueueSize());%0A%0A        for (int i = MSG_COUNT / 2; i %3C MSG_COUNT; ++i) %7B%0A            LOG.debug(%22Producer sening message #%7B%7D%22, i + 1);%0A            producer.send(session.createTextMessage(%22Message: %22 + i));%0A        %7D%0A%0A        try %7B%0A            session.commit();%0A            fail(%22Session commit should have failed with TX rolled back.%22);%0A        %7D catch (TransactionRolledBackException rb) %7B%0A            LOG.info(%22Transacted commit failed after failover: %7B%7D%22, rb.getMessage());%0A        %7D%0A%0A        assertEquals(0, proxy.getQueueSize());%0A    %7D%0A%7D%0A

Add a start on testing TX producer with failover.