You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by cs...@apache.org on 2014/03/03 15:14:09 UTC
[3/5] CXF-5543 Removing jms old style config,
changing tests to use soap over jms style
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java
index 04ac878..0e19590 100644
--- a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java
+++ b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java
@@ -25,16 +25,12 @@ import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;
-import javax.jms.ConnectionFactory;
import javax.jms.DeliveryMode;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Queue;
import javax.jms.Topic;
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.cxf.BusFactory;
-import org.apache.cxf.bus.spring.SpringBusFactory;
import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.message.ExchangeImpl;
@@ -45,156 +41,49 @@ import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.transport.Conduit;
import org.apache.cxf.transport.MessageObserver;
import org.apache.cxf.transport.MultiplexDestination;
-import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
public class JMSDestinationTest extends AbstractJMSTester {
- private static final int MAX_RECEIVE_TIME = 10;
- private Message destMessage;
-
- public JMSDestinationTest() {
-
- }
-
- @BeforeClass
- public static void createAndStartBroker() throws Exception {
- startBroker(new JMSBrokerSetup("tcp://localhost:" + JMS_PORT));
- }
-
- private void waitForReceiveInMessage() {
- int waitTime = 0;
- while (inMessage == null && waitTime < MAX_RECEIVE_TIME) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- // do nothing here
- }
- waitTime++;
- }
- assertTrue("Can't receive the Conduit Message in " + MAX_RECEIVE_TIME + " seconds",
- inMessage != null);
- }
-
- private void waitForReceiveDestMessage() {
- int waitTime = 0;
- while (destMessage == null && waitTime < MAX_RECEIVE_TIME) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- // do nothing here
- }
- waitTime++;
- }
- assertNotNull("Can't receive the Destination message in " + MAX_RECEIVE_TIME
- + " seconds", destMessage);
- }
-
- protected MessageObserver createMessageObserver() {
- return new MessageObserver() {
- public void onMessage(Message m) {
- Exchange exchange = new ExchangeImpl();
- exchange.setInMessage(m);
- m.setExchange(exchange);
- destMessage = m;
- }
- };
- }
-
- @Test
- public void testGetConfigurationFromSpring() throws Exception {
- SpringBusFactory bf = new SpringBusFactory();
- BusFactory.setDefaultBus(null);
- bus = bf.createBus("/jms_test_config.xml");
- BusFactory.setDefaultBus(bus);
- EndpointInfo ei = setupServiceInfo("http://cxf.apache.org/jms_conf_test", "/wsdl/others/jms_test_no_addr.wsdl",
- "HelloWorldQueueBinMsgService", "HelloWorldQueueBinMsgPort");
- JMSDestination destination = setupJMSDestination(ei);
- JMSConfiguration jmsConfig = destination.getJmsConfig();
- assertEquals("Can't get the right ServerConfig's MessageTimeToLive ", 500L, jmsConfig
- .getTimeToLive());
- assertEquals("Can't get the right Server's MessageSelector", "cxf_message_selector", jmsConfig
- .getMessageSelector());
- assertEquals("Can't get the right DurableSubscriberName", "cxf_subscriber", jmsConfig
- .getDurableSubscriptionName());
-
- assertEquals("The receiveTimeout should be set", jmsConfig.getReceiveTimeout().longValue(), 1500L);
- assertEquals("The maxSuspendedContinuations should be set",
- jmsConfig.getMaxSuspendedContinuations(), 2);
- assertNotNull("The connectionFactory should not be null", jmsConfig.getConnectionFactory());
- assertTrue("Should get the instance of ActiveMQConnectionFactory",
- jmsConfig.getConnectionFactory() instanceof ActiveMQConnectionFactory);
- ActiveMQConnectionFactory cf = (ActiveMQConnectionFactory)jmsConfig.getConnectionFactory();
- assertEquals("The borker URL is wrong", cf.getBrokerURL(), "tcp://localhost:61500");
- assertEquals("Get a wrong TargetDestination", jmsConfig.getTargetDestination(), "queue:test");
- assertEquals("Get the wrong pubSubDomain value", jmsConfig.isPubSubDomain(), false);
- destination.shutdown();
- BusFactory.setDefaultBus(null);
-
- }
@Test
public void testGetConfigurationFromWSDL() throws Exception {
- SpringBusFactory bf = new SpringBusFactory();
- BusFactory.setDefaultBus(null);
- bus = bf.createBus();
- BusFactory.setDefaultBus(bus);
- EndpointInfo ei = setupServiceInfo("http://cxf.apache.org/hello_world_jms", "/wsdl/jms_test.wsdl",
- "HelloWorldQueueBinMsgService", "HelloWorldQueueBinMsgPort");
-
+ EndpointInfo ei = setupServiceInfo("HelloWorldQueueBinMsgService", "HelloWorldQueueBinMsgPort");
JMSDestination destination = setupJMSDestination(ei);
- ConnectionFactory cf = destination.getJmsConfig().getConnectionFactory();
- assertNotNull("ConnectionFactory should not be null", cf);
-
- assertEquals("Can't get the right DurableSubscriberName", "CXF_subscriber", destination
- .getJmsConfig().getDurableSubscriptionName());
-
assertEquals("Can't get the right AddressPolicy's Destination",
- "dynamicQueues/test.jmstransport.binary", destination.getJmsConfig()
- .getTargetDestination());
+ "test.jmstransport.binary",
+ destination.getJmsConfig().getTargetDestination());
destination.shutdown();
- BusFactory.setDefaultBus(null);
-
}
@Test
public void testDurableSubscriber() throws Exception {
- SpringBusFactory bf = new SpringBusFactory();
- BusFactory.setDefaultBus(null);
- bus = bf.createBus("jms_test_config.xml");
- BusFactory.setDefaultBus(bus);
destMessage = null;
- EndpointInfo ei = setupServiceInfo("http://cxf.apache.org/hello_world_jms", "/wsdl/jms_test.wsdl",
- "HelloWorldPubSubService", "HelloWorldPubSubPort");
- JMSConduit conduit = setupJMSConduit(ei, true);
+ EndpointInfo ei = setupServiceInfo("HelloWorldPubSubService", "HelloWorldPubSubPort");
+ JMSConduit conduit = setupJMSConduitWithObserver(ei);
Message outMessage = new MessageImpl();
setupMessageHeader(outMessage);
JMSDestination destination = setupJMSDestination(ei);
destination.setMessageObserver(createMessageObserver());
// The JMSBroker (ActiveMQ 5.x) need to take some time to setup the DurableSubscriber
- Thread.sleep(2000);
+ Thread.sleep(500);
sendOneWayMessage(conduit, outMessage);
- // wait for the message to be get from the destination
- //long time = System.currentTimeMillis();
waitForReceiveDestMessage();
- //System.out.println("time: " + (System.currentTimeMillis() - time));
- // just verify the Destination inMessage
+
assertTrue("The destiantion should have got the message ", destMessage != null);
verifyReceivedMessage(destMessage);
verifyHeaders(destMessage, outMessage);
conduit.close();
destination.shutdown();
- BusFactory.setDefaultBus(null);
}
@Test
public void testOneWayDestination() throws Exception {
- EndpointInfo ei = setupServiceInfo("http://cxf.apache.org/hello_world_jms", "/wsdl/jms_test.wsdl",
- "HWStaticReplyQBinMsgService", "HWStaticReplyQBinMsgPort");
+ EndpointInfo ei = setupServiceInfo("HWStaticReplyQBinMsgService", "HWStaticReplyQBinMsgPort");
JMSDestination destination = setupJMSDestination(ei);
destination.setMessageObserver(createMessageObserver());
- JMSConduit conduit = setupJMSConduit(ei, true);
+ JMSConduit conduit = setupJMSConduitWithObserver(ei);
Message outMessage = new MessageImpl();
setupMessageHeader(outMessage);
@@ -209,114 +98,6 @@ public class JMSDestinationTest extends AbstractJMSTester {
destination.shutdown();
}
- @Test
- @Ignore
- public void testOneWayReplyToSetUnset() throws Exception {
- /* 1. Test that replyTo destination set in WSDL is NOT used
- * in spec compliant mode */
-
- destMessage = null;
- EndpointInfo ei = setupServiceInfo("http://cxf.apache.org/hello_world_jms", "/wsdl/jms_test.wsdl",
- "HWStaticReplyQBinMsgService", "HWStaticReplyQBinMsgPort");
- JMSConduit conduit = setupJMSConduit(ei, true);
- Message outMessage = new MessageImpl();
- setupMessageHeader(outMessage);
- JMSDestination destination = setupJMSDestination(ei);
- destination.setMessageObserver(createMessageObserver());
- sendOneWayMessage(conduit, outMessage);
- waitForReceiveDestMessage();
- // just verify the Destination inMessage
- assertTrue("The destination should have got the message ", destMessage != null);
- verifyReplyToNotSet(destMessage);
- destMessage = null;
-
- /* 2. Test that replyTo destination set in WSDL IS used
- * in spec non-compliant mode */
-
- sendOneWayMessage(conduit, outMessage);
- waitForReceiveDestMessage();
- assertTrue("The destination should have got the message ", destMessage != null);
- String exName = getQueueName(conduit.getJmsConfig().getReplyDestination());
- verifyReplyToSet(destMessage, Queue.class, exName);
- destMessage = null;
-
- /* 3. Test that replyTo destination provided via invocation context
- * overrides the value set in WSDL and IS used in spec non-compliant mode */
-
- String contextReplyTo = conduit.getJmsConfig().getReplyDestination() + ".context";
- exName += ".context";
- setupMessageHeader(outMessage, "cidValue", contextReplyTo);
- sendOneWayMessage(conduit, outMessage);
- waitForReceiveDestMessage();
- assertTrue("The destiantion should have got the message ", destMessage != null);
- verifyReplyToSet(destMessage, Queue.class, exName);
- destMessage = null;
-
- /* 4. Test that replyTo destination provided via invocation context
- * and the value set in WSDL are NOT used in spec non-compliant mode
- * when JMSConstants.JMS_SET_REPLY_TO == false */
-
- setupMessageHeader(outMessage);
- outMessage.put(JMSConstants.JMS_SET_REPLY_TO, Boolean.FALSE);
- sendOneWayMessage(conduit, outMessage);
- waitForReceiveDestMessage();
- assertTrue("The destiantion should have got the message ", destMessage != null);
- verifyReplyToNotSet(destMessage);
- destMessage = null;
-
- /* 5. Test that replyTo destination set in WSDL IS used in spec non-compliant
- * mode when JMSConstants.JMS_SET_REPLY_TO == true */
-
- setupMessageHeader(outMessage);
- outMessage.put(JMSConstants.JMS_SET_REPLY_TO, Boolean.TRUE);
- sendOneWayMessage(conduit, outMessage);
- waitForReceiveDestMessage();
- assertTrue("The destiantion should have got the message ", destMessage != null);
- exName = getQueueName(conduit.getJmsConfig().getReplyDestination());
- verifyReplyToSet(destMessage, Queue.class, exName);
- destMessage = null;
-
- conduit.close();
- destination.shutdown();
- }
-
- private String getQueueName(String exName) {
- if (exName == null) {
- return null;
- }
- return (exName.indexOf('/') != -1 && exName.indexOf('/') < exName.length())
- ? exName.substring(exName.indexOf('/') + 1) : exName;
- }
-
-
- protected void verifyReplyToNotSet(Message cxfMsg) {
- javax.jms.Message jmsMsg =
- javax.jms.Message.class.cast(cxfMsg.get(JMSConstants.JMS_REQUEST_MESSAGE));
- assertNotNull("JMS Messsage must be null", jmsMsg);
- }
-
- private String getDestinationName(Destination dest) throws JMSException {
- if (dest instanceof Queue) {
- return ((Queue)dest).getQueueName();
- } else {
- return ((Topic)dest).getTopicName();
- }
- }
-
- protected void verifyReplyToSet(Message cxfMsg,
- Class<? extends Destination> type,
- String expectedName) throws Exception {
- javax.jms.Message jmsMsg =
- javax.jms.Message.class.cast(cxfMsg.get(JMSConstants.JMS_REQUEST_MESSAGE));
- assertNotNull("JMS Messsage must not be null", jmsMsg);
- assertNotNull("JMS Messsage's replyTo must not be null", jmsMsg.getJMSReplyTo());
- assertTrue("JMS Messsage's replyTo type must be of type " + type.getName(),
- type.isAssignableFrom(jmsMsg.getJMSReplyTo().getClass()));
- String receivedName = getDestinationName(jmsMsg.getJMSReplyTo());
- assertTrue("JMS Messsage's replyTo must be named " + expectedName + " but was " + receivedName,
- expectedName == receivedName || receivedName.equals(expectedName));
-
- }
private void setupMessageHeader(Message outMessage, String correlationId, String replyTo) {
JMSMessageHeadersType header = new JMSMessageHeadersType();
header.setJMSCorrelationID(correlationId);
@@ -389,12 +170,6 @@ public class JMSDestinationTest extends AbstractJMSTester {
}
private void verifyJmsHeaderEquality(JMSMessageHeadersType outHeader, JMSMessageHeadersType inHeader) {
- /*
- * if (outHeader.getJMSCorrelationID() != null) { // only check if the correlation id was explicitly
- * set as // otherwise the in header will contain an automatically // generated correlation id
- * assertEquals("The inMessage and outMessage JMS Header's CorrelationID should be equals", outHeader
- * .getJMSCorrelationID(), inHeader.getJMSCorrelationID()); }
- */
assertEquals("The inMessage and outMessage JMS Header's JMSPriority should be equals", outHeader
.getJMSPriority(), inHeader.getJMSPriority());
assertEquals("The inMessage and outMessage JMS Header's JMSDeliveryMode should be equals", outHeader
@@ -405,10 +180,8 @@ public class JMSDestinationTest extends AbstractJMSTester {
@Test
public void testRoundTripDestination() throws Exception {
- EndpointInfo ei = setupServiceInfo("http://cxf.apache.org/hello_world_jms", "/wsdl/jms_test.wsdl",
- "HelloWorldService", "HelloWorldPort");
- // set up the conduit send to be true
- JMSConduit conduit = setupJMSConduit(ei, true);
+ EndpointInfo ei = setupServiceInfo("HelloWorldService", "HelloWorldPort");
+ JMSConduit conduit = setupJMSConduitWithObserver(ei);
final Message outMessage = new MessageImpl();
setupMessageHeader(outMessage, null);
final JMSDestination destination = setupJMSDestination(ei);
@@ -456,13 +229,11 @@ public class JMSDestinationTest extends AbstractJMSTester {
@Test
public void testProperty() throws Exception {
-
+ EndpointInfo ei = setupServiceInfo("HelloWorldService", "HelloWorldPort");
final String customPropertyName = "THIS_PROPERTY_WILL_NOT_BE_AUTO_COPIED";
- EndpointInfo ei = setupServiceInfo("http://cxf.apache.org/hello_world_jms", "/wsdl/jms_test.wsdl",
- "HelloWorldService", "HelloWorldPort");
// set up the conduit send to be true
- JMSConduit conduit = setupJMSConduit(ei, true);
+ JMSConduit conduit = setupJMSConduitWithObserver(ei);
final Message outMessage = new MessageImpl();
setupMessageHeader(outMessage, null);
@@ -522,8 +293,7 @@ public class JMSDestinationTest extends AbstractJMSTester {
@Test
public void testIsMultiplexCapable() throws Exception {
- EndpointInfo ei = setupServiceInfo("http://cxf.apache.org/hello_world_jms", "/wsdl/jms_test.wsdl",
- "HelloWorldService", "HelloWorldPort");
+ EndpointInfo ei = setupServiceInfo("HelloWorldService", "HelloWorldPort");
final JMSDestination destination = setupJMSDestination(ei);
destination.setMessageObserver(createMessageObserver());
assertTrue("is multiplex", destination instanceof MultiplexDestination);
@@ -532,12 +302,11 @@ public class JMSDestinationTest extends AbstractJMSTester {
@Test
public void testSecurityContext() throws Exception {
- EndpointInfo ei = setupServiceInfo("http://cxf.apache.org/hello_world_jms", "/wsdl/jms_test.wsdl",
- "HelloWorldService", "HelloWorldPort");
+ EndpointInfo ei = setupServiceInfo("HelloWorldService", "HelloWorldPort");
final JMSDestination destination = setupJMSDestination(ei);
destination.setMessageObserver(createMessageObserver());
// set up the conduit send to be true
- JMSConduit conduit = setupJMSConduit(ei, true);
+ JMSConduit conduit = setupJMSConduitWithObserver(ei);
final Message outMessage = new MessageImpl();
setupMessageHeader(outMessage, null);
sendOneWayMessage(conduit, outMessage);
@@ -550,20 +319,114 @@ public class JMSDestinationTest extends AbstractJMSTester {
destination.shutdown();
}
+
@Test
- public void testGetSpringSingleConnectionFactoryFromWSDL() throws Exception {
- EndpointInfo ei = setupServiceInfo("http://cxf.apache.org/hello_world_jms", "/wsdl/jms_test.wsdl",
- "HelloWorldServiceSpringICF", "HelloWorldPortSpringICF");
- final JMSDestination destination = setupJMSDestination(ei);
+ @Ignore
+ public void testOneWayReplyToSetUnset() throws Exception {
+ /* 1. Test that replyTo destination set in WSDL is NOT used
+ * in spec compliant mode */
+
+ destMessage = null;
+ EndpointInfo ei = setupServiceInfo(
+ "HWStaticReplyQBinMsgService", "HWStaticReplyQBinMsgPort");
+ JMSConduit conduit = setupJMSConduitWithObserver(ei);
+ Message outMessage = new MessageImpl();
+ setupMessageHeader(outMessage);
+ JMSDestination destination = setupJMSDestination(ei);
destination.setMessageObserver(createMessageObserver());
- // set up the conduit send to be true
- JMSConduit conduit = setupJMSConduit(ei, true);
- final Message outMessage = new MessageImpl();
- setupMessageHeader(outMessage, null);
sendOneWayMessage(conduit, outMessage);
waitForReceiveDestMessage();
+ // just verify the Destination inMessage
+ assertTrue("The destination should have got the message ", destMessage != null);
+ verifyReplyToNotSet(destMessage);
+ destMessage = null;
+
+ /* 2. Test that replyTo destination set in WSDL IS used
+ * in spec non-compliant mode */
+
+ sendOneWayMessage(conduit, outMessage);
+ waitForReceiveDestMessage();
+ assertTrue("The destination should have got the message ", destMessage != null);
+ String exName = getQueueName(conduit.getJmsConfig().getReplyDestination());
+ verifyReplyToSet(destMessage, Queue.class, exName);
+ destMessage = null;
+
+ /* 3. Test that replyTo destination provided via invocation context
+ * overrides the value set in WSDL and IS used in spec non-compliant mode */
+
+ String contextReplyTo = conduit.getJmsConfig().getReplyDestination() + ".context";
+ exName += ".context";
+ setupMessageHeader(outMessage, "cidValue", contextReplyTo);
+ sendOneWayMessage(conduit, outMessage);
+ waitForReceiveDestMessage();
+ assertTrue("The destiantion should have got the message ", destMessage != null);
+ verifyReplyToSet(destMessage, Queue.class, exName);
+ destMessage = null;
+
+ /* 4. Test that replyTo destination provided via invocation context
+ * and the value set in WSDL are NOT used in spec non-compliant mode
+ * when JMSConstants.JMS_SET_REPLY_TO == false */
+
+ setupMessageHeader(outMessage);
+ outMessage.put(JMSConstants.JMS_SET_REPLY_TO, Boolean.FALSE);
+ sendOneWayMessage(conduit, outMessage);
+ waitForReceiveDestMessage();
+ assertTrue("The destiantion should have got the message ", destMessage != null);
+ verifyReplyToNotSet(destMessage);
+ destMessage = null;
+
+ /* 5. Test that replyTo destination set in WSDL IS used in spec non-compliant
+ * mode when JMSConstants.JMS_SET_REPLY_TO == true */
+
+ setupMessageHeader(outMessage);
+ outMessage.put(JMSConstants.JMS_SET_REPLY_TO, Boolean.TRUE);
+ sendOneWayMessage(conduit, outMessage);
+ waitForReceiveDestMessage();
+ assertTrue("The destiantion should have got the message ", destMessage != null);
+ exName = getQueueName(conduit.getJmsConfig().getReplyDestination());
+ verifyReplyToSet(destMessage, Queue.class, exName);
+ destMessage = null;
+
conduit.close();
destination.shutdown();
}
+ private String getQueueName(String exName) {
+ if (exName == null) {
+ return null;
+ }
+ return (exName.indexOf('/') != -1 && exName.indexOf('/') < exName.length())
+ ? exName.substring(exName.indexOf('/') + 1) : exName;
+ }
+
+
+ protected void verifyReplyToNotSet(Message cxfMsg) {
+ javax.jms.Message jmsMsg =
+ javax.jms.Message.class.cast(cxfMsg.get(JMSConstants.JMS_REQUEST_MESSAGE));
+ assertNotNull("JMS Messsage must be null", jmsMsg);
+ }
+
+ private String getDestinationName(Destination dest) throws JMSException {
+ if (dest instanceof Queue) {
+ return ((Queue)dest).getQueueName();
+ } else {
+ return ((Topic)dest).getTopicName();
+ }
+ }
+
+ protected void verifyReplyToSet(Message cxfMsg,
+ Class<? extends Destination> type,
+ String expectedName) throws Exception {
+ javax.jms.Message jmsMsg =
+ javax.jms.Message.class.cast(cxfMsg.get(JMSConstants.JMS_REQUEST_MESSAGE));
+ assertNotNull("JMS Messsage must not be null", jmsMsg);
+ assertNotNull("JMS Messsage's replyTo must not be null", jmsMsg.getJMSReplyTo());
+ assertTrue("JMS Messsage's replyTo type must be of type " + type.getName(),
+ type.isAssignableFrom(jmsMsg.getJMSReplyTo().getClass()));
+ String receivedName = getDestinationName(jmsMsg.getJMSReplyTo());
+ assertTrue("JMS Messsage's replyTo must be named " + expectedName + " but was " + receivedName,
+ expectedName == receivedName || receivedName.equals(expectedName));
+
+ }
+
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/OldConfigTest.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/OldConfigTest.java b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/OldConfigTest.java
deleted file mode 100644
index 575659b..0000000
--- a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/OldConfigTest.java
+++ /dev/null
@@ -1,46 +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.cxf.transport.jms;
-
-import org.apache.cxf.service.model.EndpointInfo;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-public class OldConfigTest extends AbstractJMSTester {
-
- @BeforeClass
- public static void createAndStartBroker() throws Exception {
- startBroker(new JMSBrokerSetup("tcp://localhost:" + JMS_PORT));
- }
-
- @Test
- public void testUsernameAndPassword() throws Exception {
- EndpointInfo ei = setupServiceInfo("http://cxf.apache.org/hello_world_jms", "/wsdl/jms_test.wsdl",
- "HelloWorldService", "HelloWorldPort");
- JMSOldConfigHolder holder = new JMSOldConfigHolder();
- JMSConfiguration config = holder.createJMSConfigurationFromEndpointInfo(bus, ei, target, false);
- String username = config.getJndiConfig().getConnectionUserName();
- String password = config.getJndiConfig().getConnectionPassword();
- Assert.assertEquals("User name does not match." , "testUser", username);
- Assert.assertEquals("Password does not match." , "testPassword", password);
- }
-}
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/RequestResponseTest.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/RequestResponseTest.java b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/RequestResponseTest.java
index 820088f..c44179c 100644
--- a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/RequestResponseTest.java
+++ b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/RequestResponseTest.java
@@ -19,15 +19,10 @@
package org.apache.cxf.transport.jms;
-import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.io.StringReader;
import javax.jms.DeliveryMode;
-import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.message.ExchangeImpl;
import org.apache.cxf.message.Message;
@@ -35,57 +30,12 @@ import org.apache.cxf.message.MessageImpl;
import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.transport.Conduit;
import org.apache.cxf.transport.MessageObserver;
-import org.junit.BeforeClass;
import org.junit.Test;
public class RequestResponseTest extends AbstractJMSTester {
- private static final int MAX_RECEIVE_TIME = 10;
-
- public RequestResponseTest() {
- }
-
- @BeforeClass
- public static void createAndStartBroker() throws Exception {
- startBroker(new JMSBrokerSetup("tcp://localhost:" + JMS_PORT));
- }
-
- private void waitForReceiveInMessage() {
- int waitTime = 0;
- while (inMessage == null && waitTime < MAX_RECEIVE_TIME) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- // do nothing here
- }
- waitTime++;
- }
- assertTrue("Can't receive the Conduit Message in " + MAX_RECEIVE_TIME + " seconds",
- inMessage != null);
- }
private void verifyReceivedMessage(Message message) {
- ByteArrayInputStream bis = (ByteArrayInputStream)message.getContent(InputStream.class);
- String response = "<not found>";
- if (bis != null) {
- byte bytes[] = new byte[bis.available()];
- try {
- bis.read(bytes);
- } catch (IOException ex) {
- assertFalse("Read the Destination recieved Message error ", false);
- ex.printStackTrace();
- }
- response = IOUtils.newStringFromBytes(bytes);
- } else {
- StringReader reader = (StringReader)message.getContent(Reader.class);
- char buffer[] = new char[5000];
- try {
- int i = reader.read(buffer);
- response = new String(buffer, 0 , i);
- } catch (IOException e) {
- assertFalse("Read the Destination recieved Message error ", false);
- e.printStackTrace();
- }
- }
+ String response = getContent(message);
assertEquals("The response content should be equal", AbstractJMSTester.MESSAGE_CONTENT, response);
}
@@ -101,12 +51,6 @@ public class RequestResponseTest extends AbstractJMSTester {
}
private void verifyJmsHeaderEquality(JMSMessageHeadersType outHeader, JMSMessageHeadersType inHeader) {
- /*
- * if (outHeader.getJMSCorrelationID() != null) { // only check if the correlation id was explicitly
- * set as // otherwise the in header will contain an automatically // generated correlation id
- * assertEquals("The inMessage and outMessage JMS Header's CorrelationID should be equals", outHeader
- * .getJMSCorrelationID(), inHeader.getJMSCorrelationID()); }
- */
assertEquals("The inMessage and outMessage JMS Header's JMSPriority should be equals", outHeader
.getJMSPriority(), inHeader.getJMSPriority());
assertEquals("The inMessage and outMessage JMS Header's JMSDeliveryMode should be equals", outHeader
@@ -137,7 +81,6 @@ public class RequestResponseTest extends AbstractJMSTester {
EndpointInfo ei = setupServiceInfo("http://cxf.apache.org/jms_simple", "/wsdl/jms_spec_testsuite.wsdl",
"JMSSimpleService002X", "SimplePortTopicRequest");
sendAndReceiveMessages(ei, true);
- //sendAndReceiveMessages(ei, false);
}
@Test
@@ -162,7 +105,7 @@ public class RequestResponseTest extends AbstractJMSTester {
protected void sendAndReceiveMessages(EndpointInfo ei, boolean synchronous) throws IOException {
inMessage = null;
// set up the conduit send to be true
- JMSConduit conduit = setupJMSConduit(ei, true);
+ JMSConduit conduit = setupJMSConduitWithObserver(ei);
final Message outMessage = createMessage();
final JMSDestination destination = setupJMSDestination(ei);
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/ThrottlingCounterTest.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/ThrottlingCounterTest.java b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/ThrottlingCounterTest.java
index fada026..d7e85b7 100644
--- a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/ThrottlingCounterTest.java
+++ b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/ThrottlingCounterTest.java
@@ -24,7 +24,6 @@ import org.junit.Test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-
public class ThrottlingCounterTest {
@Test
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/JMSEndpointTest.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/JMSEndpointTest.java b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/JMSEndpointTest.java
index 70bf53d..e61a1b3 100644
--- a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/JMSEndpointTest.java
+++ b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/JMSEndpointTest.java
@@ -113,16 +113,18 @@ public class JMSEndpointTest extends Assert {
+ "=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+ "&jndiConnectionFactoryName=ConnectionFactory"
+ "&jndiURL=tcp://localhost:61616"
- + "&jndi-com.sun.jndi.someParameter=someValue");
+ + "&jndi-com.sun.jndi.someParameter=someValue"
+ + "&durableSubscriptionName=dur");
assertEquals(JMSEndpoint.JNDI, endpoint.getJmsVariant());
assertEquals(endpoint.getParameters().size(), 0);
- assertEquals(endpoint.getJndiInitialContextFactory(),
- "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
- assertEquals(endpoint.getJndiConnectionFactoryName(), "ConnectionFactory");
- assertEquals(endpoint.getJndiURL(), "tcp://localhost:61616");
+ assertEquals("org.apache.activemq.jndi.ActiveMQInitialContextFactory",
+ endpoint.getJndiInitialContextFactory());
+ assertEquals("ConnectionFactory", endpoint.getJndiConnectionFactoryName());
+ assertEquals("tcp://localhost:61616", endpoint.getJndiURL());
+ assertEquals("dur", endpoint.getDurableSubscriptionName());
Map<String, String> addParas = endpoint.getJndiParameters();
- assertEquals(addParas.size(), 1);
- assertEquals(addParas.get("com.sun.jndi.someParameter"), "someValue");
+ assertEquals(1, addParas.size());
+ assertEquals("someValue", addParas.get("com.sun.jndi.someParameter"));
}
@Test
@@ -130,18 +132,17 @@ public class JMSEndpointTest extends Assert {
JMSEndpoint endpoint = new JMSEndpoint("jms:queue:Foo.Bar?" + "deliveryMode=NON_PERSISTENT"
+ "&timeToLive=100" + "&priority=5" + "&replyToName=foo.bar2");
assertEquals(JMSEndpoint.QUEUE, endpoint.getJmsVariant());
- assertEquals(endpoint.getParameters().size(), 0);
- assertEquals(endpoint.getDeliveryMode(),
- DeliveryModeType.NON_PERSISTENT);
- assertEquals(endpoint.getTimeToLive(), 100);
- assertEquals(endpoint.getPriority(), 5);
- assertEquals(endpoint.getReplyToName(), "foo.bar2");
+ assertEquals(0, endpoint.getParameters().size());
+ assertEquals(DeliveryModeType.NON_PERSISTENT, endpoint.getDeliveryMode());
+ assertEquals(100, endpoint.getTimeToLive());
+ assertEquals(5, endpoint.getPriority());
+ assertEquals("foo.bar2", endpoint.getReplyToName());
}
@Test
public void testRequestUri() throws Exception {
- JMSEndpoint endpoint = new JMSEndpoint("jms:jndi:Foo.Bar?" + "jndiInitialContextFactory"
- + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+ JMSEndpoint endpoint = new JMSEndpoint("jms:jndi:Foo.Bar"
+ + "?jndiInitialContextFactory=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+ "&targetService=greetMe"
+ "&replyToName=replyQueue"
+ "&timeToLive=1000"
@@ -149,7 +150,7 @@ public class JMSEndpointTest extends Assert {
+ "&foo=bar"
+ "&foo2=bar2");
assertEquals(JMSEndpoint.JNDI, endpoint.getJmsVariant());
- assertEquals(endpoint.getParameters().size(), 3);
+ assertEquals(2, endpoint.getParameters().size());
String requestUri = endpoint.getRequestURI();
// Checking what's the request uri should have
assertTrue(requestUri.startsWith("jms:jndi:Foo.Bar?"));
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/URIConfiguredConduitTest.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/URIConfiguredConduitTest.java b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/URIConfiguredConduitTest.java
index 84cebb7..033e7b9 100644
--- a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/URIConfiguredConduitTest.java
+++ b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/uri/URIConfiguredConduitTest.java
@@ -23,20 +23,20 @@ import javax.jms.ConnectionFactory;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
-import org.apache.cxf.configuration.ConfiguredBeanLocator;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.message.ExchangeImpl;
import org.apache.cxf.message.Message;
import org.apache.cxf.message.MessageImpl;
import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.transport.jms.JMSConduit;
+import org.apache.cxf.transport.jms.JMSConfigFactory;
import org.apache.cxf.transport.jms.JMSConfiguration;
import org.apache.cxf.transport.jms.JMSConstants;
import org.apache.cxf.transport.jms.JMSMessageHeadersType;
-import org.apache.cxf.transport.jms.JMSOldConfigHolder;
import org.apache.cxf.transport.jms.util.TestReceiver;
import org.apache.cxf.ws.addressing.EndpointReferenceType;
import org.junit.Assert;
+import org.junit.BeforeClass;
import org.junit.Test;
/**
@@ -45,13 +45,18 @@ import org.junit.Test;
*/
public class URIConfiguredConduitTest {
private static final String SERVICE_QUEUE = "test";
- private static final String BROKER_URI = "vm://localhost?broker.persistent=false";
- private ConnectionFactory connectionFactory;
+ private static final String BROKER_URI = "vm://URIConfiguredConduitTest?broker.persistent=false";
+ private static ConnectionFactory cf;
private enum SyncType {
sync,
async
};
+
+ @BeforeClass
+ public static void initConnectionFactory() {
+ cf = new ActiveMQConnectionFactory(BROKER_URI);
+ }
@Test
public void testSendReceive() throws Exception {
@@ -74,24 +79,15 @@ public class URIConfiguredConduitTest {
}
public void sendAndReceive(SyncType syncType, String address) throws Exception {
- BusFactory bf = BusFactory.newInstance();
- Bus bus = bf.createBus();
- BusFactory.setDefaultBus(bus);
-
// Register bean locator for cf lookup
- ConfiguredBeanLocator cbl = bus.getExtension(ConfiguredBeanLocator.class);
- MyBeanLocator registry = new MyBeanLocator(cbl);
- bus.setExtension(registry, ConfiguredBeanLocator.class);
-
- connectionFactory = new ActiveMQConnectionFactory(BROKER_URI);
- registry.register("ConnectionFactory", connectionFactory);
- TestReceiver receiver = new TestReceiver(connectionFactory, SERVICE_QUEUE, false);
+ TestReceiver receiver = new TestReceiver(cf, SERVICE_QUEUE, false);
receiver.runAsync();
EndpointInfo ei = new EndpointInfo();
ei.setAddress(address);
- JMSOldConfigHolder holder = new JMSOldConfigHolder();
- JMSConfiguration jmsConfig = holder.createJMSConfigurationFromEndpointInfo(bus, ei, null, true);
+ Bus bus = BusFactory.getDefaultBus();
+ JMSConfiguration jmsConfig = JMSConfigFactory.createFromEndpointInfo(bus, ei, null);
+ jmsConfig.setConnectionFactory(cf);
JMSConduit conduit = new JMSConduit(new EndpointReferenceType(), jmsConfig, bus);
Exchange exchange = new ExchangeImpl();
@@ -109,7 +105,6 @@ public class URIConfiguredConduitTest {
.get(JMSConstants.JMS_CLIENT_RESPONSE_HEADERS);
Assert.assertEquals(receiver.getRequestMessageId(), inHeaders.getJMSCorrelationID());
conduit.close();
- bus.shutdown(true);
}
private void waitForAsyncReply(Exchange exchange) throws InterruptedException {
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/util/JMSUtilTest.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/util/JMSUtilTest.java b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/util/JMSUtilTest.java
index fec7872..f4bcf74 100644
--- a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/util/JMSUtilTest.java
+++ b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/util/JMSUtilTest.java
@@ -19,9 +19,20 @@
package org.apache.cxf.transport.jms.util;
+import java.io.IOException;
+import java.nio.charset.Charset;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicLong;
+import javax.jms.BytesMessage;
+import javax.jms.Connection;
+import javax.jms.JMSException;
+import javax.jms.Session;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.cxf.transport.jms.JMSConfiguration;
+import org.apache.cxf.transport.jms.JMSConstants;
+import org.apache.cxf.transport.jms.JMSFactory;
import org.junit.Assert;
import org.junit.Test;
@@ -54,4 +65,24 @@ public class JMSUtilTest extends Assert {
assertEquals("The correlationID value does not match expected value",
prefix + expectedIndex, correlationID);
}
+
+ @Test
+ public void testJMSMessageMarshal() throws IOException, JMSException {
+ String testMsg = "Test Message";
+ final byte[] testBytes = testMsg.getBytes(Charset.defaultCharset().name()); // TODO encoding
+ JMSConfiguration jmsConfig = new JMSConfiguration();
+ jmsConfig.setConnectionFactory(new ActiveMQConnectionFactory("vm://tesstMarshal?broker.persistent=false"));
+
+ ResourceCloser closer = new ResourceCloser();
+ try {
+ Connection connection = JMSFactory.createConnection(jmsConfig);
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ javax.jms.Message jmsMessage =
+ JMSUtil.createAndSetPayload(testBytes, session, JMSConstants.BYTE_MESSAGE_TYPE);
+ assertTrue("Message should have been of type BytesMessage ", jmsMessage instanceof BytesMessage);
+ } finally {
+ closer.close();
+ }
+
+ }
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/rt/transports/jms/src/test/resources/jms_test.wsdl
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/test/resources/jms_test.wsdl b/rt/transports/jms/src/test/resources/jms_test.wsdl
new file mode 100644
index 0000000..5c4d26f
--- /dev/null
+++ b/rt/transports/jms/src/test/resources/jms_test.wsdl
@@ -0,0 +1,252 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<definitions name="HelloWorldService"
+ targetNamespace="http://cxf.apache.org/hello_world_jms"
+ xmlns="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:jms="http://www.w3.org/2010/soapjms/"
+ xmlns:x1="http://cxf.apache.org/hello_world_jms/types"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://cxf.apache.org/hello_world_jms"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2010/soapjms/ http://svn.apache.org/repos/asf/cxf/tags/cxf-2.7.7/rt/transports/jms/src/main/resources/schemas/wsdl/spec/jms-spec-wsdl.xsd ">
+ <types>
+ <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:x1="http://cxf.apache.org/hello_world_jms/types" targetNamespace="http://cxf.apache.org/hello_world_jms/types" elementFormDefault="qualified">
+ <complexType name="ErrorCode">
+ <sequence>
+ <element name="minor" type="short"/>
+ <element name="major" type="short"/>
+ </sequence>
+ </complexType>
+ <complexType name="testRpcLitFault">
+ <sequence>
+ <element name="faultType" type="string"/>
+ </sequence>
+ </complexType>
+ <complexType name="testRpcLitFaultResponse">
+ <sequence/>
+ </complexType>
+ <element name="NoSuchCodeLit" type="x1:NoSuchCodeLit"/>
+ <complexType name="NoSuchCodeLit">
+ <sequence>
+ <element name="code" type="x1:ErrorCode"/>
+ </sequence>
+ </complexType>
+ <element name="BadRecordLit" type="x1:BadRecordLit"/>
+ <complexType name="BadRecordLit">
+ <sequence>
+ <element name="reason" type="string"/>
+ <element name="code" type="short"/>
+ </sequence>
+ </complexType>
+ </schema>
+ </types>
+ <message name="greetMe">
+ <part name="stringParam0" type="xsd:string"/>
+ </message>
+ <message name="greetMeResponse">
+ <part name="return" type="xsd:string"/>
+ </message>
+ <message name="sayHi"/>
+ <message name="sayHiResponse">
+ <part name="return" type="xsd:string"/>
+ </message>
+ <message name="greetMeOneWay">
+ <part name="stringParam0" type="xsd:string"/>
+ </message>
+ <message name="testRpcLitFaultRequest">
+ <part name="in" type="xsd:string"/>
+ </message>
+ <message name="testRpcLitFaultResponse">
+ <part name="out" type="x1:testRpcLitFaultResponse"/>
+ </message>
+ <message name="NoSuchCodeLitFault">
+ <part name="NoSuchCodeLit" element="x1:NoSuchCodeLit"/>
+ </message>
+ <message name="BadRecordLitFault">
+ <part name="BadRecordLit" element="x1:BadRecordLit"/>
+ </message>
+ <portType name="HelloWorldPortType">
+ <operation name="greetMe">
+ <input message="tns:greetMe" name="greetMe"/>
+ <output message="tns:greetMeResponse" name="greetMeResponse"/>
+ </operation>
+ <operation name="sayHi">
+ <input message="tns:sayHi" name="sayHi"/>
+ <output message="tns:sayHiResponse" name="sayHiResponse"/>
+ </operation>
+ <operation name="greetMeOneWay">
+ <input message="tns:greetMeOneWay" name="greetMeOneWay"/>
+ </operation>
+ <operation name="testRpcLitFault">
+ <input name="testRpcLitFaultRequest" message="tns:testRpcLitFaultRequest"/>
+ <output name="testRpcLitFaultResponse" message="tns:testRpcLitFaultResponse"/>
+ <fault name="NoSuchCodeLitFault" message="tns:NoSuchCodeLitFault"/>
+ <fault name="BadRecordLitFault" message="tns:BadRecordLitFault"/>
+ </operation>
+ </portType>
+ <portType name="HelloWorldPubSubPort">
+ <operation name="greetMeOneWay">
+ <input message="tns:greetMeOneWay" name="greetMeOneWay"/>
+ </operation>
+ </portType>
+ <binding name="HelloWorldPortBinding" type="tns:HelloWorldPortType">
+ <soap:binding style="rpc" transport="http://www.w3.org/2010/soapjms/"/>
+ <jms:jndiURL>tcp://localhost:61500</jms:jndiURL>
+ <jms:jndiInitialContextFactory>org.apache.activemq.jndi.ActiveMQInitialContextFactory</jms:jndiInitialContextFactory>
+
+ <operation name="greetMe">
+ <soap:operation soapAction="" style="rpc"/>
+ <input name="greetMe">
+ <soap:body namespace="http://cxf.apache.org/hello_world_jms" use="literal"/>
+ </input>
+ <output name="greetMeResponse">
+ <soap:body namespace="http://cxf.apache.org/hello_world_jms" use="literal"/>
+ </output>
+ </operation>
+ <operation name="sayHi">
+ <soap:operation soapAction="" style="rpc"/>
+ <input name="sayHi">
+ <soap:body namespace="http://cxf.apache.org/hello_world_jms" use="literal"/>
+ </input>
+ <output name="sayHiResponse">
+ <soap:body namespace="http://cxf.apache.org/hello_world_jms" use="literal"/>
+ </output>
+ </operation>
+ <operation name="greetMeOneWay">
+ <soap:operation style="rpc"/>
+ <input name="greetMeOneWay">
+ <soap:body namespace="http://cxf.apache.org/hello_world_jms" use="literal"/>
+ </input>
+ </operation>
+ <operation name="testRpcLitFault">
+ <soap:operation style="rpc"/>
+ <input>
+ <soap:body namespace="http://cxf.apache.org/hello_world_jms" use="literal"/>
+ </input>
+ <output>
+ <soap:body namespace="http://cxf.apache.org/hello_world_jms" use="literal"/>
+ </output>
+ <fault name="NoSuchCodeLitFault">
+ <soap:fault name="NoSuchCodeLitFault" use="literal"/>
+ </fault>
+ <fault name="BadRecordLitFault">
+ <soap:fault name="BadRecordLitFault" use="literal"/>
+ </fault>
+ </operation>
+ </binding>
+ <binding name="HelloWorldQueueBinMsgBinding" type="tns:HelloWorldPortType">
+ <soap:binding style="rpc" transport="http://www.w3.org/2010/soapjms/"/>
+ <jms:jndiURL>tcp://localhost:61500</jms:jndiURL>
+ <jms:jndiInitialContextFactory>org.apache.activemq.jndi.ActiveMQInitialContextFactory</jms:jndiInitialContextFactory>
+
+ <operation name="greetMe">
+ <soap:operation soapAction="" style="rpc"/>
+ <input name="greetMe">
+ <soap:body namespace="http://cxf.apache.org/hello_world_jms" use="literal"/>
+ </input>
+ <output name="greetMeResponse">
+ <soap:body namespace="http://cxf.apache.org/hello_world_jms" use="literal"/>
+ </output>
+ </operation>
+ <operation name="sayHi">
+ <soap:operation soapAction="" style="rpc"/>
+ <input name="sayHi">
+ <soap:body namespace="http://cxf.apache.org/hello_world_jms" use="literal"/>
+ </input>
+ <output name="sayHiResponse">
+ <soap:body namespace="http://cxf.apache.org/hello_world_jms" use="literal"/>
+ </output>
+ </operation>
+ <operation name="greetMeOneWay">
+ <soap:operation style="rpc"/>
+ <input name="greetMeOneWay">
+ <soap:body namespace="http://cxf.apache.org/hello_world_jms" use="literal"/>
+ </input>
+ </operation>
+ </binding>
+ <binding name="HWStaticReplyQBinMsgBinding" type="tns:HelloWorldPortType">
+ <soap:binding style="rpc" transport="http://www.w3.org/2010/soapjms/"/>
+ <jms:jndiURL>tcp://localhost:61500</jms:jndiURL>
+ <jms:jndiInitialContextFactory>org.apache.activemq.jndi.ActiveMQInitialContextFactory</jms:jndiInitialContextFactory>
+
+ <operation name="greetMe">
+ <soap:operation soapAction="" style="rpc"/>
+ <input name="greetMe">
+ <soap:body namespace="http://cxf.apache.org/hello_world_jms" use="literal"/>
+ </input>
+ <output name="greetMeResponse">
+ <soap:body namespace="http://cxf.apache.org/hello_world_jms" use="literal"/>
+ </output>
+ </operation>
+ <operation name="sayHi">
+ <soap:operation soapAction="" style="rpc"/>
+ <input name="sayHi">
+ <soap:body namespace="http://cxf.apache.org/hello_world_jms" use="literal"/>
+ </input>
+ <output name="sayHiResponse">
+ <soap:body namespace="http://cxf.apache.org/hello_world_jms" use="literal"/>
+ </output>
+ </operation>
+ <operation name="greetMeOneWay">
+ <soap:operation style="rpc"/>
+ <input name="greetMeOneWay">
+ <soap:body namespace="http://cxf.apache.org/hello_world_jms" use="literal"/>
+ </input>
+ </operation>
+ </binding>
+ <binding name="HelloWorldPubSubBinding" type="tns:HelloWorldPubSubPort">
+ <soap:binding style="rpc" transport="http://www.w3.org/2010/soapjms/"/>
+ <jms:jndiURL>tcp://localhost:61500</jms:jndiURL>
+ <jms:jndiInitialContextFactory>org.apache.activemq.jndi.ActiveMQInitialContextFactory</jms:jndiInitialContextFactory>
+ <operation name="greetMeOneWay">
+ <soap:operation style="rpc"/>
+ <input name="greetMeOneWay">
+ <soap:body namespace="http://cxf.apache.org/hello_world_jms" use="literal"/>
+ </input>
+ </operation>
+ </binding>
+ <service name="HelloWorldQueueBinMsgService">
+ <port binding="tns:HelloWorldQueueBinMsgBinding" name="HelloWorldQueueBinMsgPort">
+ <soap:address location="jms:queue:test.jmstransport.binary?replyToQueueName=test.jms.addr.reply.queue&messageType=binary&receiveTimeout=500&timeTolive=600" />
+ <wswa:UsingAddressing xmlns:wswa="http://www.w3.org/2005/02/addressing/wsdl"/>
+ </port>
+ </service>
+ <service name="HelloWorldService">
+ <port binding="tns:HelloWorldPortBinding" name="HelloWorldPort">
+ <soap:address location="jms:queue:test.jmstransport.text?username=testUser&password=testPassword&useConduitIdSelector=false" />
+ </port>
+ </service>
+ <service name="HelloWorldServiceLoop">
+ <port binding="tns:HWStaticReplyQBinMsgBinding" name="HelloWorldPortLoop">
+ <soap:address location="jms:queue:test.jmstransport.binary?replyToQueueName=test.jmstransport.binary.reply&messageType=binary" />
+ </port>
+ </service>
+ <service name="HWStaticReplyQBinMsgService">
+ <port binding="tns:HWStaticReplyQBinMsgBinding" name="HWStaticReplyQBinMsgPort">
+ <soap:address location="jms:queue:test.jmstransport.binary?replyToQueueName=test.jmstransport.binary.reply&messageType=binary" />
+ </port>
+ </service>
+ <service name="HelloWorldPubSubService">
+ <port binding="tns:HelloWorldPubSubBinding" name="HelloWorldPubSubPort">
+ <soap:address location="jms:topic:test.jmstransport.oneway.topic" />
+ </port>
+ </service>
+</definitions>
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/rt/transports/jms/src/test/resources/jms_test_config.xml
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/test/resources/jms_test_config.xml b/rt/transports/jms/src/test/resources/jms_test_config.xml
deleted file mode 100644
index cff8911..0000000
--- a/rt/transports/jms/src/test/resources/jms_test_config.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ct="http://cxf.apache.org/configuration/types" xmlns:jms="http://cxf.apache.org/transports/jms" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation=" http://cxf.apache.org/transports/jms http://cxf.apache.org/schemas/configuration/jms.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
- <jms:conduit name="{http://cxf.apache.org/jms_conf_test}HelloWorldQueueBinMsgPort.jms-conduit">
- <jms:clientConfig clientReceiveTimeout="500" messageTimeToLive="500"/>
- <jms:runtimePolicy messageType="binary"/>
- <jms:sessionPool lowWaterMark="10" highWaterMark="5000"/>
- <jms:address destinationStyle="queue"
- jndiConnectionFactoryName="ConnectionFactory"
- jndiDestinationName="myOwnDestination"
- jndiReplyDestinationName="myOwnReplyDestination"
- connectionUserName="testUser"
- connectionPassword="testPassword">
- <jms:JMSNamingProperty name="java.naming.factory.initial" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>
- <jms:JMSNamingProperty name="java.naming.provider.url" value="tcp://localhost:61500"/>
- </jms:address>
- <jms:jmsConfig-ref>jmsConf1</jms:jmsConfig-ref>
- </jms:conduit>
- <jms:destination name="{http://cxf.apache.org/jms_conf_test}HelloWorldQueueBinMsgPort.jms-destination">
- <jms:sessionPool lowWaterMark="10" highWaterMark="5000"/>
- <jms:address destinationStyle="queue"
- jndiConnectionFactoryName="ConnectionFactory"
- jndiDestinationName="myOwnDestination"
- jndiReplyDestinationName="myOwnReplyDestination"
- connectionUserName="testUser"
- connectionPassword="testPassword">
- <jms:JMSNamingProperty name="java.naming.factory.initial" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>
- <jms:JMSNamingProperty name="java.naming.provider.url" value="tcp://localhost:61511"/>
- </jms:address>
- <jms:jmsConfig-ref>jmsConf2</jms:jmsConfig-ref>
- </jms:destination>
- <jms:destination name="{http://cxf.apache.org/hello_world_jms}HelloWorldPubSubPort.jms-destination">
- <jms:serverConfig messageTimeToLive="500" durableSubscriptionClientId="test-server-id"/>
- <jms:runtimePolicy durableSubscriberName="cxf_subscriber"/>
- <jms:sessionPool lowWaterMark="10" highWaterMark="5000"/>
- </jms:destination>
- <bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
- </bean>
- <bean id="jmsConf1" class="org.apache.cxf.transport.jms.JMSConfiguration"
- p:connectionFactory-ref="connectionFactory"
- p:targetDestination="queue:test"
- p:pubSubDomain="false"/>
- <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"
- p:brokerURL="tcp://localhost:61500"/>
- <bean id="jmsConf2" class="org.apache.cxf.transport.jms.JMSConfiguration"
- p:connectionFactory-ref="jmsConnectionFactory"
- p:timeToLive="500"
- p:messageSelector="cxf_message_selector"
- p:sessionTransacted="true"
- p:durableSubscriptionName="cxf_subscriber"
- p:targetDestination="queue:test"
- p:replyDestination="queue:test.reply"
- p:pubSubDomain="false"
- p:usingEndpointInfo="false"
- p:receiveTimeout="1500"
- p:maxSuspendedContinuations="2"/>
-</beans>
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/rt/transports/jms/src/test/resources/jms_test_jndi.xml
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/test/resources/jms_test_jndi.xml b/rt/transports/jms/src/test/resources/jms_test_jndi.xml
deleted file mode 100644
index e812ca4..0000000
--- a/rt/transports/jms/src/test/resources/jms_test_jndi.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ct="http://cxf.apache.org/configuration/types" xmlns:jms="http://cxf.apache.org/transports/jms" xmlns:p="http://www.springframework.org/schema/p" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation=" http://cxf.apache.org/transports/jms http://cxf.apache.org/schemas/configuration/jms.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="jndi" class="org.apache.xbean.spring.jndi.SpringInitialContextFactory" factory-method="makeInitialContext" singleton="true">
- <property name="entries" ref="jndiEntries"/>
- </bean>
- <util:map id="jndiEntries">
- <entry key="ConnectionFactory">
- <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory" p:brokerURL="vm://localhost"/>
- </entry>
- </util:map>
-</beans>
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/systests/jaxrs/activemq-data/localhost/KahaDB/db-1.log
----------------------------------------------------------------------
diff --git a/systests/jaxrs/activemq-data/localhost/KahaDB/db-1.log b/systests/jaxrs/activemq-data/localhost/KahaDB/db-1.log
new file mode 100644
index 0000000..ab3d099
Binary files /dev/null and b/systests/jaxrs/activemq-data/localhost/KahaDB/db-1.log differ
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/systests/jaxrs/activemq-data/localhost/KahaDB/db.data
----------------------------------------------------------------------
diff --git a/systests/jaxrs/activemq-data/localhost/KahaDB/db.data b/systests/jaxrs/activemq-data/localhost/KahaDB/db.data
new file mode 100644
index 0000000..ce7e1b5
Binary files /dev/null and b/systests/jaxrs/activemq-data/localhost/KahaDB/db.data differ
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/systests/jaxrs/activemq-data/localhost/KahaDB/db.redo
----------------------------------------------------------------------
diff --git a/systests/jaxrs/activemq-data/localhost/KahaDB/db.redo b/systests/jaxrs/activemq-data/localhost/KahaDB/db.redo
new file mode 100644
index 0000000..45f61d1
Binary files /dev/null and b/systests/jaxrs/activemq-data/localhost/KahaDB/db.redo differ
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jms/JAXRSJmsTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jms/JAXRSJmsTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jms/JAXRSJmsTest.java
index 499650b..49e8e0d 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jms/JAXRSJmsTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jms/JAXRSJmsTest.java
@@ -80,10 +80,9 @@ public class JAXRSJmsTest extends AbstractBusClientServerTestBase {
public void testGetBookFromWebClient() throws Exception {
// setup the the client
String endpointAddressUrlEncoded = "jms:jndi:dynamicQueues/test.jmstransport.text"
- + "?jndiInitialContextFactory=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
- + "&replyToName=dynamicQueues/test.jmstransport.response"
- + "&jndiURL=tcp://localhost:" + JMS_PORT
- + "&jndiConnectionFactoryName=ConnectionFactory";
+ + "?replyToName=dynamicQueues/test.jmstransport.response"
+ + "&jndiInitialContextFactory=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+ + "&jndiURL=tcp://localhost:" + JMS_PORT;
WebClient client = WebClient.create(endpointAddressUrlEncoded);
WebClient.getConfig(client).getRequestContext()
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jms/JMSServer.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jms/JMSServer.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jms/JMSServer.java
index 045b1cc..87cc385 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jms/JMSServer.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jms/JMSServer.java
@@ -18,6 +18,7 @@
*/
package org.apache.cxf.systest.jaxrs.jms;
+import org.apache.activemq.broker.BrokerService;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -36,6 +37,10 @@ public class JMSServer extends AbstractBusTestServerBase {
public static void main(String[] args) {
try {
+ BrokerService broker = new BrokerService();
+ broker.addConnector("tcp://localhost:61500");
+ broker.start();
+ System.setProperty("testutil.ports.EmbeddedJMSBrokerLauncher", "61500");
JMSServer s = new JMSServer();
s.start();
} catch (Exception ex) {
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jms/jms_server_config.xml
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jms/jms_server_config.xml b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jms/jms_server_config.xml
index b1fdf29..6a38115 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jms/jms_server_config.xml
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/jms/jms_server_config.xml
@@ -20,20 +20,12 @@
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jms="http://cxf.apache.org/transports/jms" xmlns:p="http://www.springframework.org/schema/p" xmlns:jaxrs="http://cxf.apache.org/jaxrs" xsi:schemaLocation=" http://cxf.apache.org/transports/jms http://cxf.apache.org/schemas/configuration/jms.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
- <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"
+ <bean id="ConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"
p:brokerURL="tcp://localhost:${testutil.ports.EmbeddedJMSBrokerLauncher}"/>
- <bean id="jmsConfig" class="org.apache.cxf.transport.jms.JMSConfiguration"
- p:connectionFactory-ref="jmsConnectionFactory"
- p:timeToLive="500000"
- p:maxSuspendedContinuations="0"/>
- <jms:destination name="{http://books.com}BookService.jms-destination">
- <jms:address jndiConnectionFactoryName="ConnectionFactory" jndiDestinationName="dynamicQueues/test.jmstransport.text">
- <jms:JMSNamingProperty name="java.naming.factory.initial" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>
- <jms:JMSNamingProperty name="java.naming.provider.url" value="tcp://localhost:${testutil.ports.EmbeddedJMSBrokerLauncher}"/>
- </jms:address>
- <jms:jmsConfig-ref>jmsConfig</jms:jmsConfig-ref>
- </jms:destination>
- <jaxrs:server xmlns:s="http://books.com" serviceName="s:BookService" transportId="http://cxf.apache.org/transports/jms" address="/">
+ <jaxrs:server xmlns:s="http://books.com"
+ serviceName="s:BookService"
+ transportId="http://www.w3.org/2010/soapjms/"
+ address="jms:queue:test.jmstransport.text?replyToName=test.jmstransport.response">
<jaxrs:serviceBeans>
<bean class="org.apache.cxf.systest.jaxrs.JMSBookStore"/>
</jaxrs:serviceBeans>
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/systests/transport-jms/src/test/java/org/apache/cxf/jms/testsuite/testcases/SOAPJMSTestSuiteTest.java
----------------------------------------------------------------------
diff --git a/systests/transport-jms/src/test/java/org/apache/cxf/jms/testsuite/testcases/SOAPJMSTestSuiteTest.java b/systests/transport-jms/src/test/java/org/apache/cxf/jms/testsuite/testcases/SOAPJMSTestSuiteTest.java
index 1f852d6..3d5fb0d 100644
--- a/systests/transport-jms/src/test/java/org/apache/cxf/jms/testsuite/testcases/SOAPJMSTestSuiteTest.java
+++ b/systests/transport-jms/src/test/java/org/apache/cxf/jms/testsuite/testcases/SOAPJMSTestSuiteTest.java
@@ -62,11 +62,11 @@ import org.apache.cxf.testsuite.testcase.MessagePropertiesType;
import org.apache.cxf.testsuite.testcase.TestCaseType;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.apache.cxf.testutil.common.EmbeddedJMSBrokerLauncher;
+import org.apache.cxf.transport.jms.JMSConfigFactory;
import org.apache.cxf.transport.jms.JMSConfiguration;
import org.apache.cxf.transport.jms.JMSConstants;
import org.apache.cxf.transport.jms.JMSFactory;
import org.apache.cxf.transport.jms.JMSMessageHeadersType;
-import org.apache.cxf.transport.jms.JMSOldConfigHolder;
import org.apache.cxf.transport.jms.spec.JMSSpecConstants;
import org.apache.cxf.transport.jms.util.JMSSender;
import org.apache.cxf.transport.jms.util.JMSUtil;
@@ -631,9 +631,7 @@ public class SOAPJMSTestSuiteTest extends AbstractBusClientServerTestBase {
EndpointInfo endpointInfo = new EndpointInfo();
endpointInfo.setAddress(address);
- JMSOldConfigHolder oldConfig = new JMSOldConfigHolder();
- JMSConfiguration jmsConfig = oldConfig
- .createJMSConfigurationFromEndpointInfo(staticBus, endpointInfo , null, true);
+ JMSConfiguration jmsConfig = JMSConfigFactory.createFromEndpointInfo(staticBus, endpointInfo , null);
ResourceCloser closer = new ResourceCloser();
try {
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/systests/transport-jms/src/test/java/org/apache/cxf/jms/testsuite/testcases/SoapJmsSpecTest.java
----------------------------------------------------------------------
diff --git a/systests/transport-jms/src/test/java/org/apache/cxf/jms/testsuite/testcases/SoapJmsSpecTest.java b/systests/transport-jms/src/test/java/org/apache/cxf/jms/testsuite/testcases/SoapJmsSpecTest.java
index 33adc9b..b18344f 100644
--- a/systests/transport-jms/src/test/java/org/apache/cxf/jms/testsuite/testcases/SoapJmsSpecTest.java
+++ b/systests/transport-jms/src/test/java/org/apache/cxf/jms/testsuite/testcases/SoapJmsSpecTest.java
@@ -35,14 +35,12 @@ import org.apache.cxf.systest.jms.Hello;
import org.apache.cxf.systest.jms.Server;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.apache.cxf.testutil.common.EmbeddedJMSBrokerLauncher;
+import org.apache.cxf.transport.jms.JMSConfigFactory;
import org.apache.cxf.transport.jms.JMSConfiguration;
import org.apache.cxf.transport.jms.JMSConstants;
import org.apache.cxf.transport.jms.JMSMessageHeadersType;
-import org.apache.cxf.transport.jms.JMSOldConfigHolder;
-import org.apache.cxf.transport.jms.JNDIConfiguration;
import org.apache.cxf.transport.jms.spec.JMSSpecConstants;
import org.apache.cxf.transport.jms.uri.JMSEndpoint;
-import org.apache.cxf.transport.jms.util.JndiHelper;
import org.apache.cxf.transport.jms.util.TestReceiver;
import org.apache.hello_world_doc_lit.Greeter;
import org.apache.hello_world_doc_lit.SOAPService7;
@@ -172,10 +170,8 @@ public class SoapJmsSpecTest extends AbstractBusClientServerTestBase {
private void specNoWsdlService(String messageType) throws Exception {
String address = "jms:jndi:dynamicQueues/test.cxf.jmstransport.queue3"
- + "?jndiInitialContextFactory"
- + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
- + "&jndiConnectionFactoryName=ConnectionFactory&jndiURL="
- + broker.getEncodedBrokerURL();
+ + "?jndiInitialContextFactory=org.apache.activemq.jndi.ActiveMQInitialContextFactory"
+ + "&jndiConnectionFactoryName=ConnectionFactory&jndiURL=" + broker.getEncodedBrokerURL();
if (messageType != null) {
address = address + "&messageType=" + messageType;
}
@@ -229,12 +225,8 @@ public class SoapJmsSpecTest extends AbstractBusClientServerTestBase {
endpoint.setJndiConnectionFactoryName("ConnectionFactory");
final JMSConfiguration jmsConfig = new JMSConfiguration();
- JndiHelper jt = new JndiHelper(JMSOldConfigHolder.getInitialContextEnv(endpoint));
-
- JNDIConfiguration jndiConfig = new JNDIConfiguration();
- jndiConfig.setJndiConnectionFactoryName(endpoint.getJndiConnectionFactoryName());
- jmsConfig.setJndiTemplate(jt);
- jmsConfig.setJndiConfig(jndiConfig);
+ jmsConfig.setJndiEnvironment(JMSConfigFactory.getInitialContextEnv(endpoint));
+ jmsConfig.setConnectionFactoryName(endpoint.getJndiConnectionFactoryName());
TestReceiver receiver = new TestReceiver(jmsConfig.getConnectionFactory(),
"dynamicQueues/SoapService7.replyto.queue", false);
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerGzipTest.java
----------------------------------------------------------------------
diff --git a/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerGzipTest.java b/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerGzipTest.java
index 6fb83a8..9e83bc2 100644
--- a/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerGzipTest.java
+++ b/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerGzipTest.java
@@ -26,15 +26,10 @@ import javax.xml.ws.Endpoint;
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
-import org.apache.cxf.bus.spring.SpringBusFactory;
-import org.apache.cxf.endpoint.Client;
-import org.apache.cxf.frontend.ClientProxy;
-import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
import org.apache.cxf.testutil.common.EmbeddedJMSBrokerLauncher;
-import org.apache.cxf.transport.jms.AddressType;
-import org.apache.cxf.transport.jms.JMSNamingPropertyType;
+import org.apache.cxf.transport.common.gzip.GZIPFeature;
import org.apache.hello_world_doc_lit.Greeter;
import org.apache.hello_world_doc_lit.PingMeFault;
import org.apache.hello_world_doc_lit.SOAPService2;
@@ -50,12 +45,12 @@ public class JMSClientServerGzipTest extends AbstractBusClientServerTestBase {
Endpoint ep;
protected void run() {
Object impleDoc = new GreeterImplDoc();
- SpringBusFactory bf = new SpringBusFactory();
- Bus bus = bf.createBus("org/apache/cxf/systest/jms/gzipBus.xml");
- BusFactory.setDefaultBus(bus);
+ Bus bus = BusFactory.getDefaultBus();
+ bus.getFeatures().add(new GZIPFeature());
setBus(bus);
broker.updateWsdl(bus, "testutils/hello_world_doc_lit.wsdl");
- ep = Endpoint.publish(null, impleDoc);
+ ep = Endpoint.publish(null, impleDoc,
+ new GZIPFeature());
}
public void tearDown() {
ep.stop();
@@ -87,34 +82,18 @@ public class JMSClientServerGzipTest extends AbstractBusClientServerTestBase {
@Test
public void testGzipEncodingWithJms() throws Exception {
- SpringBusFactory bf = new SpringBusFactory();
- Bus bus = bf.createBus("org/apache/cxf/systest/jms/gzipBus.xml");
- BusFactory.setDefaultBus(bus);
QName serviceName = getServiceName(new QName("http://apache.org/hello_world_doc_lit",
"SOAPService2"));
QName portName = getPortName(new QName("http://apache.org/hello_world_doc_lit", "SoapPort2"));
URL wsdl = getWSDLURL("/wsdl/hello_world_doc_lit.wsdl");
assertNotNull(wsdl);
-
SOAPService2 service = new SOAPService2(wsdl, serviceName);
- assertNotNull(service);
String response1 = new String("Hello Milestone-");
String response2 = new String("Bonjour");
try {
- Greeter greeter = service.getPort(portName, Greeter.class);
-
- Client client = ClientProxy.getClient(greeter);
- EndpointInfo ei = client.getEndpoint().getEndpointInfo();
- AddressType address = ei.getTraversedExtensor(new AddressType(), AddressType.class);
- JMSNamingPropertyType name = new JMSNamingPropertyType();
- JMSNamingPropertyType password = new JMSNamingPropertyType();
- name.setName("java.naming.security.principal");
- name.setValue("ivan");
- password.setName("java.naming.security.credentials");
- password.setValue("the-terrible");
- address.getJMSNamingProperty().add(name);
- address.getJMSNamingProperty().add(password);
+ Greeter greeter = service.getPort(portName, Greeter.class, new GZIPFeature());
+
for (int idx = 0; idx < 5; idx++) {
greeter.greetMeOneWay("test String");
@@ -139,6 +118,5 @@ public class JMSClientServerGzipTest extends AbstractBusClientServerTestBase {
} catch (UndeclaredThrowableException ex) {
throw (Exception)ex.getCause();
}
- bus.shutdown(true);
}
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerSoap12Test.java
----------------------------------------------------------------------
diff --git a/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerSoap12Test.java b/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerSoap12Test.java
index 0f7f4a1..538bef2 100644
--- a/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerSoap12Test.java
+++ b/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerSoap12Test.java
@@ -27,14 +27,9 @@ import javax.xml.ws.Endpoint;
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.bus.spring.SpringBusFactory;
-import org.apache.cxf.endpoint.Client;
-import org.apache.cxf.frontend.ClientProxy;
-import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
import org.apache.cxf.testutil.common.EmbeddedJMSBrokerLauncher;
-import org.apache.cxf.transport.jms.AddressType;
-import org.apache.cxf.transport.jms.JMSNamingPropertyType;
import org.apache.hello_world_doc_lit.Greeter;
import org.apache.hello_world_doc_lit.PingMeFault;
import org.apache.hello_world_doc_lit.SOAPService2;
@@ -56,7 +51,7 @@ public class JMSClientServerSoap12Test extends AbstractBusClientServerTestBase {
BusFactory.setDefaultBus(bus);
setBus(bus);
broker.updateWsdl(bus, "testutils/hello_world_doc_lit.wsdl");
- Endpoint.publish(null, impleDoc);
+ Endpoint.publish("jms:queue:routertest.SOAPService2Q.text", impleDoc);
}
}
@@ -102,7 +97,7 @@ public class JMSClientServerSoap12Test extends AbstractBusClientServerTestBase {
String response2 = new String("Bonjour");
try {
Greeter greeter = service.getPort(portName, Greeter.class);
-
+ /*
Client client = ClientProxy.getClient(greeter);
EndpointInfo ei = client.getEndpoint().getEndpointInfo();
AddressType address = ei.getTraversedExtensor(new AddressType(), AddressType.class);
@@ -114,6 +109,7 @@ public class JMSClientServerSoap12Test extends AbstractBusClientServerTestBase {
password.setValue("the-terrible");
address.getJMSNamingProperty().add(name);
address.getJMSNamingProperty().add(password);
+ */
for (int idx = 0; idx < 5; idx++) {
greeter.greetMeOneWay("test String");
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
----------------------------------------------------------------------
diff --git a/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java b/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
index d886cff..22b259c 100644
--- a/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
+++ b/systests/transport-jms/src/test/java/org/apache/cxf/systest/jms/JMSClientServerTest.java
@@ -24,16 +24,12 @@ import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
-import javax.activation.DataHandler;
import javax.xml.namespace.QName;
import javax.xml.ws.AsyncHandler;
-import javax.xml.ws.Binding;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Endpoint;
-import javax.xml.ws.Holder;
import javax.xml.ws.Response;
import javax.xml.ws.soap.AddressingFeature;
-import javax.xml.ws.soap.SOAPBinding;
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
@@ -50,19 +46,12 @@ import org.apache.cxf.hello_world_jms.HelloWorldPubSubService;
import org.apache.cxf.hello_world_jms.HelloWorldQueueDecoupledOneWaysService;
import org.apache.cxf.hello_world_jms.HelloWorldService;
import org.apache.cxf.hello_world_jms.NoSuchCodeLitFault;
-import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
-import org.apache.cxf.jms_mtom.JMSMTOMPortType;
-import org.apache.cxf.jms_mtom.JMSMTOMService;
-import org.apache.cxf.jms_mtom.JMSOutMTOMService;
-import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
import org.apache.cxf.testutil.common.EmbeddedJMSBrokerLauncher;
-import org.apache.cxf.transport.jms.AddressType;
import org.apache.cxf.transport.jms.JMSConstants;
import org.apache.cxf.transport.jms.JMSMessageHeadersType;
-import org.apache.cxf.transport.jms.JMSNamingPropertyType;
import org.apache.cxf.transport.jms.JMSPropertyType;
import org.apache.hello_world_doc_lit.Greeter;
import org.apache.hello_world_doc_lit.PingMeFault;
@@ -111,16 +100,6 @@ public class JMSClientServerTest extends AbstractBusClientServerTestBase {
client.getEndpoint().getOutInterceptors().add(new TibcoSoapActionInterceptor());
client.getOutInterceptors().add(new LoggingOutInterceptor());
client.getInInterceptors().add(new LoggingInInterceptor());
- EndpointInfo ei = client.getEndpoint().getEndpointInfo();
- AddressType address = ei.getTraversedExtensor(new AddressType(), AddressType.class);
- JMSNamingPropertyType name = new JMSNamingPropertyType();
- JMSNamingPropertyType password = new JMSNamingPropertyType();
- name.setName("java.naming.security.principal");
- name.setValue("ivan");
- password.setName("java.naming.security.credentials");
- password.setValue("the-terrible");
- address.getJMSNamingProperty().add(name);
- address.getJMSNamingProperty().add(password);
for (int idx = 0; idx < 5; idx++) {
greeter.greetMeOneWay("test String");
@@ -192,6 +171,7 @@ public class JMSClientServerTest extends AbstractBusClientServerTestBase {
}
}
+ @Ignore
@Test
public void testAsyncCall() throws Exception {
QName serviceName = new QName("http://cxf.apache.org/hello_world_jms", "HelloWorldService");
@@ -539,7 +519,7 @@ public class JMSClientServerTest extends AbstractBusClientServerTestBase {
try {
HelloWorldOneWayPort greeter = service.getPort(portName, HelloWorldOneWayPort.class);
GreeterImplQueueDecoupledOneWays requestServant = new GreeterImplQueueDecoupledOneWays(true);
- requestEndpoint = Endpoint.publish("", requestServant);
+ requestEndpoint = Endpoint.publish(null, requestServant);
BindingProvider bp = (BindingProvider)greeter;
Map<String, Object> requestContext = bp.getRequestContext();
@@ -578,7 +558,7 @@ public class JMSClientServerTest extends AbstractBusClientServerTestBase {
}
@Test
- public void testContextPropogation() throws Exception {
+ public void testContextPropagation() throws Exception {
final String testReturnPropertyName = "Test_Prop";
final String testIgnoredPropertyName = "Test_Prop_No_Return";
QName serviceName = new QName("http://cxf.apache.org/hello_world_jms", "HelloWorldService");
@@ -631,47 +611,7 @@ public class JMSClientServerTest extends AbstractBusClientServerTestBase {
}
}
- @Test
- public void testMTOM() throws Exception {
- QName serviceName = new QName("http://cxf.apache.org/jms_mtom", "JMSMTOMService");
- QName portName = new QName("http://cxf.apache.org/jms_mtom", "MTOMPort");
-
- URL wsdl = getWSDLURL("/wsdl/jms_test_mtom.wsdl");
- JMSMTOMService service = new JMSMTOMService(wsdl, serviceName);
-
- JMSMTOMPortType mtom = service.getPort(portName, JMSMTOMPortType.class);
- Binding binding = ((BindingProvider)mtom).getBinding();
- ((SOAPBinding)binding).setMTOMEnabled(true);
-
- Holder<String> name = new Holder<String>("Sam");
- URL fileURL = this.getClass().getResource("/org/apache/cxf/systest/jms/JMSClientServerTest.class");
- Holder<DataHandler> handler1 = new Holder<DataHandler>();
- handler1.value = new DataHandler(fileURL);
- int size = handler1.value.getInputStream().available();
- mtom.testDataHandler(name, handler1);
-
- byte bytes[] = IOUtils.readBytesFromStream(handler1.value.getInputStream());
- assertEquals("The response file is not same with the sent file.", size, bytes.length);
- }
-
-
- @Test
- public void testOutMTOM() throws Exception {
- QName serviceName = new QName("http://cxf.apache.org/jms_mtom", "JMSMTOMService");
- QName portName = new QName("http://cxf.apache.org/jms_mtom", "MTOMPort");
-
- URL wsdl = getWSDLURL("/wsdl/jms_test_mtom.wsdl");
- JMSOutMTOMService service = new JMSOutMTOMService(wsdl, serviceName);
-
- JMSMTOMPortType mtom = service.getPort(portName, JMSMTOMPortType.class);
- URL fileURL = this.getClass().getResource("/org/apache/cxf/systest/jms/JMSClientServerTest.class");
- DataHandler handler1 = new DataHandler(fileURL);
- int size = handler1.getInputStream().available();
- DataHandler ret = mtom.testOutMtom();
-
- byte bytes[] = IOUtils.readBytesFromStream(ret.getInputStream());
- assertEquals("The response file is not same with the original file.", size, bytes.length);
- }
+
}