Author: veithen
Date: Sat Jan 14 18:57:49 2017
New Revision: 1778818
URL: http://svn.apache.org/viewvc?rev=1778818&view=rev
Log:
Introduce getEndpoint methods similar to Axis2Server.
Modified:
axis/axis2/java/rampart/trunk/modules/rampart-integration/src/main/java/org/apache/axis2/integration/JettyServer.java
axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java
Modified:
axis/axis2/java/rampart/trunk/modules/rampart-integration/src/main/java/org/apache/axis2/integration/JettyServer.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/rampart/trunk/modules/rampart-integration/src/main/java/org/apache/axis2/integration/JettyServer.java?rev=1778818&r1=1778817&r2=1778818&view=diff
==============================================================================
---
axis/axis2/java/rampart/trunk/modules/rampart-integration/src/main/java/org/apache/axis2/integration/JettyServer.java
(original)
+++
axis/axis2/java/rampart/trunk/modules/rampart-integration/src/main/java/org/apache/axis2/integration/JettyServer.java
Sat Jan 14 18:57:49 2017
@@ -27,6 +27,7 @@ import org.eclipse.jetty.webapp.WebAppCo
import org.junit.rules.ExternalResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.testutils.PortAllocator;
import org.apache.axis2.transport.http.AxisServlet;
@@ -230,4 +231,12 @@ public class JettyServer extends Externa
throw new IllegalStateException("Could not find Jetty http connector");
}
+
+ public String getEndpoint(String serviceName) {
+ return String.format("%s://localhost:%s/axis2/services/%s", secure ?
"https" : "http", getPort(), serviceName);
+ }
+
+ public EndpointReference getEndpointReference(String serviceName) {
+ return new EndpointReference(getEndpoint(serviceName));
+ }
}
Modified:
axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java?rev=1778818&r1=1778817&r2=1778818&view=diff
==============================================================================
---
axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java
(original)
+++
axis/axis2/java/rampart/trunk/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java
Sat Jan 14 18:57:49 2017
@@ -27,7 +27,6 @@ import org.apache.axiom.om.util.AXIOMUti
import org.apache.axiom.soap.SOAPHeaderBlock;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
-import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.context.ConfigurationContext;
@@ -104,17 +103,13 @@ public class RampartTest {
Options options = new Options();
if( i == 13 ) {
- options.setTo(new EndpointReference("https://localhost:" +
- secureServer.getPort() +
- "/axis2/services/SecureService" + i));
+
options.setTo(secureServer.getEndpointReference("SecureService" + i));
//Username token created with user/pass from options
options.setUserName("alice");
options.setPassword("password");
}
else {
- options.setTo(new EndpointReference("http://localhost:" +
- server.getPort() +
- "/axis2/services/SecureService" + i));
+ options.setTo(server.getEndpointReference("SecureService"
+ i));
}
System.out.println("Testing WS-Sec: custom scenario " + i);
@@ -180,17 +175,13 @@ public class RampartTest {
Options options = new Options();
if (i == 13) {
- options.setTo(new EndpointReference("https://localhost:" +
- secureServer.getPort() +
- "/axis2/services/SecureService" + i));
+
options.setTo(secureServer.getEndpointReference("SecureService" + i));
//Username token created with user/pass from options
options.setUserName("alice");
options.setPassword("password");
}
else {
- options.setTo(new EndpointReference("http://localhost:" +
- server.getPort() +
- "/axis2/services/SecureService" + i));
+ options.setTo(server.getEndpointReference("SecureService"
+ i));
}
System.out.println("Testing WS-Sec: negative scenario " + i);
options.setAction("urn:returnError");
@@ -215,10 +206,10 @@ public class RampartTest {
Options options = new Options();
if (i == 3 || i == 6) {
- options.setTo(new EndpointReference("https://localhost:" +
secureServer.getPort() + "/axis2/services/SecureServiceSC" + i));
+
options.setTo(secureServer.getEndpointReference("SecureServiceSC" + i));
}
else {
- options.setTo(new EndpointReference("http://localhost:" +
server.getPort() + "/axis2/services/SecureServiceSC" + i));
+
options.setTo(server.getEndpointReference("SecureServiceSC" + i));
}
System.out.println("Testing WS-SecConv: custom scenario " + i);