You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2017/12/27 10:31:03 UTC
svn commit: r1819328 [2/2] - in
/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws:
anytype/tests/ sample/ security/ swamtom/ type_substitution/tests/
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/ParallelAsyncTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/ParallelAsyncTests.java?rev=1819328&r1=1819327&r2=1819328&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/ParallelAsyncTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/ParallelAsyncTests.java Wed Dec 27 10:31:03 2017
@@ -19,19 +19,24 @@
package org.apache.axis2.jaxws.sample;
-import junit.framework.Test;
-import junit.framework.TestSuite;
import org.apache.axis2.jaxws.TestLogger;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
import org.apache.axis2.jaxws.sample.parallelasync.common.CallbackHandler;
import org.apache.axis2.jaxws.sample.parallelasync.server.AsyncPort;
import org.apache.axis2.jaxws.sample.parallelasync.server.AsyncService;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
import org.test.parallelasync.CustomAsyncResponse;
import org.test.parallelasync.SleepResponse;
-import org.test.parallelasync.WakeUpResponse;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Response;
+
+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.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
@@ -44,29 +49,24 @@ import java.util.concurrent.Future;
*
* ExecutionException tests are covered in jaxws.dispatch and jaxws.proxy
*/
-public class ParallelAsyncTests extends AbstractTestCase {
-
- private static final String DOCLITWR_ASYNC_ENDPOINT =
- "http://localhost:6060/axis2/services/AsyncService.DocLitWrappedPortImplPort";
+public class ParallelAsyncTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
// used for logging
private String myClassName = "ParallelAsyncTests";
- public static Test suite() {
- return getTestSetup(new TestSuite(ParallelAsyncTests.class));
- }
-
+ @Test
public void testNOOP () {}
/**
* @testStrategy Check that the web service is up and running
* before running any other tests
*/
+ @Test
public void testService_isAlive() throws Exception {
final String MESSAGE = "testServiceAlive";
- String title = myClassName + " : " + getName() + " : ";
-
AsyncPort port = getPort((Executor)null);
String req1base = "sleepAsync";
@@ -80,7 +80,7 @@ public class ParallelAsyncTests extends
request1 = req1base + "_" + i;
request2 = req2base + "_" + i;
- TestLogger.logger.debug(title + "iteration [" + i + "] using request1 [" + request1 +
+ TestLogger.logger.debug("Iteration [" + i + "] using request1 [" + request1 +
"] request2 [" + request2 + "]");
// submit request #1 to the server-side web service that
@@ -114,7 +114,7 @@ public class ParallelAsyncTests extends
req2_result = resp2.get().getResponse();
} catch (Exception e) {
TestLogger.logger.debug(
- title + "iteration [" + i + "] using request1 [" + request1 +
+ "Iteration [" + i + "] using request1 [" + request1 +
"] request2 [" + request2 + "] : got exception [" +
e.getClass().getName() + "] [" + e.getMessage() + "] ");
e.printStackTrace();
@@ -167,11 +167,11 @@ public class ParallelAsyncTests extends
{
req_cb_result = sleepResp.getMessage();
TestLogger.logger.debug(
- title + " request [" + request1 + "] : result [" + req_cb_result + "] ");
+ "Request [" + request1 + "] : result [" + req_cb_result + "] ");
}
} catch (Exception ex) {
- TestLogger.logger.debug(title + " request [" + request1 + "] : got exception [" +
+ TestLogger.logger.debug("Request [" + request1 + "] : got exception [" +
ex.getClass().getName() + "] [" + ex.getMessage() + "] ");
ex.printStackTrace();
fail(ex.toString());
@@ -188,11 +188,10 @@ public class ParallelAsyncTests extends
* is a request being processed. Uses the default executor.
*
*/
+ @Test
public void testService_ExecutorShutdownNow() throws Exception {
final String MESSAGE = "testExecutorShutdownNow";
- String title = myClassName + " : " + getName() + " : ";
-
AsyncService service = getService(null);
AsyncPort port = getPort(service);
@@ -205,7 +204,7 @@ public class ParallelAsyncTests extends
}
else
{
- TestLogger.logger.debug(title + " No executor service available. Nothing to test.");
+ TestLogger.logger.debug("No executor service available. Nothing to test.");
return;
}
@@ -215,11 +214,11 @@ public class ParallelAsyncTests extends
String request1 = "sleepAsync_with_Callback_1";
- TestLogger.logger.debug(title + " port.sleepAsync(" + request1 +
+ TestLogger.logger.debug("port.sleepAsync(" + request1 +
", callbackHander1) #1 being submitted....");
Future<?> sr1 = port.sleepAsync(request1, sleepCallbackHandler1);
TestLogger.logger.debug(
- title + " port.sleepAsync(" + request1 + ", callbackHander1) #1 .....submitted.");
+ "port.sleepAsync(" + request1 + ", callbackHander1) #1 .....submitted.");
// wait a bit to make sure that the server has the request
Thread.sleep(1000);
@@ -228,19 +227,19 @@ public class ParallelAsyncTests extends
// attempts to stop all actively executing tasks via Thread.interrupt()
// and should prevent new tasks from being submitted
TestLogger.logger
- .debug(title + " shutting down executor [" + ex.getClass().getName() + "]");
+ .debug("Shutting down executor [" + ex.getClass().getName() + "]");
ex.shutdownNow();
// check the waiting request
- TestLogger.logger.debug(title + " port.isAsleep(" + request1 + ") #1 being submitted....");
+ TestLogger.logger.debug("port.isAsleep(" + request1 + ") #1 being submitted....");
String asleepWithCallback1 = port.isAsleep(request1);
TestLogger.logger.debug(
- title + " port.isAsleep(" + request1 + ") #1 = [" + asleepWithCallback1 + "]");
+ "port.isAsleep(" + request1 + ") #1 = [" + asleepWithCallback1 + "]");
// wakeup the waiting request
- TestLogger.logger.debug(title + " port.wakeUp(request1) #1 being submitted....");
+ TestLogger.logger.debug("port.wakeUp(request1) #1 being submitted....");
String wake1 = port.wakeUp(request1);
- TestLogger.logger.debug(title + " port.wakeUp(" + request1 + ") #1 = [" + wake1 + "]");
+ TestLogger.logger.debug("port.wakeUp(" + request1 + ") #1 = [" + wake1 + "]");
// wait a bit..
Thread.sleep(2000);
@@ -248,7 +247,7 @@ public class ParallelAsyncTests extends
// check the Future
if (sr1.isDone())
{
- TestLogger.logger.debug(title + " sr1.isDone[TRUE] ");
+ TestLogger.logger.debug("sr1.isDone[TRUE] ");
}
// try to get the response
@@ -259,29 +258,29 @@ public class ParallelAsyncTests extends
if (sleepResp1 != null)
{
- TestLogger.logger.debug(title + " request [" + request1 +
+ TestLogger.logger.debug("request [" + request1 +
"] #1: sleepResponse [NOT NULL] from callback handler");
String result1 = sleepResp1.getMessage();
TestLogger.logger.debug(
- title + " request [" + request1 + "] #1: result [" + result1 + "] ");
+ "request [" + request1 + "] #1: result [" + result1 + "] ");
}
else
{
- TestLogger.logger.debug(title + " request [" + request1 +
+ TestLogger.logger.debug("request [" + request1 +
"] #1: sleepResponse [NULL] from callback handler");
// see what the Future says
TestLogger.logger.debug(
- title + " request [" + request1 + "] #1: ....check Future response...");
+ "request [" + request1 + "] #1: ....check Future response...");
Object futureResult = sr1.get();
TestLogger.logger.debug(
- title + " request [" + request1 + "] #1: ....Future response [" +
+ "request [" + request1 + "] #1: ....Future response [" +
futureResult + "]...");
}
} catch (Exception exc) {
- TestLogger.logger.debug(title + " request [" + request1 + "] : got exception [" +
+ TestLogger.logger.debug("request [" + request1 + "] : got exception [" +
exc.getClass().getName() + "] [" + exc.getMessage() + "] ");
gotException = true;
}
@@ -295,11 +294,10 @@ public class ParallelAsyncTests extends
* is a request being processed. Uses an application executor
* service.
*/
+ @Test
public void testService_ExecutorShutdownNow_2() throws Exception {
final String MESSAGE = "testExecutorShutdownNow_2";
- String title = myClassName + " : " + getName() + " : ";
-
AsyncService service = getService(null);
AsyncPort port = getPort(service);
@@ -313,11 +311,11 @@ public class ParallelAsyncTests extends
String request1 = "sleepAsync_with_Callback_1";
- TestLogger.logger.debug(title + " port.sleepAsync(" + request1 +
+ TestLogger.logger.debug("port.sleepAsync(" + request1 +
", callbackHander1) #1 being submitted....");
Future<?> sr1 = port.sleepAsync(request1, sleepCallbackHandler1);
TestLogger.logger.debug(
- title + " port.sleepAsync(" + request1 + ", callbackHander1) #1 .....submitted.");
+ "port.sleepAsync(" + request1 + ", callbackHander1) #1 .....submitted.");
// wait a bit to make sure that the server has the request
Thread.sleep(1000);
@@ -326,19 +324,19 @@ public class ParallelAsyncTests extends
// attempts to stop all actively executing tasks via Thread.interrupt()
// and should prevent new tasks from being submitted
TestLogger.logger
- .debug(title + " shutting down executor [" + ex.getClass().getName() + "]");
+ .debug("Shutting down executor [" + ex.getClass().getName() + "]");
ex.shutdownNow();
// check the waiting request
- TestLogger.logger.debug(title + " port.isAsleep(" + request1 + ") #1 being submitted....");
+ TestLogger.logger.debug("port.isAsleep(" + request1 + ") #1 being submitted....");
String asleepWithCallback1 = port.isAsleep(request1);
TestLogger.logger.debug(
- title + " port.isAsleep(" + request1 + ") #1 = [" + asleepWithCallback1 + "]");
+ "port.isAsleep(" + request1 + ") #1 = [" + asleepWithCallback1 + "]");
// wakeup the waiting request
- TestLogger.logger.debug(title + " port.wakeUp(request1) #1 being submitted....");
+ TestLogger.logger.debug("port.wakeUp(request1) #1 being submitted....");
String wake1 = port.wakeUp(request1);
- TestLogger.logger.debug(title + " port.wakeUp(" + request1 + ") #1 = [" + wake1 + "]");
+ TestLogger.logger.debug("port.wakeUp(" + request1 + ") #1 = [" + wake1 + "]");
// wait a bit..
Thread.sleep(2000);
@@ -346,7 +344,7 @@ public class ParallelAsyncTests extends
// check the Future
if (sr1.isDone())
{
- TestLogger.logger.debug(title + " sr1.isDone[TRUE] ");
+ TestLogger.logger.debug("sr1.isDone[TRUE] ");
}
// try to get the response
@@ -357,29 +355,29 @@ public class ParallelAsyncTests extends
if (sleepResp1 != null)
{
- TestLogger.logger.debug(title + " request [" + request1 +
+ TestLogger.logger.debug("Request [" + request1 +
"] #1: sleepResponse [NOT NULL] from callback handler");
String result1 = sleepResp1.getMessage();
TestLogger.logger.debug(
- title + " request [" + request1 + "] #1: result [" + result1 + "] ");
+ "Request [" + request1 + "] #1: result [" + result1 + "] ");
}
else
{
- TestLogger.logger.debug(title + " request [" + request1 +
+ TestLogger.logger.debug("Request [" + request1 +
"] #1: sleepResponse [NULL] from callback handler");
// see what the Future says
TestLogger.logger.debug(
- title + " request [" + request1 + "] #1: ....check Future response...");
+ "Request [" + request1 + "] #1: ....check Future response...");
Object futureResult = sr1.get();
TestLogger.logger.debug(
- title + " request [" + request1 + "] #1: ....Future response [" +
+ "Request [" + request1 + "] #1: ....Future response [" +
futureResult + "]...");
}
} catch (Exception exc) {
- TestLogger.logger.debug(title + " request [" + request1 + "] : got exception [" +
+ TestLogger.logger.debug("Request [" + request1 + "] : got exception [" +
exc.getClass().getName() + "] [" + exc.getMessage() + "] ");
gotException = true;
}
@@ -392,11 +390,10 @@ public class ParallelAsyncTests extends
* is a request. Uses the default executor.
*
*/
+ @Test
public void testService_ExecutorShutdownNow_3() throws Exception {
final String MESSAGE = "testExecutorShutdownNow_3";
- String title = myClassName + " : " + getName() + " : ";
-
AsyncService service = getService(null);
AsyncPort port = getPort(service);
@@ -411,12 +408,12 @@ public class ParallelAsyncTests extends
// attempts to stop all actively executing tasks via Thread.interrupt()
// and should prevent new tasks from being submitted
TestLogger.logger
- .debug(title + " shutting down executor [" + ex.getClass().getName() + "]");
+ .debug("Shutting down executor [" + ex.getClass().getName() + "]");
ex.shutdownNow();
}
else
{
- TestLogger.logger.debug(title + " No executor service available. Nothing to test.");
+ TestLogger.logger.debug("No executor service available. Nothing to test.");
return;
}
@@ -430,15 +427,15 @@ public class ParallelAsyncTests extends
try
{
// submit a request to the server that will wait until we ask for it
- TestLogger.logger.debug(title + " port.sleepAsync(" + request1 +
+ TestLogger.logger.debug("port.sleepAsync(" + request1 +
", callbackHander1) #1 being submitted....");
sr1 = port.sleepAsync(request1, sleepCallbackHandler1);
- TestLogger.logger.debug(title + " port.sleepAsync(" + request1 +
+ TestLogger.logger.debug("port.sleepAsync(" + request1 +
", callbackHander1) #1 .....submitted.");
}
catch (Exception exc)
{
- TestLogger.logger.debug(title + " request [" + request1 + "] : got exception [" +
+ TestLogger.logger.debug("Request [" + request1 + "] : got exception [" +
exc.getClass().getName() + "] [" + exc.getMessage() + "] ");
gotRequestException = true;
}
@@ -450,9 +447,9 @@ public class ParallelAsyncTests extends
if (!gotRequestException)
{
// wakeup the waiting request
- TestLogger.logger.debug(title + " port.wakeUp(request1) #1 being submitted....");
+ TestLogger.logger.debug("port.wakeUp(request1) #1 being submitted....");
String wake1 = port.wakeUp(request1);
- TestLogger.logger.debug(title + " port.wakeUp(" + request1 + ") #1 = [" + wake1 + "]");
+ TestLogger.logger.debug("port.wakeUp(" + request1 + ") #1 = [" + wake1 + "]");
// try to get the response
try {
@@ -461,28 +458,28 @@ public class ParallelAsyncTests extends
if (sleepResp1 != null)
{
- TestLogger.logger.debug(title + " request [" + request1 +
+ TestLogger.logger.debug("Request [" + request1 +
"] #1: sleepResponse [NOT NULL] from callback handler");
String result1 = sleepResp1.getMessage();
TestLogger.logger.debug(
- title + " request [" + request1 + "] #1: result [" + result1 + "] ");
+ "Request [" + request1 + "] #1: result [" + result1 + "] ");
}
else
{
- TestLogger.logger.debug(title + " request [" + request1 +
+ TestLogger.logger.debug("Request [" + request1 +
"] #1: sleepResponse [NULL] from callback handler");
// see what the Future says
- TestLogger.logger.debug(title + " request [" + request1 +
+ TestLogger.logger.debug("Request [" + request1 +
"] #1: ....check Future response...");
Object futureResult = sr1.get();
- TestLogger.logger.debug(title + " request [" + request1 +
+ TestLogger.logger.debug("Request [" + request1 +
"] #1: ....Future response [" + futureResult + "]...");
}
} catch (Exception exc) {
- TestLogger.logger.debug(title + " request [" + request1 + "] : got exception [" +
+ TestLogger.logger.debug("Request [" + request1 + "] : got exception [" +
exc.getClass().getName() + "] [" + exc.getMessage() + "] ");
gotResponseException = true;
}
@@ -550,14 +547,14 @@ public class ParallelAsyncTests extends
}
- private AsyncPort getPort(AsyncService service) {
+ private AsyncPort getPort(AsyncService service) throws Exception {
AsyncPort port = service.getAsyncPort();
assertNotNull("Port is null", port);
Map<String, Object> rc = ((BindingProvider) port).getRequestContext();
rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- DOCLITWR_ASYNC_ENDPOINT);
+ server.getEndpoint("AsyncService.DocLitWrappedPortImplPort"));
return port;
@@ -567,7 +564,7 @@ public class ParallelAsyncTests extends
* Auxiliary method used for obtaining a proxy pre-configured with a
* specific Executor
*/
- private AsyncPort getPort(Executor ex) {
+ private AsyncPort getPort(Executor ex) throws Exception {
AsyncService service = getService(ex);
AsyncPort port = service.getAsyncPort();
@@ -575,7 +572,7 @@ public class ParallelAsyncTests extends
Map<String, Object> rc = ((BindingProvider) port).getRequestContext();
rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- DOCLITWR_ASYNC_ENDPOINT);
+ server.getEndpoint("AsyncService.DocLitWrappedPortImplPort"));
return port;
}
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/StringListTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/StringListTests.java?rev=1819328&r1=1819327&r2=1819328&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/StringListTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/StringListTests.java Wed Dec 27 10:31:03 2017
@@ -19,30 +19,30 @@
package org.apache.axis2.jaxws.sample;
-import junit.framework.Test;
-import junit.framework.TestSuite;
import org.apache.axis2.jaxws.TestLogger;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
import org.apache.axis2.jaxws.sample.stringlist.sei.StringListPortType;
import org.apache.axis2.jaxws.sample.stringlist.sei.StringListService;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
-import javax.xml.ws.BindingProvider;
-
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
-public class StringListTests extends AbstractTestCase {
- String axisEndpoint = "http://localhost:6060/axis2/services/StringListService.StringListPortTypeImplPort";
+import javax.xml.ws.BindingProvider;
- public static Test suite() {
- return getTestSetup(new TestSuite(StringListTests.class));
- }
+public class StringListTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
+ @Test
public void testStringListScenario() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
StringListService sls = new StringListService();
StringListPortType portType =sls.getStringListPort();
BindingProvider p = (BindingProvider)portType;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ server.getEndpoint("StringListService.StringListPortTypeImplPort"));
String[] send = new String[]{"String1","String2","String3","String Space"};
// since the array is serilized as xsd:list the string with space will be converted
// to a new array element. so we send array.length of 3 but get back array.length of 5
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/WSGenTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/WSGenTests.java?rev=1819328&r1=1819327&r2=1819328&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/WSGenTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/WSGenTests.java Wed Dec 27 10:31:03 2017
@@ -19,36 +19,33 @@
package org.apache.axis2.jaxws.sample;
-import junit.framework.Test;
-import junit.framework.TestSuite;
import org.apache.axis2.jaxws.TestLogger;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
import org.apache.axis2.jaxws.sample.wsgen.client.WSGenInterface;
import org.apache.axis2.jaxws.sample.wsgen.client.WSGenService;
+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.fail;
import javax.xml.ws.BindingProvider;
-public class WSGenTests extends AbstractTestCase {
-
- String axisEndpoint = "http://localhost:6060/axis2/services/WSGenService.WSGenPort";
-
- public static Test suite() {
- return getTestSetup(new TestSuite(WrapTests.class));
- }
-
-
+public class WSGenTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
+ @Test
public void testWSGen() {
try{
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
WSGenService service = new WSGenService();
WSGenInterface proxy = service.getWSGenPort();
BindingProvider p = (BindingProvider)proxy;
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- axisEndpoint);
+ server.getEndpoint("WSGenService.WSGenPort"));
String outString = "this is a wonderful test";
String s = proxy.echoString(outString);
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/security/BasicAuthSecurityTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/security/BasicAuthSecurityTests.java?rev=1819328&r1=1819327&r2=1819328&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/security/BasicAuthSecurityTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/security/BasicAuthSecurityTests.java Wed Dec 27 10:31:03 2017
@@ -19,11 +19,15 @@
package org.apache.axis2.jaxws.security;
-import junit.framework.Test;
-import junit.framework.TestSuite;
import org.apache.axis2.jaxws.BindingProvider;
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;
@@ -31,9 +35,10 @@ import javax.xml.ws.Service;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.soap.SOAPBinding;
-public class BasicAuthSecurityTests extends AbstractTestCase {
+public class BasicAuthSecurityTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
- private String endpointUrl = "http://localhost:6060/axis2/services/BasicAuthSecurityService.SimpleProviderServiceSOAP11port0";
private String xmlString = "<invokeOp>test input</invokeOp>";
private QName SERVICE_QNAME = new QName("http://ws.apache.org/axis2", "BasicAuthSecurityService");
private QName PORT_QNAME = new QName("http://ws.apache.org/axis2", "SimpleProviderServiceSOAP11port0");
@@ -41,16 +46,16 @@ public class BasicAuthSecurityTests exte
private String USER_ID = "testid";
private String PASSWORD = "testid";
- public static Test suite() {
- return getTestSetup(new TestSuite(BasicAuthSecurityTests.class));
+ private static String getEndpoint() throws Exception {
+ return server.getEndpoint("BasicAuthSecurityService.SimpleProviderServiceSOAP11port0");
}
-
+
+ @Test
public void testBasicAuth() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<String> dispatch = getDispatch(Service.Mode.PAYLOAD,
- endpointUrl,
+ getEndpoint(),
SOAPBinding.SOAP11HTTP_BINDING);
TestLogger.logger.debug(">> Invoking Dispatch<String> BasicAuthSecurityService");
@@ -66,12 +71,12 @@ public class BasicAuthSecurityTests exte
assertTrue(retVal != null);
}
+ @Test
public void testBasicAuth_uid_pwd() throws Exception {
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<String> dispatch = getDispatch(Service.Mode.PAYLOAD,
- endpointUrl,
+ getEndpoint(),
SOAPBinding.SOAP11HTTP_BINDING);
dispatch.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, USER_ID);
@@ -91,12 +96,12 @@ public class BasicAuthSecurityTests exte
assertTrue(retVal != null);
}
+ @Test
public void testBasicAuth_uid()throws Exception{
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<String> dispatch = getDispatch(Service.Mode.PAYLOAD,
- endpointUrl,
+ getEndpoint(),
SOAPBinding.SOAP11HTTP_BINDING);
dispatch.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, USER_ID);
@@ -111,12 +116,12 @@ public class BasicAuthSecurityTests exte
TestLogger.logger.debug(">> Response [" + retVal + "]");
}
+ @Test
public void testBasicAuth_pwd()throws Exception{
TestLogger.logger.debug("---------------------------------------");
- TestLogger.logger.debug("test: " + getName());
Dispatch<String> dispatch = getDispatch(Service.Mode.PAYLOAD,
- endpointUrl,
+ getEndpoint(),
SOAPBinding.SOAP11HTTP_BINDING);
dispatch.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, PASSWORD);
@@ -130,7 +135,7 @@ public class BasicAuthSecurityTests exte
fail("Set PASSWORD with no USERID: WebServiceException is expected");
}
catch(WebServiceException wse){
- TestLogger.logger.debug(getName() + ": " + wse);
+ TestLogger.logger.debug(wse);
}
// Try a second time to verify
@@ -143,7 +148,7 @@ public class BasicAuthSecurityTests exte
fail("Set PASSWORD with no USERID: WebServiceException is expected");
}
catch(WebServiceException wse){
- TestLogger.logger.debug(getName() + ": " + wse);
+ TestLogger.logger.debug(wse);
}
}
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/swamtom/SWAMTOMTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/swamtom/SWAMTOMTests.java?rev=1819328&r1=1819327&r2=1819328&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/swamtom/SWAMTOMTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/swamtom/SWAMTOMTests.java Wed Dec 27 10:31:03 2017
@@ -17,7 +17,9 @@
* under the License.
*/package org.apache.axis2.jaxws.swamtom;
-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.AttachmentPart;
@@ -29,36 +31,34 @@ import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;
import javax.xml.ws.soap.SOAPBinding;
+import static org.junit.Assert.fail;
+
import java.io.ByteArrayInputStream;
import java.util.Iterator;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
/**
* Tests calling an endpoint that has one operation that
* uses an MTOM attachment and another operation that uses a SWA
* attachment.
*/
-public class SWAMTOMTests extends AbstractTestCase {
+public class SWAMTOMTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
+
private static final QName QNAME_SERVICE = new QName("http://swamtomservice.test.org",
"SWAMTOMService");
private static final QName QNAME_PORT = new QName("http://swamtomservice.test.org",
"SWAMTOMPortTypePort");
- private static final String URL_ENDPOINT = "http://localhost:6060/axis2/services/SWAMTOMService.SWAMTOMPortTypePort";
-
- public static Test suite() {
- return getTestSetup(new TestSuite(SWAMTOMTests.class));
- }
- public Dispatch<SOAPMessage> getDispatch(String soapAction) {
+ public Dispatch<SOAPMessage> getDispatch(String soapAction) throws Exception {
+ String endpoint = server.getEndpoint("SWAMTOMService.SWAMTOMPortTypePort");
Service service = Service.create(QNAME_SERVICE);
- service.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_BINDING, URL_ENDPOINT);
+ service.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_BINDING, endpoint);
Dispatch<SOAPMessage> dispatch = service.createDispatch(QNAME_PORT,
SOAPMessage.class,
Service.Mode.MESSAGE);
BindingProvider p = (BindingProvider) dispatch;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, URL_ENDPOINT);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint);
p.getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
p.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, soapAction);
@@ -84,6 +84,7 @@ public class SWAMTOMTests extends Abstra
* This test ensures that the toleration of the attachments with legacy (pre WS-I 1.0) content ids.
* @throws Exception
*/
+ @Test
public void testSWAAttachments_LegacyContentID() throws Exception {
String soapAction = "swaAttachment";
Dispatch<SOAPMessage> dispatch = getDispatch(soapAction);
@@ -201,6 +202,7 @@ public class SWAMTOMTests extends Abstra
* This test ensures that the endpoint can receive and return compliant (pre WS-I 1.0) content ids.
* @throws Exception
*/
+ @Test
public void testSWAAttachments_WSI() throws Exception {
String soapAction = "swaAttachment";
Dispatch<SOAPMessage> dispatch = getDispatch(soapAction);
@@ -311,6 +313,7 @@ public class SWAMTOMTests extends Abstra
*
* @throws Exception
*/
+ @Test
public void testSWAAttachments2_WSI() throws Exception {
String soapAction = "swaAttachment2";
Dispatch<SOAPMessage> dispatch = getDispatch(soapAction);
@@ -459,6 +462,7 @@ public class SWAMTOMTests extends Abstra
*
* @throws Exception
*/
+ @Test
public void testSWAAttachments2_Legacy() throws Exception {
String soapAction = "swaAttachment2";
Dispatch<SOAPMessage> dispatch = getDispatch(soapAction);
Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/type_substitution/tests/TypeSubstitutionTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/type_substitution/tests/TypeSubstitutionTests.java?rev=1819328&r1=1819327&r2=1819328&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/type_substitution/tests/TypeSubstitutionTests.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/type_substitution/tests/TypeSubstitutionTests.java Wed Dec 27 10:31:03 2017
@@ -19,11 +19,10 @@
package org.apache.axis2.jaxws.type_substitution.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 javax.xml.namespace.QName;
import javax.xml.soap.MessageFactory;
@@ -32,15 +31,20 @@ import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPMessage;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import java.io.ByteArrayInputStream;
import java.util.Iterator;
-public class TypeSubstitutionTests extends AbstractTestCase {
+public class TypeSubstitutionTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
private String NS = "http://apple.org";
private QName XSI_TYPE = new QName("http://www.w3.org/2001/XMLSchema-instance", "type");
- private String endpointUrl = "http://localhost:6060/axis2/services/AppleFinderService.AppleFinderPort";
private QName serviceName = new QName(NS, "AppleFinderService");
private QName portName = new QName(NS, "AppleFinderPort");
@@ -51,11 +55,8 @@ public class TypeSubstitutionTests exten
private String reqMsgEnd = "</soap:Body></soap:Envelope>";
private String GET_APPLES = "<ns2:getApples xmlns:ns2=\"" + NS + "\"/>";
-
- public static Test suite() {
- return getTestSetup(new TestSuite(TypeSubstitutionTests.class));
- }
-
+
+ @Test
public void testTypeSubstitution() throws Exception {
Dispatch<SOAPMessage> dispatch = createDispatch();
@@ -116,7 +117,7 @@ public class TypeSubstitutionTests exten
private Dispatch<SOAPMessage> createDispatch() throws Exception {
Service svc = Service.create(serviceName);
- svc.addPort(portName, null, endpointUrl);
+ svc.addPort(portName, null, server.getEndpoint("AppleFinderService.AppleFinderPort"));
Dispatch<SOAPMessage> dispatch =
svc.createDispatch(portName, SOAPMessage.class, Service.Mode.MESSAGE);
return dispatch;