Author: alessio.soldano(a)jboss.com
Date: 2011-10-19 05:39:14 -0400 (Wed, 19 Oct 2011)
New Revision: 15134
Modified:
shared-testsuite/trunk/testsuite/src/test/ant-import/build-samples-jaxrpc.xml
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/docstyle/bare/TrivialServiceDocBareTestCase.java
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/docstyle/wrapped/TrivialServiceDocWrappedTestCase.java
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/exception/ExceptionTestCase.java
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/handler/HeaderClientTestCase.java
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/holder/HolderTestCase.java
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/message/MessageTestCase.java
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/mtom/MTOMTestCase.java
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/oneway/OneWayTestCase.java
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/rpcstyle/TrivialServiceRpcTestCase.java
Log:
Updating some jaxrpc tests to avoid relying on remote jndi lookup
Modified: shared-testsuite/trunk/testsuite/src/test/ant-import/build-samples-jaxrpc.xml
===================================================================
---
shared-testsuite/trunk/testsuite/src/test/ant-import/build-samples-jaxrpc.xml 2011-10-19
09:33:41 UTC (rev 15133)
+++
shared-testsuite/trunk/testsuite/src/test/ant-import/build-samples-jaxrpc.xml 2011-10-19
09:39:14 UTC (rev 15134)
@@ -292,6 +292,9 @@
<include name="webservices.xml"/>
<include name="wsdl/**"/>
</webinf>
+ <manifest>
+ <attribute name="Dependencies"
value="org.jboss.ws.common"/>
+ </manifest>
</war>
<jar
jarfile="${tests.output.dir}/test-libs/jaxrpc-samples-message-client.jar">
<fileset dir="${tests.output.dir}/test-classes">
@@ -318,6 +321,9 @@
<include name="webservices.xml"/>
<include name="wsdl/**"/>
</webinf>
+ <manifest>
+ <attribute name="Dependencies"
value="org.jboss.ws.common,javax.mail.api services export,javax.activation.api
services export"/>
+ </manifest>
</war>
<jar
destfile="${tests.output.dir}/test-libs/jaxrpc-samples-mtom-client.jar">
<metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/mtom/META-INF">
Modified:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/docstyle/bare/TrivialServiceDocBareTestCase.java
===================================================================
---
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/docstyle/bare/TrivialServiceDocBareTestCase.java 2011-10-19
09:33:41 UTC (rev 15133)
+++
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/docstyle/bare/TrivialServiceDocBareTestCase.java 2011-10-19
09:39:14 UTC (rev 15134)
@@ -21,8 +21,12 @@
*/
package org.jboss.test.ws.jaxrpc.samples.docstyle.bare;
+import java.net.URL;
+
import javax.naming.InitialContext;
+import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
+import javax.xml.rpc.ServiceFactory;
import junit.framework.Test;
@@ -37,6 +41,8 @@
*/
public class TrivialServiceDocBareTestCase extends JBossWSTest
{
+ private static final String TARGET_NAMESPACE =
"http://org.jboss.ws/samples/docstyle/bare";
+ private static final String TARGET_ENDPOINT_URL = "http://" +
getServerHost() + ":8080/jaxrpc-samples-docstyle-bare";
private static TrivialService port;
public static Test suite()
@@ -50,12 +56,15 @@
if (port == null)
{
- InitialContext iniCtx = getInitialContext();
- Object obj = iniCtx.lookup("java:comp/env/service/TrivialService");
- Service service = (Service)obj;
- port = (TrivialService)service.getPort(TrivialService.class);
+ port = getService(TrivialService.class, "SampleService",
"TrivialServicePort");
}
}
+
+ 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 testProducPurchase() throws Exception
{
Modified:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/docstyle/wrapped/TrivialServiceDocWrappedTestCase.java
===================================================================
---
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/docstyle/wrapped/TrivialServiceDocWrappedTestCase.java 2011-10-19
09:33:41 UTC (rev 15133)
+++
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/docstyle/wrapped/TrivialServiceDocWrappedTestCase.java 2011-10-19
09:39:14 UTC (rev 15134)
@@ -21,8 +21,12 @@
*/
package org.jboss.test.ws.jaxrpc.samples.docstyle.wrapped;
+import java.net.URL;
+
import javax.naming.InitialContext;
+import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
+import javax.xml.rpc.ServiceFactory;
import junit.framework.Test;
@@ -37,6 +41,8 @@
*/
public class TrivialServiceDocWrappedTestCase extends JBossWSTest
{
+ private static final String TARGET_NAMESPACE =
"http://org.jboss.ws/samples/docstyle/wrapped";
+ private static final String TARGET_ENDPOINT_URL = "http://" +
getServerHost() + ":8080/jaxrpc-samples-docstyle-wrapped";
private static TrivialService port;
public static Test suite()
@@ -50,11 +56,15 @@
if (port == null)
{
- InitialContext iniCtx = getInitialContext();
- Service service =
(Service)iniCtx.lookup("java:comp/env/service/TrivialService");
- port = (TrivialService)service.getPort(TrivialService.class);
+ port = getService(TrivialService.class, "SampleService",
"TrivialServicePort");
}
}
+
+ 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 testProducTrivial() throws Exception
{
Modified:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/exception/ExceptionTestCase.java
===================================================================
---
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/exception/ExceptionTestCase.java 2011-10-19
09:33:41 UTC (rev 15133)
+++
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/exception/ExceptionTestCase.java 2011-10-19
09:39:14 UTC (rev 15134)
@@ -22,6 +22,7 @@
package org.jboss.test.ws.jaxrpc.samples.exception;
import java.io.ByteArrayInputStream;
+import java.net.URL;
import java.rmi.RemoteException;
import javax.naming.InitialContext;
@@ -55,6 +56,7 @@
public class ExceptionTestCase extends JBossWSTest
{
private static final String TARGET_NAMESPACE =
"http://org.jboss.ws/samples/exception";
+ private static final String TARGET_ENDPOINT_URL = "http://" +
getServerHost() + ":8080/jaxrpc-samples-exception";
public static Test suite() throws Exception
{
@@ -63,10 +65,9 @@
private ExceptionServiceInterface getPort() throws Exception
{
- InitialContext iniCtx = getInitialContext();
- ExceptionService service =
(ExceptionService)iniCtx.lookup("java:comp/env/service/ExceptionService");
- ExceptionServiceInterface port = service.getPort();
- return port;
+ ServiceFactory serviceFactory = ServiceFactory.newInstance();
+ Service service = serviceFactory.createService(new URL(TARGET_ENDPOINT_URL +
"?wsdl"), new QName(TARGET_NAMESPACE, "ExceptionService"));
+ return (ExceptionServiceInterface)service.getPort(new QName(TARGET_NAMESPACE,
"ExceptionServiceInterfacePort"), ExceptionServiceInterface.class);
}
/** Test creation of a SOAPFault */
Modified:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/handler/HeaderClientTestCase.java
===================================================================
---
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/handler/HeaderClientTestCase.java 2011-10-19
09:33:41 UTC (rev 15133)
+++
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/handler/HeaderClientTestCase.java 2011-10-19
09:39:14 UTC (rev 15134)
@@ -21,8 +21,12 @@
*/
package org.jboss.test.ws.jaxrpc.samples.handler;
+import java.net.URL;
+
import javax.naming.InitialContext;
+import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
+import javax.xml.rpc.ServiceFactory;
import javax.xml.rpc.holders.StringHolder;
import junit.framework.Test;
@@ -39,6 +43,7 @@
public class HeaderClientTestCase extends JBossWSTest
{
public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() +
":8080/jaxrpc-samples-handler";
+ private static final String TARGET_NAMESPACE =
"http://org.jboss.ws/samples/handler";
private static HeaderTestService port;
@@ -53,11 +58,15 @@
if (port == null)
{
- InitialContext iniCtx = getInitialContext();
- Service service =
(Service)iniCtx.lookup("java:comp/env/service/TestService");
- port = (HeaderTestService)service.getPort(HeaderTestService.class);
+ port = getService(HeaderTestService.class, "TestService",
"HeaderTestServicePort");
}
}
+
+ 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_ADDRESS +
"?wsdl"), new QName(TARGET_NAMESPACE, serviceName));
+ return (T) service.getPort(new QName(TARGET_NAMESPACE, portName), clazz);
+ }
public void testBoundInHeader() throws Exception
{
Modified:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/holder/HolderTestCase.java
===================================================================
---
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/holder/HolderTestCase.java 2011-10-19
09:33:41 UTC (rev 15133)
+++
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/holder/HolderTestCase.java 2011-10-19
09:39:14 UTC (rev 15134)
@@ -23,11 +23,13 @@
import java.math.BigDecimal;
import java.math.BigInteger;
+import java.net.URL;
import java.util.GregorianCalendar;
import javax.naming.InitialContext;
import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
+import javax.xml.rpc.ServiceFactory;
import javax.xml.rpc.holders.BigDecimalHolder;
import javax.xml.rpc.holders.BigIntegerHolder;
import javax.xml.rpc.holders.BooleanHolder;
@@ -62,6 +64,9 @@
*/
public class HolderTestCase extends JBossWSTest
{
+ private static final String TARGET_ENDPOINT_URL = "http://" +
getServerHost() + ":8080/jaxrpc-samples-holder";
+ private static final String TARGET_NAMESPACE =
"http://org.jboss.ws/samples/holder";
+
private static HolderTestService port;
public static Test suite()
@@ -75,11 +80,15 @@
if (port == null)
{
- InitialContext iniCtx = getInitialContext();
- Service service =
(Service)iniCtx.lookup("java:comp/env/service/TestService");
- port = (HolderTestService)service.getPort(HolderTestService.class);
+ port = getService(HolderTestService.class, "TestService",
"HolderTestServicePort");
}
}
+
+ 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 testEchoBigDecimal() throws Exception
{
Modified:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/message/MessageTestCase.java
===================================================================
---
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/message/MessageTestCase.java 2011-10-19
09:33:41 UTC (rev 15133)
+++
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/message/MessageTestCase.java 2011-10-19
09:39:14 UTC (rev 15134)
@@ -30,6 +30,7 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.rpc.Service;
+import javax.xml.rpc.ServiceFactory;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPConnection;
@@ -61,6 +62,7 @@
public class MessageTestCase extends JBossWSTest
{
private final String TARGET_ENDPOINT = "http://" + getServerHost() +
":8080/jaxrpc-samples-message";
+ private static final String TARGET_NAMESPACE =
"http://org.jboss.ws/samples/message";
/** Deploy the test ear */
public static Test suite() throws Exception
@@ -129,12 +131,11 @@
private MessageTestService getPort() throws Exception
{
- InitialContext iniCtx = getInitialContext();
- Service service =
(Service)iniCtx.lookup("java:comp/env/service/MessageService");
- MessageTestService port =
(MessageTestService)service.getPort(MessageTestService.class);
- return port;
+ ServiceFactory serviceFactory = ServiceFactory.newInstance();
+ Service service = serviceFactory.createService(new URL(TARGET_ENDPOINT +
"?wsdl"), new QName(TARGET_NAMESPACE, "MessageService"));
+ return (MessageTestService)service.getPort(new QName(TARGET_NAMESPACE,
"MessageTestServicePort"), MessageTestService.class);
}
-
+
private SOAPElement convertToSOAPElement(Element reqElement) throws
TransformerException, SOAPException
{
SOAPElement parent = SOAPFactory.newInstance().createElement("dummy");
Modified:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/mtom/MTOMTestCase.java
===================================================================
---
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/mtom/MTOMTestCase.java 2011-10-19
09:33:41 UTC (rev 15133)
+++
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/mtom/MTOMTestCase.java 2011-10-19
09:39:14 UTC (rev 15134)
@@ -24,10 +24,13 @@
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.InputStreamReader;
+import java.net.URL;
import javax.activation.DataHandler;
import javax.naming.InitialContext;
+import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
+import javax.xml.rpc.ServiceFactory;
import javax.xml.rpc.Stub;
import javax.xml.transform.stream.StreamSource;
@@ -45,6 +48,9 @@
*/
public class MTOMTestCase extends JBossWSTest
{
+ private static final String TARGET_NAMESPACE =
"http://org.jboss.ws/samples/mtom";
+ private static final String TARGET_ENDPOINT_URL = "http://" +
getServerHost() + ":8080/jaxrpc-samples-mtom";
+
private static EmployeeRecords port;
/** Deploy the test ear */
@@ -59,11 +65,15 @@
if (port == null)
{
- InitialContext iniCtx = getInitialContext();
- Service service =
(Service)iniCtx.lookup("java:comp/env/service/XOPTestService");
- port = (EmployeeRecords)service.getPort(EmployeeRecords.class);
+ port = getService(EmployeeRecords.class, "EmployeeService",
"EmployeeRecordsPort");
}
}
+
+ 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 testUpdate() throws Exception
{
Modified:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/oneway/OneWayTestCase.java
===================================================================
---
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/oneway/OneWayTestCase.java 2011-10-19
09:33:41 UTC (rev 15133)
+++
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/oneway/OneWayTestCase.java 2011-10-19
09:39:14 UTC (rev 15134)
@@ -21,8 +21,12 @@
*/
package org.jboss.test.ws.jaxrpc.samples.oneway;
+import java.net.URL;
+
import javax.naming.InitialContext;
+import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
+import javax.xml.rpc.ServiceFactory;
import junit.framework.Test;
@@ -37,6 +41,9 @@
*/
public class OneWayTestCase extends JBossWSTest
{
+ private static final String TARGET_ENDPOINT_URL = "http://" +
getServerHost() + ":8080/jaxrpc-samples-oneway";
+ private static final String TARGET_NAMESPACE =
"http://org.jboss.ws/samples/oneway";
+
private static OneWayTestService port;
public static Test suite()
@@ -50,11 +57,15 @@
if (port == null)
{
- InitialContext iniCtx = getInitialContext();
- Service service =
(Service)iniCtx.lookup("java:comp/env/service/TestService");
- port = (OneWayTestService)service.getPort(OneWayTestService.class);
+ port = getService(OneWayTestService.class, "TestService",
"OneWayTestServicePort");
}
}
+
+ 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 testOneWay() throws Exception
{
Modified:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/rpcstyle/TrivialServiceRpcTestCase.java
===================================================================
---
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/rpcstyle/TrivialServiceRpcTestCase.java 2011-10-19
09:33:41 UTC (rev 15133)
+++
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxrpc/samples/rpcstyle/TrivialServiceRpcTestCase.java 2011-10-19
09:39:14 UTC (rev 15134)
@@ -21,8 +21,12 @@
*/
package org.jboss.test.ws.jaxrpc.samples.rpcstyle;
+import java.net.URL;
+
import javax.naming.InitialContext;
+import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
+import javax.xml.rpc.ServiceFactory;
import junit.framework.Test;
@@ -37,6 +41,9 @@
*/
public class TrivialServiceRpcTestCase extends JBossWSTest
{
+ private static final String TARGET_ENDPOINT_URL = "http://" +
getServerHost() + ":8080/jaxrpc-samples-rpcstyle";
+ private static final String TARGET_NAMESPACE =
"http://org.jboss.ws/samples/rpcstyle";
+
private static TrivialService port;
public static Test suite()
@@ -50,11 +57,15 @@
if (port == null)
{
- InitialContext iniCtx = getInitialContext();
- Service service =
(Service)iniCtx.lookup("java:comp/env/service/TrivialService");
- port = (TrivialService)service.getPort(TrivialService.class);
+ port = getService(TrivialService.class, "SampleService",
"TrivialServicePort");
}
}
+
+ 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 testTrivialAccess() throws Exception
{