Author: richard.opalka(a)jboss.com
Date: 2011-11-09 07:51:00 -0500 (Wed, 09 Nov 2011)
New Revision: 15222
Modified:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/jsr109ejb/DocEJBTestCase.java
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/jsr109ejb/RpcEJBTestCase.java
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/jsr109pojo/DocJSETestCase.java
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/jsr109pojo/RpcJSETestCase.java
Log:
JNDI -> URL based tests
Modified:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/jsr109ejb/DocEJBTestCase.java
===================================================================
---
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/jsr109ejb/DocEJBTestCase.java 2011-11-09
12:04:39 UTC (rev 15221)
+++
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/jsr109ejb/DocEJBTestCase.java 2011-11-09
12:51:00 UTC (rev 15222)
@@ -21,8 +21,11 @@
*/
package org.jboss.test.ws.jaxrpc.samples.jsr109ejb;
-import javax.naming.InitialContext;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
+import javax.xml.rpc.ServiceFactory;
import junit.framework.Test;
@@ -37,6 +40,8 @@
*/
public class DocEJBTestCase extends JBossWSTest
{
+ private static final String TARGET_NAMESPACE =
"http://org.jboss.ws/samples/jsr109ejb";
+ private static final String TARGET_ENDPOINT_URL = "http://" +
getServerHost() + ":8080/jaxrpc-samples-jsr109ejb-doc";
private static JaxRpcTestService endpoint;
public static Test suite()
@@ -50,12 +55,16 @@
if (endpoint == null)
{
- InitialContext iniCtx = getInitialContext();
- Service service =
(Service)iniCtx.lookup("java:comp/env/service/TestServiceEJB");
- endpoint = (JaxRpcTestService)service.getPort(JaxRpcTestService.class);
+ endpoint = getService(JaxRpcTestService.class, "TestService",
"JaxRpcTestServicePort");
}
}
+ protected <T> T getService(final Class<T> clazz, final String serviceName,
final String portName) throws Exception {
+ ServiceFactory serviceFactory = ServiceFactory.newInstance();
+ Service service = serviceFactory.createService(new URL(TARGET_ENDPOINT_URL +
"?wsdl"), new QName(TARGET_NAMESPACE, serviceName));
+ return (T) service.getPort(new QName(TARGET_NAMESPACE, portName), clazz);
+ }
+
public void testEchoString() throws Exception
{
String hello = "Hello";
@@ -72,4 +81,5 @@
Object retObj = endpoint.echoSimpleUserType(hello, userType);
assertEquals(userType, retObj);
}
+
}
Modified:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/jsr109ejb/RpcEJBTestCase.java
===================================================================
---
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/jsr109ejb/RpcEJBTestCase.java 2011-11-09
12:04:39 UTC (rev 15221)
+++
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/jsr109ejb/RpcEJBTestCase.java 2011-11-09
12:51:00 UTC (rev 15222)
@@ -21,8 +21,11 @@
*/
package org.jboss.test.ws.jaxrpc.samples.jsr109ejb;
-import javax.naming.InitialContext;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
+import javax.xml.rpc.ServiceFactory;
import junit.framework.Test;
@@ -37,6 +40,8 @@
*/
public class RpcEJBTestCase extends JBossWSTest
{
+ private static final String TARGET_NAMESPACE =
"http://org.jboss.ws/samples/jsr109ejb";
+ private static final String TARGET_ENDPOINT_URL = "http://" +
getServerHost() + ":8080/jaxrpc-samples-jsr109ejb-rpc";
private static JaxRpcTestService port;
public static Test suite()
@@ -50,12 +55,16 @@
if (port == null)
{
- InitialContext iniCtx = getInitialContext();
- Service service =
(Service)iniCtx.lookup("java:comp/env/service/TestServiceEJB");
- port = (JaxRpcTestService)service.getPort(JaxRpcTestService.class);
+ port = getService(JaxRpcTestService.class, "TestService",
"JaxRpcTestServicePort");
}
}
+ protected <T> T getService(final Class<T> clazz, final String serviceName,
final String portName) throws Exception {
+ ServiceFactory serviceFactory = ServiceFactory.newInstance();
+ Service service = serviceFactory.createService(new URL(TARGET_ENDPOINT_URL +
"?wsdl"), new QName(TARGET_NAMESPACE, serviceName));
+ return (T) service.getPort(new QName(TARGET_NAMESPACE, portName), clazz);
+ }
+
public void testEchoString() throws Exception
{
String hello = "Hello";
Modified:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/jsr109pojo/DocJSETestCase.java
===================================================================
---
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/jsr109pojo/DocJSETestCase.java 2011-11-09
12:04:39 UTC (rev 15221)
+++
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/jsr109pojo/DocJSETestCase.java 2011-11-09
12:51:00 UTC (rev 15222)
@@ -21,8 +21,11 @@
*/
package org.jboss.test.ws.jaxrpc.samples.jsr109pojo;
-import javax.naming.InitialContext;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
+import javax.xml.rpc.ServiceFactory;
import junit.framework.Test;
@@ -37,6 +40,8 @@
*/
public class DocJSETestCase extends JBossWSTest
{
+ private static final String TARGET_NAMESPACE =
"http://org.jboss.ws/samples/jsr109pojo";
+ private static final String TARGET_ENDPOINT_URL = "http://" +
getServerHost() + ":8080/jaxrpc-samples-jsr109pojo-doc";
private static JaxRpcTestService port;
public static Test suite()
@@ -50,12 +55,16 @@
if (port == null)
{
- InitialContext iniCtx = getInitialContext();
- Service service =
(Service)iniCtx.lookup("java:comp/env/service/TestServiceJSE");
- port = (JaxRpcTestService)service.getPort(JaxRpcTestService.class);
+ port = getService(JaxRpcTestService.class, "TestService",
"JaxRpcTestServicePort");
}
}
+ protected <T> T getService(final Class<T> clazz, final String serviceName,
final String portName) throws Exception {
+ ServiceFactory serviceFactory = ServiceFactory.newInstance();
+ Service service = serviceFactory.createService(new URL(TARGET_ENDPOINT_URL +
"?wsdl"), new QName(TARGET_NAMESPACE, serviceName));
+ return (T) service.getPort(new QName(TARGET_NAMESPACE, portName), clazz);
+ }
+
public void testEchoString() throws Exception
{
String hello = "Hello";
Modified:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/jsr109pojo/RpcJSETestCase.java
===================================================================
---
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/jsr109pojo/RpcJSETestCase.java 2011-11-09
12:04:39 UTC (rev 15221)
+++
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/jsr109pojo/RpcJSETestCase.java 2011-11-09
12:51:00 UTC (rev 15222)
@@ -21,8 +21,11 @@
*/
package org.jboss.test.ws.jaxrpc.samples.jsr109pojo;
-import javax.naming.InitialContext;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
+import javax.xml.rpc.ServiceFactory;
import junit.framework.Test;
@@ -37,6 +40,8 @@
*/
public class RpcJSETestCase extends JBossWSTest
{
+ private static final String TARGET_NAMESPACE =
"http://org.jboss.ws/samples/jsr109pojo";
+ private static final String TARGET_ENDPOINT_URL = "http://" +
getServerHost() + ":8080/jaxrpc-samples-jsr109pojo-rpc";
private static JaxRpcTestService port;
public static Test suite()
@@ -50,12 +55,16 @@
if (port == null)
{
- InitialContext iniCtx = getInitialContext();
- Service service =
(Service)iniCtx.lookup("java:comp/env/service/TestServiceJSE");
- port = (JaxRpcTestService)service.getPort(JaxRpcTestService.class);
+ port = getService(JaxRpcTestService.class, "TestService",
"JaxRpcTestServicePort");
}
}
+ protected <T> T getService(final Class<T> clazz, final String serviceName,
final String portName) throws Exception {
+ ServiceFactory serviceFactory = ServiceFactory.newInstance();
+ Service service = serviceFactory.createService(new URL(TARGET_ENDPOINT_URL +
"?wsdl"), new QName(TARGET_NAMESPACE, serviceName));
+ return (T) service.getPort(new QName(TARGET_NAMESPACE, portName), clazz);
+ }
+
public void testEchoString() throws Exception
{
String hello = "Hello";