Author: veithen
Date: Wed Dec 27 10:31:03 2017
New Revision: 1819328
URL: http://svn.apache.org/viewvc?rev=1819328&view=rev
Log:
Migrate more JAX-WS integration tests to the Axis2Server rule.
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/anytype/tests/AnyTypeTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/BareNoArgTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/BareTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/DocLitBareMinTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/FaultsServiceTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/HeadersHandlerTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/MTOMFeatureTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/MtomSampleByteArrayTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/MtomSampleTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/NonWrapTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/ParallelAsyncTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/StringListTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/WSGenTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/security/BasicAuthSecurityTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/swamtom/SWAMTOMTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/type_substitution/tests/TypeSubstitutionTests.java
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/anytype/tests/AnyTypeTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/anytype/tests/AnyTypeTests.java?rev=1819328&r1=1819327&r2=1819328&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/anytype/tests/AnyTypeTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/anytype/tests/AnyTypeTests.java
Wed Dec 27 10:31:03 2017
@@ -32,7 +32,7 @@ import javax.xml.ws.BindingProvider;
public class AnyTypeTests {
@ClassRule
- public static Axis2Server server = new Axis2Server("target/repo");
+ public static final Axis2Server server = new Axis2Server("target/repo");
@Test
public void testAnyTypeElementinWrappedWSDL(){
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/BareNoArgTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/BareNoArgTests.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/BareNoArgTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/BareNoArgTests.java
Wed Dec 27 10:31:03 2017
@@ -18,44 +18,46 @@
*/
package org.apache.axis2.jaxws.sample;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
import
org.apache.axis2.jaxws.sample.doclitbarenoarg.sei.BareDocLitNoArgService;
import
org.apache.axis2.jaxws.sample.doclitbarenoarg.sei.DocLitBareNoArgPortType;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
-import javax.xml.ws.BindingProvider;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
+import static org.junit.Assert.assertTrue;
-public class BareNoArgTests extends AbstractTestCase {
+import javax.xml.ws.BindingProvider;
- static final String ENDPOINT_URL =
-
"http://localhost:6060/axis2/services/BareDocLitNoArgService.DocLitBareNoArgPortTypeImplPort";
+public class BareNoArgTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
- public static Test suite() {
- return getTestSetup(new TestSuite(BareNoArgTests.class));
+ private static String getEndpoint() throws Exception {
+ return
server.getEndpoint("BareDocLitNoArgService.DocLitBareNoArgPortTypeImplPort");
}
-
- public void testTwoWayEmpty_With_SOAPACTION() {
+
+ @Test
+ public void testTwoWayEmpty_With_SOAPACTION() throws Exception {
BareDocLitNoArgService service = new BareDocLitNoArgService();
DocLitBareNoArgPortType proxy = service.getBareDocLitNoArgPort();
BindingProvider p = (BindingProvider) proxy;
p.getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY,
Boolean.TRUE);
p.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY,
"twoWayEmpty");
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
ENDPOINT_URL);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
getEndpoint());
String response = proxy.twoWayEmpty();
assertTrue("Did not receive expected response value",
"org.apache.axis2.jaxws.sample.doclitbarenoarg.DocLitBareNoArgPortTypeImpl.twoWayEmpty".equals(response));
}
- public void testTwoWayEmpty_No_SOAPACTION() {
+ @Test
+ public void testTwoWayEmpty_No_SOAPACTION() throws Exception {
BareDocLitNoArgService service = new BareDocLitNoArgService();
DocLitBareNoArgPortType proxy = service.getBareDocLitNoArgPort();
BindingProvider p = (BindingProvider) proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
ENDPOINT_URL);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
getEndpoint());
String response = proxy.twoWayEmpty();
assertTrue("Did not receive expected response value",
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/BareTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/BareTests.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/BareTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/BareTests.java
Wed Dec 27 10:31:03 2017
@@ -22,32 +22,32 @@
*/
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.marshaller.impl.alt.MethodMarshallerUtils;
import org.apache.axis2.jaxws.sample.doclitbare.sei.BareDocLitService;
import org.apache.axis2.jaxws.sample.doclitbare.sei.DocLitBarePortType;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
-import javax.xml.ws.BindingProvider;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
-public class BareTests extends AbstractTestCase {
+import javax.xml.ws.BindingProvider;
- static final String ENDPOINT_URL =
-
"http://localhost:6060/axis2/services/BareDocLitService.DocLitBarePortTypeImplPort";
+public class BareTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
// String containing some characters that require XML encoding
private static String XMLCHARS = ">><<<3>>>3>>>3";
-
- public static Test suite() {
- return getTestSetup(new TestSuite(BareTests.class));
+
+ private static String getEndpoint() throws Exception {
+ return
server.getEndpoint("BareDocLitService.DocLitBarePortTypeImplPort");
}
+ @Test
public void testEchoString() throws Exception {
TestLogger.logger.debug("------------------------------");
- TestLogger.logger.debug("Test : " + getName());
-
BareDocLitService service = new BareDocLitService();
DocLitBarePortType proxy = service.getBareDocLitPort();
@@ -56,7 +56,7 @@ public class BareTests extends AbstractT
BindingProvider.SOAPACTION_USE_PROPERTY,
Boolean.TRUE);
p.getRequestContext().put(
BindingProvider.SOAPACTION_URI_PROPERTY,
"echoString");
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
ENDPOINT_URL);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
getEndpoint());
String request = "Hello World";
String response = proxy.echoString(request);
@@ -70,9 +70,9 @@ public class BareTests extends AbstractT
}
+ @Test
public void testEchoString_xmlencode() throws Exception {
TestLogger.logger.debug("------------------------------");
- TestLogger.logger.debug("Test : " + getName());
BareDocLitService service = new BareDocLitService();
DocLitBarePortType proxy = service.getBareDocLitPort();
@@ -81,7 +81,7 @@ public class BareTests extends AbstractT
BindingProvider.SOAPACTION_USE_PROPERTY,
Boolean.TRUE);
p.getRequestContext().put(
BindingProvider.SOAPACTION_URI_PROPERTY,
"echoString");
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
ENDPOINT_URL);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
getEndpoint());
String request = XMLCHARS;
String response = proxy.echoString(request);
@@ -95,9 +95,9 @@ public class BareTests extends AbstractT
}
+ @Test
public void testTwoWaySync(){
TestLogger.logger.debug("------------------------------");
- TestLogger.logger.debug("Test : " + getName());
try{
@@ -108,7 +108,7 @@ public class BareTests extends AbstractT
BindingProvider.SOAPACTION_USE_PROPERTY,
Boolean.TRUE);
p.getRequestContext().put(
BindingProvider.SOAPACTION_URI_PROPERTY,
"twoWaySimple");
-
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
ENDPOINT_URL);
+
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
getEndpoint());
String response = proxy.twoWaySimple(10);
TestLogger.logger.debug("Sync Response =" + response);
@@ -124,16 +124,16 @@ public class BareTests extends AbstractT
}
}
+ @Test
public void testTwoWaySyncWithBodyRouting(){
TestLogger.logger.debug("------------------------------");
- TestLogger.logger.debug("Test : " + getName());
try{
BareDocLitService service = new BareDocLitService();
DocLitBarePortType proxy = service.getBareDocLitPort();
BindingProvider p = (BindingProvider) proxy;
-
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
ENDPOINT_URL);
+
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
getEndpoint());
String response = proxy.twoWaySimple(10);
TestLogger.logger.debug("Sync Response =" + response);
@@ -149,9 +149,9 @@ public class BareTests extends AbstractT
}
}
+ @Test
public void testOneWayEmpty(){
TestLogger.logger.debug("------------------------------");
- TestLogger.logger.debug("Test : " + getName());
try{
@@ -164,7 +164,7 @@ public class BareTests extends AbstractT
p.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY,
"oneWayEmpty");
p.getRequestContext().put(
-
BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ENDPOINT_URL);
+
BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
proxy.oneWayEmpty();
// Try the call again
@@ -177,10 +177,9 @@ public class BareTests extends AbstractT
}
}
+ @Test
public void testHeader() throws Exception {
TestLogger.logger.debug("------------------------------");
- TestLogger.logger.debug("Test : " + getName());
-
BareDocLitService service = new BareDocLitService();
DocLitBarePortType proxy = service.getBareDocLitPort();
@@ -189,7 +188,7 @@ public class BareTests extends AbstractT
BindingProvider.SOAPACTION_USE_PROPERTY,
Boolean.TRUE);
p.getRequestContext().put(
BindingProvider.SOAPACTION_URI_PROPERTY,
"headerTest");
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
ENDPOINT_URL);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
getEndpoint());
String request = "Hello World";
String response = proxy.headerTest(1, request);
@@ -206,10 +205,9 @@ public class BareTests extends AbstractT
}
+ @Test
public void testHeaderWithNull() throws Exception {
TestLogger.logger.debug("------------------------------");
- TestLogger.logger.debug("Test : " + getName());
-
BareDocLitService service = new BareDocLitService();
DocLitBarePortType proxy = service.getBareDocLitPort();
@@ -218,7 +216,7 @@ public class BareTests extends AbstractT
BindingProvider.SOAPACTION_USE_PROPERTY,
Boolean.TRUE);
p.getRequestContext().put(
BindingProvider.SOAPACTION_URI_PROPERTY,
"headerTest");
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
ENDPOINT_URL);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
getEndpoint());
// Don't write a header element when the @WebParam header parameter is
null.
p.getRequestContext().put(org.apache.axis2.jaxws.Constants.WRITE_HEADER_ELEMENT_IF_NULL,
Boolean.FALSE);
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/DocLitBareMinTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/DocLitBareMinTests.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/DocLitBareMinTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/DocLitBareMinTests.java
Wed Dec 27 10:31:03 2017
@@ -22,33 +22,31 @@
*/
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.doclitbaremin.sei.BareDocLitMinService;
import org.apache.axis2.jaxws.sample.doclitbaremin.sei.DocLitBareMinPortType;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
-import javax.xml.ws.BindingProvider;
+import static org.junit.Assert.assertTrue;
+import javax.xml.ws.BindingProvider;
-public class DocLitBareMinTests extends AbstractTestCase {
- String axisEndpoint =
"http://localhost:6060/axis2/services/DocLitBareMinPortTypeImplService.DocLitBareMinPortTypeImplPort";
+public class DocLitBareMinTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
- public static Test suite() {
- return getTestSetup(new TestSuite(DocLitBareMinTests.class));
- }
-
-
+ @Test
public void testEcho() throws Exception {
TestLogger.logger.debug("------------------------------");
- TestLogger.logger.debug("Test : " + getName());
BareDocLitMinService service = new BareDocLitMinService();
DocLitBareMinPortType proxy = service.getBareDocLitMinPort();
BindingProvider p = (BindingProvider) proxy;
- p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+
server.getEndpoint("DocLitBareMinPortTypeImplService.DocLitBareMinPortTypeImplPort"));
p.getRequestContext().put(
BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
p.getRequestContext().put(
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/FaultsServiceTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/FaultsServiceTests.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/FaultsServiceTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/FaultsServiceTests.java
Wed Dec 27 10:31:03 2017
@@ -22,10 +22,7 @@
*/
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.faultsservice.BaseFault_Exception;
import org.apache.axis2.jaxws.sample.faultsservice.ComplexFault_Exception;
import org.apache.axis2.jaxws.sample.faultsservice.DerivedFault1_Exception;
@@ -34,40 +31,47 @@ import org.apache.axis2.jaxws.sample.fau
import org.apache.axis2.jaxws.sample.faultsservice.FaultsServicePortType;
import
org.apache.axis2.jaxws.sample.faultsservice.InvalidTickerFault_Exception;
import org.apache.axis2.jaxws.sample.faultsservice.SimpleFault;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
import org.test.polymorphicfaults.BaseFault;
import org.test.polymorphicfaults.ComplexFault;
import org.test.polymorphicfaults.DerivedFault1;
import org.test.polymorphicfaults.DerivedFault2;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.fail;
+
import javax.xml.soap.DetailEntry;
import javax.xml.soap.SOAPFault;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.soap.SOAPFaultException;
-public class FaultsServiceTests extends AbstractTestCase {
-
- String axisEndpoint =
"http://localhost:6060/axis2/services/FaultsService.FaultsPort";
-
- public static Test suite() {
- return getTestSetup(new TestSuite(FaultsServiceTests.class));
- }
+public class FaultsServiceTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
/**
* Utility method to get the proxy
* @return proxy
*/
- private FaultsServicePortType getProxy() {
+ private FaultsServicePortType getProxy() throws Exception {
FaultsService service = new FaultsService();
FaultsServicePortType proxy = service.getFaultsPort();
BindingProvider p = (BindingProvider)proxy;
-
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,axisEndpoint);
+ p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+ server.getEndpoint("FaultsService.FaultsPort"));
return proxy;
}
/**
* Tests that that BaseFault is thrown
*/
- public void testFaultsService0() {
+ @Test
+ public void testFaultsService0() throws Exception {
Exception exception = null;
FaultsServicePortType proxy = getProxy();
try{
@@ -113,7 +117,8 @@ public class FaultsServiceTests extends
/**
* Tests that that BaseFault (DerivedFault1) is thrown
*/
- public void testFaultsService1() {
+ @Test
+ public void testFaultsService1() throws Exception {
FaultsServicePortType proxy = getProxy();
Exception exception = null;
try{
@@ -161,7 +166,8 @@ public class FaultsServiceTests extends
/**
* Tests that that BaseFault (DerivedFault1) is thrown
*/
- public void testFaultsService2() {
+ @Test
+ public void testFaultsService2() throws Exception {
FaultsServicePortType proxy = getProxy();
Exception exception = null;
try{
@@ -183,7 +189,7 @@ public class FaultsServiceTests extends
DerivedFault2 df = (DerivedFault2) fault;
assertEquals(2, df.getA());
assertEquals("DerivedFault2", df.getB());
- assertEquals(2F, df.getC());
+ assertEquals(2F, df.getC(), 0.0F);
// Repeat to verify behavior
try{
@@ -205,13 +211,14 @@ public class FaultsServiceTests extends
df = (DerivedFault2) fault;
assertEquals(2, df.getA());
assertEquals("DerivedFault2", df.getB());
- assertEquals(2F, df.getC());
+ assertEquals(2F, df.getC(), 0.0F);
}
/**
* Tests that that ComplxFaultFault is thrown
*/
- public void testFaultsService3(){
+ @Test
+ public void testFaultsService3() throws Exception {
FaultsServicePortType proxy = getProxy();
Exception exception = null;
try{
@@ -234,7 +241,7 @@ public class FaultsServiceTests extends
ComplexFault cf = (ComplexFault) fault;
assertEquals(2, cf.getA());
assertEquals("Complex", cf.getB());
- assertEquals(2F, cf.getC());
+ assertEquals(2F, cf.getC(), 0.0F);
assertEquals(5, cf.getD());
@@ -259,7 +266,7 @@ public class FaultsServiceTests extends
cf = (ComplexFault) fault;
assertEquals(2, cf.getA());
assertEquals("Complex", cf.getB());
- assertEquals(2F, cf.getC());
+ assertEquals(2F, cf.getC(), 0.0F);
assertEquals(5, cf.getD());
}
@@ -267,7 +274,8 @@ public class FaultsServiceTests extends
/**
* Tests that throwing of SimpleFault
*/
- public void testFaultsService4(){
+ @Test
+ public void testFaultsService4() throws Exception {
FaultsServicePortType proxy = getProxy();
Exception exception = null;
try{
@@ -307,7 +315,8 @@ public class FaultsServiceTests extends
* Test throwing legacy fault
* Disabled while I fix this test
*/
- public void testFaultsService5(){
+ @Test
+ public void testFaultsService5() throws Exception {
FaultsServicePortType proxy = getProxy();
Exception exception = null;
try{
@@ -343,7 +352,8 @@ public class FaultsServiceTests extends
/**
* Tests that throwing of BaseFault_Exception
*/
- public void testFaultsService6(){
+ @Test
+ public void testFaultsService6() throws Exception {
FaultsServicePortType proxy = getProxy();
Exception exception = null;
try{
@@ -379,7 +389,8 @@ public class FaultsServiceTests extends
/**
* Tests that throwing of DerivedFault1_Exception
*/
- public void testFaultsService7(){
+ @Test
+ public void testFaultsService7() throws Exception {
FaultsServicePortType proxy = getProxy();
Exception exception = null;
try{
@@ -417,7 +428,8 @@ public class FaultsServiceTests extends
/**
* Tests that throwing of DerivedFault1_Exception
*/
- public void testFaultsService8(){
+ @Test
+ public void testFaultsService8() throws Exception {
FaultsServicePortType proxy = getProxy();
Exception exception = null;
try{
@@ -431,7 +443,7 @@ public class FaultsServiceTests extends
assertNotNull(faultInfo);
assertEquals(200, faultInfo.getA());
assertEquals("DF2", faultInfo.getB());
- assertEquals(80.0F, faultInfo.getC());
+ assertEquals(80.0F, faultInfo.getC(), 0.0F);
} catch (Exception e) {
fail("Wrong exception thrown. Expected DerivedFault1_Exception
but received " + e.getClass());
}
@@ -448,7 +460,7 @@ public class FaultsServiceTests extends
assertNotNull(faultInfo);
assertEquals(200, faultInfo.getA());
assertEquals("DF2", faultInfo.getB());
- assertEquals(80.0F, faultInfo.getC());
+ assertEquals(80.0F, faultInfo.getC(), 0.0F);
} catch (Exception e) {
fail("Wrong exception thrown. Expected DerivedFault1_Exception
but received " + e.getClass());
}
@@ -457,7 +469,8 @@ public class FaultsServiceTests extends
/**
* Tests that that SOAPFaultException is thrown
*/
- public void testFaultsService9a(){
+ @Test
+ public void testFaultsService9a() throws Exception {
FaultsServicePortType proxy = getProxy();
Exception exception = null;
try{
@@ -511,7 +524,8 @@ public class FaultsServiceTests extends
/**
* Tests that that SOAPFaultException is thrown
*/
- public void testFaultsService9b(){
+ @Test
+ public void testFaultsService9b() throws Exception {
FaultsServicePortType proxy = getProxy();
Exception exception = null;
try{
@@ -575,7 +589,8 @@ public class FaultsServiceTests extends
/**
* Tests that that SOAPFaultException (NPE) is thrown
*/
- public void testFaultsService10(){
+ @Test
+ public void testFaultsService10() throws Exception {
FaultsServicePortType proxy = getProxy();
Exception exception = null;
try{
@@ -625,7 +640,8 @@ public class FaultsServiceTests extends
/**
* Tests that that SOAPFaultException (NPE) is thrown
*/
- public void testFaultsService10a(){
+ @Test
+ public void testFaultsService10a() throws Exception {
FaultsServicePortType proxy = getProxy();
Exception exception = null;
try{
@@ -676,7 +692,8 @@ public class FaultsServiceTests extends
/**
* Tests that that SOAPFaultException (for WebServiceException) is thrown
*/
- public void testFaultsService11(){
+ @Test
+ public void testFaultsService11() throws Exception {
FaultsServicePortType proxy = getProxy();
Exception exception = null;
try{
@@ -728,18 +745,19 @@ public class FaultsServiceTests extends
/**
* Tests Resource injection
*/
+ @Test
public void testResourceInjection() throws Exception {
FaultsServicePortType proxy = getProxy();
float total = proxy.getQuote("INJECTION");
// If resource injection occurred properly, then the a value of
1234567 is expected
- assertEquals("Resource Injection Failed", 1234567F, total);
+ assertEquals("Resource Injection Failed", 1234567F, total, 0.0F);
// Repeat to verify behavior
total = proxy.getQuote("INJECTION");
// If resource injection occurred properly, then the a value of
1234567 is expected
- assertEquals("Resource Injection Failed", 1234567F, total);
+ assertEquals("Resource Injection Failed", 1234567F, total, 0.0F);
}
}
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/HeadersHandlerTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/HeadersHandlerTests.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/HeadersHandlerTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/HeadersHandlerTests.java
Wed Dec 27 10:31:03 2017
@@ -18,6 +18,10 @@
*/
package org.apache.axis2.jaxws.sample;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
@@ -37,40 +41,39 @@ import javax.xml.ws.Response;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.handler.Handler;
-import junit.framework.Test;
-import junit.framework.TestSuite;
import org.apache.axis2.jaxws.TestLogger;
import org.apache.axis2.Constants;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
import
org.apache.axis2.jaxws.sample.headershandler.HeadersClientTrackerHandler;
import org.apache.axis2.jaxws.sample.headershandler.HeadersHandlerPortType;
import org.apache.axis2.jaxws.sample.headershandler.HeadersHandlerService;
import org.apache.axis2.jaxws.sample.headershandler.TestHeaders;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Test;
import org.test.headershandler.HeadersHandlerResponse;
/**
* @author rott
*
*/
-public class HeadersHandlerTests extends AbstractTestCase {
+public class HeadersHandlerTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
- String axisEndpoint =
"http://localhost:6060/axis2/services/HeadersHandlerService.HeadersHandlerPortTypeImplPort";
-
private static final String filelogname = "target/HeadersHandlerTests.log";
- public static Test suite() {
- return getTestSetup(new TestSuite(HeadersHandlerTests.class));
- }
-
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
deleteFile();
- super.setUp();
}
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
//deleteFile();
- super.tearDown();
}
private void deleteFile() throws Exception {
@@ -78,18 +81,20 @@ public class HeadersHandlerTests extends
file.delete(); // yes, delete for each retrieval, which should only
happen once per test
}
+ private static String getEndpoint() throws Exception {
+ return
server.getEndpoint("HeadersHandlerService.HeadersHandlerPortTypeImplPort");
+ }
-
+ @Test
public void testHeadersHandler() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
HeadersHandlerService service = new HeadersHandlerService();
HeadersHandlerPortType proxy = service.getHeadersHandlerPort();
BindingProvider p = (BindingProvider) proxy;
Map<String, Object> requestCtx = p.getRequestContext();
- requestCtx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
axisEndpoint);
+ requestCtx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
getEndpoint());
/*
* add several headers by way of HeadersAdapter property
@@ -212,16 +217,16 @@ public class HeadersHandlerTests extends
TestLogger.logger.debug("----------------------------------");
}
+ @Test
public void testHeadersHandlerAsyncCallback() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
HeadersHandlerService service = new HeadersHandlerService();
HeadersHandlerPortType proxy = service.getHeadersHandlerPort();
BindingProvider p = (BindingProvider) proxy;
Map<String, Object> requestCtx = p.getRequestContext();
- requestCtx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
axisEndpoint);
+ requestCtx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
getEndpoint());
/*
* add several headers by way of HeadersAdapter property
@@ -350,16 +355,16 @@ public class HeadersHandlerTests extends
TestLogger.logger.debug("----------------------------------");
}
- public void testHeadersHandlerServerInboundFault() {
+ @Test
+ public void testHeadersHandlerServerInboundFault() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
HeadersHandlerService service = new HeadersHandlerService();
HeadersHandlerPortType proxy = service.getHeadersHandlerPort();
BindingProvider p = (BindingProvider) proxy;
Map<String, Object> requestCtx = p.getRequestContext();
- requestCtx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
axisEndpoint);
+ requestCtx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
getEndpoint());
/*
* add several headers by way of HeadersAdapter property
@@ -501,16 +506,17 @@ public class HeadersHandlerTests extends
* When the response flow is fixed, remove this comment, and remove the
'_' from the
* test method name to enable it.
*/
- public void _testHeadersHandlerServerInboundFlowReversal() {
+ @Ignore
+ @Test
+ public void testHeadersHandlerServerInboundFlowReversal() throws Exception
{
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
HeadersHandlerService service = new HeadersHandlerService();
HeadersHandlerPortType proxy = service.getHeadersHandlerPort();
BindingProvider p = (BindingProvider) proxy;
Map<String, Object> requestCtx = p.getRequestContext();
- requestCtx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
axisEndpoint);
+ requestCtx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
getEndpoint());
/*
* add several headers by way of HeadersAdapter property
@@ -641,9 +647,9 @@ public class HeadersHandlerTests extends
* use it as an alternative to SAAJ. We have protection built in to
prevent handler
* implementations from doing both. This method tests for that.
*/
+ @Test
public void testHeadersHandlerTracker() {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
try {
HeadersHandlerService service = new HeadersHandlerService();
@@ -656,7 +662,7 @@ public class HeadersHandlerTests extends
p.getBinding().setHandlerChain(handlers);
Map<String, Object> requestCtx = p.getRequestContext();
- requestCtx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
axisEndpoint);
+ requestCtx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
getEndpoint());
int total = proxy.headersHandler(1, 1);
fail("Should have received a WebServiceException, but did not.");
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/MTOMFeatureTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/MTOMFeatureTests.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/MTOMFeatureTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/MTOMFeatureTests.java
Wed Dec 27 10:31:03 2017
@@ -19,9 +19,12 @@
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.io.BufferedInputStream;
import java.io.File;
-import java.util.List;
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
@@ -36,38 +39,41 @@ import javax.xml.ws.Service.Mode;
import javax.xml.ws.soap.MTOMFeature;
import javax.xml.ws.soap.SOAPBinding;
-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.mtomfeature.ObjectFactory;
import org.apache.axis2.jaxws.sample.mtomfeature.ProcessDocumentDelegate;
import org.apache.axis2.jaxws.sample.mtomfeature.ProcessDocumentService;
import org.apache.axis2.jaxws.sample.mtomfeature.SendPDFFile;
import org.apache.axis2.jaxws.sample.mtomfeature.SendPDFFileResponse;
import org.apache.axis2.jaxws.spi.Binding;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
+
+public class MTOMFeatureTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
-public class MTOMFeatureTests extends AbstractTestCase {
- private static final String axisEndpoint =
"http://localhost:6060/axis2/services/ProcessDocumentService.ProcessDocumentPortBindingImplPort";
private static final QName serviceName = new
QName("http://mtomfeature.sample.jaxws.axis2.apache.org/",
"ProcessDocumentService");
private static final QName portName = new
QName("http://mtomfeature.sample.jaxws.axis2.apache.org/",
"ProcessDocumentPort");
String resourceDir = System.getProperty("basedir",".")+
File.separator+"test-resources"+File.separator+"pdf";
- public static Test suite() {
- return getTestSetup(new TestSuite(MTOMFeatureTests.class));
+
+ private static String getEndpoint() throws Exception {
+ return
server.getEndpoint("ProcessDocumentService.ProcessDocumentPortBindingImplPort");
}
+
+ @Test
public void testMTOMFeatureProxy(){
try{
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
MTOMFeature mtomFeature = new MTOMFeature(true, 1);
ProcessDocumentService service = new ProcessDocumentService();
ProcessDocumentDelegate proxy =
service.getProcessDocumentPort(mtomFeature);
BindingProvider bp = (BindingProvider)proxy;
-
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
axisEndpoint);
+
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
getEndpoint());
Binding b =(Binding) bp.getBinding();
WebServiceFeature wsFeature = b.getFeature(MTOMFeature.ID);
@@ -99,16 +105,16 @@ public class MTOMFeatureTests extends Ab
}
}
+ @Test
public void testMTOMFeatureDispatch(){
try{
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
MTOMFeature mtomFeature = new MTOMFeature(true, 1);
//Create the necessary JAXBContext
JAXBContext jbc =
JAXBContext.newInstance("org.apache.axis2.jaxws.sample.mtomfeature");
// Create the JAX-WS client needed to send the request
Service service = Service.create(serviceName);
- service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
axisEndpoint);
+ service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
getEndpoint());
Dispatch<Object> dispatch = service.createDispatch(portName, jbc,
Mode.PAYLOAD, mtomFeature);
ObjectFactory of = new ObjectFactory();
SendPDFFile pdf = of.createSendPDFFile();
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/MtomSampleByteArrayTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/MtomSampleByteArrayTests.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/MtomSampleByteArrayTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/MtomSampleByteArrayTests.java
Wed Dec 27 10:31:03 2017
@@ -19,15 +19,16 @@
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.mtom1.Base64Binary;
import org.apache.axis2.jaxws.sample.mtom1.ImageDepot;
import org.apache.axis2.jaxws.sample.mtom1.Invoke;
import org.apache.axis2.jaxws.sample.mtom1.ObjectFactory;
import org.apache.axis2.jaxws.sample.mtom1.SendImageResponse;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Test;
import javax.imageio.ImageIO;
import javax.xml.bind.JAXBContext;
@@ -35,33 +36,39 @@ import javax.xml.namespace.QName;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;
import javax.xml.ws.soap.SOAPBinding;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.awt.*;
import java.io.File;
-public class MtomSampleByteArrayTests extends AbstractTestCase {
+public class MtomSampleByteArrayTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
private static final QName QNAME_SERVICE = new
QName("urn://mtom1.sample.jaxws.axis2.apache.org", "SendImageService");
private static final QName QNAME_PORT = new
QName("urn://mtom1.sample.jaxws.axis2.apache.org", "sendImageSoap");
- private static final String URL_ENDPOINT =
"http://localhost:6060/axis2/services/SendImageService.sendImagePort";
private static final String IMAGE_DIR =
System.getProperty("basedir",".")+File.separator+"test-resources"+File.separator+"image";
- public static Test suite() {
- return getTestSetup(new TestSuite(MtomSampleByteArrayTests.class));
+ private static String getEndpoint() throws Exception {
+ return server.getEndpoint("SendImageService.sendImagePort");
}
-
+
/*
* Enable attachment Optimization through the SOAPBinding method
* -- setMTOMEnabled([true|false])
* Using SOAP11
*/
- public void _testAttachmentByteArrayAPI11() throws Exception {
+ @Ignore
+ @Test
+ public void testAttachmentByteArrayAPI11() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
String imageResourceDir = IMAGE_DIR;
Service svc = Service.create(QNAME_SERVICE);
- svc.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_BINDING, URL_ENDPOINT);
+ svc.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_BINDING, getEndpoint());
JAXBContext jbc =
JAXBContext.newInstance("org.apache.axis2.jaxws.sample.mtom1");
Dispatch<Object> dispatch = svc.createDispatch(QNAME_PORT, jbc,
Service.Mode.PAYLOAD);
@@ -98,14 +105,14 @@ public class MtomSampleByteArrayTests ex
* -- setMTOMEnabled([true|false])
* Using SOAP11
*/
+ @Test
public void testAttachmentByteArrayAPI11_ClientSendsNonOptimizedMTOM()
throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
String imageResourceDir = IMAGE_DIR;
Service svc = Service.create(QNAME_SERVICE);
- svc.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_BINDING, URL_ENDPOINT);
+ svc.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_BINDING, getEndpoint());
JAXBContext jbc =
JAXBContext.newInstance("org.apache.axis2.jaxws.sample.mtom1");
Dispatch<Object> dispatch = svc.createDispatch(QNAME_PORT, jbc,
Service.Mode.PAYLOAD);
@@ -141,15 +148,15 @@ public class MtomSampleByteArrayTests ex
* Enable attachment optimization using the SOAP11 binding
* property for MTOM.
*/
+ @Test
public void testAttachmentByteArrayProperty11() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
String imageResourceDir = IMAGE_DIR;
Service svc = Service.create(QNAME_SERVICE);
- svc.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_MTOM_BINDING,
URL_ENDPOINT);
+ svc.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_MTOM_BINDING,
getEndpoint());
JAXBContext jbc =
JAXBContext.newInstance("org.apache.axis2.jaxws.sample.mtom1");
Dispatch<Object> dispatch = svc.createDispatch(QNAME_PORT, jbc,
Service.Mode.PAYLOAD);
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/MtomSampleTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/MtomSampleTests.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/MtomSampleTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/MtomSampleTests.java
Wed Dec 27 10:31:03 2017
@@ -19,15 +19,12 @@
package org.apache.axis2.jaxws.sample;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
import org.apache.axis2.datasource.jaxb.JAXBAttachmentUnmarshallerMonitor;
import org.apache.axis2.jaxws.TestLogger;
-import org.apache.axis2.jaxws.framework.AbstractTestCase;
import org.apache.axis2.jaxws.provider.DataSourceImpl;
-import org.apache.axis2.util.Utils;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Test;
import org.test.mtom.ImageDepot;
import org.test.mtom.ObjectFactory;
import org.test.mtom.SendImage;
@@ -49,44 +46,33 @@ import javax.xml.ws.soap.MTOMFeature;
import javax.xml.ws.soap.SOAPBinding;
import javax.xml.ws.soap.SOAPFaultException;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import java.awt.Image;
import java.io.File;
import java.util.List;
-public class MtomSampleTests extends AbstractTestCase {
+public class MtomSampleTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
private static final QName QNAME_SERVICE = new
QName("urn://mtom.test.org", "MtomSampleService");
private static final QName QNAME_PORT = new
QName("urn://mtom.test.org", "MtomSample");
- private static final String URL_ENDPOINT =
"http://localhost:6060/axis2/services/MtomSampleService.MtomSampleServicePort";
-
- private static final String URL_ENDPOINT_MTOMDISABLE =
-
"http://localhost:6060/axis2/services/MtomSampleMTOMDisableService.MtomSampleMTOMDisableServicePort";
- private static final String URL_ENDPOINT_MTOMDISABLE2 =
-
"http://localhost:6060/axis2/services/MtomSampleMTOMDisable2Service.MtomSampleMTOMDisable2ServicePort";
- private static final String URL_ENDPOINT_MTOMENABLE =
-
"http://localhost:6060/axis2/services/MtomSampleMTOMEnableService.MtomSampleMTOMEnableServicePort";
- private static final String URL_ENDPOINT_MTOMDEFAULT =
-
"http://localhost:6060/axis2/services/MtomSampleMTOMDefaultService.MtomSampleMTOMDefaultServicePort";
- private static final String URL_ENDPOINT_MTOMTHRESHOLD =
-
"http://localhost:6060/axis2/services/MtomSampleMTOMThresholdService.MtomSampleMTOMThresholdServicePort";
-
private static final String IMAGE_DIR =
System.getProperty("basedir",".")+"/"+"test-resources"+File.separator+"image";
private static boolean CHECK_VERSIONMISMATCH = true;
- public static Test suite() {
- return getTestSetup(new TestSuite(MtomSampleTests.class));
- }
-
/*
* Enable attachment Optimization through the SOAPBinding method
* -- setMTOMEnabled([true|false])
* Using SOAP11
*/
+ @Test
public void testSendImageAttachmentAPI11() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
String imageResourceDir = IMAGE_DIR;
@@ -111,7 +97,8 @@ public class MtomSampleTests extends Abs
// Create the JAX-WS client needed to send the request
Service service = Service.create(QNAME_SERVICE);
- service.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_BINDING,
URL_ENDPOINT);
+ service.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_BINDING,
+ server.getEndpoint("MtomSampleService.MtomSampleServicePort"));
Dispatch<Object> dispatch = service.createDispatch(QNAME_PORT, jbc,
Mode.PAYLOAD);
//Enable attachment optimization
@@ -134,9 +121,9 @@ public class MtomSampleTests extends Abs
* Enable attachment Optimization through the MTOMFeature
* Using SOAP11
*/
+ @Test
public void testSendImageFeature11() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
String imageResourceDir = IMAGE_DIR;
@@ -163,7 +150,8 @@ public class MtomSampleTests extends Abs
// Create the JAX-WS client needed to send the request
Service service = Service.create(QNAME_SERVICE);
- service.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_BINDING,
URL_ENDPOINT);
+ service.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_BINDING,
+ server.getEndpoint("MtomSampleService.MtomSampleServicePort"));
Dispatch<Object> dispatch = service.createDispatch(QNAME_PORT, jbc,
Mode.PAYLOAD, mtom21);
List cids = null;
@@ -212,9 +200,9 @@ public class MtomSampleTests extends Abs
/*
* Enable attachment Optimization but call an endpoint with
@MTOM(enable=false)
*/
+ @Test
public void testSendImage_MTOMDisable() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
String imageResourceDir = IMAGE_DIR;
@@ -241,7 +229,8 @@ public class MtomSampleTests extends Abs
// Create the JAX-WS client needed to send the request
Service service = Service.create(QNAME_SERVICE);
- service.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_BINDING,
URL_ENDPOINT_MTOMDISABLE);
+ service.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_BINDING,
+
server.getEndpoint("MtomSampleMTOMDisableService.MtomSampleMTOMDisableServicePort"));
Dispatch<Object> dispatch = service.createDispatch(QNAME_PORT, jbc,
Mode.PAYLOAD, mtom21);
List cids = null;
@@ -292,9 +281,9 @@ public class MtomSampleTests extends Abs
* Enable attachment Optimization but call an endpoint with
@MTOM(enable=false)
* which should override the MTOM BindingType
*/
+ @Test
public void testSendImage_MTOMDisable2() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
String imageResourceDir = IMAGE_DIR;
@@ -321,7 +310,8 @@ public class MtomSampleTests extends Abs
// Create the JAX-WS client needed to send the request
Service service = Service.create(QNAME_SERVICE);
- service.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_BINDING,
URL_ENDPOINT_MTOMDISABLE2);
+ service.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_BINDING,
+
server.getEndpoint("MtomSampleMTOMDisable2Service.MtomSampleMTOMDisable2ServicePort"));
Dispatch<Object> dispatch = service.createDispatch(QNAME_PORT, jbc,
Mode.PAYLOAD, mtom21);
List cids = null;
@@ -371,9 +361,9 @@ public class MtomSampleTests extends Abs
/*
* Enable attachment Optimization but call an endpoint with
@MTOM(enable=true)
*/
+ @Test
public void testSendImage_MTOMEnable() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
String imageResourceDir = IMAGE_DIR;
@@ -400,7 +390,8 @@ public class MtomSampleTests extends Abs
// Create the JAX-WS client needed to send the request
Service service = Service.create(QNAME_SERVICE);
- service.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_BINDING,
URL_ENDPOINT_MTOMENABLE);
+ service.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_BINDING,
+
server.getEndpoint("MtomSampleMTOMEnableService.MtomSampleMTOMEnableServicePort"));
Dispatch<Object> dispatch = service.createDispatch(QNAME_PORT, jbc,
Mode.PAYLOAD, mtom21);
List cids = null;
@@ -449,9 +440,9 @@ public class MtomSampleTests extends Abs
/*
* Enable attachment Optimization but call an endpoint with @MTOM
*/
+ @Test
public void testSendImage_MTOMDefault() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
String imageResourceDir = IMAGE_DIR;
@@ -478,7 +469,8 @@ public class MtomSampleTests extends Abs
// Create the JAX-WS client needed to send the request
Service service = Service.create(QNAME_SERVICE);
- service.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_BINDING,
URL_ENDPOINT_MTOMDEFAULT);
+ service.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_BINDING,
+
server.getEndpoint("MtomSampleMTOMDefaultService.MtomSampleMTOMDefaultServicePort"));
Dispatch<Object> dispatch = service.createDispatch(QNAME_PORT, jbc,
Mode.PAYLOAD, mtom21);
List cids = null;
@@ -529,9 +521,9 @@ public class MtomSampleTests extends Abs
* Enable attachment optimization using the SOAP11 binding
* property for MTOM.
*/
+ @Test
public void testSendImageAttachmentProperty11() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
String imageResourceDir = IMAGE_DIR;
@@ -557,7 +549,8 @@ public class MtomSampleTests extends Abs
// Create the JAX-WS client needed to send the request with soap 11
binding
// property for MTOM
Service service = Service.create(QNAME_SERVICE);
- service.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_MTOM_BINDING,
URL_ENDPOINT);
+ service.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_MTOM_BINDING,
+ server.getEndpoint("MtomSampleService.MtomSampleServicePort"));
Dispatch<Object> dispatch = service.createDispatch(QNAME_PORT, jbc,
Mode.PAYLOAD);
SendImageResponse response = (SendImageResponse)
dispatch.invoke(request);
@@ -576,9 +569,9 @@ public class MtomSampleTests extends Abs
* Enable attachment optimization using both the SOAP11 binding
* property for MTOM and the Binding API
*/
+ @Test
public void testSendImageAttachmentAPIProperty11() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
String imageResourceDir = IMAGE_DIR;
@@ -604,7 +597,8 @@ public class MtomSampleTests extends Abs
// Create the JAX-WS client needed to send the request with soap 11
binding
// property for MTOM
Service service = Service.create(QNAME_SERVICE);
- service.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_MTOM_BINDING,
URL_ENDPOINT);
+ service.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_MTOM_BINDING,
+ server.getEndpoint("MtomSampleService.MtomSampleServicePort"));
Dispatch<Object> dispatch = service.createDispatch(QNAME_PORT, jbc,
Mode.PAYLOAD);
@@ -631,9 +625,9 @@ public class MtomSampleTests extends Abs
* Sending SOAP12 message to SOAP11 endpoint will correctly result in
exception
*
*/
+ @Test
public void testSendImageAttachmentProperty12() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
String imageResourceDir = IMAGE_DIR;
@@ -659,7 +653,8 @@ public class MtomSampleTests extends Abs
// Create the JAX-WS client needed to send the request with soap 11
binding
// property for MTOM
Service service = Service.create(QNAME_SERVICE);
- service.addPort(QNAME_PORT, SOAPBinding.SOAP12HTTP_MTOM_BINDING,
URL_ENDPOINT);
+ service.addPort(QNAME_PORT, SOAPBinding.SOAP12HTTP_MTOM_BINDING,
+ server.getEndpoint("MtomSampleService.MtomSampleServicePort"));
Dispatch<Object> dispatch = service.createDispatch(QNAME_PORT, jbc,
Mode.PAYLOAD);
try {
@@ -720,9 +715,9 @@ public class MtomSampleTests extends Abs
* Sending SOAP12 message to SOAP11 endpoint will correctly result in
exception
*
*/
+ @Test
public void testSendImageAttachmentAPI12() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
String imageResourceDir = IMAGE_DIR;
@@ -748,7 +743,8 @@ public class MtomSampleTests extends Abs
// Create the JAX-WS client needed to send the request with soap 11
binding
// property for MTOM
Service service = Service.create(QNAME_SERVICE);
- service.addPort(QNAME_PORT, SOAPBinding.SOAP12HTTP_BINDING,
URL_ENDPOINT);
+ service.addPort(QNAME_PORT, SOAPBinding.SOAP12HTTP_BINDING,
+ server.getEndpoint("MtomSampleService.MtomSampleServicePort"));
Dispatch<Object> dispatch = service.createDispatch(QNAME_PORT, jbc,
Mode.PAYLOAD);
@@ -807,10 +803,9 @@ public class MtomSampleTests extends Abs
/*
* Enable attachment Optimization but call an endpoint with
@MTOM(enable=true, Threshold = 99000)
*/
-
+ @Test
public void testSendImage_setMTOMThreshold() throws Exception {
TestLogger.logger.debug("----------------------------------");
- TestLogger.logger.debug("test: " + getName());
System.out.println("testSendImage_setMTOMThreshold()");
String imageResourceDir = IMAGE_DIR;
@@ -837,7 +832,8 @@ public class MtomSampleTests extends Abs
MTOMFeature mtom21 = new MTOMFeature(true, threshold);
// Create the JAX-WS client needed to send the request
Service service = Service.create(QNAME_SERVICE);
- service.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_BINDING,
URL_ENDPOINT_MTOMTHRESHOLD);
+ service.addPort(QNAME_PORT, SOAPBinding.SOAP11HTTP_BINDING,
+
server.getEndpoint("MtomSampleMTOMThresholdService.MtomSampleMTOMThresholdServicePort"));
Dispatch<Object> dispatch = service.createDispatch(QNAME_PORT, jbc,
Mode.PAYLOAD, mtom21);
List cids = null;
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/NonWrapTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/NonWrapTests.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/NonWrapTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/src/test/java/org/apache/axis2/jaxws/sample/NonWrapTests.java
Wed Dec 27 10:31:03 2017
@@ -22,12 +22,13 @@
*/
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.nonwrap.sei.DocLitNonWrapPortType;
import org.apache.axis2.jaxws.sample.nonwrap.sei.DocLitNonWrapService;
+import org.apache.axis2.testutils.Axis2Server;
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Test;
import org.test.sample.nonwrap.ObjectFactory;
import org.test.sample.nonwrap.ReturnType;
import org.test.sample.nonwrap.TwoWay;
@@ -36,19 +37,23 @@ import org.test.sample.nonwrap.TwoWayHol
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Holder;
import javax.xml.ws.WebServiceException;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
import java.util.concurrent.Future;
-public class NonWrapTests extends AbstractTestCase {
+public class NonWrapTests {
+ @ClassRule
+ public static final Axis2Server server = new Axis2Server("target/repo");
- String axisEndpoint =
"http://localhost:6060/axis2/services/DocLitNonWrapService.DocLitNonWrapPortTypeImplPort";
-
- public static Test suite() {
- return getTestSetup(new TestSuite(NonWrapTests.class));
+ private static String getEndpoint() throws Exception {
+ return
server.getEndpoint("DocLitNonWrapService.DocLitNonWrapPortTypeImplPort");
}
-
+
+ @Test
public void testTwoWaySync(){
TestLogger.logger.debug("------------------------------");
- TestLogger.logger.debug("Test : " + getName());
try{
TwoWay twoWay = new ObjectFactory().createTwoWay();
twoWay.setTwowayStr("testing sync call for java bean non wrap
endpoint");
@@ -56,7 +61,7 @@ public class NonWrapTests extends Abstra
DocLitNonWrapPortType proxy = service.getDocLitNonWrapPort();
BindingProvider p = (BindingProvider)proxy;
-
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
axisEndpoint);
+
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
getEndpoint());
ReturnType returnValue = proxy.twoWay(twoWay);
TestLogger.logger.debug(returnValue.getReturnStr());
@@ -70,17 +75,18 @@ public class NonWrapTests extends Abstra
fail();
}
}
-
- public void _testTwoWaySyncNull() throws Exception{
+
+ @Ignore
+ @Test
+ public void testTwoWaySyncNull() throws Exception{
TestLogger.logger.debug("------------------------------");
- TestLogger.logger.debug("Test : " + getName());
try{
TwoWay twoWay = null; // This should cause an WebServiceException
DocLitNonWrapService service = new DocLitNonWrapService();
DocLitNonWrapPortType proxy = service.getDocLitNonWrapPort();
BindingProvider p = (BindingProvider)proxy;
-
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
axisEndpoint);
+
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
getEndpoint());
ReturnType returnValue = proxy.twoWay(twoWay);
@@ -105,9 +111,9 @@ public class NonWrapTests extends Abstra
}
}
+ @Test
public void testTwoWayASyncCallback(){
TestLogger.logger.debug("------------------------------");
- TestLogger.logger.debug("Test : " + getName());
try{
TwoWay twoWay = new ObjectFactory().createTwoWay();
twoWay.setTwowayStr("testing Async call for java bean non wrap
endpoint");
@@ -115,7 +121,7 @@ public class NonWrapTests extends Abstra
DocLitNonWrapPortType proxy = service.getDocLitNonWrapPort();
BindingProvider p = (BindingProvider)proxy;
-
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
axisEndpoint);
+
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
getEndpoint());
AsyncCallback callback = new AsyncCallback();
Future<?> monitor = proxy.twoWayAsync(twoWay, callback);
@@ -132,9 +138,9 @@ public class NonWrapTests extends Abstra
}
}
+ @Test
public void testTwoWayHolder(){
TestLogger.logger.debug("------------------------------");
- TestLogger.logger.debug("Test : " + getName());
try{
TwoWayHolder twh = new TwoWayHolder();
twh.setTwoWayHolderInt(new Integer(0));
@@ -146,7 +152,7 @@ public class NonWrapTests extends Abstra
DocLitNonWrapPortType proxy = service.getDocLitNonWrapPort();
BindingProvider p = (BindingProvider)proxy;
-
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
axisEndpoint);
+
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
getEndpoint());
proxy.twoWayHolder(holder);
twh = holder.value;
@@ -166,9 +172,9 @@ public class NonWrapTests extends Abstra
}
}
+ @Test
public void testTwoWayHolderAsync(){
TestLogger.logger.debug("------------------------------");
- TestLogger.logger.debug("Test : " + getName());
try{
TwoWayHolder twh = new TwoWayHolder();
twh.setTwoWayHolderInt(new Integer(0));
@@ -180,7 +186,7 @@ public class NonWrapTests extends Abstra
DocLitNonWrapPortType proxy = service.getDocLitNonWrapPort();
BindingProvider p = (BindingProvider)proxy;
-
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
axisEndpoint);
+
p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
getEndpoint());
AsyncCallback callback = new AsyncCallback();
Future<?> monitor =proxy.twoWayHolderAsync(twh, callback);