Author: darran.lofthouse(a)jboss.com
Date: 2007-07-31 05:36:05 -0400 (Tue, 31 Jul 2007)
New Revision: 4032
Modified:
trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxrpc/jbws1653/JBWS1653TestCase.java
Log:
Add tests for JBWS-1771 - Post-handler-chain not invoked for 'Standard Client'
configuration with DII client
Modified:
trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxrpc/jbws1653/JBWS1653TestCase.java
===================================================================
---
trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxrpc/jbws1653/JBWS1653TestCase.java 2007-07-31
08:57:42 UTC (rev 4031)
+++
trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxrpc/jbws1653/JBWS1653TestCase.java 2007-07-31
09:36:05 UTC (rev 4032)
@@ -27,10 +27,13 @@
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.ws.core.jaxrpc.client.ServiceFactoryImpl;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestSetup;
@@ -63,11 +66,58 @@
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 findResource(String resName)
+ {
+ URL resURL = super.findResource(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;
+ }
+
public URL getResource(String resName)
{
URL resURL = super.getResource(resName);
@@ -85,6 +135,9 @@
};
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");
TestEndpoint port = (TestEndpoint)service.getPort(TestEndpoint.class);
@@ -100,4 +153,95 @@
Thread.currentThread().setContextClassLoader(ctxLoader);
}
}
+
+ public void testCustomConfigConfiguredDII() throws Exception
+ {
+ if (true)
+ {
+ 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.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);
+
+ 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);
+ 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);
+
+ 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("thefrog");
+ assertEquals("thefrog", retStr);
+ assertEquals("thefrog", ClientHandler.message);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(ctxLoader);
+ }
+ }
}
Show replies by date