Add a NIO variant of the JMS clent tests for working through NIO

transport issues.
This commit is contained in:
Timothy Bish 2014-02-11 12:05:46 -05:00
parent be6b4830ec
commit d8c2eda6e8
2 changed files with 148 additions and 5 deletions

View File

@ -0,0 +1,137 @@
/**
* 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.activemq.transport.amqp;
import javax.jms.JMSException;
import org.junit.Test;
/**
* Test the JMS client when connected to the NIO transport.
*/
public class JMSClientNioTest extends JMSClientTest {
@Override
@Test
public void testProducerConsume() throws Exception {
}
@Override
@Test
public void testTransactedConsumer() throws Exception {
}
@Override
@Test
public void testRollbackRececeivedMessage() throws Exception {
}
@Override
@Test
public void testTXConsumerAndLargeNumberOfMessages() throws Exception {
}
@Override
@Test
public void testSelectors() throws Exception {
}
@Override
@Test(timeout=30000)
public void testProducerThrowsWhenBrokerStops() throws Exception {
}
@Override
@Test(timeout=30000)
public void testProducerCreateThrowsWhenBrokerStops() throws Exception {
}
@Override
@Test(timeout=30000)
public void testConsumerCreateThrowsWhenBrokerStops() throws Exception {
}
@Override
@Test(timeout=30000)
public void testConsumerReceiveNoWaitThrowsWhenBrokerStops() throws Exception {
}
@Override
@Test(timeout=30000)
public void testConsumerReceiveTimedThrowsWhenBrokerStops() throws Exception {
}
@Override
@Test(timeout=30000)
public void testConsumerReceiveReturnsBrokerStops() throws Exception {
}
@Override
@Test(timeout=30000)
public void testBrokerRestartWontHangConnectionClose() throws Exception {
}
@Override
@Test(timeout=120000)
public void testProduceAndConsumeLargeNumbersOfMessages() throws JMSException {
}
@Override
@Test(timeout=30000)
public void testSyncSends() throws Exception {
}
@Override
@Test(timeout=30000)
public void testDurableConsumerAsync() throws Exception {
}
@Override
@Test(timeout=30000)
public void testDurableConsumerSync() throws Exception {
}
@Override
@Test(timeout=30000)
public void testTopicConsumerAsync() throws Exception {
}
@Override
@Test(timeout=45000)
public void testTopicConsumerSync() throws Exception {
}
@Override
@Test(timeout=60000)
public void testConnectionsAreClosed() throws Exception {
}
@Override
@Test(timeout=30000)
public void testExecptionListenerCalledOnBrokerStop() throws Exception {
}
@Override
@Test(timeout=30000)
public void testSessionTransactedCommit() throws JMSException, InterruptedException {
}
@Override
protected int getBrokerPort() {
return nioPort;
}
}

View File

@ -48,7 +48,6 @@ import org.apache.activemq.transport.amqp.joram.ActiveMQAdmin;
import org.apache.activemq.util.Wait; import org.apache.activemq.util.Wait;
import org.apache.qpid.amqp_1_0.jms.impl.ConnectionFactoryImpl; import org.apache.qpid.amqp_1_0.jms.impl.ConnectionFactoryImpl;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TestName; import org.junit.rules.TestName;
@ -669,14 +668,12 @@ public class JMSClientTest extends AmqpTestSupport {
})); }));
} }
@Ignore("AMQ-5041")
@Test(timeout=30000) @Test(timeout=30000)
public void testExecptionListenerCalledOnBrokerStop() throws Exception { public void testExecptionListenerCalledOnBrokerStop() throws Exception {
ActiveMQAdmin.enableJMSFrameTracing(); ActiveMQAdmin.enableJMSFrameTracing();
Connection connection = createConnection(); Connection connection = createConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Queue queue = session.createQueue(name.toString());
connection.start(); connection.start();
final CountDownLatch called = new CountDownLatch(1); final CountDownLatch called = new CountDownLatch(1);
@ -752,9 +749,18 @@ public class JMSClientTest extends AmqpTestSupport {
return createConnection(clientId, false); return createConnection(clientId, false);
} }
/**
* Can be overridden in subclasses to test against a different transport suchs as NIO.
*
* @return the port to connect to on the Broker.
*/
protected int getBrokerPort() {
return port;
}
private Connection createConnection(String clientId, boolean syncPublish) throws JMSException { private Connection createConnection(String clientId, boolean syncPublish) throws JMSException {
final ConnectionFactoryImpl factory = new ConnectionFactoryImpl("localhost", port, "admin", "password"); final ConnectionFactoryImpl factory = new ConnectionFactoryImpl("localhost", getBrokerPort(), "admin", "password");
factory.setSyncPublish(syncPublish); factory.setSyncPublish(syncPublish);
factory.setTopicPrefix("topic://"); factory.setTopicPrefix("topic://");