Author: darran.lofthouse(a)jboss.com
Date: 2007-08-24 13:18:20 -0400 (Fri, 24 Aug 2007)
New Revision: 4500
Modified:
legacy/branches/jbossws-1.2.1.GA_CP/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/client/ServiceImpl.java
legacy/branches/jbossws-1.2.1.GA_CP/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws1653/JBWS1653TestCase.java
Log:
[JBPAPP-274] Post-handler-chain not invoked for 'Standard Client' configuration
with DII client.
Modified:
legacy/branches/jbossws-1.2.1.GA_CP/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/client/ServiceImpl.java
===================================================================
---
legacy/branches/jbossws-1.2.1.GA_CP/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/client/ServiceImpl.java 2007-08-24
16:14:20 UTC (rev 4499)
+++
legacy/branches/jbossws-1.2.1.GA_CP/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/client/ServiceImpl.java 2007-08-24
17:18:20 UTC (rev 4500)
@@ -421,7 +421,7 @@
}
private int initStubProperties(CallImpl call, String seiName)
- {
+ {
// nothing to do
if (usrMetaData == null)
return 0;
@@ -443,6 +443,8 @@
private int initCallProperties(CallImpl call, String seiName)
{
+ setupHandlerChain(call.getEndpointMetaData());
+
// nothing to do
if (usrMetaData == null)
return 0;
Modified:
legacy/branches/jbossws-1.2.1.GA_CP/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws1653/JBWS1653TestCase.java
===================================================================
---
legacy/branches/jbossws-1.2.1.GA_CP/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws1653/JBWS1653TestCase.java 2007-08-24
16:14:20 UTC (rev 4499)
+++
legacy/branches/jbossws-1.2.1.GA_CP/jbossws-tests/src/java/org/jboss/test/ws/jaxrpc/jbws1653/JBWS1653TestCase.java 2007-08-24
17:18:20 UTC (rev 4500)
@@ -27,14 +27,16 @@
import java.net.URLClassLoader;
import javax.naming.InitialContext;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.Call;
import javax.xml.rpc.Service;
import junit.framework.Test;
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
+import org.jboss.ws.core.jaxrpc.client.ServiceFactoryImpl;
-
/**
* [JBWS-1653] Post-handler-chain not invoked for "Standard Client"
configuration
*
@@ -64,14 +66,92 @@
assertNull(ClientHandler.message);
}
+ public void testStandardConfigConfiguredDII() throws Exception
+ {
+ ServiceFactoryImpl factory = new ServiceFactoryImpl();
+ URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxrpc-jbws1653/TestEndpoint?wsdl");
+ QName qname = new QName("http://org.jboss.test.ws/jbws1653",
"TestService");
+ Service service = factory.createService(wsdlURL, qname);
+
+ Call call = service.createCall();
+ call.setOperationName(new QName("http://org.jboss.test.ws/jbws1653",
"echoString"));
+
+ call.setTargetEndpointAddress("http://" + getServerHost() +
":8080/jaxrpc-jbws1653/TestEndpoint");
+
+ String hello = "Hello";
+ Object retObj = call.invoke(new Object[] { hello });
+ assertEquals(hello, retObj);
+
+ assertNull(ClientHandler.message);
+ }
+
+ public void testStandardConfigFullyConfiguredDII() throws Exception
+ {
+ ServiceFactoryImpl factory = new ServiceFactoryImpl();
+ URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxrpc-jbws1653/TestEndpoint?wsdl");
+ URL mappingURL = new
File("resources/jaxrpc/jbws1653/WEB-INF/jaxrpc-mapping.xml").toURL();
+ QName qname = new QName("http://org.jboss.test.ws/jbws1653",
"TestService");
+ Service service = factory.createService(wsdlURL, qname, mappingURL);
+ TestEndpoint port = (TestEndpoint)service.getPort(TestEndpoint.class);
+
+ String retStr = port.echoString("kermit");
+ assertEquals("kermit", retStr);
+ assertNull(ClientHandler.message);
+ }
+
public void testCustomConfig() throws Exception
{
ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
- URLClassLoader urlLoader = new URLClassLoader(new URL[] {}, ctxLoader)
+ URLClassLoader urlLoader = new URLClassLoader(new URL[] {}, ctxLoader) {
+ public URL getResource(String resName)
+ {
+ URL resURL = super.getResource(resName);
+ try
+ {
+ if
(resName.endsWith("META-INF/standard-jaxrpc-client-config.xml"))
+ resURL = new
File("resources/jaxrpc/jbws1653/META-INF/standard-jaxrpc-client-config.xml").toURL();
+ }
+ catch (MalformedURLException ex)
+ {
+ // ignore
+ }
+ return resURL;
+ }
+ };
+ Thread.currentThread().setContextClassLoader(urlLoader);
+
+ URL configURL =
urlLoader.getResource("META-INF/standard-jaxrpc-client-config.xml");
+ assertTrue("Invalid config url: " + configURL,
configURL.toExternalForm().indexOf("jbws1653") > 0);
+
+ InitialContext iniCtx = getInitialContext();
+ Service service =
(Service)iniCtx.lookup("java:comp/env/service/TestService");
+ TestEndpoint port = (TestEndpoint)service.getPort(TestEndpoint.class);
+
+ try
{
- public URL findResource(String resName)
+ String retStr = port.echoString("kermit");
+ assertEquals("kermit", retStr);
+ assertEquals("kermit", ClientHandler.message);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(ctxLoader);
+ }
+ }
+
+ public void testCustomConfigConfiguredDII() throws Exception
+ {
+ if (false)
+ {
+ System.out.println("FIXME: [JBWS-1771] Post-handler-chain not invoked for
\"Standard Client\" configuration with DII client");
+ return;
+ }
+
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ URLClassLoader urlLoader = new URLClassLoader(new URL[] {}, ctxLoader) {
+ public URL getResource(String resName)
{
- URL resURL = super.findResource(resName);
+ URL resURL = super.getResource(resName);
try
{
if
(resName.endsWith("META-INF/standard-jaxrpc-client-config.xml"))
@@ -83,7 +163,37 @@
}
return resURL;
}
-
+ };
+ Thread.currentThread().setContextClassLoader(urlLoader);
+
+ ServiceFactoryImpl factory = new ServiceFactoryImpl();
+ URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxrpc-jbws1653/TestEndpoint?wsdl");
+ QName qname = new QName("http://org.jboss.test.ws/jbws1653",
"TestService");
+ Service service = factory.createService(wsdlURL, qname);
+
+ Call call = service.createCall();
+ call.setOperationName(new QName("http://org.jboss.test.ws/jbws1653",
"echoString"));
+
+ call.setTargetEndpointAddress("http://" + getServerHost() +
":8080/jaxrpc-jbws1653/TestEndpoint");
+
+ String hello = "Hello";
+
+ try
+ {
+ Object retObj = call.invoke(new Object[] { hello });
+ assertEquals(hello, retObj);
+ assertEquals(hello, ClientHandler.message);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(ctxLoader);
+ }
+ }
+
+ public void testCustomConfigFullyConfiguredDII() throws Exception
+ {
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ URLClassLoader urlLoader = new URLClassLoader(new URL[] {}, ctxLoader) {
public URL getResource(String resName)
{
URL resURL = super.getResource(resName);
@@ -101,18 +211,18 @@
};
Thread.currentThread().setContextClassLoader(urlLoader);
- URL configURL =
urlLoader.findResource("META-INF/standard-jaxrpc-client-config.xml");
- assertTrue("Invalid config url: " + configURL,
configURL.toExternalForm().indexOf("jbws1653") > 0);
-
- InitialContext iniCtx = getInitialContext();
- Service service =
(Service)iniCtx.lookup("java:comp/env/service/TestService");
+ ServiceFactoryImpl factory = new ServiceFactoryImpl();
+ URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxrpc-jbws1653/TestEndpoint?wsdl");
+ URL mappingURL = new
File("resources/jaxrpc/jbws1653/WEB-INF/jaxrpc-mapping.xml").toURL();
+ QName qname = new QName("http://org.jboss.test.ws/jbws1653",
"TestService");
+ Service service = factory.createService(wsdlURL, qname, mappingURL);
TestEndpoint port = (TestEndpoint)service.getPort(TestEndpoint.class);
try
{
- String retStr = port.echoString("kermit");
- assertEquals("kermit", retStr);
- assertEquals("kermit", ClientHandler.message);
+ String retStr = port.echoString("thefrog");
+ assertEquals("thefrog", retStr);
+ assertEquals("thefrog", ClientHandler.message);
}
finally
{
Show replies by date