Author: veithen
Date: Wed Dec 27 22:18:52 2017
New Revision: 1819371
URL: http://svn.apache.org/viewvc?rev=1819371&view=rev
Log:
Eliminate remaining code in jaxws-integration that relies on fixed TCP port
numbers.
Added:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/servicejars/AsyncService2/
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/servicejars/AsyncService2/META-INF/
- copied from r1819370,
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/asyncdoclit/server/META-INF/
axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/Junit4ClassRunnerWithRuntimeIgnore.java
(with props)
Removed:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/framework/StartServer.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/framework/StopServer.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/asyncdoclit/server/META-INF/
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/utility/
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/pom.xml
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/DispatchTestConstants.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/StringDispatchTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/framework/AbstractTestCase.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/FaultyWebServiceTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/RuntimeExceptionsAsyncMepTest.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncClient.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncService.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/parallelasync/common/Constants.java
axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/RuntimeIgnoreException.java
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/pom.xml
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/pom.xml?rev=1819371&r1=1819370&r2=1819371&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/pom.xml (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/pom.xml Wed Dec 27
22:18:52 2017
@@ -238,6 +238,13 @@
</packages>
<resourcesDirectory>src/test/servicejars/AddressingProvider</resourcesDirectory>
</jaxwsService>
+ <jaxwsService>
+ <name>AsyncService2</name>
+ <packages>
+
<package>org.apache.axis2.jaxws.sample.asyncdoclit</package>
+ </packages>
+
<resourcesDirectory>src/test/servicejars/AsyncService2</resourcesDirectory>
+ </jaxwsService>
</jaxwsServices>
</configuration>
</execution>
@@ -1118,18 +1125,6 @@
<jar
destfile="${servicejars.dir}/AsyncService.jar"
basedir="${servicejars.dir}/AsyncService" />
<delete dir="${servicejars.dir}/AsyncService"
/>
- <copy
toDir="${servicejars.dir}/AsyncService2/">
- <fileset dir="target/test-classes">
- <include
name="org/apache/axis2/jaxws/sample/asyncdoclit/**" />
- </fileset>
- <fileset
dir="src/test/java/org/apache/axis2/jaxws/sample/asyncdoclit/server">
- <include name="META-INF/**" />
- </fileset>
- </copy>
-
- <jar
destfile="${servicejars.dir}/AsyncService2.jar"
basedir="${servicejars.dir}/AsyncService2" />
- <delete dir="${servicejars.dir}/AsyncService2"
/>
-
<copy
toDir="${servicejars.dir}/FaultyWebServiceService/">
<fileset dir="target/test-classes">
<include
name="org/apache/axis2/jaxws/sample/faults/**" />
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/DispatchTestConstants.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/DispatchTestConstants.java?rev=1819371&r1=1819370&r2=1819371&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/DispatchTestConstants.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/DispatchTestConstants.java
Wed Dec 27 22:18:52 2017
@@ -23,7 +23,6 @@ import javax.xml.namespace.QName;
public class DispatchTestConstants {
- public static final String URL =
"http://localhost:6060/axis2/services/EchoService";
public static final String BADURL =
"http://this.is.not.a.valid.hostname.at.all.no.way:9999/wacky";
public static final QName QNAME_SERVICE = new
QName("http://ws.apache.org/axis2", "EchoService");
public static final QName QNAME_PORT = new
QName("http://ws.apache.org/axis2", "EchoServiceSOAP11port0");
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/StringDispatchTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/StringDispatchTests.java?rev=1819371&r1=1819370&r2=1819371&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/StringDispatchTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/dispatch/StringDispatchTests.java
Wed Dec 27 22:18:52 2017
@@ -19,11 +19,12 @@
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.AllTestsWithRuntimeIgnore;
+import org.apache.axis2.testutils.Axis2Server;
+import org.apache.axis2.testutils.Junit4ClassRunnerWithRuntimeIgnore;
+import org.junit.ClassRule;
+import org.junit.Test;
import org.junit.runner.RunWith;
import javax.xml.ws.Dispatch;
@@ -32,28 +33,29 @@ 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.net.UnknownHostException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
-@RunWith(AllTestsWithRuntimeIgnore.class)
+@RunWith(Junit4ClassRunnerWithRuntimeIgnore.class)
public class StringDispatchTests extends AbstractTestCase {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
-
- public static Test suite() {
- return getTestSetup(new TestSuite(StringDispatchTests.class));
- }
-
/**
* Invoke a sync Dispatch<String> 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<String> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
String.class, Service.Mode.PAYLOAD);
@@ -91,13 +93,13 @@ public class StringDispatchTests extends
* says we should get a ProtocolException, not a
* WebServiceException.
*/
+ @Test
public void testSyncPayloadMode_exception() 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<String> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
String.class, Service.Mode.PAYLOAD);
@@ -136,13 +138,13 @@ public class StringDispatchTests extends
/**
* Invoke a sync Dispatch<String> in MESSAGE mode
*/
+ @Test
public void testSyncWithMessageMode() 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<String> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
String.class, Service.Mode.MESSAGE);
@@ -178,13 +180,13 @@ public class StringDispatchTests extends
/**
* Invoke a Dispatch<String> using the async callback API 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<String> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
String.class, Service.Mode.PAYLOAD);
@@ -236,13 +238,13 @@ public class StringDispatchTests extends
/**
* Invoke a Dispatch<String> using the async callback API 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<String> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
String.class, Service.Mode.MESSAGE);
@@ -293,13 +295,13 @@ public class StringDispatchTests extends
/**
* Invoke a Dispatch<String> using the async polling API 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<String> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
String.class, Service.Mode.PAYLOAD);
@@ -344,13 +346,13 @@ public class StringDispatchTests extends
/**
* Invoke a Dispatch<String> using the async polling API 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<String> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
String.class, Service.Mode.MESSAGE);
@@ -395,13 +397,13 @@ public class StringDispatchTests extends
/**
* Invoke a Dispatch<String> one-way in PAYLOAD mode
*/
+ @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<String> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
String.class, Service.Mode.PAYLOAD);
@@ -416,13 +418,13 @@ public class StringDispatchTests extends
/**
* Invoke a Dispatch<String> one-way in MESSAGE mode
*/
+ @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<String> dispatch =
svc.createDispatch(DispatchTestConstants.QNAME_PORT,
String.class, Service.Mode.MESSAGE);
@@ -435,11 +437,11 @@ public class StringDispatchTests extends
}
+ @Test
public void testSyncPayloadMode_badHostName() throws Exception {
checkUnknownHostURL(DispatchTestConstants.BADURL);
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
@@ -474,11 +476,11 @@ public class StringDispatchTests extends
}
+ @Test
public void testAsyncCallbackMessageMode_badHostName() throws Exception {
checkUnknownHostURL(DispatchTestConstants.BADURL);
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
@@ -544,11 +546,11 @@ public class StringDispatchTests extends
}
}
+ @Test
public void testAsyncPollingPayloadMode_badHostName() throws Exception {
checkUnknownHostURL(DispatchTestConstants.BADURL);
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
// Initialize the JAX-WS client artifacts
Service svc = Service.create(DispatchTestConstants.QNAME_SERVICE);
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/framework/AbstractTestCase.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/framework/AbstractTestCase.java?rev=1819371&r1=1819370&r2=1819371&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/framework/AbstractTestCase.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/framework/AbstractTestCase.java
Wed Dec 27 22:18:52 2017
@@ -24,54 +24,9 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.net.UnknownHostException;
-import junit.extensions.TestSetup;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import org.apache.axis2.jaxws.TestLogger;
-import org.apache.axis2.jaxws.dispatch.DispatchTestConstants;
import org.apache.axis2.testutils.RuntimeIgnoreException;
-public class AbstractTestCase extends TestCase {
- public AbstractTestCase() {
- super();
- }
-
- /*
- * users may pass in their own repositoryDir path and path to custom
configuration file.
- * Passing 'null' for either param will use the default
- */
- protected static Test getTestSetup(Test test, final String repositoryDir,
final String axis2xml) {
- return new TestSetup(test) {
- public void setUp() throws Exception {
- TestLogger.logger.debug("Starting the server for: "
+this.getClass().getName());
- StartServer startServer = new StartServer("server1");
- startServer.testStartServer(repositoryDir, axis2xml);
- }
-
- public void tearDown() throws Exception {
- TestLogger.logger.debug("Stopping the server for: "
+this.getClass().getName());
- StopServer stopServer = new StopServer("server1");
- stopServer.testStopServer();
- }
- };
- }
-
- protected static Test getTestSetup(Test test) {
- return new TestSetup(test) {
- public void setUp() throws Exception {
- TestLogger.logger.debug("Starting the server for: "
+this.getClass().getName());
- StartServer startServer = new StartServer("server1");
- startServer.testStartServer();
- }
-
- public void tearDown() throws Exception {
- TestLogger.logger.debug("Stopping the server for: "
+this.getClass().getName());
- StopServer stopServer = new StopServer("server1");
- stopServer.testStopServer();
- }
- };
- }
-
+public class AbstractTestCase {
/**
* Check that the given URL refers to an unknown host. More precisely,
this method checks that
* the DNS resolver will not be able to resolve the host name. If the
expectation is not met,
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/FaultyWebServiceTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/FaultyWebServiceTests.java?rev=1819371&r1=1819370&r2=1819371&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/FaultyWebServiceTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/FaultyWebServiceTests.java
Wed Dec 27 22:18:52 2017
@@ -22,17 +22,17 @@
*/
package org.apache.axis2.jaxws.sample;
-import junit.framework.Test;
-import junit.framework.TestSuite;
import org.apache.axis2.jaxws.TestLogger;
-import org.apache.axis2.jaxws.dispatch.DispatchTestConstants;
import org.apache.axis2.jaxws.framework.AbstractTestCase;
import org.apache.axis2.jaxws.sample.faults.FaultyWebServiceFault_Exception;
import org.apache.axis2.jaxws.sample.faults.FaultyWebServicePortType;
import org.apache.axis2.jaxws.sample.faults.FaultyWebServiceService;
import org.apache.axis2.jaxws.sample.wrap.sei.DocLitWrap;
import org.apache.axis2.jaxws.sample.wrap.sei.DocLitWrapService;
-import org.apache.axis2.testutils.AllTestsWithRuntimeIgnore;
+import org.apache.axis2.testutils.Axis2Server;
+import org.apache.axis2.testutils.Junit4ClassRunnerWithRuntimeIgnore;
+import org.junit.ClassRule;
+import org.junit.Test;
import org.junit.runner.RunWith;
import org.test.faults.FaultyWebServiceResponse;
@@ -41,23 +41,28 @@ import javax.xml.ws.BindingProvider;
import javax.xml.ws.Response;
import javax.xml.ws.WebServiceException;
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.net.UnknownHostException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
-@RunWith(AllTestsWithRuntimeIgnore.class)
+@RunWith(Junit4ClassRunnerWithRuntimeIgnore.class)
public class FaultyWebServiceTests extends AbstractTestCase {
- String axisEndpoint =
"http://localhost:6060/axis2/services/FaultyWebServiceService.FaultyWebServicePortTypeImplPort";
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
- public static Test suite() {
- return getTestSetup(new TestSuite(FaultyWebServiceTests.class));
+ private static String getEndpoint() throws Exception {
+ return
server.getEndpoint("FaultyWebServiceService.FaultyWebServicePortTypeImplPort");
}
-
-
+ @Test
public void testFaultyWebService(){
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
FaultyWebServiceService service = new FaultyWebServiceService();
FaultyWebServicePortType proxy = service.getFaultyWebServicePort();
@@ -65,7 +70,7 @@ public class FaultyWebServiceTests exten
try{
exception = null;
BindingProvider p = (BindingProvider)proxy;
-
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,axisEndpoint);
+
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
getEndpoint());
// the invoke will throw an exception, if the test is performed
right
int total = proxy.faultyWebService(10);
@@ -89,7 +94,7 @@ public class FaultyWebServiceTests exten
try{
exception = null;
BindingProvider p = (BindingProvider)proxy;
-
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,axisEndpoint);
+
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
getEndpoint());
// the invoke will throw an exception, if the test is performed
right
int total = proxy.faultyWebService(10);
@@ -111,6 +116,7 @@ public class FaultyWebServiceTests exten
}
+ @Test
public void testFaultyWebService_badEndpoint() throws Exception {
String host = "this.is.a.bad.endpoint.terrible.in.fact";
String badEndpoint = "http://" + host;
@@ -118,7 +124,6 @@ public class FaultyWebServiceTests exten
checkUnknownHostURL(badEndpoint);
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
FaultyWebServiceService service = new FaultyWebServiceService();
FaultyWebServicePortType proxy = service.getFaultyWebServicePort();
@@ -177,7 +182,7 @@ public class FaultyWebServiceTests exten
// TODO should also have an invoke oneway bad endpoint test to make sure
// we get an exception as indicated in JAXWS 6.4.2.
-
+ @Test
public void testFaultyWebService_badEndpoint_oneWay() throws Exception {
String host = "this.is.a.bad.endpoint.terrible.in.fact";
String badEndpoint = "http://" + host;
@@ -194,7 +199,6 @@ public class FaultyWebServiceTests exten
WebServiceException exception = null;
TestLogger.logger.debug("------------------------------");
- TestLogger.logger.debug("Test : " + getName());
try{
exception = null;
@@ -231,6 +235,7 @@ public class FaultyWebServiceTests exten
assertTrue(exception.getCause().getMessage().indexOf(host)!=-1);
}
+ @Test
public void testFaultyWebService_badEndpoint_AsyncCallback()
throws Exception {
@@ -238,7 +243,6 @@ public class FaultyWebServiceTests exten
String badEndpoint = "http://" + host;
TestLogger.logger.debug("------------------------------");
- TestLogger.logger.debug("Test : " + getName());
FaultyWebServiceService service = new FaultyWebServiceService();
FaultyWebServicePortType proxy = service.getFaultyWebServicePort();
@@ -291,6 +295,7 @@ public class FaultyWebServiceTests exten
}
+ @Test
public void testFaultyWebService_badEndpoint_AsyncPolling()
throws Exception {
@@ -298,7 +303,6 @@ public class FaultyWebServiceTests exten
String badEndpoint = "http://" + host;
TestLogger.logger.debug("------------------------------");
- TestLogger.logger.debug("Test : " + getName());
FaultyWebServiceService service = new FaultyWebServiceService();
FaultyWebServicePortType proxy = service.getFaultyWebServicePort();
@@ -361,14 +365,14 @@ public class FaultyWebServiceTests exten
/*
* Tests fault processing for user defined fault types
*/
+ @Test
public void testCustomFault_AsyncCallback() throws Exception {
TestLogger.logger.debug("------------------------------");
- TestLogger.logger.debug("test: " + getName());
FaultyWebServiceService service = new FaultyWebServiceService();
FaultyWebServicePortType proxy = service.getFaultyWebServicePort();
BindingProvider p = (BindingProvider) proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
getEndpoint());
FaultyAsyncHandler callback = new FaultyAsyncHandler();
Future<?> future = proxy.faultyWebServiceAsync(1, callback);
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/RuntimeExceptionsAsyncMepTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/RuntimeExceptionsAsyncMepTest.java?rev=1819371&r1=1819370&r2=1819371&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/RuntimeExceptionsAsyncMepTest.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/RuntimeExceptionsAsyncMepTest.java
Wed Dec 27 22:18:52 2017
@@ -18,6 +18,10 @@
*/
package org.apache.axis2.jaxws.sample;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.net.ConnectException;
import java.net.UnknownHostException;
import java.util.Map;
@@ -31,9 +35,6 @@ import javax.xml.ws.WebServiceFeature;
import javax.xml.ws.soap.AddressingFeature;
import javax.xml.ws.soap.SOAPFaultException;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
import org.apache.axis2.addressing.AddressingConstants;
import org.apache.axis2.deployment.FileSystemConfigurator;
import org.apache.axis2.jaxws.ClientConfigurationFactory;
@@ -44,7 +45,10 @@ import org.apache.axis2.jaxws.sample.asy
import org.apache.axis2.jaxws.sample.asyncdoclit.client.ThrowExceptionFault;
import org.apache.axis2.jaxws.sample.asyncdoclit.common.CallbackHandler;
import org.apache.axis2.metadata.registry.MetadataFactoryRegistry;
-import org.apache.axis2.testutils.AllTestsWithRuntimeIgnore;
+import org.apache.axis2.testutils.Axis2Server;
+import org.apache.axis2.testutils.Junit4ClassRunnerWithRuntimeIgnore;
+import org.junit.ClassRule;
+import org.junit.Test;
import org.junit.runner.RunWith;
import org.test.asyncdoclit.ExceptionTypeEnum;
import org.test.asyncdoclit.ThrowExceptionResponse;
@@ -52,13 +56,12 @@ import org.test.asyncdoclit.ThrowExcepti
/**
* Test for varios async exceptions whern AsyncMEP is enabled
*/
-@RunWith(AllTestsWithRuntimeIgnore.class)
+@RunWith(Junit4ClassRunnerWithRuntimeIgnore.class)
public class RuntimeExceptionsAsyncMepTest extends AbstractTestCase {
+ @ClassRule
+ public static final Axis2Server server = new
Axis2Server("target/addressing-repo");
- private static final String DOCLITWR_ASYNC_ENDPOINT =
"http://localhost:6060/axis2/services/AsyncService2.DocLitWrappedPortImplPort";
private static final String CONNECT_EXCEPTION_ENDPOINT =
"http://localhost:6061/axis2/services/AsyncService2.DocLitWrappedPortImplPort";
- static final String CONNECT_404_ENDPOINT = DOCLITWR_ASYNC_ENDPOINT //
Constants.DOCLITWR_ASYNC_ENDPOINT
- + "/DoesNotExist";
static final String HOST_NOT_FOUND_ENDPOINT =
"http://this.endpoint.does.not.exist/nope";
@@ -69,18 +72,15 @@ public class RuntimeExceptionsAsyncMepTe
*/
static boolean listenerAlreadySetup = false;
- public static Test suite() {
- Test test = getTestSetup(new TestSuite(
- RuntimeExceptionsAsyncMepTest.class), null,
- "test-resources/axis2_addressing.xml");
- return test;
+ private static String getEndpoint() throws Exception {
+ return server.getEndpoint("AsyncService2.DocLitWrappedPortImplPort");
}
- private AsyncPort getPort() {
+ private AsyncPort getPort() throws Exception {
return getPort(null);
}
- private AsyncPort getPort(WebServiceFeature... features) {
+ private AsyncPort getPort(WebServiceFeature... features) throws Exception {
AsyncService service = new AsyncService();
AsyncPort port = service.getAsyncPort(features);
@@ -88,7 +88,7 @@ public class RuntimeExceptionsAsyncMepTe
Map<String, Object> rc = ((BindingProvider) port).getRequestContext();
rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- DOCLITWR_ASYNC_ENDPOINT);
+ getEndpoint());
return port;
}
@@ -98,7 +98,7 @@ public class RuntimeExceptionsAsyncMepTe
* does not exist. Verify that the connection exception is
received
* by the client.
*/
-
+ @Test
public void testAsyncCallback_asyncWire_ConnectException() throws
Exception {
setupAddressingAndListener();
@@ -126,6 +126,7 @@ public class RuntimeExceptionsAsyncMepTe
* is a server not found case). Expected to throw a
* EE/WSE/UnknownHostException
*/
+ @Test
public void testAsyncPolling_asyncMEP_UnknwonHost() throws Exception {
checkUnknownHostURL(HOST_NOT_FOUND_ENDPOINT);
@@ -159,11 +160,12 @@ public class RuntimeExceptionsAsyncMepTe
* configured against an endpoint which does not exist (this
* is a 404-Not Found case). Expected to throw a EE/WSE
*/
+ @Test
public void testAsyncPolling_asyncMEP_404NotFound() throws Exception {
AsyncPort port = getPort();
Map<String, Object> rc = ((BindingProvider) port).getRequestContext();
- rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
CONNECT_404_ENDPOINT);
+ rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint() +
"/DoesNotExist");
Response<ThrowExceptionResponse> resp = port
.throwExceptionAsync(ExceptionTypeEnum.WSE);
@@ -197,6 +199,7 @@ public class RuntimeExceptionsAsyncMepTe
* will throw a WSE which should result in a
* EE/SOAPFaultException
*/
+ @Test
public void testAsyncPolling_asyncMEP_WebServiceException()
throws Exception {
@@ -222,6 +225,7 @@ public class RuntimeExceptionsAsyncMepTe
* will throw a wsdl:fault which should result in a
* EE/SimpleFault
*/
+ @Test
public void testAsyncPolling_asyncMEP_WsdlFault() throws Exception {
AsyncPort port = getPort();
@@ -249,6 +253,7 @@ public class RuntimeExceptionsAsyncMepTe
* is a server not found case). Expected to throw a
* EE/WSE/UnknownHostException
*/
+ @Test
public void testAsyncCallback_asyncMEP_UnknownHost() throws Exception {
checkUnknownHostURL(HOST_NOT_FOUND_ENDPOINT);
@@ -285,11 +290,12 @@ public class RuntimeExceptionsAsyncMepTe
* is a 404 Not Found case). Expected to throw a
* EE/WSE/UnknownHostException
*/
+ @Test
public void testAsyncCallback_asyncMEP_404NotFound() throws Exception {
AsyncPort port = getPort();
Map<String, Object> rc = ((BindingProvider) port).getRequestContext();
- rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
CONNECT_404_ENDPOINT);
+ rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint() +
"/DoesNotExist");
CallbackHandler<ThrowExceptionResponse> handler = new
CallbackHandler<ThrowExceptionResponse>();
Future<?> resp = port.throwExceptionAsync(ExceptionTypeEnum.WSE,
@@ -327,6 +333,7 @@ public class RuntimeExceptionsAsyncMepTe
* throws a generic WebServiceException. I think we may have
* the record for longest method name in Apache here.
*/
+ @Test
public void testAsyncCallback_asyncMEP_WebServiceException()
throws Exception {
@@ -334,7 +341,7 @@ public class RuntimeExceptionsAsyncMepTe
Map<String, Object> rc = ((BindingProvider) port).getRequestContext();
rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- DOCLITWR_ASYNC_ENDPOINT);
+ getEndpoint());
rc.put(AddressingConstants.WSA_REPLY_TO, "blarg");
CallbackHandler<ThrowExceptionResponse> handler = new
CallbackHandler<ThrowExceptionResponse>();
@@ -361,6 +368,7 @@ public class RuntimeExceptionsAsyncMepTe
* throws a generic WebServiceException. I think we may have
* the record for longest method name in Apache here.
*/
+ @Test
public void
testAsyncCallback_asyncMEP_asyncWire_Addressing_WebServiceException()
throws Exception {
setupAddressingAndListener();
@@ -368,7 +376,7 @@ public class RuntimeExceptionsAsyncMepTe
Map<String, Object> rc = ((BindingProvider) port).getRequestContext();
rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- DOCLITWR_ASYNC_ENDPOINT);
+ getEndpoint());
//rc.put(AddressingConstants.WSA_REPLY_TO,
AddressingConstants.Final.WSA_ANONYMOUS_URL);
rc.put("org.apache.axis2.jaxws.use.async.mep", Boolean.TRUE);
@@ -397,6 +405,7 @@ public class RuntimeExceptionsAsyncMepTe
* will throw a wsdl:fault which should result in a
* EE/SimpleFault
*/
+ @Test
public void testAsyncCallback_asyncMEP_WsdlFault() throws Exception {
AsyncPort port = getPort();
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncClient.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncClient.java?rev=1819371&r1=1819370&r2=1819371&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncClient.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncClient.java
Wed Dec 27 22:18:52 2017
@@ -18,18 +18,11 @@
*/
package org.apache.axis2.jaxws.sample.asyncdoclit.client;
-import java.util.Map;
-import java.util.concurrent.Executor;
import java.util.concurrent.Future;
import java.util.concurrent.TimeoutException;
-import javax.xml.ws.BindingProvider;
-
public class AsyncClient {
- private static final String DOCLITWR_ASYNC_ENDPOINT =
-
"http://localhost:6060/axis2/services/AsyncService2.DocLitWrappedPortImplPort";
-
private static final int max_isasleep_check = 30;
/**
@@ -92,30 +85,6 @@ public class AsyncClient {
}
/**
- * Auxiliary method used for obtaining a proxy pre-configured with a
- * specific Executor
- */
- public static AsyncPort getPort(Executor ex) {
- AsyncService service = new AsyncService();
-
- if (ex != null) service.setExecutor(ex);
-
- AsyncPort port = service.getAsyncPort();
- if (port == null) {
- throw new RuntimeException("service.getAsyncPort() is null");
- }
-
- Map<String, Object> rc = ((BindingProvider) port).getRequestContext();
- rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- DOCLITWR_ASYNC_ENDPOINT); //Constants.DOCLITWR_ASYNC_ENDPOINT);
-
- System.out.println("AsyncClient.getPort() = "
- + DOCLITWR_ASYNC_ENDPOINT);
//Constants.DOCLITWR_ASYNC_ENDPOINT);
-
- return port;
- }
-
- /**
* Auxiliary method used to wait for a monitor for a certain amount of time
* before timing out
*
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncService.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncService.java?rev=1819371&r1=1819370&r2=1819371&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncService.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/asyncdoclit/client/AsyncService.java
Wed Dec 27 22:18:52 2017
@@ -38,7 +38,7 @@ public class AsyncService
{
private final static URL ASYNCSERVICE_WSDL_LOCATION;
- private static String
wsdlLocation="/src/test/java/org/apache/axis2/jaxws/sample/asyncdoclit/server/META-INF/async_doclitwr2.wsdl";
+ private static String
wsdlLocation="/src/test/servicejars/AsyncService2/META-INF/async_doclitwr2.wsdl";
static {
URL url = null;
try {
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/parallelasync/common/Constants.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/parallelasync/common/Constants.java?rev=1819371&r1=1819370&r2=1819371&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/parallelasync/common/Constants.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/parallelasync/common/Constants.java
Wed Dec 27 22:18:52 2017
@@ -26,10 +26,6 @@ import javax.xml.namespace.QName;
* conversion methods
*/
public class Constants {
-
- // server hostName and WC port
- private static final String SERVER = "localhost:6060";
-
//public static final String WSDL_NAMESPACE =
"http://common.wsfvt.async.jaxws";
public static final String WSDL_NAMESPACE =
"http://org/test/parallelasync";
@@ -43,19 +39,6 @@ public class Constants {
public static final QName PORT_QNAME = new QName(WSDL_NAMESPACE,
"AsyncPort");
- // Endpoint addresses
- public static final String BASE_ENDPOINT = "http://" + SERVER
- + "/axis2/services/";
-
- public static final String DOCLITWR_ASYNC_ENDPOINT = BASE_ENDPOINT
- + "AsyncService"; //+ "AsyncDocLitWrappedService";
-
- public static final String DOCLIT_ASYNC_ENDPOINT = BASE_ENDPOINT
- + "AsyncService"; //+ "AsyncDocLitService";
-
- public static final String RPCLIT_ASYNC_ENDPOINT = BASE_ENDPOINT
- + "AsyncService"; //+ "AsyncRpcLitService";
-
public static final String THE_STRING = "This Is Just A Test";
// how long the server should seep for before returning a response
Added:
axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/Junit4ClassRunnerWithRuntimeIgnore.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/Junit4ClassRunnerWithRuntimeIgnore.java?rev=1819371&view=auto
==============================================================================
---
axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/Junit4ClassRunnerWithRuntimeIgnore.java
(added)
+++
axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/Junit4ClassRunnerWithRuntimeIgnore.java
Wed Dec 27 22:18:52 2017
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.testutils;
+
+import org.junit.runner.notification.RunNotifier;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.InitializationError;
+
+public class Junit4ClassRunnerWithRuntimeIgnore extends BlockJUnit4ClassRunner
{
+ public Junit4ClassRunnerWithRuntimeIgnore(Class<?> klass) throws
InitializationError {
+ super(klass);
+ }
+
+ @Override
+ public void run(RunNotifier notifier) {
+ super.run(new RuntimeIgnoreRunNotifier(notifier));
+ }
+}
Propchange:
axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/Junit4ClassRunnerWithRuntimeIgnore.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/RuntimeIgnoreException.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/RuntimeIgnoreException.java?rev=1819371&r1=1819370&r2=1819371&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/RuntimeIgnoreException.java
(original)
+++
axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/RuntimeIgnoreException.java
Wed Dec 27 22:18:52 2017
@@ -35,6 +35,7 @@ package org.apache.axis2.testutils;
*
* @see AllTestsWithRuntimeIgnore
* @see JUnit38ClassRunnerWithRuntimeIgnore
+ * @see Junit4ClassRunnerWithRuntimeIgnore
*/
public class RuntimeIgnoreException extends Error {
private static final long serialVersionUID = -2378820905593825587L;