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:10 UTC
[4/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/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java
index 8cc6d5e..b75fdd8 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSEndpoint.java
@@ -19,14 +19,15 @@
package org.apache.cxf.transport.jms.uri;
+import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
+import javax.jms.ConnectionFactory;
import javax.jms.Message;
import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.service.model.EndpointInfo;
-import org.apache.cxf.transport.jms.spec.JMSSpecConstants;
import org.apache.cxf.ws.addressing.EndpointReferenceType;
/**
@@ -64,6 +65,7 @@ public class JMSEndpoint {
Map<String, String> parameters = new HashMap<String, String>();
private String endpointUri;
+ private ConnectionFactory connectionFactory;
private String jmsVariant;
private String destinationName;
private DeliveryModeType deliveryMode;
@@ -80,6 +82,10 @@ public class JMSEndpoint {
private boolean reconnectOnException = true;
private String durableSubscriptionName;
private long receiveTimeout = 60000L;
+ private String targetService;
+ private boolean sessionTransacted;
+ private String conduitIdSelectorPrefix;
+ private boolean useConduitIdSelector = true;
/**
* @param uri
@@ -107,97 +113,75 @@ public class JMSEndpoint {
if (ei != null) {
JMSEndpointWSDLUtil.retrieveWSDLInformation(this, ei);
-
}
if (!(StringUtils.isEmpty(endpointUri) || "jms://".equals(endpointUri) || !endpointUri.startsWith("jms"))) {
this.endpointUri = endpointUri;
JMSURIParser parsed = new JMSURIParser(endpointUri);
setJmsVariant(parsed.getVariant());
this.destinationName = parsed.getDestination();
- configureProperties(this, parsed.parseQuery());
+ Map<String, Object> query = parsed.parseQuery();
+ configureProperties(query);
+
+ // Use the properties like e.g. from JAXWS properties
+ if (ei != null && ei.getBinding() != null && ei.getBinding().getProperties() != null) {
+ configureProperties(ei.getBinding().getProperties());
+ }
+ }
+ }
+
+ private boolean trySetProperty(String name, Object value) {
+ try {
+ Method method = this.getClass().getMethod(getPropSetterName(name), value.getClass());
+ method.invoke(this, value);
+ return true;
+ } catch (NoSuchMethodException e) {
+ return false;
+ } catch (Exception e) {
+ throw new RuntimeException("Error setting property " + name + ":" + e.getMessage(), e);
}
}
+
+ private String getPropSetterName(String name) {
+ String first = name.substring(0, 1);
+ String rest = name.substring(1);
+ return "set" + first.toUpperCase() + rest;
+ }
/**
+ * Configure properties form map.
+ * For each key of the map first a property with the same name in the endpoint is tried.
+ * If that does not match then the value is either stored in the jndiParameters or the parameters
+ * depending on the prefix of the key. If it matches JNDI_PARAMETER_NAME_PREFIX it is stored in the
+ * jndiParameters else in the parameters
+ *
* @param endpoint
* @param params
*/
- private static void configureProperties(JMSEndpoint endpoint, Map<String, String> params) {
- String deliveryMode = getAndRemoveParameter(params,
- JMSEndpoint.DELIVERYMODE_PARAMETER_NAME);
- String timeToLive = getAndRemoveParameter(params,
- JMSEndpoint.TIMETOLIVE_PARAMETER_NAME);
- String priority = getAndRemoveParameter(params, JMSEndpoint.PRIORITY_PARAMETER_NAME);
- String replyToName = getAndRemoveParameter(params,
- JMSEndpoint.REPLYTONAME_PARAMETER_NAME);
- String topicReplyToName = getAndRemoveParameter(params,
- JMSEndpoint.TOPICREPLYTONAME_PARAMETER_NAME);
- String jndiConnectionFactoryName = getAndRemoveParameter(
- params,
- JMSEndpoint.JNDICONNECTIONFACTORYNAME_PARAMETER_NAME);
- String jndiInitialContextFactory = getAndRemoveParameter(
- params,
- JMSEndpoint.JNDIINITIALCONTEXTFACTORY_PARAMETER_NAME);
- String jndiUrl = getAndRemoveParameter(params, JMSEndpoint.JNDIURL_PARAMETER_NAME);
-
- String messageType = getAndRemoveParameter(params, JMSEndpoint.MESSAGE_TYPE_PARAMETER_NAME);
-
- if (deliveryMode != null) {
- endpoint.setDeliveryMode(DeliveryModeType.valueOf(deliveryMode));
- }
- if (timeToLive != null) {
- endpoint.setTimeToLive(Long.valueOf(timeToLive));
- }
- if (priority != null) {
- endpoint.setPriority(Integer.valueOf(priority));
- }
- if (replyToName != null && topicReplyToName != null) {
- throw new IllegalArgumentException(
- "The replyToName and topicReplyToName should not be defined at the same time.");
- }
- if (replyToName != null) {
- endpoint.setReplyToName(replyToName);
- }
- if (topicReplyToName != null) {
- endpoint.setTopicReplyToName(topicReplyToName);
- }
- if (jndiConnectionFactoryName != null) {
- endpoint.setJndiConnectionFactoryName(jndiConnectionFactoryName);
- }
- if (jndiInitialContextFactory != null) {
- endpoint.setJndiInitialContextFactory(jndiInitialContextFactory);
- }
- if (jndiUrl != null) {
- endpoint.setJndiURL(jndiUrl);
- }
- if (messageType != null) {
- endpoint.setMessageType(MessageType.fromValue(messageType));
- }
-
+ private void configureProperties(Map<String, Object> params) {
for (String key : params.keySet()) {
- String value = params.get(key);
+ Object value = params.get(key);
if (value == null || value.equals("")) {
continue;
}
+ if (trySetProperty(key, value)) {
+ continue;
+ }
+ if (!(value instanceof String)) {
+ continue;
+ }
+ String valueSt = (String)value;
if (key.startsWith(JMSEndpoint.JNDI_PARAMETER_NAME_PREFIX)) {
key = key.substring(5);
- endpoint.putJndiParameter(key, value);
+ putJndiParameter(key, valueSt);
} else {
- endpoint.putParameter(key, value);
+ putParameter(key, valueSt);
}
}
- }
-
- /**
- * @param parameters
- * @param deliverymodeParameterName
- * @return
- */
- private static String getAndRemoveParameter(Map<String, String> parameters,
- String parameterName) {
- String value = parameters.get(parameterName);
- parameters.remove(parameterName);
- return value;
+
+ if (replyToName != null && topicReplyToName != null) {
+ throw new IllegalArgumentException(
+ "The replyToName and topicReplyToName should not be defined at the same time.");
+ }
}
public String getRequestURI() {
@@ -210,12 +194,6 @@ public class JMSEndpoint {
requestUri.append(":" + destinationName);
boolean first = true;
for (String key : parameters.keySet()) {
- // now we just skip the MESSAGE_TYPE_PARAMETER_NAME
- // and TARGETSERVICE_PARAMETER_NAME
- if (JMSSpecConstants.TARGETSERVICE_PARAMETER_NAME.equals(key)
- || MESSAGE_TYPE_PARAMETER_NAME.equals(key)) {
- continue;
- }
String value = parameters.get(key);
if (first) {
requestUri.append("?" + key + "=" + value);
@@ -264,6 +242,13 @@ public class JMSEndpoint {
public void setEndpointUri(String endpointUri) {
this.endpointUri = endpointUri;
}
+ public ConnectionFactory getConnectionFactory() {
+ return connectionFactory;
+ }
+ public void setConnectionFactory(ConnectionFactory connectionFactory) {
+ this.connectionFactory = connectionFactory;
+ }
+
public String getJmsVariant() {
return jmsVariant;
}
@@ -292,18 +277,27 @@ public class JMSEndpoint {
public void setDeliveryMode(DeliveryModeType deliveryMode) {
this.deliveryMode = deliveryMode;
}
+ public void setDeliveryMode(String deliveryMode) {
+ this.deliveryMode = DeliveryModeType.valueOf(deliveryMode);
+ }
public MessageType getMessageType() {
return messageType == null ? MessageType.BYTE : messageType;
}
public void setMessageType(MessageType messageType) {
this.messageType = messageType;
}
+ public void setMessageType(String messageType) {
+ this.messageType = MessageType.fromValue(messageType);
+ }
public long getTimeToLive() {
return timeToLive;
}
public void setTimeToLive(long timeToLive) {
this.timeToLive = timeToLive;
}
+ public void setTimeToLive(String timeToLive) {
+ this.timeToLive = Long.valueOf(timeToLive);
+ }
public boolean isSetPriority() {
return priority != null;
}
@@ -313,6 +307,9 @@ public class JMSEndpoint {
public void setPriority(int priority) {
this.priority = priority;
}
+ public void setPriority(String priority) {
+ this.priority = Integer.valueOf(priority);
+ }
public String getReplyToName() {
return replyToName;
}
@@ -372,9 +369,41 @@ public class JMSEndpoint {
public long getReceiveTimeout() {
return receiveTimeout;
}
+
public void setReceiveTimeout(long receiveTimeout) {
this.receiveTimeout = receiveTimeout;
}
+
+ public void setReceiveTimeout(String receiveTimeout) {
+ this.receiveTimeout = Long.valueOf(receiveTimeout);
+ }
+ public String getTargetService() {
+ return targetService;
+ }
+ public void setTargetService(String targetService) {
+ this.targetService = targetService;
+ }
+ public boolean isSessionTransacted() {
+ return sessionTransacted;
+ }
+ public void setSessionTransacted(boolean sessionTransacted) {
+ this.sessionTransacted = sessionTransacted;
+ }
+ public void setSessionTransacted(String sessionTransacted) {
+ this.sessionTransacted = Boolean.valueOf(sessionTransacted);
+ }
+ public String getConduitIdSelectorPrefix() {
+ return conduitIdSelectorPrefix;
+ }
+ public void setConduitIdSelectorPrefix(String conduitIdSelectorPrefix) {
+ this.conduitIdSelectorPrefix = conduitIdSelectorPrefix;
+ }
+ public boolean isUseConduitIdSelector() {
+ return useConduitIdSelector;
+ }
+ public void setUseConduitIdSelector(boolean useConduitIdSelector) {
+ this.useConduitIdSelector = useConduitIdSelector;
+ }
public enum DeliveryModeType { PERSISTENT, NON_PERSISTENT };
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSURIParser.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSURIParser.java b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSURIParser.java
index db2bdcb..a569b1c 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSURIParser.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/uri/JMSURIParser.java
@@ -73,8 +73,8 @@ final class JMSURIParser {
}
}
- public Map<String, String> parseQuery() {
- Map<String, String> rc = new HashMap<String, String>();
+ public Map<String, Object> parseQuery() {
+ Map<String, Object> rc = new HashMap<String, Object>();
if (query != null) {
String[] parameters = StringUtils.split(query, "&");
for (String parameter : parameters) {
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/wsdl11/JMSWSDLExtensionLoader.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/wsdl11/JMSWSDLExtensionLoader.java b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/wsdl11/JMSWSDLExtensionLoader.java
index 2e5fbcf..fe110bd 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/wsdl11/JMSWSDLExtensionLoader.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/wsdl11/JMSWSDLExtensionLoader.java
@@ -35,73 +35,23 @@ public final class JMSWSDLExtensionLoader implements WSDLExtensionLoader {
public JMSWSDLExtensionLoader(Bus b) {
WSDLManager manager = b.getExtension(WSDLManager.class);
+ Class<?>[] extensors = new Class[] {
+ org.apache.cxf.transport.jms.wsdl.JndiContextParameterType.class,
+ org.apache.cxf.transport.jms.wsdl.JndiInitialContextFactoryType.class,
+ org.apache.cxf.transport.jms.wsdl.JndiURLType.class,
+ org.apache.cxf.transport.jms.wsdl.DeliveryModeType.class,
+ org.apache.cxf.transport.jms.wsdl.PriorityType.class,
+ org.apache.cxf.transport.jms.wsdl.TimeToLiveType.class,
+ org.apache.cxf.transport.jms.wsdl.ReplyToNameType.class
+ };
- createExtensor(manager, javax.wsdl.Port.class,
- org.apache.cxf.transport.jms.AddressType.class);
- createExtensor(manager, javax.wsdl.Port.class,
- org.apache.cxf.transport.jms.ClientBehaviorPolicyType.class);
- createExtensor(manager, javax.wsdl.Port.class,
- org.apache.cxf.transport.jms.ServerBehaviorPolicyType.class);
- createExtensor(manager, javax.wsdl.Port.class,
- org.apache.cxf.transport.jms.ClientConfig.class);
- createExtensor(manager, javax.wsdl.Port.class,
- org.apache.cxf.transport.jms.ServerConfig.class);
- createExtensor(manager, javax.wsdl.Port.class,
- org.apache.cxf.transport.jms.SessionPoolType.class);
-
- createExtensor(manager, javax.wsdl.Binding.class,
- org.apache.cxf.transport.jms.wsdl.JndiContextParameterType.class);
- createExtensor(manager, javax.wsdl.Binding.class,
- org.apache.cxf.transport.jms.wsdl.JndiConnectionFactoryNameType.class);
- createExtensor(manager, javax.wsdl.Binding.class,
- org.apache.cxf.transport.jms.wsdl.JndiInitialContextFactoryType.class);
- createExtensor(manager, javax.wsdl.Binding.class,
- org.apache.cxf.transport.jms.wsdl.JndiURLType.class);
- createExtensor(manager, javax.wsdl.Binding.class,
- org.apache.cxf.transport.jms.wsdl.DeliveryModeType.class);
- createExtensor(manager, javax.wsdl.Binding.class,
- org.apache.cxf.transport.jms.wsdl.PriorityType.class);
- createExtensor(manager, javax.wsdl.Binding.class,
- org.apache.cxf.transport.jms.wsdl.TimeToLiveType.class);
- createExtensor(manager, javax.wsdl.Binding.class,
- org.apache.cxf.transport.jms.wsdl.ReplyToNameType.class);
-
- createExtensor(manager, javax.wsdl.Port.class,
- org.apache.cxf.transport.jms.wsdl.JndiContextParameterType.class);
- createExtensor(manager, javax.wsdl.Port.class,
- org.apache.cxf.transport.jms.wsdl.JndiConnectionFactoryNameType.class);
- createExtensor(manager, javax.wsdl.Port.class,
- org.apache.cxf.transport.jms.wsdl.JndiInitialContextFactoryType.class);
- createExtensor(manager, javax.wsdl.Port.class,
- org.apache.cxf.transport.jms.wsdl.JndiURLType.class);
- createExtensor(manager, javax.wsdl.Port.class,
- org.apache.cxf.transport.jms.wsdl.DeliveryModeType.class);
- createExtensor(manager, javax.wsdl.Port.class,
- org.apache.cxf.transport.jms.wsdl.PriorityType.class);
- createExtensor(manager, javax.wsdl.Port.class,
- org.apache.cxf.transport.jms.wsdl.TimeToLiveType.class);
- createExtensor(manager, javax.wsdl.Port.class,
- org.apache.cxf.transport.jms.wsdl.ReplyToNameType.class);
-
- createExtensor(manager, javax.wsdl.Service.class,
- org.apache.cxf.transport.jms.wsdl.JndiContextParameterType.class);
- createExtensor(manager, javax.wsdl.Service.class,
- org.apache.cxf.transport.jms.wsdl.JndiConnectionFactoryNameType.class);
- createExtensor(manager, javax.wsdl.Service.class,
- org.apache.cxf.transport.jms.wsdl.JndiInitialContextFactoryType.class);
- createExtensor(manager, javax.wsdl.Service.class,
- org.apache.cxf.transport.jms.wsdl.JndiURLType.class);
- createExtensor(manager, javax.wsdl.Service.class,
- org.apache.cxf.transport.jms.wsdl.DeliveryModeType.class);
- createExtensor(manager, javax.wsdl.Service.class,
- org.apache.cxf.transport.jms.wsdl.PriorityType.class);
- createExtensor(manager, javax.wsdl.Service.class,
- org.apache.cxf.transport.jms.wsdl.TimeToLiveType.class);
- createExtensor(manager, javax.wsdl.Service.class,
- org.apache.cxf.transport.jms.wsdl.ReplyToNameType.class);
-
-
+ for (Class<?> extensor : extensors) {
+ createExtensor(manager, javax.wsdl.Binding.class, extensor);
+ createExtensor(manager, javax.wsdl.Port.class, extensor);
+ createExtensor(manager, javax.wsdl.Service.class, extensor);
+ }
}
+
public void createExtensor(WSDLManager manager,
Class<?> parentType,
Class<?> elementType) {
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/wsdl11/JmsTransportPlugin.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/wsdl11/JmsTransportPlugin.java b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/wsdl11/JmsTransportPlugin.java
deleted file mode 100644
index 64dd747..0000000
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/wsdl11/JmsTransportPlugin.java
+++ /dev/null
@@ -1,100 +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.wsdl11;
-
-import java.util.Map;
-
-import javax.wsdl.Port;
-import javax.wsdl.WSDLException;
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.xml.namespace.QName;
-
-import org.apache.cxf.transport.jms.AddressType;
-import org.apache.cxf.transport.jms.DestinationStyleType;
-import org.apache.cxf.transport.jms.JMSNamingPropertyType;
-import org.apache.cxf.wsdl.AbstractWSDLPlugin;
-
-public class JmsTransportPlugin extends AbstractWSDLPlugin {
- public static final String NS_JMS_ADDRESS = "http://cxf.apache.org/transports/jms";
- public static final QName JMS_ADDRESS = new QName(NS_JMS_ADDRESS, "address");
-
- public static final String JMS_ADDR_DEST_STYLE = "destinationStyle";
- public static final String JMS_ADDR_JNDI_URL = "jndiProviderURL";
- public static final String JMS_ADDR_JNDI_FAC = "jndiConnectionFactoryName";
- public static final String JMS_ADDR_JNDI_DEST = "jndiDestinationName";
- public static final String JMS_ADDR_MSG_TYPE = "messageType";
- public static final String JMS_ADDR_INIT_CTX = "initialContextFactory";
- public static final String JMS_ADDR_SUBSCRIBER_NAME = "durableSubscriberName";
- public static final String JMS_ADDR_MSGID_TO_CORRID = "useMessageIDAsCorrelationID";
-
- public ExtensibilityElement createExtension(Map<String, Object> args) throws WSDLException {
- AddressType jmsAddress = null;
-
- jmsAddress = (AddressType)registry.createExtension(Port.class, JMS_ADDRESS);
-
- String destType = "queue";
- if (optionSet(args, JMS_ADDR_DEST_STYLE)) {
- destType = getOption(args, JMS_ADDR_DEST_STYLE);
- }
- jmsAddress.setDestinationStyle(DestinationStyleType.fromValue(destType));
-
- String finitValue = "org.apache.activemq.jndi.ActiveMQInitialContextFactory";
- JMSNamingPropertyType finit = new JMSNamingPropertyType();
- finit.setName("java.naming.factory.initial");
- if (optionSet(args, JMS_ADDR_INIT_CTX)) {
- finitValue = getOption(args, JMS_ADDR_INIT_CTX);
- }
- finit.setValue(finitValue);
-
- String providerURL = "tcp://localhost:61616";
- JMSNamingPropertyType provider = new JMSNamingPropertyType();
- provider.setName("java.naming.provider.url");
- if (optionSet(args, JMS_ADDR_JNDI_URL)) {
- providerURL = getOption(args, JMS_ADDR_JNDI_URL);
- }
- provider.setValue(providerURL);
-
- String destName = "dynamicQueues/test.cxf.jmstransport.queue";
- if (optionSet(args, JMS_ADDR_JNDI_DEST)) {
- destName = getOption(args, JMS_ADDR_JNDI_DEST);
- }
- jmsAddress.setJndiDestinationName(destName);
-
- String factory = "ConnectionFactory";
- if (optionSet(args, JMS_ADDR_JNDI_FAC)) {
- factory = getOption(args, JMS_ADDR_JNDI_FAC);
- }
- jmsAddress.setJndiConnectionFactoryName(factory);
-
- // if (optionSet(args, JMS_ADDR_MSGID_TO_CORRID)) {
- // jmsAddress.setUseMessageIDAsCorrelationID(getOption(args,
- // JMS_ADDR_MSGID_TO_CORRID,
- // Boolean.class));
- // }
-
- jmsAddress.getJMSNamingProperty().add(finit);
- jmsAddress.getJMSNamingProperty().add(provider);
-
- // if (optionSet(args, JMS_ADDR_SUBSCRIBER_NAME)) {
- // jmsAddress.setDurableSubscriberName(getOption(args, JMS_ADDR_SUBSCRIBER_NAME));
- // }
- return jmsAddress;
- }
-}
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/rt/transports/jms/src/main/resources/META-INF/spring.handlers
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/resources/META-INF/spring.handlers b/rt/transports/jms/src/main/resources/META-INF/spring.handlers
deleted file mode 100644
index f731a39..0000000
--- a/rt/transports/jms/src/main/resources/META-INF/spring.handlers
+++ /dev/null
@@ -1,21 +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.
-#
-#
-http\://cxf.apache.org/transports/jms=org.apache.cxf.transport.jms.spring.NamespaceHandler
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/rt/transports/jms/src/main/resources/META-INF/spring.schemas
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/resources/META-INF/spring.schemas b/rt/transports/jms/src/main/resources/META-INF/spring.schemas
index 7e67346..bccd394 100644
--- a/rt/transports/jms/src/main/resources/META-INF/spring.schemas
+++ b/rt/transports/jms/src/main/resources/META-INF/spring.schemas
@@ -19,4 +19,3 @@
#
#
http\://cxf.apache.org/schemas/wsdl/jms.xsd=schemas/wsdl/jms.xsd
-http\://cxf.apache.org/schemas/configuration/jms.xsd=schemas/configuration/jms.xsd
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/rt/transports/jms/src/main/resources/META-INF/wsdl.plugin.xml
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/resources/META-INF/wsdl.plugin.xml b/rt/transports/jms/src/main/resources/META-INF/wsdl.plugin.xml
deleted file mode 100644
index 137ece3..0000000
--- a/rt/transports/jms/src/main/resources/META-INF/wsdl.plugin.xml
+++ /dev/null
@@ -1,23 +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.
--->
-<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
-<properties>
- <entry key="jms-javax.wsdl.Port">org.apache.cxf.transport.jms.wsdl11.JmsTransportPlugin</entry>
-</properties>
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/rt/transports/jms/src/main/resources/schemas/configuration/jms.xsd
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/resources/schemas/configuration/jms.xsd b/rt/transports/jms/src/main/resources/schemas/configuration/jms.xsd
deleted file mode 100644
index 850b07f..0000000
--- a/rt/transports/jms/src/main/resources/schemas/configuration/jms.xsd
+++ /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.
- -->
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:jms="http://cxf.apache.org/transports/jms" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:beans="http://www.springframework.org/schema/beans"
- xmlns:cxf-beans="http://cxf.apache.org/configuration/beans"
- targetNamespace="http://cxf.apache.org/transports/jms"
- elementFormDefault="qualified" jaxb:version="2.0">
-
- <xs:include schemaLocation="http://cxf.apache.org/schemas/wsdl/jms.xsd" />
- <xs:import namespace="http://www.springframework.org/schema/beans"
- schemaLocation="http://www.springframework.org/schema/beans/spring-beans.xsd" />
- <xs:import namespace="http://cxf.apache.org/configuration/beans"
- schemaLocation="http://cxf.apache.org/schemas/configuration/cxf-beans.xsd" />
-
- <xs:element name="destination">
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="beans:identifiedType">
- <xs:sequence>
- <xs:element name="serverConfig" type="jms:ServerConfig"
- minOccurs="0" />
- <xs:element name="runtimePolicy" type="jms:ServerBehaviorPolicyType"
- minOccurs="0" />
- <xs:element name="sessionPool" type="jms:SessionPoolType"
- minOccurs="0" />
- <xs:element name="address" type="jms:AddressType"
- minOccurs="0" />
- <xs:element name="jmsConfig-ref" type="xs:string"
- maxOccurs="1" minOccurs="0" />
- </xs:sequence>
- <xs:attributeGroup ref="cxf-beans:beanAttributes" />
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
- <xs:element name="conduit">
- <xs:complexType>
- <xs:complexContent>
- <xs:extension base="beans:identifiedType">
- <xs:sequence>
- <xs:element name="clientConfig" type="jms:ClientConfig"
- minOccurs="0" />
- <xs:element name="runtimePolicy" type="jms:ClientBehaviorPolicyType"
- minOccurs="0" />
- <xs:element name="sessionPool" type="jms:SessionPoolType"
- minOccurs="0" />
- <xs:element name="address" type="jms:AddressType"
- minOccurs="0" />
- <xs:element name="jmsConfig-ref" type="xs:string"
- maxOccurs="1" minOccurs="0" />
- </xs:sequence>
- <xs:attributeGroup ref="cxf-beans:beanAttributes" />
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
- </xs:element>
-
-</xs:schema>
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/rt/transports/jms/src/main/resources/schemas/wsdl/jms.xjb
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/resources/schemas/wsdl/jms.xjb b/rt/transports/jms/src/main/resources/schemas/wsdl/jms.xjb
deleted file mode 100644
index 8b02ee8..0000000
--- a/rt/transports/jms/src/main/resources/schemas/wsdl/jms.xjb
+++ /dev/null
@@ -1,39 +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.
--->
-<jaxb:bindings version="1.0"
- xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
- jaxb:extensionBindingPrefixes="xjc">
- <jaxb:bindings schemaLocation="http://schemas.xmlsoap.org/wsdl/2003-02-11.xsd" node="/xs:schema">
- <jaxb:schemaBindings>
- <jaxb:package name="org.apache.cxf.wsdl"/>
- </jaxb:schemaBindings>
- <jaxb:globalBindings generateIsSetMethod="true"/>
- </jaxb:bindings>
- <jaxb:bindings schemaLocation="http://schemas.xmlsoap.org/wsdl/2003-02-11.xsd" node="/xs:schema/xs:complexType[@name='tExtensibilityElement']">
- <jaxb:class implClass="org.apache.cxf.wsdl.TExtensibilityElementImpl"/>
- </jaxb:bindings>
- <jaxb:bindings schemaLocation="jms.xsd" node="/xs:schema">
- <jaxb:schemaBindings>
- <jaxb:package name="org.apache.cxf.transport.jms"/>
- </jaxb:schemaBindings>
- </jaxb:bindings>
-</jaxb:bindings>
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/rt/transports/jms/src/main/resources/schemas/wsdl/jms.xsd
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/resources/schemas/wsdl/jms.xsd b/rt/transports/jms/src/main/resources/schemas/wsdl/jms.xsd
deleted file mode 100644
index 4539c49..0000000
--- a/rt/transports/jms/src/main/resources/schemas/wsdl/jms.xsd
+++ /dev/null
@@ -1,347 +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.
--->
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:jms="http://cxf.apache.org/transports/jms"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
- targetNamespace="http://cxf.apache.org/transports/jms"
- xmlns:pt="http://cxf.apache.org/configuration/parameterized-types"
- elementFormDefault="qualified" jaxb:version="2.0">
-
- <xs:import namespace="http://schemas.xmlsoap.org/wsdl/"
- schemaLocation="http://schemas.xmlsoap.org/wsdl/2003-02-11.xsd"/>
- <xs:import namespace="http://cxf.apache.org/configuration/parameterized-types"
- schemaLocation="http://cxf.apache.org/schemas/configuration/parameterized-types.xsd"/>
-
- <!-- Valid wsdl elements -->
- <xs:element name="client" type="jms:ClientBehaviorPolicyType"/>
- <xs:element name="server" type="jms:ServerBehaviorPolicyType"/>
- <xs:element name="clientConfig" type="jms:ClientConfig"/>
- <xs:element name="serverConfig" type="jms:ServerConfig"/>
- <xs:element name="address" type="jms:AddressType"/>
- <xs:element name="sessionPool" type="jms:SessionPoolType"/>
-
- <xs:complexType name="SessionPoolType">
- <xs:annotation>
- <xs:documentation>JMS Session pool configuration policy</xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="wsdl:tExtensibilityElement">
- <xs:attribute name="lowWaterMark" type="pt:ParameterizedInt" default="20"/>
- <xs:attribute name="highWaterMark" type="pt:ParameterizedInt" default="500" />
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="ClientConfig">
- <xs:complexContent>
- <xs:extension base="wsdl:tExtensibilityElement">
- <xs:attribute name="clientReceiveTimeout" type="pt:ParameterizedLong"
- default="60000" />
- <xs:attribute name="messageTimeToLive" type="pt:ParameterizedLong"
- default="0" />
- <xs:attribute name="conduitSelectorPrefix" type="xs:string" use="optional"/>
- <xs:attribute name="useConduitIdSelector" type="pt:ParameterizedBoolean" use="optional"/>
- <xs:attribute name="enforceSpec" type="pt:ParameterizedBoolean" use="optional" default="true"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="ServerConfig">
- <xs:complexContent>
- <xs:extension base="wsdl:tExtensibilityElement">
- <xs:attribute name="messageTimeToLive" type="pt:ParameterizedLong" default="0" />
- <xs:attribute name="durableSubscriptionClientId" type="xs:string" />
- <xs:attribute name="serverReceiveTimeout" type="pt:ParameterizedLong"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="JMSPropertyType">
- <xs:sequence>
- <xs:element name="name" type="xs:string"/>
- <xs:element name="value" type="xs:string"/>
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="JMSMessageHeadersType">
- <xs:annotation>
- <xs:documentation>JMS properties.</xs:documentation>
- </xs:annotation>
- <xs:sequence>
- <xs:element name="property" type="jms:JMSPropertyType" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
-
- <!-- JMS Header properties -->
- <xs:attribute name="JMSCorrelationID" type="xs:string"/>
- <xs:attribute name="JMSDeliveryMode" type="pt:ParameterizedInt"/>
- <xs:attribute name="JMSExpiration" type="pt:ParameterizedLong"/>
- <xs:attribute name="JMSMessageID" type="xs:string"/>
- <xs:attribute name="JMSPriority" type="pt:ParameterizedInt"/>
- <xs:attribute name="JMSRedelivered" type="pt:ParameterizedBoolean"/>
- <xs:attribute name="JMSReplyTo" type="xs:string"/>
- <xs:attribute name="JMSTimeStamp" type="pt:ParameterizedLong"/>
- <xs:attribute name="JMSType" type="xs:string"/>
- <xs:attribute name="TimeToLive" type="pt:ParameterizedLong"/>
-
- <!-- JMS Message properties for SOAP over JMS specification -->
- <xs:attribute name="SOAPJMSTargetService" type="xs:string"/>
- <xs:attribute name="SOAPJMSBindingVersion" type="xs:string"/>
- <xs:attribute name="SOAPJMSContentType" type="xs:string"/>
- <xs:attribute name="SOAPJMSContentEncoding" type="xs:string"/>
- <xs:attribute name="SOAPJMSSOAPAction" type="xs:anyURI"/>
- <xs:attribute name="SOAPJMSIsFault" type="pt:ParameterizedBoolean"/>
- <xs:attribute name="SOAPJMSRequestURI" type="xs:string"/>
- </xs:complexType>
-
- <!--
- <xs:complexType name="SOAPOverJMSMessageType">
- <xs:annotation>
- <xs:documentation>SOAP Over JMS Message Properties</xs:documentation>
- </xs:annotation>
- <xs:sequence>
- <xs:element name="property" type="jms:JMSPropertyType" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="SOAPJMSTargetService" type="xs:string"/>
- <xs:attribute name="SOAPJMSBindingVersion" type="xs:string"/>
- <xs:attribute name="SOAPJMSContentType" type="xs:string"/>
- <xs:attribute name="SOAPJMSSOAPAction" type="xs:anyURI"/>
- <xs:attribute name="SOAPJMSIsFault" type="xs:boolean"/>
- <xs:attribute name="SOAPJMSRequestURI" type="xs:string"/>
- </xs:complexType>
- -->
-
- <xs:simpleType name="JMSClientReceiveTimeOut">
- <xs:restriction base="pt:ParameterizedLong"/>
- </xs:simpleType>
-
- <xs:simpleType name="DestinationStyleType">
- <xs:restriction base="xs:string">
- <xs:enumeration value="queue"/>
- <xs:enumeration value="topic"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:complexType name="JMSNamingPropertyType">
- <xs:annotation>
- <xs:documentation>
- javaNaming properties name/value pair.
- </xs:documentation>
- </xs:annotation>
-
- <xs:attribute name="name" type="xs:string" use="required">
- <xs:annotation>
- <xs:documentation>
- Name of Java Naming Property
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="value" type="xs:string" use="required">
- <xs:annotation>
- <xs:documentation>
- Value of Java Naming Property
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- </xs:complexType>
-
- <xs:simpleType name="MessageFormatType">
- <xs:restriction base="xs:string">
- <xs:enumeration value="text"/>
- <xs:enumeration value="binary"/>
- <xs:enumeration value="byte"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:complexType name="AddressType">
- <xs:complexContent>
- <xs:extension base="wsdl:tExtensibilityElement">
- <xs:sequence>
- <xs:element name="JMSNamingProperty"
- type="jms:JMSNamingPropertyType" minOccurs="0"
- maxOccurs="unbounded" />
- </xs:sequence>
- <xs:attribute name="destinationStyle"
- type="jms:DestinationStyleType" default="queue">
- <xs:annotation>
- <xs:documentation>
- JMS Destination style queue or topic.
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
-
- <xs:attribute name="jndiConnectionFactoryName"
- type="xs:string" use="required">
- <xs:annotation>
- <xs:documentation>
- Type of the JNDI Connection factory
- queueConnectionFactory or
- topicConnectionFactory.
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="jndiDestinationName"
- type="xs:string">
- <xs:annotation>
- <xs:documentation>
- Name of the JNDI Destination queue or topic.
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
-
- <xs:attribute name="jmsDestinationName"
- type="xs:string">
- <xs:annotation>
- <xs:documentation>
- JMS destination queue name or topic name.
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
-
- <xs:attribute name="jndiReplyDestinationName"
- type="xs:string">
- <xs:annotation>
- <xs:documentation>
- JMS Message Replyto destination when static
- queues are used for reply.
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
-
- <xs:attribute name="jmsReplyDestinationName"
- type="xs:string">
- <xs:annotation>
- <xs:documentation>
- JMS Replyto destination queue name when
- using static queues for reply.
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
-
- <xs:attribute name="jndiReplyToDestinationName"
- type="xs:string">
- <xs:annotation>
- <xs:documentation>
- Used when the ReplyTo address on the message needs to be different
- than the listening address of the consumer. This mostly applies to
- MQSeries users who are interacting with remote queues.
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
-
- <xs:attribute name="jmsReplyToDestinationName"
- type="xs:string">
- <xs:annotation>
- <xs:documentation>
- Used when the ReplyTo address on the message needs to be different
- than the listening address of the consumer. This mostly applies to
- MQSeries users who are interacting with remote queues.
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
-
- <xs:attribute name="connectionUserName"
- type="xs:string">
- <xs:annotation>
- <xs:documentation>
- UserName to use while creating JMS
- queue/topic connection.
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="connectionPassword"
- type="xs:string">
- <xs:annotation>
- <xs:documentation>
- Password to use while creating JMS
- queue/topic connection.
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="useJms11" type="pt:ParameterizedBoolean" use="optional"/>
- <xs:attribute name="reconnectOnException" type="pt:ParameterizedBoolean" use="optional"/>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="ClientBehaviorPolicyType">
- <xs:complexContent>
- <xs:extension base="wsdl:tExtensibilityElement">
- <xs:attribute name="messageType" type="jms:MessageFormatType" default="text">
- <xs:annotation>
- <xs:documentation>Type of the JMS Message payload, currently supported text and binary.</xs:documentation>
- </xs:annotation>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="ServerBehaviorPolicyType">
- <xs:annotation>
- <xs:documentation>JMS configuration policy for CXF Server.
- These are used for configuring JMS port on CXF server side.
- </xs:documentation>
- </xs:annotation>
- <xs:complexContent>
- <xs:extension base="wsdl:tExtensibilityElement">
- <xs:annotation>
- <xs:documentation>Sets selection criteria for messages received by server</xs:documentation>
- </xs:annotation>
- <xs:attribute name="messageSelector" type="xs:string">
- <xs:annotation>
- <xs:documentation>
- JMS Message Selector attribute to filter messages from the queue.
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="useMessageIDAsCorrelationID" type="pt:ParameterizedBoolean" default="false">
- <xs:annotation>
- <xs:documentation>
- Flag to indicate whether to use JMS Message Id as correlation ID. It is serverside only so should go in ServerPolicy
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="transactional" type="pt:ParameterizedBoolean" default="false">
- <xs:annotation>
- <xs:documentation>
- Flag to specify whether to use JMS transaction support on server side.
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="durableSubscriberName" type="xs:string">
- <xs:annotation>
- <xs:documentation>
- Specifies the name of the Durable Subscription
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- </xs:extension>
- </xs:complexContent>
- </xs:complexType>
-
- <xs:complexType name="JMSFaultType">
- <xs:sequence>
- <xs:element name="FaultCode" type="xs:QName"/>
- <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:anyAttribute namespace="##any" processContents="lax"/>
- </xs:complexType>
-
-</xs:schema>
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java
index 18402a7..b22876a 100644
--- a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java
+++ b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/AbstractJMSTester.java
@@ -18,69 +18,78 @@
*/
package org.apache.cxf.transport.jms;
+import java.io.ByteArrayInputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.OutputStream;
+import java.io.Reader;
+import java.io.StringReader;
import java.io.Writer;
import java.net.URL;
+import javax.jms.ConnectionFactory;
import javax.xml.namespace.QName;
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.pool.PooledConnectionFactory;
+import org.apache.activemq.store.memory.MemoryPersistenceAdapter;
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
+import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.message.ExchangeImpl;
import org.apache.cxf.message.Message;
import org.apache.cxf.service.Service;
import org.apache.cxf.service.model.EndpointInfo;
-import org.apache.cxf.testutil.common.EmbeddedJMSBrokerLauncher;
+import org.apache.cxf.testutil.common.TestUtil;
import org.apache.cxf.transport.Conduit;
import org.apache.cxf.transport.MessageObserver;
import org.apache.cxf.ws.addressing.EndpointReferenceType;
import org.apache.cxf.wsdl11.WSDLServiceFactory;
-import org.easymock.EasyMock;
-import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
-import org.junit.Before;
+import org.junit.BeforeClass;
public abstract class AbstractJMSTester extends Assert {
- public static final String JMS_PORT = EmbeddedJMSBrokerLauncher.PORT;
- public enum ExchangePattern { oneway, requestReply };
-
+ protected static final String WSDL = "/jms_test.wsdl";
+ protected static final String SERVICE_NS = "http://cxf.apache.org/hello_world_jms";
+ protected static final int MAX_RECEIVE_TIME = 10;
protected static final String MESSAGE_CONTENT = "HelloWorld";
-
- private static JMSBrokerSetup broker;
+ protected static Bus bus;
+ protected static ConnectionFactory cf;
+ protected static BrokerService broker;
- protected Bus bus;
+ protected enum ExchangePattern { oneway, requestReply };
+
protected EndpointReferenceType target;
- protected MessageObserver observer;
protected Message inMessage;
-
- public static void startBroker(JMSBrokerSetup b) throws Exception {
- assertNotNull(b);
- broker = b;
+ protected Message destMessage;
+
+ @BeforeClass
+ public static void startSerices() throws Exception {
+ broker = new BrokerService();
+ broker.setPersistent(false);
+ broker.setPopulateJMSXUserID(true);
+ broker.setUseAuthenticatedPrincipalForJMSXUserID(true);
+ broker.setUseJmx(false);
+ broker.setPersistenceAdapter(new MemoryPersistenceAdapter());
+ String brokerUri = "tcp://localhost:" + TestUtil.getNewPortNumber(AbstractJMSTester.class);
+ broker.addConnector(brokerUri);
broker.start();
+ bus = BusFactory.getDefaultBus();
+ ActiveMQConnectionFactory cf1 = new ActiveMQConnectionFactory(brokerUri);
+ cf = new PooledConnectionFactory(cf1);
}
@AfterClass
- public static void stopBroker() throws Exception {
+ public static void stopServices() throws Exception {
+ bus.shutdown(false);
broker.stop();
- broker = null;
}
-
- @Before
- public void setUp() {
- BusFactory bf = BusFactory.newInstance();
- bus = bf.createBus();
- BusFactory.setDefaultBus(bus);
- }
-
- @After
- public void tearDown() {
- bus.shutdown(true);
- if (System.getProperty("cxf.config.file") != null) {
- System.clearProperty("cxf.config.file");
- }
+
+ protected EndpointInfo setupServiceInfo(String serviceName, String portName) {
+ return setupServiceInfo(SERVICE_NS, WSDL, serviceName, portName);
}
protected EndpointInfo setupServiceInfo(String ns, String wsdl, String serviceName, String portName) {
@@ -88,16 +97,26 @@ public abstract class AbstractJMSTester extends Assert {
if (wsdlUrl == null) {
throw new IllegalArgumentException("Wsdl file not found on class path " + wsdl);
}
- String wsdlURL = wsdlUrl.toString();
- assertNotNull(wsdlUrl);
- EmbeddedJMSBrokerLauncher.updateWsdlExtensors(bus, wsdlURL);
- WSDLServiceFactory factory = new WSDLServiceFactory(bus, wsdlURL, new QName(ns, serviceName));
+ WSDLServiceFactory factory = new WSDLServiceFactory(bus, wsdlUrl.toExternalForm(),
+ new QName(ns, serviceName));
Service service = factory.create();
return service.getEndpointInfo(new QName(ns, portName));
}
+
+ protected MessageObserver createMessageObserver() {
+ return new MessageObserver() {
+ public void onMessage(Message m) {
+ Exchange exchange = new ExchangeImpl();
+ exchange.setInMessage(m);
+ m.setExchange(exchange);
+ destMessage = m;
+ }
+ };
+ }
+
protected void sendMessageAsync(Conduit conduit, Message message) throws IOException {
sendoutMessage(conduit, message, false, false);
}
@@ -124,11 +143,7 @@ public abstract class AbstractJMSTester extends Assert {
exchange.setSynchronous(synchronous);
message.setExchange(exchange);
exchange.setOutMessage(message);
- try {
- conduit.prepare(message);
- } catch (IOException ex) {
- throw new RuntimeException("JMSConduit can't prepare to send out message");
- }
+ conduit.prepare(message);
OutputStream os = message.getContent(OutputStream.class);
Writer writer = message.getContent(Writer.class);
assertTrue("The OutputStream and Writer should not both be null ", os != null || writer != null);
@@ -141,50 +156,81 @@ public abstract class AbstractJMSTester extends Assert {
}
}
- protected void adjustEndpointInfoURL(EndpointInfo endpointInfo) {
- if (endpointInfo != null) {
- AddressType at = endpointInfo.getExtensor(AddressType.class);
- if (at != null) {
- for (JMSNamingPropertyType jnt : at.getJMSNamingProperty()) {
- if (jnt.getName().equals("java.naming.provider.url")) {
- String v = jnt.getValue();
- v = v.replace("61500", JMS_PORT);
- v = v.replace("61616", JMS_PORT);
- jnt.setValue(v);
- }
- }
- }
- }
+ protected JMSConduit setupJMSConduit(EndpointInfo ei) throws IOException {
+ JMSConfiguration jmsConfig = JMSConfigFactory.createFromEndpointInfo(bus, ei, null);
+ jmsConfig.setConnectionFactory(cf);
+ return new JMSConduit(target, jmsConfig, bus);
}
- protected JMSConduit setupJMSConduit(EndpointInfo ei, boolean send) throws IOException {
- target = EasyMock.createMock(EndpointReferenceType.class);
- adjustEndpointInfoURL(ei);
-
- JMSConfiguration jmsConfig = new JMSOldConfigHolder()
- .createJMSConfigurationFromEndpointInfo(bus, ei, null, true);
- if (jmsConfig.getReceiveTimeout() == null || jmsConfig.getReceiveTimeout() == 0) {
- jmsConfig.setReceiveTimeout(5000L);
- }
- JMSConduit jmsConduit = new JMSConduit(target, jmsConfig, bus);
- if (send) {
- // setMessageObserver
- observer = new MessageObserver() {
- public void onMessage(Message m) {
- inMessage = m;
- }
- };
- jmsConduit.setMessageObserver(observer);
- }
-
+ protected JMSConduit setupJMSConduitWithObserver(EndpointInfo ei) throws IOException {
+ JMSConduit jmsConduit = setupJMSConduit(ei);
+ MessageObserver observer = new MessageObserver() {
+ public void onMessage(Message m) {
+ inMessage = m;
+ }
+ };
+ jmsConduit.setMessageObserver(observer);
return jmsConduit;
}
protected JMSDestination setupJMSDestination(EndpointInfo ei) throws IOException {
- adjustEndpointInfoURL(ei);
- JMSConfiguration jmsConfig = new JMSOldConfigHolder()
- .createJMSConfigurationFromEndpointInfo(bus, ei, null, false);
+ JMSConfiguration jmsConfig = JMSConfigFactory.createFromEndpointInfo(bus, ei, null);
+ jmsConfig.setConnectionFactory(cf);
return new JMSDestination(bus, ei, jmsConfig);
}
+ protected String getContent(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();
+ }
+ }
+ return response;
+ }
+
+ protected void waitForReceiveInMessage() {
+ int waitTime = 0;
+ while (inMessage == null && waitTime < MAX_RECEIVE_TIME) {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ // do nothing here
+ }
+ waitTime++;
+ }
+ assertTrue("Can't receive the Conduit Message in " + MAX_RECEIVE_TIME + " seconds",
+ inMessage != null);
+ }
+
+ protected void waitForReceiveDestMessage() {
+ int waitTime = 0;
+ while (destMessage == null && waitTime < MAX_RECEIVE_TIME) {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ // do nothing here
+ }
+ waitTime++;
+ }
+ assertNotNull("Can't receive the Destination message in " + MAX_RECEIVE_TIME
+ + " seconds", destMessage);
+ }
+
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/40b89868/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConduitTest.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConduitTest.java b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConduitTest.java
index 5d3543f..e942db5 100644
--- a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConduitTest.java
+++ b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConduitTest.java
@@ -19,63 +19,38 @@
package org.apache.cxf.transport.jms;
-import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;
-import java.nio.charset.Charset;
-import java.util.logging.Logger;
-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.bus.spring.SpringBusFactory;
-import org.apache.cxf.common.logging.LogUtils;
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.util.JMSUtil;
-import org.apache.cxf.transport.jms.util.ResourceCloser;
-import org.junit.Assert;
-import org.junit.BeforeClass;
import org.junit.Test;
public class JMSConduitTest extends AbstractJMSTester {
- static final Logger LOG = LogUtils.getL7dLogger(JMSConduitTest.class);
-
- @BeforeClass
- public static void createAndStartBroker() throws Exception {
- startBroker(new JMSBrokerSetup("tcp://localhost:" + JMS_PORT + "?persistent=false"));
- }
-
@Test
public void testGetConfiguration() throws Exception {
- // setup the new bus to get the configuration file
- SpringBusFactory bf = new SpringBusFactory();
- bus = bf.createBus("/jms_test_config.xml");
- EndpointInfo ei = setupServiceInfo("http://cxf.apache.org/jms_conf_test", "/wsdl/others/jms_test_no_addr.wsdl",
+ EndpointInfo ei = setupServiceInfo("http://cxf.apache.org/hello_world_jms", WSDL,
"HelloWorldQueueBinMsgService", "HelloWorldQueueBinMsgPort");
- JMSConduit conduit = setupJMSConduit(ei, false);
+ JMSConduit conduit = setupJMSConduit(ei);
assertEquals("Can't get the right ClientReceiveTimeout", 500L, conduit.getJmsConfig()
.getReceiveTimeout().longValue());
conduit.close();
- bus.shutdown(false);
}
@Test
public void testPrepareSend() throws Exception {
- EndpointInfo ei = setupServiceInfo("http://cxf.apache.org/hello_world_jms", "/wsdl/jms_test.wsdl",
+ EndpointInfo ei = setupServiceInfo("http://cxf.apache.org/hello_world_jms", WSDL,
"HelloWorldService", "HelloWorldPort");
- JMSConduit conduit = setupJMSConduit(ei, false);
+ JMSConduit conduit = setupJMSConduit(ei);
Message message = new MessageImpl();
conduit.prepare(message);
OutputStream os = message.getContent(OutputStream.class);
Writer writer = message.getContent(Writer.class);
assertTrue("The OutputStream and Writer should not both be null ", os != null || writer != null);
+ conduit.close();
}
/**
@@ -86,42 +61,25 @@ public class JMSConduitTest extends AbstractJMSTester {
*/
@Test
public void testTimeoutOnReceive() throws Exception {
- EndpointInfo ei = setupServiceInfo("http://cxf.apache.org/hello_world_jms", "/wsdl/jms_test.wsdl",
+ EndpointInfo ei = setupServiceInfo("http://cxf.apache.org/hello_world_jms", WSDL,
"HelloWorldServiceLoop", "HelloWorldPortLoop");
- JMSConduit conduit = setupJMSConduit(ei, true);
- // TODO IF the system is extremely fast. The message could still get through
+ JMSConduit conduit = setupJMSConduitWithObserver(ei);
+ // If the system is extremely fast. The message could still get through
conduit.getJmsConfig().setReceiveTimeout(Long.valueOf(1));
Message message = new MessageImpl();
try {
sendMessageSync(conduit, message);
fail("Expected a timeout here");
} catch (RuntimeException e) {
- Assert.assertTrue("Incorrect exception",
- e.getMessage().startsWith("Timeout receiving message with correlationId"));
+ if (!e.getMessage().startsWith("Timeout receiving message with correlationId")) {
+ throw e;
+ }
} finally {
conduit.close();
}
}
- @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/java/org/apache/cxf/transport/jms/JMSConfigFactoryTest.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConfigFactoryTest.java b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConfigFactoryTest.java
new file mode 100644
index 0000000..02c41fa
--- /dev/null
+++ b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSConfigFactoryTest.java
@@ -0,0 +1,36 @@
+/**
+ * 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.Test;
+
+
+public class JMSConfigFactoryTest extends AbstractJMSTester {
+
+ @Test
+ public void testUsernameAndPassword() throws Exception {
+ EndpointInfo ei = setupServiceInfo("HelloWorldService", "HelloWorldPort");
+ JMSConfiguration config = JMSConfigFactory.createFromEndpointInfo(bus, ei, target);
+ Assert.assertEquals("User name does not match." , "testUser", config.getUserName());
+ Assert.assertEquals("Password does not match." , "testPassword", config.getPassword());
+ }
+}