You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by ve...@apache.org on 2008/08/23 21:22:14 UTC
svn commit: r688401 - in /synapse/trunk/java/modules/transports: ./
src/test/java/org/apache/synapse/transport/jms/
Author: veithen
Date: Sat Aug 23 12:22:13 2008
New Revision: 688401
URL: http://svn.apache.org/viewvc?rev=688401&view=rev
Log:
Removed Mockrunner and added ActiveMQ as messaging providers for the JMS transport tests. All tests are now executed using qpid and ActiveMQ.
Added:
synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/jms/ActiveMQTestEnvironment.java
Removed:
synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/jms/MockJMSTestEnvironment.java
Modified:
synapse/trunk/java/modules/transports/pom.xml
synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/jms/JMSListenerTest.java
Modified: synapse/trunk/java/modules/transports/pom.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/pom.xml?rev=688401&r1=688400&r2=688401&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/pom.xml (original)
+++ synapse/trunk/java/modules/transports/pom.xml Sat Aug 23 12:22:13 2008
@@ -196,12 +196,7 @@
<version>0.6-beta2</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>com.mockrunner</groupId>
- <artifactId>mockrunner</artifactId>
- <version>0.3.1</version>
- <scope>test</scope>
- </dependency>
+
<dependency>
<groupId>org.apache.qpid</groupId>
<artifactId>qpid-broker</artifactId>
@@ -217,6 +212,13 @@
</dependency>
<dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <version>5.1.0</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>com.icegreen</groupId>
<artifactId>greenmail</artifactId>
<version>1.3</version>
Added: synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/jms/ActiveMQTestEnvironment.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/jms/ActiveMQTestEnvironment.java?rev=688401&view=auto
==============================================================================
--- synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/jms/ActiveMQTestEnvironment.java (added)
+++ synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/jms/ActiveMQTestEnvironment.java Sat Aug 23 12:22:13 2008
@@ -0,0 +1,76 @@
+/*
+ * 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.synapse.transport.jms;
+
+import javax.jms.Queue;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.Topic;
+import javax.jms.TopicConnectionFactory;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.command.ActiveMQQueue;
+import org.apache.activemq.command.ActiveMQTopic;
+import org.apache.synapse.transport.testkit.name.Name;
+
+@Name("ActiveMQ")
+public class ActiveMQTestEnvironment extends JMSTestEnvironment {
+ private static final String BROKER_NAME = "test";
+
+ private BrokerService broker;
+
+ @SuppressWarnings("unused")
+ private void setUp() throws Exception {
+ broker = new BrokerService();
+ broker.setBrokerName(BROKER_NAME);
+ broker.start();
+ }
+
+ @SuppressWarnings("unused")
+ private void tearDown() throws Exception {
+ broker.stop();
+ broker = null;
+ }
+
+ @Override
+ protected QueueConnectionFactory createQueueConnectionFactory() throws Exception {
+ return createConnectionFactory();
+ }
+
+ @Override
+ protected TopicConnectionFactory createTopicConnectionFactory() throws Exception {
+ return createConnectionFactory();
+ }
+
+ private ActiveMQConnectionFactory createConnectionFactory() throws Exception {
+ return new ActiveMQConnectionFactory("vm://" + BROKER_NAME);
+ }
+
+
+ @Override
+ public Queue createQueue(String name) {
+ return new ActiveMQQueue(name);
+ }
+
+ @Override
+ public Topic createTopic(String name) {
+ return new ActiveMQTopic(name);
+ }
+}
Modified: synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/jms/JMSListenerTest.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/jms/JMSListenerTest.java?rev=688401&r1=688400&r2=688401&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/jms/JMSListenerTest.java (original)
+++ synapse/trunk/java/modules/transports/src/test/java/org/apache/synapse/transport/jms/JMSListenerTest.java Sat Aug 23 12:22:13 2008
@@ -46,7 +46,6 @@
public class JMSListenerTest extends TestCase {
public static TestSuite suite() {
TransportTestSuite suite = new TransportTestSuite();
- JMSTestEnvironment env = new QpidTestEnvironment();
TransportDescriptionFactory tdf = new JMSTransportDescriptionFactory();
AxisServer server = new AxisServer();
AxisAsyncEndpointFactory asyncEndpointFactory = new AxisAsyncEndpointFactory();
@@ -59,38 +58,40 @@
clients.add(adapt(new AxisAsyncTestClient(), MessageConverter.XML_TO_AXIS));
clients.add(adapt(new JMSAxisAsyncClient(JMSConstants.JMS_BYTE_MESSAGE), MessageConverter.XML_TO_AXIS));
clients.add(adapt(new JMSAxisAsyncClient(JMSConstants.JMS_TEXT_MESSAGE), MessageConverter.XML_TO_AXIS));
- suite.addPOXTests(new JMSRequestResponseChannel(JMSConstants.DESTINATION_TYPE_QUEUE, JMSConstants.DESTINATION_TYPE_QUEUE), adapt(new AxisRequestResponseTestClient(), MessageConverter.XML_TO_AXIS, MessageConverter.AXIS_TO_XML), echoEndpointFactory, ContentTypeMode.TRANSPORT, env, server, tdf);
- suite.addPOXTests(new JMSRequestResponseChannel(JMSConstants.DESTINATION_TYPE_QUEUE, JMSConstants.DESTINATION_TYPE_QUEUE), adapt(new AxisRequestResponseTestClient(), MessageConverter.XML_TO_AXIS, MessageConverter.AXIS_TO_XML), new MockEchoEndpointFactory(), ContentTypeMode.TRANSPORT, env, tdf);
- for (String destinationType : new String[] { JMSConstants.DESTINATION_TYPE_QUEUE, JMSConstants.DESTINATION_TYPE_TOPIC }) {
- JMSAsyncChannel channel = new JMSAsyncChannel(destinationType);
- for (ContentTypeMode contentTypeMode : ContentTypeMode.values()) {
- for (AsyncTestClient<XMLMessage> client : clients) {
+ for (JMSTestEnvironment env : new JMSTestEnvironment[] { new QpidTestEnvironment(), new ActiveMQTestEnvironment() }) {
+ suite.addPOXTests(new JMSRequestResponseChannel(JMSConstants.DESTINATION_TYPE_QUEUE, JMSConstants.DESTINATION_TYPE_QUEUE), adapt(new AxisRequestResponseTestClient(), MessageConverter.XML_TO_AXIS, MessageConverter.AXIS_TO_XML), echoEndpointFactory, ContentTypeMode.TRANSPORT, env, server, tdf);
+ suite.addPOXTests(new JMSRequestResponseChannel(JMSConstants.DESTINATION_TYPE_QUEUE, JMSConstants.DESTINATION_TYPE_QUEUE), adapt(new AxisRequestResponseTestClient(), MessageConverter.XML_TO_AXIS, MessageConverter.AXIS_TO_XML), new MockEchoEndpointFactory(), ContentTypeMode.TRANSPORT, env, tdf);
+ for (String destinationType : new String[] { JMSConstants.DESTINATION_TYPE_QUEUE, JMSConstants.DESTINATION_TYPE_TOPIC }) {
+ JMSAsyncChannel channel = new JMSAsyncChannel(destinationType);
+ for (ContentTypeMode contentTypeMode : ContentTypeMode.values()) {
+ for (AsyncTestClient<XMLMessage> client : clients) {
+ if (contentTypeMode == ContentTypeMode.TRANSPORT) {
+ suite.addSOAPTests(channel, client, asyncEndpointFactory, contentTypeMode, env, server, tdf);
+ suite.addPOXTests(channel, client, asyncEndpointFactory, contentTypeMode, env, server, tdf);
+ } else {
+ // If no content type header is used, SwA can't be used and the JMS transport
+ // always uses the default charset encoding
+ suite.addSOAP11Test(channel, client, asyncEndpointFactory, contentTypeMode, new MessageTestData(null, TransportTestSuite.testString,
+ MessageContext.DEFAULT_CHAR_SET_ENCODING), env, server, tdf);
+ suite.addSOAP12Test(channel, client, asyncEndpointFactory, contentTypeMode, new MessageTestData(null, TransportTestSuite.testString,
+ MessageContext.DEFAULT_CHAR_SET_ENCODING), env, server, tdf);
+ suite.addPOXTest(channel, client, asyncEndpointFactory, contentTypeMode, new MessageTestData(null, TransportTestSuite.testString,
+ MessageContext.DEFAULT_CHAR_SET_ENCODING), env, server, tdf);
+ }
+ }
if (contentTypeMode == ContentTypeMode.TRANSPORT) {
- suite.addSOAPTests(channel, client, asyncEndpointFactory, contentTypeMode, env, server, tdf);
- suite.addPOXTests(channel, client, asyncEndpointFactory, contentTypeMode, env, server, tdf);
- } else {
- // If no content type header is used, SwA can't be used and the JMS transport
- // always uses the default charset encoding
- suite.addSOAP11Test(channel, client, asyncEndpointFactory, contentTypeMode, new MessageTestData(null, TransportTestSuite.testString,
- MessageContext.DEFAULT_CHAR_SET_ENCODING), env, server, tdf);
- suite.addSOAP12Test(channel, client, asyncEndpointFactory, contentTypeMode, new MessageTestData(null, TransportTestSuite.testString,
- MessageContext.DEFAULT_CHAR_SET_ENCODING), env, server, tdf);
- suite.addPOXTest(channel, client, asyncEndpointFactory, contentTypeMode, new MessageTestData(null, TransportTestSuite.testString,
- MessageContext.DEFAULT_CHAR_SET_ENCODING), env, server, tdf);
+ suite.addSwATests(channel, bytesMessageClient, asyncEndpointFactory, env, server, tdf);
}
+ // TODO: these tests are temporarily disabled because of SYNAPSE-304
+ // addTextPlainTests(strategy, suite);
+ suite.addBinaryTest(channel, bytesMessageClient, adapt(asyncEndpointFactory, MessageConverter.AXIS_TO_BYTE), contentTypeMode, env, server, tdf);
}
- if (contentTypeMode == ContentTypeMode.TRANSPORT) {
- suite.addSwATests(channel, bytesMessageClient, asyncEndpointFactory, env, server, tdf);
- }
- // TODO: these tests are temporarily disabled because of SYNAPSE-304
- // addTextPlainTests(strategy, suite);
- suite.addBinaryTest(channel, bytesMessageClient, adapt(asyncEndpointFactory, MessageConverter.AXIS_TO_BYTE), contentTypeMode, env, server, tdf);
}
+ suite.addTest(new MinConcurrencyTest(server, new AsyncChannel[] {
+ new JMSAsyncChannel("endpoint1", JMSConstants.DESTINATION_TYPE_QUEUE),
+ new JMSAsyncChannel("endpoint2", JMSConstants.DESTINATION_TYPE_QUEUE) },
+ 2, false, env, tdf));
}
- suite.addTest(new MinConcurrencyTest(server, new AsyncChannel[] {
- new JMSAsyncChannel("endpoint1", JMSConstants.DESTINATION_TYPE_QUEUE),
- new JMSAsyncChannel("endpoint2", JMSConstants.DESTINATION_TYPE_QUEUE) },
- 2, false, env, tdf));
return suite;
}
}