Author: veithen
Date: Wed Dec 27 20:08:40 2017
New Revision: 1819366
URL: http://svn.apache.org/viewvc?rev=1819366&view=rev
Log:
Migrate more jaxws-integration tests to the Axis2Server rule to avoid using
fixed TCP port numbers.
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/client/ProxySoapActionTest.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/DOMSourceDispatchTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/JAXBDispatchTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/ParamTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/SAXSourceDispatchTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/StreamSourceDispatchTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/misc/JAXBContextTest.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/JAXBProviderTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/OMProviderTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/ProviderTestCase.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SOAPFaultProviderTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SoapMessageNullProviderTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SoapMessageProviderTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SourceMessageProviderTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SourceProviderTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/StringMessageProviderTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/StringProviderTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/soapbinding/tests/SoapMessageProviderTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/soapbinding/tests/StringProviderTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/ProxyNonWrappedTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/ProxyTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/RPCLitSWAProxyTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/RPCProxyTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/proxy/SOAP12ProxyTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/AddNumbersHandlerTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/AddressBookTests.java
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/client/ProxySoapActionTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/client/ProxySoapActionTest.java?rev=1819366&r1=1819365&r2=1819366&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/client/ProxySoapActionTest.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/client/ProxySoapActionTest.java
Wed Dec 27 20:08:40 2017
@@ -19,29 +19,30 @@
package org.apache.axis2.jaxws.client;
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import javax.xml.ws.BindingProvider;
+
import org.apache.axis2.jaxws.TestLogger;
import org.apache.axis2.jaxws.client.soapaction.BookStore;
import org.apache.axis2.jaxws.client.soapaction.BookStoreService;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
/**
* A suite of SOAPAction related tests for the dynamic proxy client
*/
-public class ProxySoapActionTest extends AbstractTestCase {
+public class ProxySoapActionTest {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
- public static Test suite() {
- return getTestSetup(new TestSuite(ProxySoapActionTest.class));
- }
-
-
- public void testSendRequestWithSoapAction() {
+ @Test
+ public void testSendRequestWithSoapAction() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
BookStoreService service = new BookStoreService();
BookStore bs = service.getBookStorePort();
+
((BindingProvider)bs).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ server.getEndpoint("BookStoreService"));
float price = bs.getPriceWithAction("test item");
TestLogger.logger.debug("return value [" + price + "]");
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/DOMSourceDispatchTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/DOMSourceDispatchTests.java?rev=1819366&r1=1819365&r2=1819366&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/DOMSourceDispatchTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/DOMSourceDispatchTests.java
Wed Dec 27 20:08:40 2017
@@ -19,12 +19,11 @@
package org.apache.axis2.jaxws.dispatch;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
import org.apache.axiom.om.OMXMLBuilderFactory;
import org.apache.axis2.jaxws.TestLogger;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -36,6 +35,11 @@ import javax.xml.ws.Dispatch;
import javax.xml.ws.Response;
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.ByteArrayInputStream;
import java.io.StringWriter;
import java.util.concurrent.Future;
@@ -44,18 +48,17 @@ import java.util.concurrent.Future;
* This class tests the JAX-WS Dispatch with various forms of the
* javax.xml.transform.dom.DOMSource
*/
-public class DOMSourceDispatchTests extends AbstractTestCase{
- public static Test suite() {
- return getTestSetup(new TestSuite(DOMSourceDispatchTests.class));
- }
-
+public class DOMSourceDispatchTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
+
+ @Test
public void testSyncPayloadMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
Source.class, Service.Mode.PAYLOAD);
@@ -77,13 +80,13 @@ public class DOMSourceDispatchTests exte
assertTrue(responseText.contains("echoStringResponse"));
}
+ @Test
public void testSyncMessageMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
Source.class, Service.Mode.MESSAGE);
@@ -119,13 +122,13 @@ public class DOMSourceDispatchTests exte
assertTrue(responseText.contains("echoStringResponse"));
}
+ @Test
public void testAsyncCallbackPayloadMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
Source.class, Service.Mode.PAYLOAD);
@@ -182,13 +185,13 @@ public class DOMSourceDispatchTests exte
assertTrue(responseText.contains("echoStringResponse"));
}
+ @Test
public void testAsyncCallbackMessageMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
Source.class, Service.Mode.MESSAGE);
@@ -247,13 +250,13 @@ public class DOMSourceDispatchTests exte
assertTrue(responseText.contains("echoStringResponse"));
}
+ @Test
public void testAsyncPollingPayloadMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
Source.class, Service.Mode.PAYLOAD);
@@ -304,13 +307,13 @@ public class DOMSourceDispatchTests exte
assertTrue(responseText.contains("echoStringResponse"));
}
+ @Test
public void testAsyncPollingMessageMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
Source.class, Service.Mode.MESSAGE);
@@ -362,13 +365,13 @@ public class DOMSourceDispatchTests exte
assertTrue(responseText.contains("echoStringResponse"));
}
+ @Test
public void testOneWayPayloadMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
Source.class, Service.Mode.PAYLOAD);
@@ -383,13 +386,13 @@ public class DOMSourceDispatchTests exte
dispatch.invokeOneWay(request);
}
+ @Test
public void testOneWayMessageMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
Source.class, Service.Mode.MESSAGE);
@@ -404,13 +407,13 @@ public class DOMSourceDispatchTests exte
dispatch.invokeOneWay(request);
}
+ @Test
public void testBadDOMSource() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
Source.class, Service.Mode.PAYLOAD);
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/JAXBDispatchTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/JAXBDispatchTests.java?rev=1819366&r1=1819365&r2=1819366&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/JAXBDispatchTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/JAXBDispatchTests.java
Wed Dec 27 20:08:40 2017
@@ -19,10 +19,11 @@
package org.apache.axis2.jaxws.dispatch;
-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.testutils.Axis2Server;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
import org.xmlsoap.schemas.soap.envelope.Body;
import org.xmlsoap.schemas.soap.envelope.Envelope;
import test.EchoString;
@@ -33,22 +34,25 @@ import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.util.concurrent.Future;
-public class JAXBDispatchTests extends AbstractTestCase {
+public class JAXBDispatchTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
private Dispatch<Object> dispatchPayload;
private Dispatch<Object> dispatchMessage;
private JAXBContext jbc;
- public static Test suite() {
- return getTestSetup(new TestSuite(JAXBDispatchTests.class));
- }
-
+ @Before
public void setUp() throws Exception {
//Create the Service object
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
//Create the JAX-B Dispatch object to recognize the test and soap
packages
jbc =
JAXBContext.newInstance("test:org.xmlsoap.schemas.soap.envelope");
@@ -60,9 +64,9 @@ public class JAXBDispatchTests extends A
jbc, Service.Mode.MESSAGE);
}
+ @Test
public void testSyncPayload() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Create the input param
ObjectFactory factory = new ObjectFactory();
@@ -94,9 +98,9 @@ public class JAXBDispatchTests extends A
assertTrue("[ERROR] - Zero length content in response",
response.getEchoStringReturn().length() > 0);
}
+ @Test
public void testAysncPayload() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Create the input param
ObjectFactory factory = new ObjectFactory();
@@ -149,9 +153,9 @@ public class JAXBDispatchTests extends A
assertTrue("[ERROR] - Zero length content in response",
response.getEchoStringReturn().length() > 0);
}
+ @Test
public void testOneWayPayload() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Create the input param
ObjectFactory factory = new ObjectFactory();
@@ -167,9 +171,9 @@ public class JAXBDispatchTests extends A
dispatchPayload.invokeOneWay(request);
}
+ @Test
public void testSyncMessage() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Create the input param
ObjectFactory factory = new ObjectFactory();
@@ -212,9 +216,9 @@ public class JAXBDispatchTests extends A
assertTrue("[ERROR] - Zero length content in response",
echoStringResponse.getEchoStringReturn().length() > 0);
}
+ @Test
public void testAysncMessage() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Create the input param
ObjectFactory factory = new ObjectFactory();
@@ -279,9 +283,9 @@ public class JAXBDispatchTests extends A
}
+ @Test
public void testOneWayMessge() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Create the input param
ObjectFactory factory = new ObjectFactory();
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/ParamTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/ParamTests.java?rev=1819366&r1=1819365&r2=1819366&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/ParamTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/ParamTests.java
Wed Dec 27 20:08:40 2017
@@ -19,9 +19,7 @@
package org.apache.axis2.jaxws.dispatch;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
+import static org.junit.Assert.assertTrue;
import javax.xml.namespace.QName;
import javax.xml.transform.Source;
@@ -31,16 +29,14 @@ import javax.xml.ws.Service.Mode;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.soap.SOAPBinding;
+import org.junit.Test;
+
/**
* A suite for some tests for specific behavior in the Dispatch with
* null and invalid params.
*/
-public class ParamTests extends AbstractTestCase {
-
- public static Test suite() {
- return getTestSetup(new TestSuite(ParamTests.class));
- }
-
+public class ParamTests {
+ @Test
public void testNullSoapParamWithMessageMode() {
QName serviceName = new QName("http://test", "MyService");
QName portName = new QName("http://test", "MyPort");
@@ -62,10 +58,12 @@ public class ParamTests extends Abstract
assertTrue("A WebServiceException should be thrown for this null
param", handled);
}
+ @Test
public void testNullHttpParamWithPayloadMode() {
// fill in this test when we add XML/HTTP Binding support
}
+ @Test
public void testNullHttpParamWithMessageMode() {
// fill in this test when we add XML/HTTP Binding support
}
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/SAXSourceDispatchTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/SAXSourceDispatchTests.java?rev=1819366&r1=1819365&r2=1819366&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/SAXSourceDispatchTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/SAXSourceDispatchTests.java
Wed Dec 27 20:08:40 2017
@@ -19,12 +19,11 @@
package org.apache.axis2.jaxws.dispatch;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
import org.apache.axiom.om.OMXMLBuilderFactory;
import org.apache.axis2.jaxws.TestLogger;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
import org.xml.sax.InputSource;
import javax.xml.transform.Source;
@@ -33,6 +32,11 @@ import javax.xml.ws.Dispatch;
import javax.xml.ws.Response;
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.ByteArrayInputStream;
import java.io.StringWriter;
import java.util.concurrent.Future;
@@ -41,18 +45,17 @@ import java.util.concurrent.Future;
* This class tests the JAX-WS Dispatch<Source> with content in various
* forms of a javax.xml.transform.sax.SAXSource.
*/
-public class SAXSourceDispatchTests extends AbstractTestCase{
- public static Test suite() {
- return getTestSetup(new TestSuite(SAXSourceDispatchTests.class));
- }
+public class SAXSourceDispatchTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
+ @Test
public void testSyncPayloadMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
Source.class,
Service.Mode.PAYLOAD);
@@ -103,13 +106,13 @@ public class SAXSourceDispatchTests exte
}
+ @Test
public void testSyncMessageMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
Source.class, Service.Mode.MESSAGE);
@@ -160,13 +163,13 @@ public class SAXSourceDispatchTests exte
assertTrue(responseText.contains("echoStringResponse"));
}
+ @Test
public void testAsyncCallbackPayloadMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
Source.class, Service.Mode.PAYLOAD);
@@ -234,13 +237,13 @@ public class SAXSourceDispatchTests exte
assertTrue(responseText.contains("echoStringResponse"));
}
+ @Test
public void testAsyncCallbackMessageMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
Source.class, Service.Mode.MESSAGE);
@@ -308,13 +311,13 @@ public class SAXSourceDispatchTests exte
assertTrue(responseText.contains("echoStringResponse"));
}
+ @Test
public void testAsyncPollingPayloadMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
Source.class, Service.Mode.PAYLOAD);
@@ -377,13 +380,13 @@ public class SAXSourceDispatchTests exte
assertTrue(responseText.contains("echoStringResponse"));
}
+ @Test
public void testAsyncPollingMessageMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
Source.class, Service.Mode.MESSAGE);
@@ -446,13 +449,13 @@ public class SAXSourceDispatchTests exte
assertTrue(responseText.contains("echoStringResponse"));
}
+ @Test
public void testOneWayPayloadMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
Source.class, Service.Mode.PAYLOAD);
@@ -475,13 +478,13 @@ public class SAXSourceDispatchTests exte
dispatch.invokeOneWay(request);
}
+ @Test
public void testOneWayMessageMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
Source.class, Service.Mode.MESSAGE);
@@ -503,13 +506,13 @@ public class SAXSourceDispatchTests exte
dispatch.invokeOneWay(request);
}
+ @Test
public void testBadSAXSource() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
Source.class, Service.Mode.MESSAGE);
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/StreamSourceDispatchTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/StreamSourceDispatchTests.java?rev=1819366&r1=1819365&r2=1819366&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/StreamSourceDispatchTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/StreamSourceDispatchTests.java
Wed Dec 27 20:08:40 2017
@@ -19,12 +19,11 @@
package org.apache.axis2.jaxws.dispatch;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
import org.apache.axiom.om.OMXMLBuilderFactory;
import org.apache.axis2.jaxws.TestLogger;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
@@ -32,6 +31,10 @@ import javax.xml.ws.Dispatch;
import javax.xml.ws.Response;
import javax.xml.ws.Service;
import javax.xml.ws.Service.Mode;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.StringWriter;
@@ -42,21 +45,20 @@ import java.util.concurrent.Future;
* forms of a StreamSource object.
*
*/
-public class StreamSourceDispatchTests extends AbstractTestCase {
- public static Test suite() {
- return getTestSetup(new TestSuite(StreamSourceDispatchTests.class));
- }
+public class StreamSourceDispatchTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
/**
* Invoke a Dispatch<Source> synchronously with the content in PAYLOAD
mode.
*/
+ @Test
public void testSyncPayloadMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT, Source.class,
Service.Mode.PAYLOAD);
@@ -107,13 +109,13 @@ public class StreamSourceDispatchTests e
/**
* Invoke a Dispatch<Source> synchronously with the content in MESSAGE
mode.
*/
+ @Test
public void testSyncMessageMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc =
Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT, Source.class,
Mode.MESSAGE);
@@ -162,13 +164,13 @@ public class StreamSourceDispatchTests e
/**
* Invoke a Dispatch<Source> asynchronously with the content in PAYLOAD
mode.
*/
+ @Test
public void testAsyncCallbackPayloadMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT, Source.class,
Service.Mode.PAYLOAD);
@@ -237,13 +239,13 @@ public class StreamSourceDispatchTests e
/**
* Invoke a Dispatch<Source> asynchronously with the content in MESSAGE
mode.
*/
+ @Test
public void testAsyncCallbackMessageMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT, Source.class,
Mode.MESSAGE);
@@ -317,13 +319,13 @@ public class StreamSourceDispatchTests e
/**
* Invoke a Dispatch<Source> asynchronously with the content in PAYLOAD
mode.
*/
+ @Test
public void testAsyncPollingPayloadMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT, Source.class,
Service.Mode.PAYLOAD);
// Create a StreamSource with the desired content
@@ -387,13 +389,13 @@ public class StreamSourceDispatchTests e
/**
* Invoke a Dispatch<Source> asynchronously with the content in MESSAGE
mode.
*/
+ @Test
public void testAsyncPollingMessageMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT, Source.class,
Mode.MESSAGE);
@@ -459,13 +461,13 @@ public class StreamSourceDispatchTests e
/**
* Invoke a Dispatch<Source> one-way operation
*/
+ @Test
public void testOneWayPayloadMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
- svc.addPort(DispatchTestConstants.QNAME_PORT, null,
DispatchTestConstants.URL);
+ svc.addPort(DispatchTestConstants.QNAME_PORT, null,
server.getEndpoint("EchoService"));
Dispatch<Source> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT, Source.class,
Service.Mode.PAYLOAD);
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/misc/JAXBContextTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/misc/JAXBContextTest.java?rev=1819366&r1=1819365&r2=1819366&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/misc/JAXBContextTest.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/misc/JAXBContextTest.java
Wed Dec 27 20:08:40 2017
@@ -22,29 +22,26 @@
*/
package org.apache.axis2.jaxws.misc;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
import org.apache.axis2.jaxws.message.databinding.JAXBUtils;
+import org.junit.Test;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
+
+import static org.junit.Assert.assertTrue;
+
import java.util.TreeSet;
/**
* Tests Namespace to Package Algorithm
*
*/
-public class JAXBContextTest extends AbstractTestCase {
-
- public static Test suite() {
- return getTestSetup(new TestSuite(JAXBContextTest.class));
- }
-
+public class JAXBContextTest {
/**
* Test basic functionality of JAXBUtils pooling
* @throws Exception
*/
+ @Test
public void test01() throws JAXBException {
// Get a JAXBContext
TreeSet<String> context1 = new TreeSet<String>();
@@ -115,6 +112,7 @@ public class JAXBContextTest extends Abs
* Test basic functionality of JAXBUtils pooling
* @throws Exception
*/
+ @Test
public void test02() throws JAXBException {
// Get a JAXBContext
TreeSet<String> context1 = new TreeSet<String>();
@@ -187,6 +185,7 @@ public class JAXBContextTest extends Abs
assertTrue(context4.contains("org.test.addnumbers"));
}
+ @Test
public void test03() throws JAXBException {
// Simulate a web services that references a.Bean2 and b.Bean1
// Note that both these beans are in the same namespace
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/JAXBProviderTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/JAXBProviderTests.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/JAXBProviderTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/JAXBProviderTests.java
Wed Dec 27 20:08:40 2017
@@ -19,10 +19,11 @@
package org.apache.axis2.jaxws.provider;
-import junit.framework.Test;
-import junit.framework.TestSuite;
import org.apache.axiom.attachments.ByteArrayDataSource;
import org.apache.axis2.jaxws.TestLogger;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
import org.test.mtom.ImageDepot;
import org.test.mtom.ObjectFactory;
import org.test.mtom.SendImage;
@@ -40,6 +41,8 @@ import javax.xml.ws.Service;
import javax.xml.ws.soap.MTOMFeature;
import javax.xml.ws.soap.SOAPBinding;
+import static org.junit.Assert.assertTrue;
+
import java.awt.*;
import java.io.File;
@@ -65,11 +68,11 @@ import java.io.File;
*
*/
public class JAXBProviderTests extends ProviderTestCase {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
- String endpointUrl =
"http://localhost:6060/axis2/services/JAXBProviderService.JAXBProviderPort";
private QName serviceName = new QName("http://ws.apache.org/axis2",
"JAXBProviderService");
- String PROVIDER_ENDPOINT_URL =
"http://localhost:6060/axis2/services/SoapMessageCheckMTOMProviderService.SoapMessageCheckMTOMProviderPort";
private QName PROVIDER_SERVICE_NAME = new
QName("http://soapmsgcheckmtom.provider.jaxws.axis2.apache.org",
"SoapMessageCheckMTOMProviderService");
DataSource stringDS, imageDS;
@@ -91,17 +94,13 @@ public class JAXBProviderTests extends P
}
}
- public static Test suite() {
- return getTestSetup(new TestSuite(JAXBProviderTests.class));
- }
-
/**
* test String
* @throws Exception
*/
+ @Test
public void testMTOMAttachmentString() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
//Create a DataHandler with the String DataSource object
DataHandler dataHandler = new DataHandler(stringDS);
@@ -111,7 +110,7 @@ public class JAXBProviderTests extends P
imageDepot.setImageData(dataHandler);
Service svc = Service.create(serviceName);
- svc.addPort(portName, null, endpointUrl);
+ svc.addPort(portName, null,
server.getEndpoint("JAXBProviderService.JAXBProviderPort"));
JAXBContext jbc = JAXBContext.newInstance("org.test.mtom");
@@ -139,9 +138,9 @@ public class JAXBProviderTests extends P
* test Image
* @throws Exception
*/
+ @Test
public void testMTOMAttachmentImage() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
//Create a DataHandler with the String DataSource object
DataHandler dataHandler = new DataHandler(imageDS);
@@ -151,7 +150,7 @@ public class JAXBProviderTests extends P
imageDepot.setImageData(dataHandler);
Service svc = Service.create(serviceName);
- svc.addPort(portName, null, endpointUrl);
+ svc.addPort(portName, null,
server.getEndpoint("JAXBProviderService.JAXBProviderPort"));
JAXBContext jbc = JAXBContext.newInstance("org.test.mtom");
@@ -184,9 +183,9 @@ public class JAXBProviderTests extends P
* which verifies that an attachment was sent (versus inline)
* @throws Exception
*/
+ @Test
public void testMTOMAttachmentImageProvider_API() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
//Create a DataHandler with the String DataSource object
DataHandler dataHandler = new DataHandler(imageDS);
@@ -196,7 +195,7 @@ public class JAXBProviderTests extends P
imageDepot.setImageData(dataHandler);
Service svc = Service.create(PROVIDER_SERVICE_NAME);
- svc.addPort(portName, null, PROVIDER_ENDPOINT_URL);
+ svc.addPort(portName, null,
server.getEndpoint("SoapMessageCheckMTOMProviderService.SoapMessageCheckMTOMProviderPort"));
JAXBContext jbc = JAXBContext.newInstance("org.test.mtom");
@@ -229,9 +228,9 @@ public class JAXBProviderTests extends P
* which verifies that an attachment was sent (versus inline)
* @throws Exception
*/
+ @Test
public void testMTOMAttachmentImageProvider_MTOMFeature() throws Exception
{
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
//Create a DataHandler with the String DataSource object
DataHandler dataHandler = new DataHandler(imageDS);
@@ -241,7 +240,7 @@ public class JAXBProviderTests extends P
imageDepot.setImageData(dataHandler);
Service svc = Service.create(PROVIDER_SERVICE_NAME);
- svc.addPort(portName, null, PROVIDER_ENDPOINT_URL);
+ svc.addPort(portName, null,
server.getEndpoint("SoapMessageCheckMTOMProviderService.SoapMessageCheckMTOMProviderPort"));
JAXBContext jbc = JAXBContext.newInstance("org.test.mtom");
@@ -271,9 +270,9 @@ public class JAXBProviderTests extends P
* which verifies that an attachment was sent (versus inline)
* @throws Exception
*/
+ @Test
public void testMTOMAttachmentImageProvider_MTOMFeatureThreshhold() throws
Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
//Create a DataHandler with the String DataSource object
DataHandler dataHandler = new DataHandler(imageDS);
@@ -283,7 +282,7 @@ public class JAXBProviderTests extends P
imageDepot.setImageData(dataHandler);
Service svc = Service.create(PROVIDER_SERVICE_NAME);
- svc.addPort(portName, null, PROVIDER_ENDPOINT_URL);
+ svc.addPort(portName, null,
server.getEndpoint("SoapMessageCheckMTOMProviderService.SoapMessageCheckMTOMProviderPort"));
JAXBContext jbc = JAXBContext.newInstance("org.test.mtom");
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/OMProviderTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/OMProviderTests.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/OMProviderTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/OMProviderTests.java
Wed Dec 27 20:08:40 2017
@@ -5,6 +5,9 @@ import org.apache.axiom.om.OMXMLBuilderF
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPModelBuilder;
import org.apache.axis2.jaxws.Constants;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
@@ -15,14 +18,15 @@ import javax.xml.ws.Service.Mode;
import javax.xml.ws.soap.SOAPBinding;
import javax.xml.ws.soap.SOAPFaultException;
-import java.io.StringReader;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import java.io.StringReader;
public class OMProviderTests extends ProviderTestCase {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
- String endpointUrl =
"http://localhost:6060/axis2/services/OMProviderService.OMProviderPort";
private QName serviceName = new QName("http://ws.apache.org/axis2",
"OMProviderService");
private static final String SOAP11_NS_URI =
"http://schemas.xmlsoap.org/soap/envelope/";
@@ -45,21 +49,19 @@ public class OMProviderTests extends Pro
private static String request = "<invokeOp>Hello Provider
OM</invokeOp>";
private static String SOAPFaultRequest
="<invokeOp>SOAPFault</invokeOp>";
-
- public static Test suite() {
- return getTestSetup(new TestSuite(OMProviderTests.class));
- }
- protected void setUp() throws Exception {
- super.setUp();
+
+ private static String getEndpoint() throws Exception {
+ return server.getEndpoint("OMProviderService.OMProviderPort");
}
-
+
/**
* Test sending a SOAP 1.2 request in MESSAGE mode
*/
+ @Test
public void testOMElementDispatchMessageMode() throws Exception {
// Create the JAX-WS client needed to send the request
Service service = Service.create(serviceName);
- service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, endpointUrl);
+ service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
getEndpoint());
Dispatch<OMElement> dispatch = service.createDispatch(
portName, OMElement.class, Mode.MESSAGE);
@@ -84,10 +86,11 @@ public class OMProviderTests extends Pro
/**
* Test sending a SOAP 1.2 request in MESSAGE mode
*/
+ @Test
public void testOMElementDispatchMessageModeSOAPFaultException() throws
Exception {
// Create the JAX-WS client needed to send the request
Service service = Service.create(serviceName);
- service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, endpointUrl);
+ service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
getEndpoint());
Dispatch<OMElement> dispatch = service.createDispatch(
portName, OMElement.class, Mode.MESSAGE);
@@ -104,10 +107,11 @@ public class OMProviderTests extends Pro
assertTrue(response ==null);
}
+ @Test
public void testOMElementDispatchMessageModeSOAPFault() throws Exception {
// Create the JAX-WS client needed to send the request
Service service = Service.create(serviceName);
- service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, endpointUrl);
+ service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
getEndpoint());
Dispatch<OMElement> dispatch = service.createDispatch(
portName, OMElement.class, Mode.MESSAGE);
BindingProvider bp = (BindingProvider)dispatch;
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/ProviderTestCase.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/ProviderTestCase.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/ProviderTestCase.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/ProviderTestCase.java
Wed Dec 27 20:08:40 2017
@@ -19,12 +19,10 @@
package org.apache.axis2.jaxws.provider;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
-
import javax.xml.namespace.QName;
import java.io.File;
-public abstract class ProviderTestCase extends AbstractTestCase {
+public abstract class ProviderTestCase {
public QName portName = new QName("http://ws.apache.org/axis2",
"SimpleProviderServiceSOAP11port0");
public String providerResourceDir =
"test-resources"+File.separator+"provider";
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SOAPFaultProviderTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SOAPFaultProviderTests.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/SOAPFaultProviderTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SOAPFaultProviderTests.java
Wed Dec 27 20:08:40 2017
@@ -19,8 +19,7 @@
package org.apache.axis2.jaxws.provider;
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import static org.junit.Assert.fail;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
@@ -28,16 +27,21 @@ import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;
import javax.xml.ws.soap.SOAPBinding;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
+
/**
*
*/
public class SOAPFaultProviderTests extends ProviderTestCase {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
+
public QName portName =
new QName("http://ws.apache.org/axis2",
"SimpleProviderServiceSOAP11port0");
private QName serviceName = new QName("http://ws.apache.org/axis2",
"StringProviderService");
- String endpointUrl =
"http://localhost:6060/axis2/services/StringProviderService.StringProviderPort";
-
private static final String sampleSoapEnvelopeHeader =
"<soap:Envelope
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
+ "<soap:Body>";
@@ -51,17 +55,10 @@ public class SOAPFaultProviderTests exte
+ "</soap:Fault>";
- public static Test suite() {
- return getTestSetup(new TestSuite(SOAPFaultProviderTests.class));
- }
-
- public SOAPFaultProviderTests() {
- super();
- }
-
- private Dispatch<String> getDispatch() {
+ private Dispatch<String> getDispatch() throws Exception {
Service svc = Service.create(serviceName);
- svc.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, endpointUrl);
+ svc.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
+
server.getEndpoint("StringProviderService.StringProviderPort"));
// Use Message mode so we can build up the entire SOAP envelope
containing the fault
Dispatch<String> dispatch =
@@ -74,9 +71,9 @@ public class SOAPFaultProviderTests exte
return dispatch;
}
- public void testFault() {
+ @Test
+ public void testFault() throws Exception {
System.out.println("---------------------------------------");
- System.out.println("test: " + getName());
Dispatch<String> dispatch = getDispatch();
String request = sampleSoapEnvelopeHeader + soapFaultBodyContent +
sampleSoapEnvelopeFooter;
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SoapMessageNullProviderTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SoapMessageNullProviderTests.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/SoapMessageNullProviderTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SoapMessageNullProviderTests.java
Wed Dec 27 20:08:40 2017
@@ -19,20 +19,23 @@
package org.apache.axis2.jaxws.provider;
+import static org.junit.Assert.fail;
+
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPMessage;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
import javax.xml.ws.soap.SOAPBinding;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
import org.apache.axis2.jaxws.TestLogger;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
public class SoapMessageNullProviderTests extends ProviderTestCase {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
- private String endpointUrl =
"http://localhost:6060/axis2/services/SoapMessageNullProviderService.SoapMessageNullProviderPort";
private QName serviceName = new QName("http://ws.apache.org/axis2",
"SoapMessageNullProviderService");
public static final QName portName =
new QName("http://ws.apache.org/axis2", "SoapMessageNullProviderPort");
@@ -41,24 +44,16 @@ public class SoapMessageNullProviderTest
public static final String bindingID = SOAPBinding.SOAP11HTTP_BINDING;
public static final Service.Mode mode = Service.Mode.MESSAGE;
-
- public SoapMessageNullProviderTests() {
- super();
- }
-
- public static Test suite() {
- return getTestSetup(new TestSuite(SoapMessageNullProviderTests.class));
- }
/*
* Test that the custom property jaxws.provider.interpretNullAsOneway when
set to true
* correctly causes the jaxws runtime to treat a null return from a
provider as a one-way
*/
+ @Test
public void testProviderReturnsNull() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Service svc = Service.create(serviceName);
- svc.addPort(portName, bindingID, endpointUrl);
+ svc.addPort(portName, bindingID,
server.getEndpoint("SoapMessageNullProviderService.SoapMessageNullProviderPort"));
javax.xml.ws.Dispatch<SOAPMessage> dispatch = null;
dispatch = svc.createDispatch(portName, SOAPMessage.class, mode);
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SoapMessageProviderTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/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/SoapMessageProviderTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SoapMessageProviderTests.java
Wed Dec 27 20:08:40 2017
@@ -19,13 +19,12 @@
package org.apache.axis2.jaxws.provider;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
import org.apache.axis2.Constants;
import org.apache.axis2.jaxws.TestLogger;
import org.apache.axis2.jaxws.provider.soapmsg.SoapMessageProvider;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
import javax.xml.namespace.QName;
import javax.xml.soap.AttachmentPart;
@@ -43,6 +42,12 @@ import javax.xml.ws.Binding;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;
import javax.xml.ws.soap.SOAPFaultException;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.io.ByteArrayInputStream;
import java.util.ArrayList;
import java.util.HashMap;
@@ -56,8 +61,9 @@ import java.util.Map;
*
*/
public class SoapMessageProviderTests extends ProviderTestCase {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
- private String endpointUrl =
"http://localhost:6060/axis2/services/SoapMessageProviderService.SoapMessageProviderPort";
private QName serviceName = new QName("http://ws.apache.org/axis2",
"SoapMessageProviderService");
private String reqMsgStart = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
@@ -95,14 +101,15 @@ public class SoapMessageProviderTests ex
SoapMessageProvider.XML_WSE_REQUEST +
"</invoke_str></ns2:invokeOp>";
- public static Test suite() {
- return getTestSetup(new TestSuite(SoapMessageProviderTests.class));
+ private static String getEndpoint() throws Exception {
+ return
server.getEndpoint("SoapMessageProviderService.SoapMessageProviderPort");
}
-
+
/**
* Sends an SOAPMessage containing only xml data to the web service.
* Receives a response containing just xml data.
*/
+ @Test
public void testProviderSOAPMessageXMLOnly(){
try{
// Create the dispatch
@@ -163,6 +170,7 @@ public class SoapMessageProviderTests ex
* Sends an SOAPMessage containing only xml data to the web service.
* Receives a response containing an empty body
*/
+ @Test
public void testProviderSOAPMessageXMLEmptyBody(){
try{
// Create the dispatch
@@ -217,6 +225,7 @@ public class SoapMessageProviderTests ex
* Sends an SOAPMessage containing only xml data
* Provider will throw a Fault
*/
+ @Test
public void testProviderSOAPMessageSOAPFault() throws Exception {
// Create the dispatch
@@ -277,6 +286,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
@@ -323,6 +333,7 @@ public class SoapMessageProviderTests ex
* 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.
@@ -396,6 +407,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
@@ -470,6 +482,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
@@ -541,10 +554,11 @@ public class SoapMessageProviderTests ex
* This is a negative test to insure that we don't allow creation of a
dispatch with
* type Soap using Payload mode
*/
+ @Test
public void testInvalidTypeWithMode(){
try{
Service svc = Service.create(serviceName);
- svc.addPort(portName, null, endpointUrl);
+ svc.addPort(portName, null, getEndpoint());
Dispatch<SOAPMessage> dispatch =
svc.createDispatch(portName, SOAPMessage.class,
Service.Mode.PAYLOAD);
fail("Did not catch exception for invalid Dispatch with Payload
Mode");
@@ -560,6 +574,7 @@ public class SoapMessageProviderTests ex
* The header information is sent using a jaxws.request.soap.header Map
* Receives a response containing xml data
*/
+ @Test
public void testProviderSOAPMessage_RequestHeaders(){
try{
// Create the dispatch
@@ -634,6 +649,7 @@ public class SoapMessageProviderTests ex
* The header information is sent using a jaxws.request.soap.header Map
* Receives a response containing xml data
*/
+ @Test
public void testProviderSOAPMessage_RequestAndResponseHeaders(){
try{
// Create the dispatch
@@ -750,7 +766,7 @@ public class SoapMessageProviderTests ex
Service svc = Service.create(serviceName);
- svc.addPort(portName,null, endpointUrl);
+ svc.addPort(portName,null, getEndpoint());
Dispatch<SOAPMessage> dispatch =
svc.createDispatch(portName, SOAPMessage.class,
Service.Mode.MESSAGE);
return dispatch;
@@ -764,7 +780,7 @@ public class SoapMessageProviderTests ex
Service svc = Service.create(serviceName);
- svc.addPort(portName,null, endpointUrl);
+ svc.addPort(portName,null, getEndpoint());
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/SourceMessageProviderTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SourceMessageProviderTests.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/SourceMessageProviderTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SourceMessageProviderTests.java
Wed Dec 27 20:08:40 2017
@@ -19,33 +19,31 @@
package org.apache.axis2.jaxws.provider;
-import junit.framework.Test;
-import junit.framework.TestSuite;
import org.apache.axis2.jaxws.TestLogger;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
import javax.xml.namespace.QName;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;
+
+import static org.junit.Assert.fail;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
public class SourceMessageProviderTests extends ProviderTestCase {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
- private String endpointUrl =
"http://localhost:6060/axis2/services/SourceMessageProviderService.SourceMessageProviderPort";
private QName serviceName = new QName("http://ws.apache.org/axis2",
"SourceMessageProviderService");
private String xmlDir = "xml";
- public SourceMessageProviderTests() {
- super();
- }
-
- public static Test suite() {
- return getTestSetup(new TestSuite(SourceMessageProviderTests.class));
- }
-
+ @Test
public void testProviderSource(){
try{
String resourceDir = new File(providerResourceDir,
xmlDir).getAbsolutePath();
@@ -56,7 +54,7 @@ public class SourceMessageProviderTests
StreamSource xmlStreamSource = new StreamSource(inputStream);
Service svc = Service.create(serviceName);
- svc.addPort(portName,null, endpointUrl);
+ svc.addPort(portName,null,
server.getEndpoint("SourceMessageProviderService.SourceMessageProviderPort"));
Dispatch<Source> dispatch = svc.createDispatch(portName,
Source.class, null);
TestLogger.logger.debug(">> Invoking
SourceMessageProviderDispatch");
Source response = dispatch.invoke(xmlStreamSource);
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SourceProviderTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SourceProviderTests.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/SourceProviderTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/SourceProviderTests.java
Wed Dec 27 20:08:40 2017
@@ -19,9 +19,10 @@
package org.apache.axis2.jaxws.provider;
-import junit.framework.Test;
-import junit.framework.TestSuite;
import org.apache.axis2.jaxws.TestLogger;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPFault;
@@ -35,6 +36,11 @@ import javax.xml.ws.BindingProvider;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;
import javax.xml.ws.soap.SOAPFaultException;
+
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -42,22 +48,15 @@ import java.io.InputStream;
import java.io.StringWriter;
public class SourceProviderTests extends ProviderTestCase {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
- private String endpointUrl =
"http://localhost:6060/axis2/services/SourceProviderService.SourceProviderPort";
private QName serviceName = new QName("http://ws.apache.org/axis2",
"SourceProviderService");
private String xmlDir = "xml";
- public SourceProviderTests() {
- super();
- }
-
- public static Test suite() {
- return getTestSetup(new TestSuite(SourceProviderTests.class));
- }
-
- private Dispatch<Source> getDispatch() {
+ private Dispatch<Source> getDispatch() throws Exception {
Service svc = Service.create(serviceName);
- svc.addPort(portName, null, endpointUrl);
+ svc.addPort(portName, null,
server.getEndpoint("SourceProviderService.SourceProviderPort"));
Dispatch<Source> dispatch = svc
.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
@@ -92,9 +91,9 @@ public class SourceProviderTests extends
}
+ @Test
public void testNormal() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<Source> dispatch = getDispatch();
@@ -113,9 +112,9 @@ public class SourceProviderTests extends
assertTrue(response.contains(request));
}
+ @Test
public void testEmptyString() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<Source> dispatch = getDispatch();
@@ -139,9 +138,9 @@ public class SourceProviderTests extends
}
+ @Test
public void testNullSource() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<Source> dispatch = getDispatch();
@@ -162,9 +161,9 @@ public class SourceProviderTests extends
assertTrue(response == null);
}
+ @Test
public void testEmptySource() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<Source> dispatch = getDispatch();
@@ -185,9 +184,9 @@ public class SourceProviderTests extends
assertTrue(response == null);
}
+ @Test
public void testNonNullString() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<Source> dispatch = getDispatch();
@@ -211,9 +210,9 @@ public class SourceProviderTests extends
assertTrue(response == null);
}
+ @Test
public void testCommentString() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<Source> dispatch = getDispatch();
@@ -236,9 +235,9 @@ public class SourceProviderTests extends
}
+ @Test
public void testProviderReturnsNull() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<Source> dispatch = getDispatch();
@@ -262,9 +261,10 @@ public class SourceProviderTests extends
}
}
+
+ @Test
public void testProviderEmptySource() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<Source> dispatch = getDispatch();
@@ -280,10 +280,11 @@ public class SourceProviderTests extends
fail("Caught exception " + e);
}
- }
+ }
+
+ @Test
public void testTwoElementsString() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<Source> dispatch = getDispatch();
@@ -307,9 +308,9 @@ public class SourceProviderTests extends
assertTrue(response.contains("<a>hello</a>"));
}
+ @Test
public void testTwoElementsAndMixedContentString() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<Source> dispatch = getDispatch();
@@ -331,9 +332,9 @@ public class SourceProviderTests extends
assertTrue(response == null);
}
+ @Test
public void testException() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<Source> dispatch = getDispatch();
@@ -360,9 +361,9 @@ public class SourceProviderTests extends
}
}
+ @Test
public void testUserGeneratedSOAPFault() throws Exception {
System.out.println("---------------------------------------");
- System.out.println("test: " + getName());
Dispatch<Source> dispatch = getDispatch();
String request = "<test>throwUserGeneratedFault</test>";
@@ -378,6 +379,7 @@ public class SourceProviderTests extends
}
+ @Test
public void testProviderSource(){
try{
String resourceDir = new File(providerResourceDir,
xmlDir).getAbsolutePath();
@@ -388,7 +390,7 @@ public class SourceProviderTests extends
StreamSource xmlStreamSource = new StreamSource(inputStream);
Service svc = Service.create(serviceName);
- svc.addPort(portName,null, endpointUrl);
+ svc.addPort(portName,null,
server.getEndpoint("SourceProviderService.SourceProviderPort"));
Dispatch<Source> dispatch = svc.createDispatch(portName,
Source.class, null);
TestLogger.logger.debug(">> Invoking Source Provider Dispatch");
Source response = dispatch.invoke(xmlStreamSource);
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/StringMessageProviderTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/StringMessageProviderTests.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/StringMessageProviderTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/StringMessageProviderTests.java
Wed Dec 27 20:08:40 2017
@@ -19,30 +19,28 @@
package org.apache.axis2.jaxws.provider;
-import junit.framework.Test;
-import junit.framework.TestSuite;
import org.apache.axis2.jaxws.TestLogger;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
import javax.xml.namespace.QName;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;
public class StringMessageProviderTests extends ProviderTestCase {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
- String endpointUrl =
"http://localhost:6060/axis2/services/StringMessageProviderService.StringMessageProviderPort";
String xmlString = "<test>test input</test>";
private QName serviceName = new QName("http://ws.apache.org/axis2",
"StringMessageProviderService");
- public static Test suite() {
- return getTestSetup(new TestSuite(StringMessageProviderTests.class));
- }
-
+ @Test
public void testProviderString() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Service svc = Service.create(serviceName);
- svc.addPort(portName, null, endpointUrl);
+ svc.addPort(portName, null,
server.getEndpoint("StringMessageProviderService.StringMessageProviderPort"));
Dispatch<String> dispatch = svc
.createDispatch(portName, String.class, Service.Mode.PAYLOAD);
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/StringProviderTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/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/StringProviderTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/provider/StringProviderTests.java
Wed Dec 27 20:08:40 2017
@@ -19,9 +19,13 @@
package org.apache.axis2.jaxws.provider;
-import junit.framework.Test;
-import junit.framework.TestSuite;
import org.apache.axis2.jaxws.TestLogger;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPFault;
@@ -31,18 +35,15 @@ import javax.xml.ws.Service;
import javax.xml.ws.soap.SOAPFaultException;
public class StringProviderTests extends ProviderTestCase {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
- String endpointUrl =
"http://localhost:6060/axis2/services/StringProviderService.StringProviderPort";
String xmlString = "<invoke>test input</invoke>";
private QName serviceName = new QName("http://ws.apache.org/axis2",
"StringProviderService");
- public static Test suite() {
- return getTestSetup(new TestSuite(StringProviderTests.class));
- }
-
- private Dispatch<String> getDispatch() {
+ private Dispatch<String> getDispatch() throws Exception {
Service svc = Service.create(serviceName);
- svc.addPort(portName, null, endpointUrl);
+ svc.addPort(portName, null,
server.getEndpoint("StringProviderService.StringProviderPort"));
Dispatch<String> dispatch = svc
.createDispatch(portName, String.class, Service.Mode.PAYLOAD);
@@ -54,9 +55,9 @@ public class StringProviderTests extends
return dispatch;
}
- private Dispatch<String> getDispatchOneway() {
+ private Dispatch<String> getDispatchOneway() throws Exception {
Service svc = Service.create(serviceName);
- svc.addPort(portName, null, endpointUrl);
+ svc.addPort(portName, null,
server.getEndpoint("StringProviderService.StringProviderPort"));
Dispatch<String> dispatch = svc
.createDispatch(portName, String.class, Service.Mode.PAYLOAD);
@@ -68,9 +69,10 @@ public class StringProviderTests extends
return dispatch;
}
+
+ @Test
public void testNormal() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<String> dispatch = getDispatch();
@@ -83,9 +85,9 @@ public class StringProviderTests extends
assertTrue(request.equals(response));
}
+ @Test
public void testEmptyString() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<String> dispatch = getDispatch();
@@ -105,9 +107,9 @@ public class StringProviderTests extends
}
+ @Test
public void testNullString() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<String> dispatch = getDispatch();
@@ -126,9 +128,9 @@ public class StringProviderTests extends
assertTrue(response == null);
}
+ @Test
public void testNonNullString() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<String> dispatch = getDispatch();
@@ -147,9 +149,9 @@ public class StringProviderTests extends
assertTrue(response == null);
}
+ @Test
public void testCommentString() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<String> dispatch = getDispatch();
@@ -167,9 +169,9 @@ public class StringProviderTests extends
assertTrue(response == null);
}
+ @Test
public void testTwoElementsString() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<String> dispatch = getDispatch();
@@ -189,9 +191,9 @@ public class StringProviderTests extends
assertTrue("<a>hello</a>".equals(response));
}
+ @Test
public void testTwoElementsAndMixedContentString() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<String> dispatch = getDispatch();
@@ -209,9 +211,9 @@ public class StringProviderTests extends
assertTrue(response == null);
}
+ @Test
public void testException() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<String> dispatch = getDispatch();
@@ -239,9 +241,9 @@ public class StringProviderTests extends
* jaxws.provider.interpretNullAsOneway property is set
* @throws Exception
*/
+ @Test
public void testProviderReturnsNull() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<String> dispatch = getDispatch();
String request = "<invoke>returnNull</invoke>";
@@ -266,9 +268,9 @@ public class StringProviderTests extends
* jaxws.provider.interpretNullAsOneway property is set
* @throws Exception
*/
+ @Test
public void testProviderReturnsNullOneway() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<String> dispatch = getDispatchOneway();
// Because the operation is defined in WSDL, it should not be