This commit is contained in:
Timothy Bish 2013-09-05 12:06:30 -04:00
parent 0203cde150
commit edc1599018
3 changed files with 72 additions and 24 deletions

View File

@ -15,6 +15,22 @@ package org.apache.activemq.transport.amqp;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.net.URI;
import javax.jms.Connection;
import javax.jms.ExceptionListener;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import org.apache.activemq.broker.BrokerFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.qpid.amqp_1_0.client.ConnectionClosedException;
@ -26,14 +42,6 @@ import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.jms.*;
import java.net.URI;
import static org.junit.Assert.*;
/**
* @author Kevin Earls
*/
public class SimpleAMQPAuthTest {
public static final String SIMPLE_AUTH_AMQP_BROKER_XML = "org/apache/activemq/transport/amqp/simple-auth-amqp-broker.xml";
public BrokerService brokerService;
@ -67,7 +75,7 @@ public class SimpleAMQPAuthTest {
});
connection.start();
Thread.sleep(1000);
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
fail("Expected JMSException");
} catch (JMSException e) {
Exception linkedException = e.getLinkedException();
@ -88,7 +96,7 @@ public class SimpleAMQPAuthTest {
Connection connection = factory.createConnection("nosuchuser", "blah");
connection.start();
Thread.sleep(500);
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
fail("Expected JMSException");
} catch (JMSException e) {
Exception linkedException = e.getLinkedException();
@ -109,7 +117,7 @@ public class SimpleAMQPAuthTest {
Connection connection = factory.createConnection("user", "wrongPassword");
connection.start();
Thread.sleep(500);
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
fail("Expected JMSException");
} catch (JMSException e) {
Exception linkedException = e.getLinkedException();
@ -123,7 +131,6 @@ public class SimpleAMQPAuthTest {
}
}
@Test(timeout = 30000)
public void testSendReceive() throws Exception {
ConnectionFactoryImpl factory = new ConnectionFactoryImpl("localhost", port, "admin", "password");
@ -148,7 +155,6 @@ public class SimpleAMQPAuthTest {
connection.close();
}
protected BrokerService createBroker() throws Exception {
return createBroker(SIMPLE_AUTH_AMQP_BROKER_XML);
}
@ -163,6 +169,5 @@ public class SimpleAMQPAuthTest {
brokerService.start();
brokerService.waitUntilStarted();
}
}

View File

@ -16,16 +16,62 @@
*/
package org.apache.activemq.transport.amqp.joram;
import junit.framework.Test;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.rules.Timeout;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.objectweb.jtests.jms.conform.connection.ConnectionTest;
import org.objectweb.jtests.jms.conform.connection.TopicConnectionTest;
import org.objectweb.jtests.jms.conform.message.MessageBodyTest;
import org.objectweb.jtests.jms.conform.message.MessageDefaultTest;
import org.objectweb.jtests.jms.conform.message.MessageTypeTest;
import org.objectweb.jtests.jms.conform.message.headers.MessageHeaderTest;
import org.objectweb.jtests.jms.conform.message.properties.JMSXPropertyTest;
import org.objectweb.jtests.jms.conform.message.properties.MessagePropertyConversionTest;
import org.objectweb.jtests.jms.conform.message.properties.MessagePropertyTest;
import org.objectweb.jtests.jms.conform.queue.TemporaryQueueTest;
import org.objectweb.jtests.jms.conform.selector.SelectorSyntaxTest;
import org.objectweb.jtests.jms.conform.selector.SelectorTest;
import org.objectweb.jtests.jms.conform.session.QueueSessionTest;
import org.objectweb.jtests.jms.conform.session.SessionTest;
import org.objectweb.jtests.jms.conform.session.UnifiedSessionTest;
import org.objectweb.jtests.jms.conform.topic.TemporaryTopicTest;
/**
* Run the JoramJmsTests using amqp+nio
*/
public class JoramJmsNioTest extends JoramJmsTest {
@RunWith(Suite.class)
@Suite.SuiteClasses({
// TopicSessionTest.class, // Hangs, see https://issues.apache.org/jira/browse/PROTON-154
MessageHeaderTest.class,
// QueueBrowserTest.class, // https://issues.apache.org/jira/browse/AMQ-4641
MessageTypeTest.class,
UnifiedSessionTest.class,
TemporaryTopicTest.class,
TopicConnectionTest.class,
SelectorSyntaxTest.class,
QueueSessionTest.class,
SelectorTest.class,
TemporaryQueueTest.class,
ConnectionTest.class,
SessionTest.class,
JMSXPropertyTest.class,
MessageBodyTest.class,
MessageDefaultTest.class,
MessagePropertyConversionTest.class,
MessagePropertyTest.class
})
public class JoramJmsNioTest {
@Rule
public Timeout timeout = new Timeout(10 * 1000);
public static Test suite() {
System.setProperty("joram.jms.test.file", "providerNIO.properties");
Test suite = JoramJmsTest.suite();
return suite;
@BeforeClass
public static void beforeClass() throws Exception {
System.setProperty("joram.jms.test.file", getJmsTestFileName());
}
public static String getJmsTestFileName() {
return "providerNIO.properties";
}
}

View File

@ -22,8 +22,6 @@ import javax.net.ssl.KeyManager;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import junit.framework.TestCase;
import org.apache.activemq.transport.amqp.DefaultTrustManager;
import org.junit.BeforeClass;
import org.junit.Rule;
@ -53,7 +51,6 @@ import org.slf4j.LoggerFactory;
// TopicSessionTest.class, // Hangs, see https://issues.apache.org/jira/browse/PROTON-154
MessageHeaderTest.class,
QueueBrowserTest.class,
JMSXPropertyTest.class,
MessageTypeTest.class,
//,UnifiedSessionTest.class // https://issues.apache.org/jira/browse/AMQ-4375
TemporaryTopicTest.class,
@ -71,7 +68,7 @@ import org.slf4j.LoggerFactory;
MessagePropertyTest.class
})
public class JoramSslTest extends TestCase {
public class JoramSslTest {
protected static final Logger LOG = LoggerFactory.getLogger(JoramSslTest.class);