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/01/28 19:59:32 UTC

svn commit: r1780740 - in /axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration: ./ src/main/java/org/apache/rampart/ src/test/java/org/apache/rampart/

Author: veithen
Date: Sat Jan 28 19:59:32 2017
New Revision: 1780740

URL: http://svn.apache.org/viewvc?rev=1780740&view=rev
Log:
Use the existing ClientHelper in KerberosDelegationService.

Added:
    axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/KerberosDelegationService.java
      - copied, changed from r1780739, axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/main/java/org/apache/rampart/KerberosDelegationService.java
Removed:
    axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/main/java/org/apache/rampart/KerberosDelegationService.java
Modified:
    axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/pom.xml
    axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/RampartKerberosTest.java

Modified: axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/pom.xml?rev=1780740&r1=1780739&r2=1780740&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/pom.xml (original)
+++ axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/pom.xml Sat Jan 28 19:59:32 2017
@@ -163,7 +163,6 @@
 
                                 <copy overwrite="yes" file="target/classes/org/apache/rampart/Service.class" tofile="target/temp-ramp/org/apache/rampart/Service.class" />
                                 <copy overwrite="yes" file="target/classes/org/apache/rampart/PWCallback.class" tofile="target/temp-ramp/org/apache/rampart/PWCallback.class" />
-                                <copy overwrite="yes" file="target/classes/org/apache/rampart/KerberosDelegationService.class" tofile="target/temp-ramp/org/apache/rampart/KerberosDelegationService.class" />
                                 <copy overwrite="yes" file="target/classes/org/apache/rampart/KerberosDelegationServiceValidator.class" tofile="target/temp-ramp/org/apache/rampart/KerberosDelegationServiceValidator.class" />
                                 <copy overwrite="yes" file="src/test/resources/rampart/store.jks" tofile="target/temp-ramp/store.jks" />
                                 <!--path id="ramp.client.props" location="test-resources/rampart"/-->

Copied: axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/KerberosDelegationService.java (from r1780739, axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/main/java/org/apache/rampart/KerberosDelegationService.java)
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/KerberosDelegationService.java?p2=axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/KerberosDelegationService.java&p1=axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/main/java/org/apache/rampart/KerberosDelegationService.java&r1=1780739&r2=1780740&rev=1780740&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/main/java/org/apache/rampart/KerberosDelegationService.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/KerberosDelegationService.java Sat Jan 28 19:59:32 2017
@@ -1,21 +1,12 @@
 package org.apache.rampart;
 
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.servlet.http.HttpServletRequest;
 import javax.xml.namespace.QName;
 
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
-import org.apache.axis2.AxisFault;
 import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.neethi.Policy;
 import org.apache.rampart.policy.model.KerberosConfig;
 import org.apache.rampart.policy.model.RampartConfig;
@@ -26,24 +17,11 @@ import org.apache.rampart.policy.model.R
 public class KerberosDelegationService extends PolicyBasedResultsValidator{
     
     
-    public OMElement echo(OMElement elem) throws MalformedURLException, IllegalStateException, AxisFault {
-        int port = ((HttpServletRequest)MessageContext.getCurrentMessageContext().getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST)).getLocalPort();
-        
+    public OMElement echo(OMElement elem) throws Exception {
         final String serviceName = "KerberosOverTransportKeytab";
-        URL wsdlUrl = new URL(String.format("https://localhost:%s/axis2/services/%s?wsdl", port, serviceName));
-        
-        ConfigurationContext configContext = ConfigurationContextFactory.
-                        createConfigurationContextFromFileSystem("target/test-resources/rampart_client_repo", null);
 
-        ServiceClient serviceClient = new ServiceClient(configContext, wsdlUrl, null, null);
+        ServiceClient serviceClient = RampartKerberosTest.clientHelper.createServiceClient(serviceName, null, null);
 
-        serviceClient.getOptions().setTimeOutInMilliSeconds(200000);
-        serviceClient.getOptions().setProperty(HTTPConstants.SO_TIMEOUT, 200000);
-        serviceClient.getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT, 200000);
-
-        serviceClient.engageModule("addressing");
-        serviceClient.engageModule("rampart");     
-        
         RampartConfig rampartConfig = new RampartConfig();  
         
         KerberosConfig kerberosConfig = new KerberosConfig();

Modified: axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/RampartKerberosTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/RampartKerberosTest.java?rev=1780740&r1=1780739&r2=1780740&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/RampartKerberosTest.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-433/modules/rampart-integration/src/test/java/org/apache/rampart/RampartKerberosTest.java Sat Jan 28 19:59:32 2017
@@ -23,6 +23,7 @@ import org.apache.rampart.util.KerberosS
 import org.custommonkey.xmlunit.XMLAssert;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.ClassRule;
 import org.junit.Rule;
 import org.junit.Test;
 
@@ -66,11 +67,11 @@ public class RampartKerberosTest {
      */
     public static final String KERBEROS_CONF_KDC_PORT_TOKEN = "KDC_PORT";
     
-    @Rule
-    public final JettyServer server = new JettyServer("target/test-resources/rampart_service_repo", true);
+    @ClassRule
+    public static final JettyServer server = new JettyServer("target/test-resources/rampart_service_repo", true);
     
-    @Rule
-    public final ClientHelper clientHelper = new ClientHelper(server, "target/test-resources/rampart_client_repo") {
+    @ClassRule
+    public static final ClientHelper clientHelper = new ClientHelper(server, "target/test-resources/rampart_client_repo") {
         @Override
         protected void configureServiceClient(ServiceClient serviceClient) throws Exception {
             int timeout = 200000;