You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2017/12/27 20:08:40 UTC
svn commit: r1819366 [2/2] - in
/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws:
client/ dispatch/ misc/ provider/ provider/soapbinding/tests/ proxy/ sample/
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/soapbinding/tests/SoapMessageProviderTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/soapbinding/tests/SoapMessageProviderTests.java?rev=1819366&r1=1819365&r2=1819366&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/soapbinding/tests/SoapMessageProviderTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/soapbinding/tests/SoapMessageProviderTests.java Wed Dec 27 20:08:40 2017
@@ -18,6 +18,9 @@
*/
package org.apache.axis2.jaxws.provider.soapbinding.tests;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.ByteArrayInputStream;
import java.util.Iterator;
@@ -37,21 +40,20 @@ import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;
import javax.xml.ws.soap.SOAPFaultException;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
-import org.apache.axis2.jaxws.polymorphic.shape.tests.PolymorphicTests;
import org.apache.axis2.jaxws.provider.soapbinding.soapmsg.SoapMessageProvider;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
/**
* Tests Dispatch<SOAPMessage> client and a Provider<SOAPMessage> service.
* The client and service interaction tests various xml and attachment scenarios
*
*/
-public class SoapMessageProviderTests extends AbstractTestCase {
- private String endpointUrl = "http://localhost:6060/axis2/services/SoapMessageProviderService.SoapMessageProviderPort";
+public class SoapMessageProviderTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
+
private QName serviceName = new QName("http://soapmsg.soapbinding.provider.jaxws.axis2.apache.org", "SOAPBindingSoapMessageProviderService");
private QName portName = new QName("http://soapmsg.soapbinding.provider.jaxws.axis2.apache.org", "SoapMessageProviderPort");
@@ -96,13 +98,11 @@ public class SoapMessageProviderTests ex
SoapMessageProvider.XML_SOAP12_RESPONSE +
"</invoke_str></ns2:invokeOp>";
- public static Test suite() {
- return getTestSetup(new TestSuite(SoapMessageProviderTests.class));
- }
/**
* Sends an SOAPMessage containing only xml data
* Provider will throw a Fault
*/
+ @Test
public void testProviderSOAPMessageSOAPFault() throws Exception {
// Create the dispatch
@@ -164,6 +164,7 @@ public class SoapMessageProviderTests ex
* Sends an SOAPMessage containing only xml data
* Provider will throw a generic WebServicesException
*/
+ @Test
public void testProviderSOAPMessageWebServiceException() throws Exception {
// Create the dispatch
@@ -209,7 +210,7 @@ public class SoapMessageProviderTests ex
* Sends an SOAPMessage containing xml data and raw attachments to the web service.
* Receives a response containing xml data and the same raw attachments.
*/
-
+ @Test
public void testProviderSOAPMessageRawAttachment(){
// Raw Attachments are attachments that are not referenced in the xml with MTOM or SWARef.
// Currently there is no support in Axis 2 for these kinds of attachments.
@@ -283,6 +284,7 @@ public class SoapMessageProviderTests ex
* Sends an SOAPMessage containing xml data and mtom attachment.
* Receives a response containing xml data and the mtom attachment.
*/
+ @Test
public void testProviderSOAPMessageMTOM(){
try{
// Create the dispatch
@@ -357,6 +359,7 @@ public class SoapMessageProviderTests ex
* Sends an SOAPMessage containing xml data and a swaref attachment to the web service.
* Receives a response containing xml data and the swaref attachment attachment.
*/
+ @Test
public void testProviderSOAPMessageSWARef(){
try{
// Create the dispatch
@@ -428,6 +431,7 @@ public class SoapMessageProviderTests ex
/* This is a negative test case for a Provider that has NO SOAPBinding restriction
* Dispatch will send a SOAP11 request and Provider will send a SOAP12 Response.
*/
+ @Test
public void testSoap11RequestWithSoap12Response(){
SOAPMessage request = null;
Dispatch<SOAPMessage> dispatch = null;
@@ -461,7 +465,7 @@ public class SoapMessageProviderTests ex
Service svc = Service.create(serviceName);
- svc.addPort(portName,null, endpointUrl);
+ svc.addPort(portName,null, server.getEndpoint("SoapMessageProviderService.SoapMessageProviderPort"));
Dispatch<SOAPMessage> dispatch =
svc.createDispatch(portName, SOAPMessage.class, Service.Mode.MESSAGE);
return dispatch;
@@ -475,7 +479,7 @@ public class SoapMessageProviderTests ex
Service svc = Service.create(serviceName);
- svc.addPort(portName,null, endpointUrl);
+ svc.addPort(portName,null, server.getEndpoint("SoapMessageProviderService.SoapMessageProviderPort"));
Dispatch<String> dispatch =
svc.createDispatch(portName, String.class, Service.Mode.PAYLOAD);
return dispatch;
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/soapbinding/tests/StringProviderTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/soapbinding/tests/StringProviderTests.java?rev=1819366&r1=1819365&r2=1819366&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/soapbinding/tests/StringProviderTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/soapbinding/tests/StringProviderTests.java Wed Dec 27 20:08:40 2017
@@ -18,6 +18,9 @@
*/
package org.apache.axis2.jaxws.provider.soapbinding.tests;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.io.ByteArrayInputStream;
import javax.xml.namespace.QName;
@@ -30,13 +33,14 @@ import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;
import javax.xml.ws.soap.SOAPBinding;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
-
-public class StringProviderTests extends AbstractTestCase {
- private String endpointUrl = "http://localhost:6060/axis2/services/SOAPBindingStringProviderService.SOAPBindingStringProviderPort";
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
+
+public class StringProviderTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
+
private QName serviceName = new QName("http://StringProvider.soapbinding.provider.jaxws.axis2.apache.org", "SOAPBindingStringProviderService");
private QName portName = new QName("http://StringProvider.soapbinding.provider.jaxws.axis2.apache.org", "SOAPBindingStringProviderPort");
@@ -61,18 +65,16 @@ public class StringProviderTests extends
"</soapenv:Body>" +
"</soapenv:Envelope>";
- public static Test suite() {
- return getTestSetup(new TestSuite(StringProviderTests.class));
- }
/*
* This test case makes sure that we receive a soap11 response for a soap11 request.
*/
+ @Test
public void testsoap11request(){
System.out.println("---------------------------------------");
- System.out.println("test: " + getName());
try{
Service svc = Service.create(serviceName);
- svc.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, endpointUrl);
+ svc.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
+ server.getEndpoint("SOAPBindingStringProviderService.SOAPBindingStringProviderPort"));
Dispatch<String> dispatch =
svc.createDispatch(portName, String.class, Service.Mode.MESSAGE);
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/ProxyNonWrappedTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/ProxyNonWrappedTests.java?rev=1819366&r1=1819365&r2=1819366&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/ProxyNonWrappedTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/ProxyNonWrappedTests.java Wed Dec 27 20:08:40 2017
@@ -19,39 +19,46 @@
package org.apache.axis2.jaxws.proxy;
-import junit.framework.Test;
-import junit.framework.TestSuite;
import org.apache.axis2.jaxws.TestLogger;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
import org.apache.axis2.jaxws.proxy.doclitnonwrapped.DocLitnonWrappedProxy;
import org.apache.axis2.jaxws.proxy.doclitnonwrapped.Invoke;
import org.apache.axis2.jaxws.proxy.doclitnonwrapped.ObjectFactory;
import org.apache.axis2.jaxws.proxy.doclitnonwrapped.ProxyDocLitUnwrappedService;
import org.apache.axis2.jaxws.proxy.doclitnonwrapped.ReturnType;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.Assert;
+import org.junit.ClassRule;
+import org.junit.Test;
import javax.xml.namespace.QName;
import javax.xml.ws.AsyncHandler;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
import java.util.concurrent.Future;
/**
* This test cases will use proxy NON wrapped wsdl to invoke methods
* on a deployed Server Endpoint.
*/
-public class ProxyNonWrappedTests extends AbstractTestCase {
+public class ProxyNonWrappedTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
QName serviceName = new QName("http://doclitnonwrapped.proxy.test.org", "ProxyDocLitUnwrappedService");
- private String axisEndpoint = "http://localhost:6060/axis2/services/ProxyDocLitUnwrappedService.DocLitnonWrappedImplPort";
private QName portName = new QName("http://org.apache.axis2.proxy.doclitwrapped", "ProxyDocLitWrappedPort");
- public static Test suite() {
- return getTestSetup(new TestSuite(ProxyNonWrappedTests.class));
+ private static String getEndpoint() throws Exception {
+ return server.getEndpoint("ProxyDocLitUnwrappedService.DocLitnonWrappedImplPort");
}
-
- public void testInvoke(){
+
+ @Test
+ public void testInvoke() throws Exception {
TestLogger.logger.debug("-----------------------------------");
- TestLogger.logger.debug("test: " + getName());
TestLogger.logger.debug(">>Testing Sync Inovoke on Proxy DocLit non-wrapped");
ObjectFactory factory = new ObjectFactory();
Invoke invokeObj = factory.createInvoke();
@@ -61,7 +68,7 @@ public class ProxyNonWrappedTests extend
DocLitnonWrappedProxy proxy = service.getPort(portName, DocLitnonWrappedProxy.class);
assertNotNull(proxy);
BindingProvider p = (BindingProvider)proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
ReturnType response = proxy.invoke(invokeObj);
assertNotNull(response);
TestLogger.logger.debug(">>Response =" + response.getReturnStr());
@@ -75,9 +82,9 @@ public class ProxyNonWrappedTests extend
TestLogger.logger.debug("-------------------------------------");
}
- public void testNullInvoke(){
+ @Test
+ public void testNullInvoke() throws Exception {
TestLogger.logger.debug("-----------------------------------");
- TestLogger.logger.debug("test: " + getName());
TestLogger.logger.debug(">>Testing Sync Invoke on Proxy DocLit bare with a null parameter");
ObjectFactory factory = new ObjectFactory();
Invoke invokeObj = null;
@@ -86,7 +93,7 @@ public class ProxyNonWrappedTests extend
DocLitnonWrappedProxy proxy = service.getPort(portName, DocLitnonWrappedProxy.class);
assertNotNull(proxy);
BindingProvider p = (BindingProvider)proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
ReturnType response = proxy.invoke(invokeObj);
assertNull(response);
@@ -97,10 +104,10 @@ public class ProxyNonWrappedTests extend
TestLogger.logger.debug("-------------------------------------");
}
+ @Test
public void testInvokeAsyncCallback(){
try{
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("DocLitNonWrapped test case: " + getName());
ObjectFactory factory = new ObjectFactory();
//create input object to web service operation
Invoke invokeObj = factory.createInvoke();
@@ -112,7 +119,7 @@ public class ProxyNonWrappedTests extend
TestLogger.logger.debug(">>Invoking Binding Provider property");
//Setup Endpoint url -- optional.
BindingProvider p = (BindingProvider)proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
TestLogger.logger.debug(">> Invoking Proxy Asynchronous Callback");
AsyncHandler<ReturnType> handler = new AsyncCallback();
//Invoke operation Asynchronously.
@@ -137,6 +144,7 @@ public class ProxyNonWrappedTests extend
}
}
+ @Test
public void testInvokeAsyncPolling(){
}
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/ProxyTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/ProxyTests.java?rev=1819366&r1=1819365&r2=1819366&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/ProxyTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/ProxyTests.java Wed Dec 27 20:08:40 2017
@@ -19,48 +19,53 @@
package org.apache.axis2.jaxws.proxy;
-import junit.framework.Test;
-import junit.framework.TestSuite;
import org.apache.axis2.jaxws.TestLogger;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
import org.apache.axis2.jaxws.proxy.doclitwrapped.DocLitWrappedProxy;
import org.apache.axis2.jaxws.proxy.doclitwrapped.ProxyDocLitWrappedService;
import org.apache.axis2.jaxws.proxy.doclitwrapped.ReturnType;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
import javax.xml.namespace.QName;
import javax.xml.ws.AsyncHandler;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Response;
import javax.xml.ws.Service;
+
+import static org.junit.Assert.assertNotNull;
+
import java.io.File;
import java.net.URL;
import java.util.concurrent.Future;
-public class ProxyTests extends AbstractTestCase {
+public class ProxyTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
+
private QName serviceName = new QName(
"http://doclitwrapped.proxy.test.org", "ProxyDocLitWrappedService");
- private String axisEndpoint = "http://localhost:6060/axis2/services/ProxyDocLitWrappedService.DocLitWrappedProxyImplPort";
private QName portName = new QName("http://doclitwrapped.proxy.test.org",
"DocLitWrappedProxyImplPort");
private String wsdlLocation = System.getProperty("basedir",".")+"/"+"src/test/java/org/apache/axis2/jaxws/proxy/doclitwrapped/META-INF/ProxyDocLitWrapped.wsdl";
private boolean runningOnAxis = true;
- public static Test suite() {
- return getTestSetup(new TestSuite(ProxyTests.class));
+ private static String getEndpoint() throws Exception {
+ return server.getEndpoint("ProxyDocLitWrappedService.DocLitWrappedProxyImplPort");
}
- public void testMultipleServiceCalls(){
+ @Test
+ public void testMultipleServiceCalls() throws Exception {
if(!runningOnAxis){
return;
}
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test:" + getName());
String request = new String("some string request");
TestLogger.logger.debug("Service Call #1");
ProxyDocLitWrappedService service1 = new ProxyDocLitWrappedService();
DocLitWrappedProxy proxy1 = service1.getDocLitWrappedProxyImplPort();
BindingProvider p1 = (BindingProvider)proxy1;
- p1.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,axisEndpoint);
+ p1.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
String response1 = proxy1.invoke(request);
TestLogger.logger.debug("Proxy Response =" + response1);
TestLogger.logger.debug("---------------------------------------");
@@ -69,25 +74,25 @@ public class ProxyTests extends Abstract
ProxyDocLitWrappedService service2 = new ProxyDocLitWrappedService();
DocLitWrappedProxy proxy2 = service2.getDocLitWrappedProxyImplPort();
BindingProvider p2 = (BindingProvider)proxy2;
- p2.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,axisEndpoint);
+ p2.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
String response2 = proxy2.invoke(request);
TestLogger.logger.debug("Proxy Response =" + response2);
TestLogger.logger.debug("---------------------------------------");
}
+ @Test
public void testInvokeWithNullParam() throws Exception {
if(!runningOnAxis){
return;
}
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("Test Name: " + getName());
File wsdl= new File(wsdlLocation);
URL wsdlUrl = wsdl.toURI().toURL();
Service service = Service.create(null, serviceName);
Object proxy =service.getPort(portName, DocLitWrappedProxy.class);
TestLogger.logger.debug(">>Invoking Binding Provider property");
BindingProvider p = (BindingProvider)proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
DocLitWrappedProxy dwp = (DocLitWrappedProxy)proxy;
TestLogger.logger.debug(">> Invoking Proxy Synchronously");
@@ -101,6 +106,7 @@ public class ProxyTests extends Abstract
TestLogger.logger.debug("---------------------------------------");
}
+ @Test
public void testInvoke() throws Exception {
if(!runningOnAxis){
return;
@@ -114,7 +120,7 @@ public class ProxyTests extends Abstract
Object proxy =service.getPort(portName, DocLitWrappedProxy.class);
TestLogger.logger.debug(">>Invoking Binding Provider property");
BindingProvider p = (BindingProvider)proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
DocLitWrappedProxy dwp = (DocLitWrappedProxy)proxy;
TestLogger.logger.debug(">> Invoking Proxy Synchronously");
@@ -127,6 +133,7 @@ public class ProxyTests extends Abstract
TestLogger.logger.debug("---------------------------------------");
}
+ @Test
public void testInvokeWithWSDL() throws Exception {
if(!runningOnAxis){
return;
@@ -139,7 +146,7 @@ public class ProxyTests extends Abstract
Object proxy =service.getPort(portName, DocLitWrappedProxy.class);
TestLogger.logger.debug(">>Invoking Binding Provider property");
BindingProvider p = (BindingProvider)proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
DocLitWrappedProxy dwp = (DocLitWrappedProxy)proxy;
TestLogger.logger.debug(">> Invoking Proxy Synchronously");
@@ -152,6 +159,7 @@ public class ProxyTests extends Abstract
TestLogger.logger.debug("---------------------------------------");
}
+ @Test
public void testInvokeAsyncCallback() throws Exception {
if(!runningOnAxis){
return;
@@ -165,7 +173,7 @@ public class ProxyTests extends Abstract
Object proxy =service.getPort(portName, DocLitWrappedProxy.class);
TestLogger.logger.debug(">>Invoking Binding Provider property");
BindingProvider p = (BindingProvider)proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
DocLitWrappedProxy dwp = (DocLitWrappedProxy)proxy;
TestLogger.logger.debug(">> Invoking Proxy Asynchronous Callback");
@@ -178,6 +186,7 @@ public class ProxyTests extends Abstract
TestLogger.logger.debug("---------------------------------------");
}
+ @Test
public void testInvokeAsyncPolling() throws Exception {
TestLogger.logger.debug("---------------------------------------");
@@ -190,7 +199,7 @@ public class ProxyTests extends Abstract
TestLogger.logger.debug(">> Invoking Binding Provider property");
BindingProvider p = (BindingProvider) proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
TestLogger.logger.debug(">> Invoking Proxy with async polling request");
Response<ReturnType> asyncResponse = proxy.invokeAsync(request);
@@ -215,6 +224,7 @@ public class ProxyTests extends Abstract
assertNotNull(response);
}
+ @Test
public void testTwoWay() throws Exception {
if(runningOnAxis){
return;
@@ -226,7 +236,7 @@ public class ProxyTests extends Abstract
Object proxy =service.getPort(portName, DocLitWrappedProxy.class);
BindingProvider p = (BindingProvider)proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
DocLitWrappedProxy dwp = (DocLitWrappedProxy)proxy;
String response = dwp.twoWay(request);
@@ -237,14 +247,17 @@ public class ProxyTests extends Abstract
System.out.println("Response =" + response);
}
+ @Test
public void testOneWay(){
}
+ @Test
public void testHolder(){
}
+ @Test
public void testTwoWayAsyncCallback() throws Exception {
if(runningOnAxis){
return;
@@ -257,7 +270,7 @@ public class ProxyTests extends Abstract
Object proxy =service.getPort(portName, DocLitWrappedProxy.class);
BindingProvider p = (BindingProvider)proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
DocLitWrappedProxy dwp = (DocLitWrappedProxy)proxy;
AsyncHandler handler = new AsyncCallback();
@@ -268,6 +281,7 @@ public class ProxyTests extends Abstract
response = dwp.twoWayAsync(request, handler);
}
+ @Test
public void testAsyncPooling(){
}
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/RPCLitSWAProxyTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/RPCLitSWAProxyTests.java?rev=1819366&r1=1819365&r2=1819366&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/RPCLitSWAProxyTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/RPCLitSWAProxyTests.java Wed Dec 27 20:08:40 2017
@@ -19,11 +19,11 @@
package org.apache.axis2.jaxws.proxy;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
import org.apache.axis2.jaxws.provider.DataSourceImpl;
import org.apache.axis2.jaxws.proxy.rpclitswa.sei.RPCLitSWA;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
import javax.activation.DataHandler;
import javax.activation.DataSource;
@@ -35,16 +35,20 @@ import javax.xml.ws.BindingProvider;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Holder;
import javax.xml.ws.Service;
+
+import static org.junit.Assert.assertTrue;
+
import java.awt.*;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
-public class RPCLitSWAProxyTests extends AbstractTestCase {
+public class RPCLitSWAProxyTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
private QName serviceName = new QName(
"http://org/apache/axis2/jaxws/proxy/rpclitswa", "RPCLitSWAService");
- private String axisEndpoint = "http://localhost:6060/axis2/services/RPCLitSWAService.RPCLitSWA";
private QName portName = new QName("http://org/apache/axis2/jaxws/proxy/rpclitswa",
"RPCLitSWA");
private String wsdlLocation = System.getProperty("basedir",".")+"/"+
@@ -68,23 +72,20 @@ public class RPCLitSWAProxyTests extends
}
private static DataSource imageDS;
- public static Test suite() {
- return getTestSetup(new TestSuite(RPCLitSWAProxyTests.class));
- }
-
/**
* Utility method to get the proxy
* @return RPCLit proxy
* @throws MalformedURLException
*/
- public RPCLitSWA getProxy() throws MalformedURLException {
+ public RPCLitSWA getProxy() throws Exception {
File wsdl= new File(wsdlLocation);
assertTrue("WSDL does not exist:" + wsdlLocation,wsdl.exists());
URL wsdlUrl = wsdl.toURI().toURL();
Service service = Service.create(wsdlUrl, serviceName);
Object proxy =service.getPort(portName, RPCLitSWA.class);
BindingProvider p = (BindingProvider)proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ server.getEndpoint("RPCLitSWAService.RPCLitSWA"));
return (RPCLitSWA)proxy;
}
@@ -94,16 +95,17 @@ public class RPCLitSWAProxyTests extends
* @return
* @throws MalformedURLException
*/
- public Dispatch<String> getDispatch() throws MalformedURLException {
+ public Dispatch<String> getDispatch() throws Exception {
File wsdl= new File(wsdlLocation);
URL wsdlUrl = wsdl.toURI().toURL();
Service service = Service.create(null, serviceName);
- service.addPort(portName, null, axisEndpoint);
+ service.addPort(portName, null, server.getEndpoint("RPCLitSWAService.RPCLitSWA"));
Dispatch<String> dispatch = service.createDispatch(portName, String.class,
Service.Mode.PAYLOAD);
return dispatch;
}
+ @Test
public void testNOOP() {
}
@@ -126,6 +128,7 @@ public class RPCLitSWAProxyTests extends
new String[] {"text/plain"}));
// TODO: End HACK for RPCListSWAProxyTest
*/
+ @Test
public void testRPCLitSWAEcho() throws Exception {
RPCLitSWA proxy = getProxy();
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/RPCProxyTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/RPCProxyTests.java?rev=1819366&r1=1819365&r2=1819366&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/RPCProxyTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/RPCProxyTests.java Wed Dec 27 20:08:40 2017
@@ -19,13 +19,14 @@
package org.apache.axis2.jaxws.proxy;
-import junit.framework.Test;
-import junit.framework.TestSuite;
import org.apache.axis2.jaxws.TestLogger;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
import org.apache.axis2.jaxws.proxy.rpclit.RPCLitImpl;
import org.apache.axis2.jaxws.proxy.rpclit.sei.RPCFault;
import org.apache.axis2.jaxws.proxy.rpclit.sei.RPCLit;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Test;
import org.test.proxy.rpclit.ComplexAll;
import org.test.proxy.rpclit.Enum;
@@ -36,36 +37,39 @@ import javax.xml.ws.Dispatch;
import javax.xml.ws.Holder;
import javax.xml.ws.Service;
import javax.xml.ws.WebServiceException;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.io.File;
import java.math.BigInteger;
import java.net.MalformedURLException;
import java.net.URL;
-public class RPCProxyTests extends AbstractTestCase {
+public class RPCProxyTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
private QName serviceName = new QName(
"http://org.apache.axis2.jaxws.proxy.rpclit", "RPCLitService");
- private String axisEndpoint = "http://localhost:6060/axis2/services/RPCLitService.RPCLitImplPort";
private QName portName = new QName("http://org.apache.axis2.jaxws.proxy.rpclit",
"RPCLit");
private String wsdlLocation = System.getProperty("basedir",".")+"/"+"src/test/java/org/apache/axis2/jaxws/proxy/rpclit/META-INF/RPCLit.wsdl";
- public static Test suite() {
- return getTestSetup(new TestSuite(RPCProxyTests.class));
- }
-
/**
* Utility method to get the proxy
* @return RPCLit proxy
* @throws MalformedURLException
*/
- public RPCLit getProxy() throws MalformedURLException {
+ public RPCLit getProxy() throws Exception {
File wsdl= new File(wsdlLocation);
URL wsdlUrl = wsdl.toURI().toURL();
Service service = Service.create(null, serviceName);
Object proxy =service.getPort(portName, RPCLit.class);
BindingProvider p = (BindingProvider)proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ server.getEndpoint("RPCLitService.RPCLitImplPort"));
return (RPCLit)proxy;
}
@@ -75,11 +79,11 @@ public class RPCProxyTests extends Abstr
* @return
* @throws MalformedURLException
*/
- public Dispatch<String> getDispatch() throws MalformedURLException {
+ public Dispatch<String> getDispatch() throws Exception {
File wsdl= new File(wsdlLocation);
URL wsdlUrl = wsdl.toURI().toURL();
Service service = Service.create(null, serviceName);
- service.addPort(portName, null, axisEndpoint);
+ service.addPort(portName, null, server.getEndpoint("RPCLitService.RPCLitImplPort"));
Dispatch<String> dispatch = service.createDispatch(portName, String.class, Service.Mode.PAYLOAD);
return dispatch;
}
@@ -87,6 +91,7 @@ public class RPCProxyTests extends Abstr
/**
* Simple test that ensures that we can echo a string to an rpc/lit web service
*/
+ @Test
public void testSimple() throws Exception {
try{
RPCLit proxy = getProxy();
@@ -109,6 +114,7 @@ public class RPCProxyTests extends Abstr
/**
* Simple test that ensures that we can echo a string to an rpc/lit web service
*/
+ @Test
public void testSimpleInOut() throws Exception {
try{
RPCLit proxy = getProxy();
@@ -135,6 +141,7 @@ public class RPCProxyTests extends Abstr
/**
* Simple test that ensures that we can echo a string to an rpc/lit web service
*/
+ @Test
public void testSimple2() throws Exception {
try{
RPCLit proxy = getProxy();
@@ -159,6 +166,7 @@ public class RPCProxyTests extends Abstr
* Simple test that ensures that we can echo a string to an rpc/lit web service.
* This test passes the information in headers
*/
+ @Test
public void testHeader() throws Exception {
RPCLit proxy = getProxy();
String request1 = "hello";
@@ -178,6 +186,7 @@ public class RPCProxyTests extends Abstr
/**
* Simple test that ensures that a service fault is thrown correctly
*/
+ @Test
public void testFault() throws Exception {
RPCLit proxy = getProxy();
try{
@@ -207,6 +216,7 @@ public class RPCProxyTests extends Abstr
/**
* Simple test that ensures that we can echo a string to an rpc/lit web service
*/
+ @Test
public void testForNull() throws Exception {
RPCLit proxy = getProxy();
try{
@@ -234,6 +244,7 @@ public class RPCProxyTests extends Abstr
/**
* Simple test that ensures that we can echo a string to an rpc/lit web service
*/
+ @Test
public void testForNullReturn() throws Exception {
RPCLit proxy = getProxy();
@@ -257,6 +268,7 @@ public class RPCProxyTests extends Abstr
+ @Test
public void testSimple_Dispatch() throws Exception {
// Send a payload that simulates
// the rpc message
@@ -297,6 +309,7 @@ public class RPCProxyTests extends Abstr
assertTrue(response.contains("PAYLOAD WITH XSI:TYPE"));
}
+ @Test
public void testSimple2_DispatchWithoutXSIType() throws Exception {
// Send a payload that simulates
// the rpc message
@@ -343,6 +356,7 @@ public class RPCProxyTests extends Abstr
assertTrue(response.contains("HELLOWORLD"));
}
+ @Test
public void testSimple_DispatchWithoutXSIType() throws Exception {
// Send a payload that simulates
// the rpc message
@@ -389,6 +403,7 @@ public class RPCProxyTests extends Abstr
/**
* Simple test that ensures that we can echo a string to an rpc/lit web service.
*/
+ @Test
public void testStringList() throws Exception {
try{
RPCLit proxy = getProxy();
@@ -412,6 +427,7 @@ public class RPCProxyTests extends Abstr
}
}
+ @Test
public void testStringList_Dispatch() throws Exception {
// Send a payload that simulates
// the rpc message
@@ -458,7 +474,9 @@ public class RPCProxyTests extends Abstr
* Users should use document/literal processing if they
* need such complicated scenarios.
*/
- public void _testLists() {
+ @Ignore
+ @Test
+ public void testLists() {
try{
RPCLit proxy = getProxy();
QName[] request = new QName[] {RPCLitImpl.qname1, RPCLitImpl.qname2};
@@ -501,7 +519,9 @@ public class RPCProxyTests extends Abstr
* Users should use document/literal processing if they
* need such complicated scenarios.
*/
- public void _testCalendars() {
+ @Ignore
+ @Test
+ public void testCalendars() {
try{
RPCLit proxy = getProxy();
XMLGregorianCalendar[] request = new XMLGregorianCalendar[] {RPCLitImpl.bday, RPCLitImpl.holiday};
@@ -522,6 +542,7 @@ public class RPCProxyTests extends Abstr
}
}
+ @Test
public void testBigIntegers() {
try{
RPCLit proxy = getProxy();
@@ -543,6 +564,7 @@ public class RPCProxyTests extends Abstr
}
}
+ @Test
public void testLongs() {
try{
RPCLit proxy = getProxy();
@@ -566,6 +588,7 @@ public class RPCProxyTests extends Abstr
}
}
+ @Test
public void testEnums() {
try{
RPCLit proxy = getProxy();
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/SOAP12ProxyTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/SOAP12ProxyTests.java?rev=1819366&r1=1819365&r2=1819366&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/SOAP12ProxyTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/SOAP12ProxyTests.java Wed Dec 27 20:08:40 2017
@@ -19,12 +19,17 @@
package org.apache.axis2.jaxws.proxy;
-import junit.framework.Test;
-import junit.framework.TestSuite;
import org.apache.axis2.jaxws.TestLogger;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
import org.apache.axis2.jaxws.proxy.soap12.Echo;
import org.apache.axis2.jaxws.proxy.soap12.SOAP12EchoService;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
@@ -35,29 +40,26 @@ import javax.xml.ws.WebServiceException;
* requests. The endpoint can accept different keys to determine
* what it should send back.
*/
-public class SOAP12ProxyTests extends AbstractTestCase {
+public class SOAP12ProxyTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
private static final String SEND_SOAP11_RESPONSE = "RESPONSE-SOAP11";
private static final String SEND_SOAP12_RESPONSE = "RESPONSE-SOAP12";
- String axisEndpoint = "http://localhost:6060/axis2/services/SOAP12EchoService.EchoPort";
- public static Test suite() {
- return getTestSetup(new TestSuite(SOAP12ProxyTests.class));
- }
-
/**
* Send a SOAP 1.2 request and expect a SOAP 1.2 response.
*/
+ @Test
public void testSOAP12RequestSOAP12Response() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// create the proxy instance. the WSDL used by this proxy
// should have a proper SOAP 1.2 binding configured
SOAP12EchoService service = new SOAP12EchoService();
Echo proxy = service.getPort(new QName("http://jaxws.axis2.apache.org/proxy/soap12", "EchoPort"), Echo.class);
BindingProvider p = (BindingProvider) proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, server.getEndpoint("SOAP12EchoService.EchoPort"));
// invoke the remote operation. send a key that tells the
// service send back a SOAP 1.2 response.
@@ -82,9 +84,10 @@ public class SOAP12ProxyTests extends Ab
* response. This should result in an exception.
*/
// TODO fix and re-enable
- public void _testSOAP12RequestSOAP11Response() {
+ @Ignore
+ @Test
+ public void testSOAP12RequestSOAP11Response() {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// create the proxy instance. the WSDL used by this proxy
// should have a proper SOAP 1.2 binding configured
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java?rev=1819366&r1=1819365&r2=1819366&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java Wed Dec 27 20:08:40 2017
@@ -19,6 +19,13 @@
package org.apache.axis2.jaxws.sample;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
@@ -52,15 +59,11 @@ import javax.xml.ws.handler.HandlerResol
import javax.xml.ws.handler.PortInfo;
import javax.xml.ws.soap.SOAPFaultException;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
import org.apache.axis2.AxisFault;
import org.apache.axis2.description.Parameter;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.jaxws.TestLogger;
import org.apache.axis2.jaxws.description.ServiceDescription;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
import org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersClientLogicalHandler;
import org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersClientLogicalHandler2;
import org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersClientLogicalHandler3;
@@ -71,11 +74,16 @@ import org.apache.axis2.jaxws.sample.add
import org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersHandlerService;
import org.apache.axis2.jaxws.sample.addnumbershandler.AddNumbersProtocolHandler2;
import org.apache.axis2.jaxws.spi.ServiceDelegate;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
import org.test.addnumbershandler.AddNumbersHandlerResponse;
-public class AddNumbersHandlerTests extends AbstractTestCase {
+public class AddNumbersHandlerTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
- String axisEndpoint = "http://localhost:6060/axis2/services/AddNumbersHandlerService.AddNumbersHandlerPortTypeImplPort";
String invalidAxisEndpoint = "http://invalidHostName:6060/axis2/services/AddNumbersHandlerService.AddNumbersHandlerPortTypeImplPort";
static File requestFile = null;
@@ -87,8 +95,8 @@ public class AddNumbersHandlerTests exte
private static final String filelogname = "target/AddNumbersHandlerTests.log";
- public static Test suite() {
- return getTestSetup(new TestSuite(AddNumbersHandlerTests.class));
+ private static String getEndpoint() throws Exception {
+ return server.getEndpoint("AddNumbersHandlerService.AddNumbersHandlerPortTypeImplPort");
}
/**
@@ -106,16 +114,16 @@ public class AddNumbersHandlerTests exte
* 3) Handlers are sharing properties, both APPLICATION scoped and HANDLER scoped
* 3) General handler framework functionality; make sure handlers are instantiated and called
*/
+ @Test
public void testAddNumbersHandler() {
try{
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
AddNumbersHandlerService service = new AddNumbersHandlerService();
AddNumbersHandlerPortType proxy = service.getAddNumbersHandlerPort();
BindingProvider p = (BindingProvider)proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
int total = proxy.addNumbersHandler(10, 10);
assertEquals("With handler manipulation, total should be 3 less than a proper sumation.", 17, total);
@@ -173,16 +181,16 @@ public class AddNumbersHandlerTests exte
* 2) Access to the special "jaxws.webmethod.exception"
* 3) Proper exception call flow when an application exception is thrown.
*/
+ @Test
public void testAddNumbersHandler_WithCheckedException() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
AddNumbersHandlerService service = new AddNumbersHandlerService();
AddNumbersHandlerPortType proxy = service.getAddNumbersHandlerPort();
BindingProvider p = (BindingProvider)proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
AddNumbersHandlerFault_Exception expectedException = null;
Throwable t = null;
try {
@@ -266,16 +274,16 @@ public class AddNumbersHandlerTests exte
* 2) Access to the special "jaxws.webmethod.exception"
* 3) Proper exception call flow when an unchecked exception is thrown.
*/
+ @Test
public void testAddNumbersHandler_WithUnCheckedException() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
AddNumbersHandlerService service = new AddNumbersHandlerService();
AddNumbersHandlerPortType proxy = service.getAddNumbersHandlerPort();
BindingProvider p = (BindingProvider)proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
SOAPFaultException expectedException = null;
Throwable t = null;
try {
@@ -361,16 +369,16 @@ public class AddNumbersHandlerTests exte
* 2) Access to the special "jaxws.webmethod.exception"
* 3) Proper exception call flow when an unchecked exception is thrown.
*/
+ @Test
public void testAddNumbersHandler_WithHandlerException() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
AddNumbersHandlerService service = new AddNumbersHandlerService();
AddNumbersHandlerPortType proxy = service.getAddNumbersHandlerPort();
BindingProvider p = (BindingProvider)proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
SOAPFaultException expectedException = null;
Throwable t = null;
try {
@@ -403,6 +411,7 @@ public class AddNumbersHandlerTests exte
}
+ @Test
public void testAddNumbersHandlerDispatch() {
try {
QName serviceName =
@@ -412,7 +421,7 @@ public class AddNumbersHandlerTests exte
Service myService = Service.create(serviceName);
- myService.addPort(portName, null, axisEndpoint);
+ myService.addPort(portName, null, getEndpoint());
Dispatch<Source> myDispatch = myService.createDispatch(portName, Source.class,
Service.Mode.MESSAGE);
@@ -469,6 +478,7 @@ public class AddNumbersHandlerTests exte
}
}
+ @Test
public void testAddNumbersHandlerDispatchMyResolver() {
try {
QName serviceName =
@@ -480,7 +490,7 @@ public class AddNumbersHandlerTests exte
myService.setHandlerResolver(new MyHandlerResolver());
- myService.addPort(portName, null, axisEndpoint);
+ myService.addPort(portName, null, getEndpoint());
Dispatch<Source> myDispatch = myService.createDispatch(portName, Source.class,
Service.Mode.MESSAGE);
@@ -528,10 +538,10 @@ public class AddNumbersHandlerTests exte
/*
* JAXWS 9.2.1.1 conformance test
*/
+ @Test
public void testAddNumbersHandlerResolver() {
try {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
AddNumbersHandlerService service = new AddNumbersHandlerService();
@@ -558,17 +568,17 @@ public class AddNumbersHandlerTests exte
}
}
+ @Test
public void testAddNumbersHandlerWithFault() {
try{
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
AddNumbersHandlerService service = new AddNumbersHandlerService();
AddNumbersHandlerPortType proxy = service.getAddNumbersHandlerPort();
BindingProvider p = (BindingProvider)proxy;
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- axisEndpoint);
+ getEndpoint());
// value 99 triggers the handler to throw an exception, but does
// NOT trigger the AddNumbersHandler.handlefault method.
// The spec does not call the handlefault method of a handler that
@@ -607,10 +617,10 @@ public class AddNumbersHandlerTests exte
* outbound AddNumbersClientProtocolHandler are accessible. These properties are also checked here in
* the client app. AddNumbersClientLogicalHandler also subtracts 1 from the sum on the inbound flow.
*/
+ @Test
public void testAddNumbersClientHandler() {
try{
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
AddNumbersHandlerService service = new AddNumbersHandlerService();
AddNumbersHandlerPortType proxy = service.getAddNumbersHandlerPort();
@@ -618,7 +628,7 @@ public class AddNumbersHandlerTests exte
BindingProvider p = (BindingProvider)proxy;
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- axisEndpoint);
+ getEndpoint());
p.getRequestContext().put("myClientKey", "myClientVal");
List<Handler> handlers = p.getBinding().getHandlerChain();
@@ -686,10 +696,10 @@ public class AddNumbersHandlerTests exte
* puts the AddNumbersClientLogicalHandler and AddNumbersClientProtocolHandler
* in the flow. Results should be the same as testAddNumbersClientHandler.
*/
+ @Test
public void testAddNumbersClientHandlerMyResolver() {
try{
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
AddNumbersHandlerService service = new AddNumbersHandlerService();
service.setHandlerResolver(new MyHandlerResolver());
@@ -699,7 +709,7 @@ public class AddNumbersHandlerTests exte
BindingProvider p = (BindingProvider)proxy;
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- axisEndpoint);
+ getEndpoint());
int total = proxy.addNumbersHandler(10,10);
@@ -741,10 +751,10 @@ public class AddNumbersHandlerTests exte
}
}
+ @Test
public void testAddNumbersClientProtoAndLogicalHandler() {
try{
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
AddNumbersHandlerService service = new AddNumbersHandlerService();
AddNumbersHandlerPortType proxy = service.getAddNumbersHandlerPort();
@@ -752,7 +762,7 @@ public class AddNumbersHandlerTests exte
BindingProvider p = (BindingProvider)proxy;
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- axisEndpoint);
+ getEndpoint());
List<Handler> handlers = p.getBinding().getHandlerChain();
if (handlers == null)
@@ -804,10 +814,10 @@ public class AddNumbersHandlerTests exte
TestLogger.logger.debug("----------------------------------");
}
+ @Test
public void testAddNumbersClientHandlerWithFault() {
try{
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
AddNumbersHandlerService service = new AddNumbersHandlerService();
AddNumbersHandlerPortType proxy = service.getAddNumbersHandlerPort();
@@ -815,7 +825,7 @@ public class AddNumbersHandlerTests exte
BindingProvider p = (BindingProvider)proxy;
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- axisEndpoint);
+ getEndpoint());
List<Handler> handlers = p.getBinding().getHandlerChain();
if (handlers == null)
@@ -854,10 +864,10 @@ public class AddNumbersHandlerTests exte
* host on the EPR) is returned as a SOAPFaultException, and the JAX-WS application handler
* handleFault() methods are driven. This is the default behavior.
*/
+ @Test
public void testAddNumbersClientHandlerWithLocalException() {
try{
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
AddNumbersHandlerService service = new AddNumbersHandlerService();
AddNumbersHandlerPortType proxy = service.getAddNumbersHandlerPort();
@@ -902,10 +912,10 @@ public class AddNumbersHandlerTests exte
* host on the EPR) is returned as a WebServiceExcpetion (not a SOAPFaultException), and the
* JAX-WS application handler handleMessage() methods are driven.
*/
+ @Test
public void testAddNumbersClientHandlerWithLocalException_RevertBehaviorFlag() {
try{
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
AddNumbersHandlerService service = new AddNumbersHandlerService();
setAxisConfigParameter(service, org.apache.axis2.jaxws.Constants.DISABLE_SOAPFAULT_FOR_LOCAL_EXCEPTION,
@@ -946,13 +956,13 @@ public class AddNumbersHandlerTests exte
TestLogger.logger.debug("----------------------------------");
}
+ @Test
public void testAddNumbersClientHandlerWithFalse() throws Exception {
AddNumbersClientLogicalHandler2 clh = new AddNumbersClientLogicalHandler2();
AddNumbersClientProtocolHandler cph = new AddNumbersClientProtocolHandler();
cph.setPivot(true);
try{
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
AddNumbersHandlerService service = new AddNumbersHandlerService();
AddNumbersHandlerPortType proxy = service.getAddNumbersHandlerPort();
@@ -960,7 +970,7 @@ public class AddNumbersHandlerTests exte
BindingProvider p = (BindingProvider)proxy;
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- axisEndpoint);
+ getEndpoint());
List<Handler> handlers = p.getBinding().getHandlerChain();
if (handlers == null) {
@@ -998,10 +1008,10 @@ public class AddNumbersHandlerTests exte
* AddNumbersClientLogicalHandler2 doubles the first param on outbound. Async, of course.
*
*/
+ @Test
public void testAddNumbersClientHandlerAsync() {
try{
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
AddNumbersHandlerService service = new AddNumbersHandlerService();
AddNumbersHandlerPortType proxy = service.getAddNumbersHandlerPort();
@@ -1009,7 +1019,7 @@ public class AddNumbersHandlerTests exte
BindingProvider p = (BindingProvider)proxy;
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- axisEndpoint);
+ getEndpoint());
List<Handler> handlers = p.getBinding().getHandlerChain();
if (handlers == null)
@@ -1081,10 +1091,10 @@ public class AddNumbersHandlerTests exte
* @see #testAddNumbersClientHandlerWithLocalException_RevertBehaviorFlag()
*
*/
+ @Test
public void testAddNumbersClientHandlerWithLocalExceptionAsync_RevertBehavior() {
try{
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
AddNumbersHandlerService service = new AddNumbersHandlerService();
AddNumbersHandlerPortType proxy = service.getAddNumbersHandlerPort();
@@ -1135,10 +1145,10 @@ public class AddNumbersHandlerTests exte
}
}
+ @Test
public void testAddNumbersHandlerHandlerResolver() {
try {
System.out.println("----------------------------------");
- System.out.println("test: " + getName());
AddNumbersHandlerService service = new AddNumbersHandlerService(); // will give NPE:
List<Handler> handlers = service.getHandlerResolver()
.getHandlerChain(null);
@@ -1155,17 +1165,17 @@ public class AddNumbersHandlerTests exte
TestLogger.logger.debug("----------------------------------");
}
+ @Test
public void testOneWay() {
try {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
AddNumbersHandlerService service = new AddNumbersHandlerService();
AddNumbersHandlerPortType proxy = service.getAddNumbersHandlerPort();
BindingProvider bp = (BindingProvider) proxy;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- axisEndpoint);
+ getEndpoint());
proxy.oneWayInt(11);
// one-way invocations run in their own thread,
@@ -1196,18 +1206,18 @@ public class AddNumbersHandlerTests exte
TestLogger.logger.debug("----------------------------------");
}
+ @Test
public void testOneWayWithProtocolException() {
Exception exception = null;
try {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
AddNumbersHandlerService service = new AddNumbersHandlerService();
AddNumbersHandlerPortType proxy = service.getAddNumbersHandlerPort();
BindingProvider p = (BindingProvider) proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
p.getRequestContext().put("myClientKey", "myClientVal");
List<Handler> handlers = p.getBinding().getHandlerChain();
@@ -1218,7 +1228,7 @@ public class AddNumbersHandlerTests exte
p.getBinding().setHandlerChain(handlers);
BindingProvider bp = (BindingProvider) proxy;
- bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+ bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
// value 99 will trigger exception from AddNumbersClientLogicalHandler
proxy.oneWayInt(99);
} catch (Exception e) {
@@ -1248,18 +1258,18 @@ public class AddNumbersHandlerTests exte
TestLogger.logger.debug("----------------------------------");
}
+ @Test
public void testOneWayWithRuntimeException() {
Exception exception = null;
try {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
AddNumbersHandlerService service = new AddNumbersHandlerService();
AddNumbersHandlerPortType proxy = service.getAddNumbersHandlerPort();
BindingProvider p = (BindingProvider) proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
p.getRequestContext().put("myClientKey", "myClientVal");
List<Handler> handlers = p.getBinding().getHandlerChain();
@@ -1270,7 +1280,7 @@ public class AddNumbersHandlerTests exte
p.getBinding().setHandlerChain(handlers);
BindingProvider bp = (BindingProvider) proxy;
- bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+ bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
// value 99 will trigger exception from AddNumbersClientLogicalHandler
proxy.oneWayInt(999);
} catch (Exception e) {
@@ -1362,7 +1372,8 @@ public class AddNumbersHandlerTests exte
return new StreamSource(fis);
}
- protected void setUp() {
+ @Before
+ public void setUp() {
File file = new File(filelogname);
file.delete(); // yes, delete for each retrieval, which should only happen once per test
}
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/AddressBookTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/AddressBookTests.java?rev=1819366&r1=1819365&r2=1819366&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/AddressBookTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/AddressBookTests.java Wed Dec 27 20:08:40 2017
@@ -19,15 +19,18 @@
package org.apache.axis2.jaxws.sample;
-import junit.framework.Test;
-import junit.framework.TestSuite;
import org.apache.axis2.jaxws.TestLogger;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
import org.apache.axis2.jaxws.sample.addressbook.data.AddEntry;
import org.apache.axis2.jaxws.sample.addressbook.data.AddEntryResponse;
import org.apache.axis2.jaxws.sample.addressbook.AddressBook;
import org.apache.axis2.jaxws.sample.addressbook.data.AddressBookEntry;
import org.apache.axis2.jaxws.sample.addressbook.data.ObjectFactory;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import javax.xml.bind.JAXBContext;
import javax.xml.namespace.QName;
@@ -41,32 +44,32 @@ import javax.xml.ws.soap.SOAPBinding;
* This tests the AddressBook same service that exists under
* org.apache.axis2.jaxws.sample.addressbook.*
*/
-public class AddressBookTests extends AbstractTestCase {
+public class AddressBookTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
private static final String NAMESPACE = "http://org/apache/axis2/jaxws/sample/addressbook";
private static final QName QNAME_SERVICE = new QName(
NAMESPACE, "AddressBookService");
private static final QName QNAME_PORT = new QName(
NAMESPACE, "AddressBook");
- private static final String URL_ENDPOINT = "http://localhost:6060/axis2/services/AddressBookService.AddressBookImplPort";
- public static Test suite() {
- return getTestSetup(new TestSuite(AddressBookTests.class));
+ private static String getEndpoint() throws Exception {
+ return server.getEndpoint("AddressBookService.AddressBookImplPort");
}
-
+
/**
* Test the endpoint by invoking it with a JAX-WS Dispatch.
*/
-
+ @Test
public void testAddressBookWithDispatch() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
JAXBContext jbc = JAXBContext.newInstance("org.apache.axis2.jaxws.sample.addressbook.data");
// Create the JAX-WS client needed to send the request
Service service = Service.create(QNAME_SERVICE);
- service.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_BINDING, URL_ENDPOINT);
+ service.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_BINDING, getEndpoint());
Dispatch<Object> dispatch = service.createDispatch(
QNAME_PORT, jbc, Mode.PAYLOAD);
@@ -107,15 +110,15 @@ public class AddressBookTests extends Ab
* Test the "addEntry" operation. This sends a complex type and returns
* a simple type.
*/
+ @Test
public void testAddEntry() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Create the JAX-WS client needed to send the request
Service service = Service.create(QNAME_SERVICE);
AddressBook ab = service.getPort(QNAME_PORT, AddressBook.class);
BindingProvider p1 = (BindingProvider) ab;
- p1.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, URL_ENDPOINT);
+ p1.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
ObjectFactory factory = new ObjectFactory();
AddressBookEntry content = factory.createAddressBookEntry();
@@ -142,15 +145,15 @@ public class AddressBookTests extends Ab
* Test the "findEntryByName" operation. This sends a simple type and
* returns a complex type.
*/
+ @Test
public void testFindEntryByName() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Create the JAX-WS client needed to send the request
Service service = Service.create(QNAME_SERVICE);
AddressBook ab = service.getPort(QNAME_PORT, AddressBook.class);
BindingProvider p1 = (BindingProvider) ab;
- p1.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, URL_ENDPOINT);
+ p1.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
String fname = "Joe";
String lname = "Test";