Author: richard.opalka(a)jboss.com
Date: 2007-12-14 06:59:22 -0500 (Fri, 14 Dec 2007)
New Revision: 5310
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/core/client/RemotingConnectionImpl.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMConstant.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMChannelTask.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMMetadata.java
stack/native/trunk/src/test/resources/test-excludes-jboss405.txt
Log:
adding necessary remoting hack to enable WS-RM tests on JBoss AS 4.0.x
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/core/client/RemotingConnectionImpl.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/core/client/RemotingConnectionImpl.java 2007-12-14
09:21:37 UTC (rev 5309)
+++
stack/native/trunk/src/main/java/org/jboss/ws/core/client/RemotingConnectionImpl.java 2007-12-14
11:59:22 UTC (rev 5310)
@@ -196,7 +196,7 @@
{
if (RMTransportHelper.isRMMessage(callProps))
{
- RMMetadata rmMetadata = new RMMetadata(targetAddress, marshaller,
unmarshaller, callProps, metadata, clientConfig);
+ RMMetadata rmMetadata = new RMMetadata(getRemotingVersion(), targetAddress,
marshaller, unmarshaller, callProps, metadata, clientConfig);
return RM_CHANNEL.send(reqMessage, rmMetadata);
}
else
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMConstant.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMConstant.java 2007-12-14
09:21:37 UTC (rev 5309)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMConstant.java 2007-12-14
11:59:22 UTC (rev 5310)
@@ -16,6 +16,7 @@
{
private static final String PREFIX = RMConstant.class.getName();
public static final String TARGET_ADDRESS = PREFIX + ".targetAddress";
+ public static final String REMOTING_VERSION = PREFIX + ".remotingVersion";
public static final String ONE_WAY_OPERATION = PREFIX + ".oneWayOperation";
public static final String INVOCATION_CONTEXT = PREFIX +
".invocationContext";
public static final String MARSHALLER = PREFIX + ".marshaller";
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMChannelTask.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMChannelTask.java 2007-12-14
09:21:37 UTC (rev 5309)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMChannelTask.java 2007-12-14
11:59:22 UTC (rev 5310)
@@ -26,12 +26,14 @@
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
+import java.net.URL;
import java.util.Map;
import java.util.concurrent.Callable;
import org.jboss.logging.Logger;
import org.jboss.remoting.Client;
import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.marshal.MarshalFactory;
import org.jboss.ws.core.MessageTrace;
import org.jboss.ws.extensions.wsrm.RMClientSequence;
import org.jboss.ws.extensions.wsrm.transport.backchannel.RMCallbackHandler;
@@ -45,7 +47,7 @@
final class RMChannelTask implements Callable<RMChannelResponse>
{
private static final Logger logger = Logger.getLogger(RMChannelTask.class);
- private static final String JBOSSWS_SUBSYSTEM = "jbossws";
+ private static final String JBOSSWS_SUBSYSTEM = "jbossws-wsrm";
private final RMMessage rmRequest;
RMChannelTask(RMMessage rmRequest)
@@ -54,20 +56,27 @@
this.rmRequest = rmRequest;
}
+ private String addURLParameter(String urlStr, String key, String value) throws
MalformedURLException
+ {
+ URL url = new URL(urlStr);
+ urlStr += (url.getQuery() == null ? "?" : "&") + key +
"=" + value;
+ return urlStr;
+ }
+
public RMChannelResponse call()
{
- InvokerLocator locator = null;
try
{
- locator = new
InvokerLocator((String)rmRequest.getMetadata().getContext(INVOCATION_CONTEXT).get(TARGET_ADDRESS));
- }
- catch (MalformedURLException e)
- {
- return new RMChannelResponse(new IllegalArgumentException("Malformed
endpoint address", e));
- }
+ String targetAddress =
(String)rmRequest.getMetadata().getContext(INVOCATION_CONTEXT).get(TARGET_ADDRESS);
+ String version =
(String)rmRequest.getMetadata().getContext(INVOCATION_CONTEXT).get(REMOTING_VERSION);
- try
- {
+ if (version.startsWith("1.4"))
+ {
+ targetAddress = addURLParameter(targetAddress, InvokerLocator.DATATYPE,
"JBossWSMessage");
+ MarshalFactory.addMarshaller("JBossWSMessage",
RMMarshaller.getInstance(), RMUnMarshaller.getInstance());
+ }
+
+ InvokerLocator locator = new InvokerLocator(targetAddress);
URI backPort = RMTransportHelper.getBackPortURI(rmRequest);
String messageId = RMTransportHelper.getAddressingMessageId(rmRequest);
@@ -85,7 +94,7 @@
}
}
boolean oneWay = RMTransportHelper.isOneWayOperation(rmRequest);
-
+
Client client = new Client(locator, JBOSSWS_SUBSYSTEM,
rmRequest.getMetadata().getContext(REMOTING_CONFIGURATION_CONTEXT));
client.connect();
@@ -120,7 +129,7 @@
client.disconnect();
// trace the incomming response message
- if (rmResponse != null)
+ if ((rmResponse != null) && (backPort == null))
MessageTrace.traceMessage("Incoming RM Response Message",
rmResponse.getPayload());
if (backPort != null) // TODO: backport support
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMMetadata.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMMetadata.java 2007-12-14
09:21:37 UTC (rev 5309)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMMetadata.java 2007-12-14
11:59:22 UTC (rev 5310)
@@ -16,6 +16,7 @@
private Map<String, Map<String, Object>> contexts = new HashMap<String,
Map<String, Object>>();
public RMMetadata(
+ String remotingVersion,
String targetAddress,
Marshaller marshaller,
UnMarshaller unmarshaller,
@@ -27,6 +28,7 @@
throw new IllegalArgumentException("Target address cannot be null");
invocationContext.put(RMConstant.TARGET_ADDRESS, targetAddress);
+ invocationContext.put(RMConstant.REMOTING_VERSION, remotingVersion);
setContext(RMConstant.INVOCATION_CONTEXT, invocationContext);
if (marshaller == null || unmarshaller == null)
Modified: stack/native/trunk/src/test/resources/test-excludes-jboss405.txt
===================================================================
--- stack/native/trunk/src/test/resources/test-excludes-jboss405.txt 2007-12-14 09:21:37
UTC (rev 5309)
+++ stack/native/trunk/src/test/resources/test-excludes-jboss405.txt 2007-12-14 11:59:22
UTC (rev 5310)
@@ -13,9 +13,5 @@
# [JBWS-1797] Setting .NET friendly Endpoint in web.xml
org/jboss/test/ws/jaxws/jbws1797/**
-# WS-RM tests
-org/jboss/test/ws/jaxws/wsrm/oneway/**
-org/jboss/test/ws/jaxws/wsrm/reqres/**
-
# UsernameTokenHTTPSTestCase requires keystore & trustore in jboss-web tomcat
configuration
org/jboss/test/ws/interop/nov2007/wsse/UsernameTokenHTTPSTestCase.*