Author: veithen
Date: Mon Dec 25 20:23:52 2017
New Revision: 1819262
URL: http://svn.apache.org/viewvc?rev=1819262&view=rev
Log:
Use the Axis2Server rule to avoid fixed TCP port numbers.
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/CustomHTTPHeaderTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/context/tests/MessageContextTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/JAXBSourceDispatchTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/OMElementDispatchTest.java
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAP12DispatchTest.java
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/handler/header/tests/HandlerTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF16Tests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF8Tests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/nonanonymous/complextype/NonAnonymousComplexTypeTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/polymorphic/shape/tests/PolymorphicTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/soapbinding/tests/SOAPBindingProviderTests.java
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/CustomHTTPHeaderTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/CustomHTTPHeaderTests.java?rev=1819262&r1=1819261&r2=1819262&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/CustomHTTPHeaderTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/CustomHTTPHeaderTests.java
Mon Dec 25 20:23:52 2017
@@ -20,6 +20,9 @@
package org.apache.axis2.jaxws.client;
import java.util.Collections;
+
+import static org.junit.Assert.assertEquals;
+
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -28,21 +31,17 @@ import java.util.Map;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.handler.MessageContext;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
import org.apache.axis2.jaxws.sample.addnumbers.AddNumbersPortType;
import org.apache.axis2.jaxws.sample.addnumbers.AddNumbersService;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
+
+public class CustomHTTPHeaderTests {
+ @ClassRule
+ public static Axis2Server server = new Axis2Server("target/repo");
-public class CustomHTTPHeaderTests extends AbstractTestCase {
-
- String axisEndpoint =
"http://localhost:6060/axis2/services/AddNumbersService.AddNumbersPortTypeImplPort";
-
- public static Test suite() {
- return getTestSetup(new TestSuite(CustomHTTPHeaderTests.class));
- }
-
+ @Test
public void testPort() throws Exception {
Map<String, List<String>> headers = new HashMap<String,
List<String>>();
headers.put("MY_HEADER_1", Collections.singletonList("hello"));
@@ -53,7 +52,8 @@ public class CustomHTTPHeaderTests exten
BindingProvider p = (BindingProvider) port;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+
server.getEndpoint("AddNumbersService.AddNumbersPortTypeImplPort"));
p.getRequestContext().put(MessageContext.HTTP_REQUEST_HEADERS,
headers);
assertEquals(777, port.addNumbers(333, 444));
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/context/tests/MessageContextTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/context/tests/MessageContextTests.java?rev=1819262&r1=1819261&r2=1819262&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/context/tests/MessageContextTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/context/tests/MessageContextTests.java
Mon Dec 25 20:23:52 2017
@@ -19,13 +19,14 @@
package org.apache.axis2.jaxws.context.tests;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.apache.axis2.jaxws.context.MessageContextImpl;
import org.apache.axis2.jaxws.context.sei.MessageContext;
import org.apache.axis2.jaxws.context.sei.MessageContextService;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
@@ -33,47 +34,48 @@ import javax.xml.ws.Holder;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceContext;
-public class MessageContextTests extends AbstractTestCase {
+public class MessageContextTests {
+ @ClassRule
+ public static Axis2Server server = new Axis2Server("target/repo");
static final WebServiceClient wsc =
MessageContextService.class.getAnnotation(WebServiceClient.class);
-
- String axisEndpoint =
"http://localhost:6060/axis2/services/MessageContextService.MessageContextPort";
-
- public static Test suite() {
- return getTestSetup(new TestSuite(MessageContextTests.class));
- }
- public void testWSCtxt_WSDL_SERVICE_read() {
+ @Test
+ public void testWSCtxt_WSDL_SERVICE_read() throws Exception {
String type_expected = QName.class.getName();
String value_expected = "{" + wsc.targetNamespace() + "}" + wsc.name();
runTest(javax.xml.ws.handler.MessageContext.WSDL_SERVICE,
type_expected, value_expected, false);
}
- public void testWSCtxt_WSDL_PORT_read() {
+ @Test
+ public void testWSCtxt_WSDL_PORT_read() throws Exception {
String type_expected = QName.class.getName();
String value_expected = "{" + wsc.targetNamespace() +
"}MessageContextPort";
runTest(javax.xml.ws.handler.MessageContext.WSDL_PORT, type_expected,
value_expected, false);
}
- public void testWSCtxt_WSDL_OPERATION_read() {
+ @Test
+ public void testWSCtxt_WSDL_OPERATION_read() throws Exception {
String type_expected = QName.class.getName();
String value_expected = "isPropertyPresent";
runTest(javax.xml.ws.handler.MessageContext.WSDL_OPERATION,
type_expected, value_expected, false);
}
- public void testWSCtxt_WSDL_INTERFACE_read() {
+ @Test
+ public void testWSCtxt_WSDL_INTERFACE_read() throws Exception {
String type_expected = QName.class.getName();
String value_expected = "{" + wsc.targetNamespace() +
"}MessageContext";
runTest(javax.xml.ws.handler.MessageContext.WSDL_INTERFACE,
type_expected, value_expected, false);
}
- public void testWSCtxt_WSDL_DESCRIPTION_read() {
+ @Test
+ public void testWSCtxt_WSDL_DESCRIPTION_read() throws Exception {
String type_expected = java.net.URI.class.getName();
String value_expected = "META-INF/MessageContext.wsdl";
runTest(javax.xml.ws.handler.MessageContext.WSDL_DESCRIPTION,
type_expected, value_expected, false);
}
- private void runTest(String propName, String exType, String exValue,
boolean isValueFullySpecified) {
+ private void runTest(String propName, String exType, String exValue,
boolean isValueFullySpecified) throws Exception {
MessageContext port = getPort();
Holder<String> type = new Holder<String>();
@@ -109,11 +111,12 @@ public class MessageContextTests extends
}
}
- public MessageContext getPort() {
+ public MessageContext getPort() throws Exception {
MessageContextService service = new MessageContextService();
MessageContext port = service.getMessageContextPort();
BindingProvider p = (BindingProvider) port;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+
server.getEndpoint("MessageContextService.MessageContextPort"));
return port;
}
}
\ No newline at end of file
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/JAXBSourceDispatchTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/JAXBSourceDispatchTests.java?rev=1819262&r1=1819261&r2=1819262&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/JAXBSourceDispatchTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/JAXBSourceDispatchTests.java
Mon Dec 25 20:23:52 2017
@@ -19,10 +19,10 @@
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.ClassRule;
+import org.junit.Test;
import org.test.dispatch.jaxbsource.Invoke;
import org.test.dispatch.jaxbsource.ObjectFactory;
@@ -36,6 +36,9 @@ import javax.xml.transform.TransformerFa
import javax.xml.transform.stream.StreamResult;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;
+
+import static org.junit.Assert.assertNotNull;
+
import java.io.StringWriter;
/*
@@ -45,26 +48,24 @@ import java.io.StringWriter;
*/
-public class JAXBSourceDispatchTests extends AbstractTestCase {
+public class JAXBSourceDispatchTests {
/**
* Invoke a sync Dispatch<JAXBSource> in PAYLOAD mode
*/
+
+ @ClassRule
+ public static Axis2Server server = new Axis2Server("target/repo");
- private String url =
"http://localhost:6060/axis2/services/SourceProviderService";
private QName serviceName = new QName("http://ws.apache.org/axis2",
"SourceProviderService");
private QName portName =new QName("http://ws.apache.org/axis2",
"SimpleProviderServiceSOAP11port0");
- public static Test suite() {
- return getTestSetup(new TestSuite(JAXBSourceDispatchTests.class));
- }
-
+ @Test
public void testJAXBSourceSyncPayloadMode() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(serviceName);
- svc.addPort(portName, null, url);
+ svc.addPort(portName, null,
server.getEndpoint("SourceProviderService"));
Dispatch<Source> dispatch = svc.createDispatch(portName, Source.class,
Service.Mode.PAYLOAD);
//Create JAXBContext and JAXBSource here.
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/OMElementDispatchTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/OMElementDispatchTest.java?rev=1819262&r1=1819261&r2=1819262&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/OMElementDispatchTest.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/OMElementDispatchTest.java
Mon Dec 25 20:23:52 2017
@@ -19,6 +19,8 @@
package org.apache.axis2.jaxws.dispatch;
+import static org.junit.Assert.assertTrue;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.StringReader;
@@ -34,27 +36,27 @@ import javax.xml.ws.Service;
import javax.xml.ws.Service.Mode;
import javax.xml.ws.soap.SOAPBinding;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMXMLBuilderFactory;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPModelBuilder;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
/**
* This class uses the JAX-WS Dispatch API to test sending and receiving
* messages using SOAP 1.2.
*/
-public class OMElementDispatchTest extends AbstractTestCase {
+public class OMElementDispatchTest {
+ @ClassRule
+ public static Axis2Server server = new Axis2Server("target/repo");
private static final QName QNAME_SERVICE = new QName(
"http://org/apache/axis2/jaxws/test/OMELEMENT",
"OMElementService");
private static final QName QNAME_PORT = new QName(
"http://org/apache/axis2/jaxws/test/OMELEMENT", "OMElementPort");
- private static final String URL_ENDPOINT =
"http://localhost:6060/axis2/services/OMElementProviderService.OMElementProviderPort";
private static final String sampleRequest =
"<test:echoOMElement
xmlns:test=\"http://org/apache/axis2/jaxws/test/OMELEMENT\">" +
@@ -70,17 +72,18 @@ public class OMElementDispatchTest exten
sampleRequest +
sampleEnvelopeTail;
- public static Test suite() {
- return getTestSetup(new TestSuite(OMElementDispatchTest.class));
+ private static String getEndpoint() throws Exception {
+ return
server.getEndpoint("OMElementProviderService.OMElementProviderPort");
}
-
+
/**
* Test sending a SOAP 1.2 request in PAYLOAD mode
*/
+ @Test
public void testSourceDispatchPayloadMode() throws Exception {
// Create the JAX-WS client needed to send the request
Service service = Service.create(QNAME_SERVICE);
- service.addPort(QNAME_PORT, SOAPBinding.SOAP12HTTP_BINDING,
URL_ENDPOINT);
+ service.addPort(QNAME_PORT, SOAPBinding.SOAP12HTTP_BINDING,
getEndpoint());
Dispatch<Source> dispatch = service.createDispatch(
QNAME_PORT, Source.class, Mode.PAYLOAD);
@@ -144,10 +147,11 @@ public class OMElementDispatchTest exten
/**
* Test sending a SOAP 1.2 request in MESSAGE mode
*/
+ @Test
public void testSourceDispatchMessageMode() throws Exception {
// Create the JAX-WS client needed to send the request
Service service = Service.create(QNAME_SERVICE);
- service.addPort(QNAME_PORT, SOAPBinding.SOAP12HTTP_BINDING,
URL_ENDPOINT);
+ service.addPort(QNAME_PORT, SOAPBinding.SOAP12HTTP_BINDING,
getEndpoint());
Dispatch<Source> dispatch = service.createDispatch(
QNAME_PORT, Source.class, Mode.MESSAGE);
@@ -214,10 +218,11 @@ public class OMElementDispatchTest exten
/**
* Test sending a SOAP 1.2 request in PAYLOAD mode
*/
+ @Test
public void testOMElementDispatchPayloadMode() throws Exception {
// Create the JAX-WS client needed to send the request
Service service = Service.create(QNAME_SERVICE);
- service.addPort(QNAME_PORT, SOAPBinding.SOAP12HTTP_BINDING,
URL_ENDPOINT);
+ service.addPort(QNAME_PORT, SOAPBinding.SOAP12HTTP_BINDING,
getEndpoint());
Dispatch<OMElement> dispatch = service.createDispatch(
QNAME_PORT, OMElement.class, Mode.PAYLOAD);
@@ -261,10 +266,11 @@ public class OMElementDispatchTest exten
/**
* 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(QNAME_SERVICE);
- service.addPort(QNAME_PORT, SOAPBinding.SOAP12HTTP_BINDING,
URL_ENDPOINT);
+ service.addPort(QNAME_PORT, SOAPBinding.SOAP12HTTP_BINDING,
getEndpoint());
Dispatch<OMElement> dispatch = service.createDispatch(
QNAME_PORT, OMElement.class, Mode.MESSAGE);
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAP12DispatchTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAP12DispatchTest.java?rev=1819262&r1=1819261&r2=1819262&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAP12DispatchTest.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAP12DispatchTest.java
Mon Dec 25 20:23:52 2017
@@ -19,10 +19,11 @@
package org.apache.axis2.jaxws.dispatch;
-import junit.framework.Test;
-import junit.framework.TestSuite;
import org.apache.axis2.jaxws.description.builder.MDQConstants;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Test;
import javax.xml.namespace.QName;
import javax.xml.transform.Source;
@@ -35,6 +36,11 @@ import javax.xml.ws.Service;
import javax.xml.ws.Service.Mode;
import javax.xml.ws.soap.SOAPBinding;
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 java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -42,13 +48,14 @@ import java.io.ByteArrayOutputStream;
* This class uses the JAX-WS Dispatch API to test sending and receiving
* messages using SOAP 1.2.
*/
-public class SOAP12DispatchTest extends AbstractTestCase {
+public class SOAP12DispatchTest {
+ @ClassRule
+ public static Axis2Server server = new Axis2Server("target/repo");
private static final QName QNAME_SERVICE = new QName(
"http://org/apache/axis2/jaxws/test/SOAP12", "SOAP12Service");
private static final QName QNAME_PORT = new QName(
"http://org/apache/axis2/jaxws/test/SOAP12", "SOAP12Port");
- private static final String URL_ENDPOINT =
"http://localhost:6060/axis2/services/SOAP12ProviderService.SOAP12ProviderPort";
private static final String sampleRequest =
"<test:echoString
xmlns:test=\"http://org/apache/axis2/jaxws/test/SOAP12\">" +
@@ -77,17 +84,18 @@ public class SOAP12DispatchTest extends
sampleRequest +
sampleEnvelopeTail;
- public static Test suite() {
- return getTestSetup(new TestSuite(SOAP12DispatchTest.class));
+ private static String getEndpoint() throws Exception {
+ return server.getEndpoint("SOAP12ProviderService.SOAP12ProviderPort");
}
-
+
/**
* Test sending a SOAP 1.2 request in PAYLOAD mode
*/
+ @Test
public void testSOAP12DispatchPayloadMode() throws Exception {
// Create the JAX-WS client needed to send the request
Service service = Service.create(QNAME_SERVICE);
- service.addPort(QNAME_PORT, SOAPBinding.SOAP12HTTP_BINDING,
URL_ENDPOINT);
+ service.addPort(QNAME_PORT, SOAPBinding.SOAP12HTTP_BINDING,
getEndpoint());
Dispatch<Source> dispatch = service.createDispatch(
QNAME_PORT, Source.class, Mode.PAYLOAD);
@@ -161,10 +169,12 @@ public class SOAP12DispatchTest extends
* JAX-WS will default to SOAP11, and SOAP12 is not registered as a
protocol for the JMS namespace. See AXIS2-4855
* for more information.
*/
- public void _testSOAP12JMSDispatchPayloadMode() throws Exception {
+ @Ignore
+ @Test
+ public void testSOAP12JMSDispatchPayloadMode() throws Exception {
// Create the JAX-WS client needed to send the request
Service service = Service.create(QNAME_SERVICE);
- service.addPort(QNAME_PORT, MDQConstants.SOAP12JMS_BINDING,
URL_ENDPOINT);
+ service.addPort(QNAME_PORT, MDQConstants.SOAP12JMS_BINDING,
getEndpoint());
Dispatch<Source> dispatch = service.createDispatch(
QNAME_PORT, Source.class, Mode.PAYLOAD);
@@ -228,10 +238,11 @@ public class SOAP12DispatchTest extends
/**
* Test sending a SOAP 1.2 request in MESSAGE mode
*/
+ @Test
public void testSOAP12DispatchMessageMode() throws Exception {
// Create the JAX-WS client needed to send the request
Service service = Service.create(QNAME_SERVICE);
- service.addPort(QNAME_PORT, SOAPBinding.SOAP12HTTP_BINDING,
URL_ENDPOINT);
+ service.addPort(QNAME_PORT, SOAPBinding.SOAP12HTTP_BINDING,
getEndpoint());
Dispatch<Source> dispatch = service.createDispatch(
QNAME_PORT, Source.class, Mode.MESSAGE);
@@ -298,10 +309,11 @@ public class SOAP12DispatchTest extends
/**
* Test sending a SOAP 1.2 request in MESSAGE mode
*/
+ @Test
public void testSOAP12DispatchMessageMode_MustUnderstand() throws
Exception {
// Create the JAX-WS client needed to send the request
Service service = Service.create(QNAME_SERVICE);
- service.addPort(QNAME_PORT, SOAPBinding.SOAP12HTTP_BINDING,
URL_ENDPOINT);
+ service.addPort(QNAME_PORT, SOAPBinding.SOAP12HTTP_BINDING,
getEndpoint());
Dispatch<Source> dispatch = service.createDispatch(
QNAME_PORT, Source.class, Mode.MESSAGE);
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java?rev=1819262&r1=1819261&r2=1819262&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SOAPMessageDispatchTests.java
Mon Dec 25 20:23:52 2017
@@ -19,10 +19,10 @@
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.ClassRule;
+import org.junit.Test;
import javax.xml.namespace.QName;
import javax.xml.soap.MessageFactory;
@@ -30,12 +30,17 @@ import javax.xml.soap.SOAPMessage;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Response;
import javax.xml.ws.Service;
+
+import static org.junit.Assert.assertNotNull;
+
import java.io.File;
import java.io.FileInputStream;
import java.util.concurrent.Future;
-public class SOAPMessageDispatchTests extends AbstractTestCase {
- private String url =
"http://localhost:6060/axis2/services/ProxyDocLitWrappedService.DocLitWrappedProxyImplPort";
+public class SOAPMessageDispatchTests {
+ @ClassRule
+ public static Axis2Server server = new Axis2Server("target/repo");
+
private QName serviceName = new QName(
"http://org.apache.axis2.proxy.doclitwrapped",
"ProxyDocLitWrappedService");
private QName portName = new
QName("http://org.apache.axis2.proxy.doclitwrapped",
@@ -43,20 +48,20 @@ public class SOAPMessageDispatchTests ex
String messageResource = "test-resources" + File.separator + "xml" +
File.separator +"soapmessage.xml";
- public static Test suite() {
- return getTestSetup(new TestSuite(SOAPMessageDispatchTests.class));
+ private static String getEndpoint() throws Exception {
+ return
server.getEndpoint("ProxyDocLitWrappedService.DocLitWrappedProxyImplPort");
}
+ @Test
public void testSOAPMessageSyncMessageMode() throws Exception {
String basedir = new
File(System.getProperty("basedir",".")).getAbsolutePath();
String messageResource = new File(basedir,
this.messageResource).getAbsolutePath();
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
//Initialize the JAX-WS client artifacts
Service svc = Service.create(serviceName);
- svc.addPort(portName, null, url);
+ svc.addPort(portName, null, getEndpoint());
Dispatch<SOAPMessage> dispatch = svc.createDispatch(portName,
SOAPMessage.class,
Service.Mode.MESSAGE);
@@ -81,16 +86,16 @@ public class SOAPMessageDispatchTests ex
response.writeTo(System.out);
}
+ @Test
public void testSOAPMessageAsyncCallbackMessageMode() throws Exception {
String basedir = new
File(System.getProperty("basedir",".")).getAbsolutePath();
String messageResource = new File(basedir,
this.messageResource).getAbsolutePath();
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
//Initialize the JAX-WS client artifacts
Service svc = Service.create(serviceName);
- svc.addPort(portName, null, url);
+ svc.addPort(portName, null, getEndpoint());
Dispatch<SOAPMessage> dispatch = svc.createDispatch(portName,
SOAPMessage.class,
Service.Mode.MESSAGE);
@@ -131,16 +136,16 @@ public class SOAPMessageDispatchTests ex
response.writeTo(System.out);
}
+ @Test
public void testSOAPMessageAsyncPollingMessageMode() throws Exception {
String basedir = new
File(System.getProperty("basedir",".")).getAbsolutePath();
String messageResource = new File(basedir,
this.messageResource).getAbsolutePath();
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
//Initialize the JAX-WS client artifacts
Service svc = Service.create(serviceName);
- svc.addPort(portName, null, url);
+ svc.addPort(portName, null, getEndpoint());
Dispatch<SOAPMessage> dispatch = svc.createDispatch(portName,
SOAPMessage.class,
Service.Mode.MESSAGE);
@@ -187,9 +192,10 @@ public class SOAPMessageDispatchTests ex
*
* @throws Exception
*/
+ @Test
public void testConnectionReleaseForInvokeOneWayWithMEPMismatch() throws
Exception {
Service svc = Service.create(serviceName);
- svc.addPort(portName, null, url);
+ svc.addPort(portName, null, getEndpoint());
Dispatch<SOAPMessage> dispatch = svc.createDispatch(portName,
SOAPMessage.class,
Service.Mode.MESSAGE);
MessageFactory factory = MessageFactory.newInstance();
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/handler/header/tests/HandlerTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/handler/header/tests/HandlerTests.java?rev=1819262&r1=1819261&r2=1819262&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/handler/header/tests/HandlerTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/handler/header/tests/HandlerTests.java
Mon Dec 25 20:23:52 2017
@@ -19,29 +19,32 @@
package org.apache.axis2.jaxws.handler.header.tests;
-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.ClassRule;
+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.Dispatch;
import javax.xml.ws.Service;
import javax.xml.ws.soap.SOAPFaultException;
-public class HandlerTests extends AbstractTestCase {
- public static Test suite() {
- return getTestSetup(new TestSuite(HandlerTests.class));
- }
+public class HandlerTests {
+ @ClassRule
+ public static Axis2Server server = new Axis2Server("target/repo");
- public void testHandler_getHeader_invocation() {
+ @Test
+ public void testHandler_getHeader_invocation() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
Object res;
//Add myHeader to SOAPMessage that will be injected by
handler.getHeader().
String soapMessage =
"<soap:Envelope
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:demo=\"http://demo/\"><soap:Header> <demo:myheader
soap:mustUnderstand=\"1\"/></soap:Header><soap:Body><demo:echo><arg0>test</arg0></demo:echo></soap:Body></soap:Envelope>";
- String url =
"http://localhost:6060/axis2/services/DemoService.DemoServicePort";
+ String url = server.getEndpoint("DemoService.DemoServicePort");
QName name = new QName("http://demo/", "DemoService");
QName portName = new QName("http://demo/", "DemoServicePort");
//Create Service
@@ -58,13 +61,13 @@ public class HandlerTests extends Abstra
TestLogger.logger.debug("----------------------------------");
}
- public void test_MU_Failure() {
+ @Test
+ public void test_MU_Failure() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
//Add bad header to SOAPMessage, we expect MU to fail
String soapMessage =
"<soap:Envelope
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:demo=\"http://demo/\"><soap:Header> <demo:badHeader
soap:mustUnderstand=\"1\"/></soap:Header><soap:Body><demo:echo><arg0>test</arg0></demo:echo></soap:Body></soap:Envelope>";
- String url =
"http://localhost:6060/axis2/services/DemoService.DemoServicePort";
+ String url = server.getEndpoint("DemoService.DemoServicePort");
QName name = new QName("http://demo/", "DemoService");
QName portName = new QName("http://demo/", "DemoServicePort");
try {
@@ -94,14 +97,14 @@ public class HandlerTests extends Abstra
* Test that a mustUnderstand header with a specific SOAP role that the
endpoint is acting in
* doesn't cause a NotUnderstood fault if the header QName is one that the
handler understands.
*/
- public void testSoapRoleActedIn() {
+ @Test
+ public void testSoapRoleActedIn() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
Object res;
//Add myHeader to SOAPMessage that will be injected by
handler.getHeader().
String soapMessage =
"<soap:Envelope
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:demo=\"http://demo/\"><soap:Header> <demo:myheader
soap:actor=\"http://DemoHandler/Role\"
soap:mustUnderstand=\"1\"/></soap:Header><soap:Body><demo:echo><arg0>test</arg0></demo:echo></soap:Body></soap:Envelope>";
- String url =
"http://localhost:6060/axis2/services/DemoService.DemoServicePort";
+ String url = server.getEndpoint("DemoService.DemoServicePort");
QName name = new QName("http://demo/", "DemoService");
QName portName = new QName("http://demo/", "DemoServicePort");
//Create Service
@@ -122,14 +125,14 @@ public class HandlerTests extends Abstra
* Test that a mustUnderstand header with a specific SOAP role that the
endpoint is acting in
* doesn't cause a NotUnderstood fault if the header QName is one that the
handler understands.
*/
- public void testSoapRoleNotActedIn() {
+ @Test
+ public void testSoapRoleNotActedIn() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
Object res;
//Add myHeader to SOAPMessage that will be injected by
handler.getHeader().
String soapMessage =
"<soap:Envelope
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:demo=\"http://demo/\"><soap:Header> <demo:myheader
soap:actor=\"http://DemoHandler/NotActedIn\"
soap:mustUnderstand=\"1\"/></soap:Header><soap:Body><demo:echo><arg0>test</arg0></demo:echo></soap:Body></soap:Envelope>";
- String url =
"http://localhost:6060/axis2/services/DemoService.DemoServicePort";
+ String url = server.getEndpoint("DemoService.DemoServicePort");
QName name = new QName("http://demo/", "DemoService");
QName portName = new QName("http://demo/", "DemoServicePort");
//Create Service
@@ -150,13 +153,13 @@ public class HandlerTests extends Abstra
* Test that a mustUnderstand header with a specific SOAP role that the
endpoint is acting in
* which has a mustUnderstand header that will not be processed by the
handler causes a fault.
*/
- public void testSoapRoleActedInNotUnderstoodFault() {
+ @Test
+ public void testSoapRoleActedInNotUnderstoodFault() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
//Add myHeader to SOAPMessage that will be injected by
handler.getHeader().
String soapMessage =
"<soap:Envelope
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:demo=\"http://demo/\"><soap:Header> <demo:myNOTUNDERSTOODheader
soap:actor=\"http://DemoHandler/Role\"
soap:mustUnderstand=\"1\"/></soap:Header><soap:Body><demo:echo><arg0>test</arg0></demo:echo></soap:Body></soap:Envelope>";
- String url =
"http://localhost:6060/axis2/services/DemoService.DemoServicePort";
+ String url = server.getEndpoint("DemoService.DemoServicePort");
QName name = new QName("http://demo/", "DemoService");
QName portName = new QName("http://demo/", "DemoServicePort");
try {
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF16Tests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF16Tests.java?rev=1819262&r1=1819261&r2=1819262&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF16Tests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF16Tests.java
Mon Dec 25 20:23:52 2017
@@ -1,92 +1,101 @@
package org.apache.axis2.jaxws.jaxb.string;
-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.Assert;
+import org.junit.ClassRule;
+import org.junit.Test;
import javax.xml.ws.BindingProvider;
-public class JAXBStringUTF16Tests extends AbstractTestCase {
- String axisEndpoint =
"http://localhost:6060/axis2/services/JAXBStringService.JAXBStringPortTypeImplPort";
- String axis2ProviderEndpoint =
"http://localhost:6060/axis2/services/StringMessageProviderService.StringMessageProviderPort";
+public class JAXBStringUTF16Tests {
+ @ClassRule
+ public static Axis2Server server = new Axis2Server("target/repo");
- public static Test suite() {
- return getTestSetup(new TestSuite(JAXBStringUTF16Tests.class));
- }
-
- private void runTest16(String value) {
+ private void runTest16(String value) throws Exception {
runTestWithUTF16(value, value);
}
- private void runTest16(String value, String value1) {
+ private void runTest16(String value, String value1) throws Exception {
runTestWithUTF16(value, value1);
}
+ @Test
public void testSimpleString16BOM() throws Exception {
// Call the Axis2 StringMessageProvider which has a check to ensure
// that the BOM for UTF-16 is not written inside the message.
- runTestWithEncoding("a simple string", "a simple string", "UTF-16",
axis2ProviderEndpoint);
+ runTestWithEncoding("a simple string", "a simple string", "UTF-16",
+
server.getEndpoint("StringMessageProviderService.StringMessageProviderPort"));
}
+ @Test
public void testSimpleString16() throws Exception {
runTest16("a simple string");
}
+ @Test
public void testStringWithApostrophes16() throws Exception {
runTest16("this isn't a simple string");
}
+ @Test
public void testStringWithEntities16() throws Exception {
runTest16("&<>'"", "&<>'"");
}
+ @Test
public void testStringWithRawEntities16() throws Exception {
runTest16("&<>'\"", "&<>'\"");
}
+ @Test
public void testStringWithLeadingAndTrailingSpaces16() throws Exception {
runTest16(" centered ");
}
+ @Test
public void testWhitespace16() throws Exception {
runTest16(" \n \t "); // note: \r fails
}
+ @Test
public void testFrenchAccents16() throws Exception {
runTest16("\u00e0\u00e2\u00e4\u00e7\u00e8\u00e9\u00ea\u00eb\u00ee\u00ef\u00f4\u00f6\u00f9\u00fb\u00fc");
}
+ @Test
public void testGermanUmlauts16() throws Exception {
runTest16(" Some text \u00df with \u00fc special \u00f6 chars
\u00e4.");
}
+ @Test
public void testWelcomeUnicode1_16() throws Exception {
// welcome in several languages
runTest16(
"Chinese (trad.) : \u6b61\u8fce ");
}
+ @Test
public void testWelcomeUnicode2_16() throws Exception {
// welcome in several languages
runTest16(
"Greek : \u03ba\u03b1\u03bb\u03ce\u03c2
\u03bf\u03c1\u03af\u03c3\u03b1\u03c4\u03b5");
}
+ @Test
public void testWelcomeUnicode3_16() throws Exception {
// welcome in several languages
runTest16(
"Japanese : \u3088\u3046\u3053\u305d");
}
- private void runTestWithUTF16(String input, String output) {
+ private void runTestWithUTF16(String input, String output) throws
Exception {
runTestWithEncoding(input, output, "UTF-16");
}
- private void runTestWithEncoding(String input, String output, String
encoding) {
- runTestWithEncoding(input, output, encoding, axisEndpoint);
+ private void runTestWithEncoding(String input, String output, String
encoding) throws Exception {
+ runTestWithEncoding(input, output, encoding,
server.getEndpoint("JAXBStringService.JAXBStringPortTypeImplPort"));
}
private void runTestWithEncoding(String input, String output, String
encoding, String endpoint) {
- TestLogger.logger.debug("Test : " + getName());
JAXBStringPortType myPort = (new
JAXBStringService()).getJAXBStringPort();
BindingProvider p = (BindingProvider) myPort;
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
endpoint);
@@ -99,7 +108,7 @@ public class JAXBStringUTF16Tests extend
request.setArg(input);
EchoResponse response = myPort.echoString(request);
TestLogger.logger.debug(response.getResponse());
- assertEquals(output, response.getResponse());
+ Assert.assertEquals(output, response.getResponse());
}
}
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF8Tests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF8Tests.java?rev=1819262&r1=1819261&r2=1819262&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF8Tests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/jaxb/string/JAXBStringUTF8Tests.java
Mon Dec 25 20:23:52 2017
@@ -1,31 +1,32 @@
package org.apache.axis2.jaxws.jaxb.string;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
+import org.junit.ClassRule;
+import org.junit.Test;
import org.apache.axis2.jaxws.TestLogger;
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import org.apache.axis2.testutils.Axis2Server;
-import javax.xml.ws.BindingProvider;
+import static org.junit.Assert.assertEquals;
-public class JAXBStringUTF8Tests extends AbstractTestCase {
- String axisEndpoint =
"http://localhost:6060/axis2/services/JAXBStringService.JAXBStringPortTypeImplPort";
+import javax.xml.ws.BindingProvider;
- public static Test suite() {
- return getTestSetup(new TestSuite(JAXBStringUTF8Tests.class));
- }
+public class JAXBStringUTF8Tests {
+ @ClassRule
+ public static Axis2Server server = new Axis2Server("target/repo");
- private void runTest(String value) {
+ private void runTest(String value) throws Exception{
runTestWithUTF8(value, value);
}
- private void runTest(String value, String value1) {
+ private void runTest(String value, String value1) throws Exception {
runTestWithUTF8(value, value1);
}
+ @Test
public void testSimpleString() throws Exception {
runTest("a simple string");
}
+ @Test
public void testSimpleStringSwitchEncoding() throws Exception {
String input = "a simple string";
String output = "a simple string";
@@ -36,62 +37,71 @@ public class JAXBStringUTF8Tests extends
runTestWithEncoding(input, output, null); // now try again...using
default, UTF-8
}
+ @Test
public void testStringWithApostrophes() throws Exception {
runTest("this isn't a simple string");
}
+ @Test
public void testStringWithEntities() throws Exception {
runTest("&<>'"", "&<>'"");
}
+ @Test
public void testStringWithRawEntities() throws Exception {
runTest("&<>'\"", "&<>'\"");
}
+ @Test
public void testStringWithLeadingAndTrailingSpaces() throws Exception {
runTest(" centered ");
}
+ @Test
public void testWhitespace() throws Exception {
runTest(" \n \t "); // note: \r fails
}
+ @Test
public void testFrenchAccents() throws Exception {
runTest("\u00e0\u00e2\u00e4\u00e7\u00e8\u00e9\u00ea\u00eb\u00ee\u00ef\u00f4\u00f6\u00f9\u00fb\u00fc");
}
+ @Test
public void testGermanUmlauts() throws Exception {
runTest(" Some text \u00df with \u00fc special \u00f6 chars \u00e4.");
}
+ @Test
public void testWelcomeUnicode1() throws Exception {
// welcome in several languages
runTest(
"Chinese (trad.) : \u6b61\u8fce ");
}
+ @Test
public void testWelcomeUnicode2() throws Exception {
// welcome in several languages
runTest(
"Greek : \u03ba\u03b1\u03bb\u03ce\u03c2
\u03bf\u03c1\u03af\u03c3\u03b1\u03c4\u03b5");
}
+ @Test
public void testWelcomeUnicode3() throws Exception {
// welcome in several languages
runTest(
"Japanese : \u3088\u3046\u3053\u305d");
}
- private void runTestWithUTF8(String input, String output) {
+ private void runTestWithUTF8(String input, String output) throws Exception
{
runTestWithEncoding(input, output, null); // no encoding means to use
default, UTF-8
}
- private void runTestWithEncoding(String input, String output, String
encoding) {
- TestLogger.logger.debug("Test : " + getName());
-
+ private void runTestWithEncoding(String input, String output, String
encoding) throws Exception {
JAXBStringPortType myPort = (new
JAXBStringService()).getJAXBStringPort();
BindingProvider p = (BindingProvider) myPort;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+
server.getEndpoint("JAXBStringService.JAXBStringPortTypeImplPort"));
if (encoding != null) {
p.getRequestContext().put(org.apache.axis2.Constants.Configuration.CHARACTER_SET_ENCODING,
encoding);
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/nonanonymous/complextype/NonAnonymousComplexTypeTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/nonanonymous/complextype/NonAnonymousComplexTypeTests.java?rev=1819262&r1=1819261&r2=1819262&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/nonanonymous/complextype/NonAnonymousComplexTypeTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/nonanonymous/complextype/NonAnonymousComplexTypeTests.java
Mon Dec 25 20:23:52 2017
@@ -22,29 +22,26 @@
*/
package org.apache.axis2.jaxws.nonanonymous.complextype;
-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.ClassRule;
+import org.junit.Test;
import javax.xml.ws.BindingProvider;
-public class NonAnonymousComplexTypeTests extends AbstractTestCase {
+public class NonAnonymousComplexTypeTests {
+ @ClassRule
+ public static Axis2Server server = new Axis2Server("target/repo");
- String axisEndpoint =
"http://localhost:6060/axis2/services/EchoMessageService.EchoMessageImplPort";
-
- public static Test suite() {
- return getTestSetup(new TestSuite(NonAnonymousComplexTypeTests.class));
- }
-
- public void testSimpleProxy() {
+ @Test
+ public void testSimpleProxy() throws Exception {
TestLogger.logger.debug("------------------------------");
- TestLogger.logger.debug("Test : " + getName());
String msg = "Hello Server";
EchoMessagePortType myPort = (new
EchoMessageService()).getEchoMessagePort();
BindingProvider p = (BindingProvider) myPort;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ server.getEndpoint("EchoMessageService.EchoMessageImplPort"));
String response = myPort.echoMessage(msg);
TestLogger.logger.debug(response);
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/polymorphic/shape/tests/PolymorphicTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/polymorphic/shape/tests/PolymorphicTests.java?rev=1819262&r1=1819261&r2=1819262&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/polymorphic/shape/tests/PolymorphicTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/polymorphic/shape/tests/PolymorphicTests.java
Mon Dec 25 20:23:52 2017
@@ -19,39 +19,41 @@
package org.apache.axis2.jaxws.polymorphic.shape.tests;
-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.polymorphic.shape.sei.PolymorphicShapePortType;
import org.apache.axis2.jaxws.polymorphic.shape.sei.PolymorphicShapeService;
import org.apache.axis2.jaxws.util.WSDL4JWrapper;
import org.apache.axis2.jaxws.util.WSDLWrapper;
import org.apache.axis2.jaxws.wsdl.impl.SchemaReaderImpl;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
import org.test.shape.Shape;
import org.test.shape.Square;
import org.test.shape.threed.ThreeDSquare;
import javax.xml.ws.BindingProvider;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.File;
import java.net.URL;
import java.util.Iterator;
import java.util.Set;
-public class PolymorphicTests extends AbstractTestCase {
- String axisEndpoint =
"http://localhost:6060/axis2/services/PolymorphicShapeService.PolymorphicShapePort";
+public class PolymorphicTests {
+ @ClassRule
+ public static Axis2Server server = new Axis2Server("target/repo");
- public static Test suite() {
- return getTestSetup(new TestSuite(PolymorphicTests.class));
- }
-
- public void testFormalAndActualTypeInDifferentPackages(){
+ @Test
+ public void testFormalAndActualTypeInDifferentPackages() throws Exception {
TestLogger.logger.debug("------------------------------");
- TestLogger.logger.debug("Test : " + getName());
PolymorphicShapeService service = new PolymorphicShapeService();
PolymorphicShapePortType port = service.getPolymorphicShapePort();
BindingProvider p = (BindingProvider) port;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+
server.getEndpoint("PolymorphicShapeService.PolymorphicShapePort"));
Shape shapeType;
@@ -77,9 +79,9 @@ public class PolymorphicTests extends Ab
TestLogger.logger.debug("-------------------------------");
}
+ @Test
public void testInlineUseOfJAXBBinding() throws Exception {
TestLogger.logger.debug("------------------------------");
- TestLogger.logger.debug("Test : " + getName());
String schemaBindingPkgName = "org.test.echomessage";
String standardPkgName= "org.test.complextype.nonanonymous";
String
wsdlLocation="test-resources/wsdl/JAXB_Customization_Sample.wsdl";
@@ -101,9 +103,9 @@ public class PolymorphicTests extends Ab
TestLogger.logger.debug("------------------------------");
}
+ @Test
public void testSchemaReader() throws Exception {
TestLogger.logger.debug("------------------------------");
- TestLogger.logger.debug("Test : " + getName());
String wsdlLocation="test-resources/wsdl/shapes.wsdl";
String baseDir = new
File(System.getProperty("basedir",".")).getCanonicalPath();
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/soapbinding/tests/SOAPBindingProviderTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/soapbinding/tests/SOAPBindingProviderTests.java?rev=1819262&r1=1819261&r2=1819262&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/soapbinding/tests/SOAPBindingProviderTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/provider/soapbinding/tests/SOAPBindingProviderTests.java
Mon Dec 25 20:23:52 2017
@@ -19,6 +19,8 @@
package org.apache.axis2.jaxws.provider.soapbinding.tests;
+import static org.junit.Assert.assertTrue;
+
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -34,15 +36,14 @@ import javax.xml.ws.BindingProvider;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
-import org.apache.axis2.jaxws.polymorphic.shape.tests.PolymorphicTests;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
+
+public class SOAPBindingProviderTests {
+ @ClassRule
+ public static Axis2Server server = new Axis2Server("target/repo");
-public class SOAPBindingProviderTests extends AbstractTestCase {
- private String endpointUrl =
"http://localhost:6060/axis2/services/SOAPBindingProviderService.SOAPBindingProviderPort";
private QName serviceName = new
QName("http://SOAPBindingProvider.provider.jaxws.axis2.apache.org",
"SOAPBindingProviderService");
private QName portName = new
QName("http://SOAPBindingProvider.provider.jaxws.axis2.apache.org",
"SOAPBindingProviderPort");
@@ -71,13 +72,9 @@ public class SOAPBindingProviderTests ex
String request = "<invokeOp>Hello World</invokeOp>";
- public static Test suite() {
- return getTestSetup(new TestSuite(SOAPBindingProviderTests.class));
- }
-
+ @Test
public void testSoap11Request() throws Exception {
System.out.println("---------------------------------------");
- System.out.println("test: " + getName());
Dispatch<SOAPMessage> dispatch=getDispatch();
String soapMessage = getSOAP11Message();
@@ -88,9 +85,9 @@ public class SOAPBindingProviderTests ex
assertTrue(getVersionURI(message).equals(SOAP11_NS_URI));
}
+ @Test
public void testSoap12Request() throws Exception {
System.out.println("---------------------------------------");
- System.out.println("test: " + getName());
Dispatch<SOAPMessage> dispatch=getDispatch();
String soapMessage = getSOAP12Message();
@@ -105,8 +102,9 @@ public class SOAPBindingProviderTests ex
System.out.println("Provider endpoint was able to receive both SOAP 11
and SOAP 12 request");
}
- private Dispatch<SOAPMessage> getDispatch(){
+ private Dispatch<SOAPMessage> getDispatch() throws Exception {
Service svc = Service.create(serviceName);
+ String endpointUrl =
server.getEndpoint("SOAPBindingProviderService.SOAPBindingProviderPort");
svc.addPort(portName, null, endpointUrl);
Dispatch<SOAPMessage> dispatch = svc.createDispatch(portName,
SOAPMessage.class, Service.Mode.MESSAGE);
BindingProvider p = (BindingProvider) dispatch;