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 18:26:40 UTC

svn commit: r1780728 - in /axis/axis2/java/rampart/branches/RAMPART-426: ./ modules/rampart-integration/ modules/rampart-integration/src/main/java/org/apache/axis2/integration/ modules/rampart-integration/src/main/java/org/apache/rahas/ modules/rampart...

Author: veithen
Date: Sat Jan 28 18:26:39 2017
New Revision: 1780728

URL: http://svn.apache.org/viewvc?rev=1780728&view=rev
Log:
Merge latest changes from trunk.

Removed:
    axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-integration/src/main/java/org/apache/axis2/integration/JettyServer.java
Modified:
    axis/axis2/java/rampart/branches/RAMPART-426/   (props changed)
    axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-integration/pom.xml
    axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-integration/src/main/java/org/apache/rahas/TestClient.java
    axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java
    axis/axis2/java/rampart/branches/RAMPART-426/pom.xml

Propchange: axis/axis2/java/rampart/branches/RAMPART-426/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Jan 28 18:26:39 2017
@@ -1 +1 @@
-/axis/axis2/java/rampart/trunk:1778772-1780712
+/axis/axis2/java/rampart/trunk:1778772-1780727

Modified: axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-integration/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-integration/pom.xml?rev=1780728&r1=1780727&r2=1780728&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-integration/pom.xml (original)
+++ axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-integration/pom.xml Sat Jan 28 18:26:39 2017
@@ -523,24 +523,9 @@
             <artifactId>log4j</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-util</artifactId>
-            <version>${jetty.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-webapp</artifactId>
-            <version>${jetty.version}</version>
-        </dependency>
-        <dependency>
             <groupId>org.apache.axis2</groupId>
             <artifactId>axis2-testutils</artifactId>
             <version>${axis2.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.bouncycastle</groupId>
-            <artifactId>bcpkix-jdk15on</artifactId>
-            <version>${bcprov.jdk15.version}</version>
-        </dependency>
     </dependencies>
 </project>

Modified: axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-integration/src/main/java/org/apache/rahas/TestClient.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-integration/src/main/java/org/apache/rahas/TestClient.java?rev=1780728&r1=1780727&r2=1780728&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-integration/src/main/java/org/apache/rahas/TestClient.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-integration/src/main/java/org/apache/rahas/TestClient.java Sat Jan 28 18:26:39 2017
@@ -28,10 +28,9 @@ import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.integration.JettyServer;
+import org.apache.axis2.testutils.ClientHelper;
+import org.apache.axis2.testutils.JettyServer;
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyEngine;
 import org.apache.rampart.RampartMessageData;
@@ -43,40 +42,15 @@ public abstract class TestClient {
     @Rule
     public final JettyServer server = new JettyServer(TESTING_PATH + getServiceRepo(), false);
 
+    @Rule
+    public final ClientHelper clientHelper = new ClientHelper(server, TESTING_PATH + "rahas_client_repo");
+
     /**
      */
     @Test
     public void testRequest() throws Exception {
-        // Get the repository location from the args
-        String repo = TESTING_PATH + "rahas_client_repo";
-
-        ConfigurationContext configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(repo,
-                                                                                                                  null);
-        ServiceClient serviceClient = new ServiceClient(configContext, null);
-        Options options = new Options();
-
-        System.setProperty("javax.net.ssl.keyStorePassword", "password");
-        System.setProperty("javax.net.ssl.keyStoreType", "JKS");
-        System.setProperty("javax.net.ssl.trustStore", "/home/ruchith/Desktop/interop/certs/interop2.jks");
-        System.setProperty("javax.net.ssl.trustStorePassword", "password");
-        System.setProperty("javax.net.ssl.trustStoreType","JKS");
-
-        options.setTo(server.getEndpointReference("SecureService"));
-//        options.setTo(new EndpointReference("http://127.0.0.1:" + 9090 + "/axis2/services/UTSAMLHoK"));
-//        options.setTo(new EndpointReference("https://www-lk.wso2.com:8443/axis2/services/UTSAMLHoK"));
-//        options.setTo(new EndpointReference("https://192.18.49.133:2343/jaxws-s1-sts/sts"));
-//        options.setTo(new EndpointReference("https://207.200.37.116/SxSts/Scenario_1_IssuedTokenOverTransport_UsernameOverTransport"));
-//        options.setTo(new EndpointReference("http://localhost:9090/SxSts/Scenario_4_IssuedToken_MutualCertificate10"));
-
-//        options.setTo(new EndpointReference("http://127.0.0.1:" + 9090 + "/axis2/services/MutualCertsSAMLHoK"));
-//        options.setTo(new EndpointReference("http://www-lk.wso2.com:8888/axis2/services/MutualCertsSAMLHoK"));
-//        options.setTo(new EndpointReference("https://131.107.72.15/trust/Addressing2004/UserName"));
-//        options.setTo(new EndpointReference("https://131.107.72.15/trust/UserName"));
-//        options.setTo(new EndpointReference("http://127.0.0.1:" + 9090 + "/trust/X509WSS10"));
-//        options.setTo(new EndpointReference("https://131.107.72.15/trust/UserName"));
-//        options.setTo(new EndpointReference("http://127.0.0.1:" + 9090 + "/jaxws-s4-sts/sts"));
-//        options.setTo(new EndpointReference("http://127.0.0.1:9090/jaxws-s4/simple"));
-//        options.setTo(new EndpointReference("http://127.0.0.1:" + 9090 + "/axis2/services/UTSAMLBearer"));
+        ServiceClient serviceClient = clientHelper.createServiceClient("SecureService");
+        Options options = serviceClient.getOptions();
 
         options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
         options.setAction(this.getRequestAction());
@@ -90,8 +64,6 @@ public abstract class TestClient {
         serviceClient.engageModule("addressing");
         serviceClient.engageModule("rampart");
 
-        serviceClient.setOptions(options);
-
         //Blocking invocation
 
         OMElement result = serviceClient.sendReceive(getRequest());

Modified: axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java?rev=1780728&r1=1780727&r2=1780728&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java (original)
+++ axis/axis2/java/rampart/branches/RAMPART-426/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java Sat Jan 28 18:26:39 2017
@@ -31,10 +31,9 @@ import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.integration.JettyServer;
+import org.apache.axis2.testutils.ClientHelper;
+import org.apache.axis2.testutils.JettyServer;
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyEngine;
 import org.junit.Rule;
@@ -51,8 +50,26 @@ public class RampartTest {
     public final JettyServer server = new JettyServer(TESTING_PATH + "rampart_service_repo", false);
     
     @Rule
+    public final ClientHelper clientHelper = new ClientHelper(server, TESTING_PATH + "rampart_client_repo") {
+        @Override
+        protected void configureServiceClient(ServiceClient serviceClient) throws Exception {
+            serviceClient.engageModule("addressing");
+            serviceClient.engageModule("rampart");
+        }
+    };
+    
+    @Rule
     public final JettyServer secureServer = new JettyServer(TESTING_PATH + "rampart_service_repo", true);
     
+    @Rule
+    public final ClientHelper secureClientHelper = new ClientHelper(secureServer, TESTING_PATH + "rampart_client_repo") {
+        @Override
+        protected void configureServiceClient(ServiceClient serviceClient) throws Exception {
+            serviceClient.engageModule("addressing");
+            serviceClient.engageModule("rampart");
+        }
+    };
+    
     static {
         try {
             resources = ResourceBundle.getBundle("org.apache.rampart.errors");
@@ -61,28 +78,9 @@ public class RampartTest {
         }
     }
 
-    private ServiceClient getServiceClientInstance() throws AxisFault {
-
-        String repository = TESTING_PATH + "rampart_client_repo";
-
-        ConfigurationContext configContext = ConfigurationContextFactory.
-                createConfigurationContextFromFileSystem(repository, null);
-        ServiceClient serviceClient = new ServiceClient(configContext, null);
-
-
-        serviceClient.engageModule("addressing");
-        serviceClient.engageModule("rampart");
-
-        return serviceClient;
-
-    }
-
     @Test
     public void testWithPolicy() {
         try {
-
-            ServiceClient serviceClient = getServiceClientInstance();
-
             //TODO : figure this out !!
             boolean basic256Supported = false;
             
@@ -102,17 +100,15 @@ public class RampartTest {
                     // Testcase - 25 is failing, for the moment skipping it.
                     continue;
                 }
-                Options options = new Options();
+                
+                ServiceClient serviceClient = (i == 13 ? secureClientHelper : clientHelper).createServiceClient("SecureService" + i);
+                Options options = serviceClient.getOptions();
                 
                 if( i == 13 ) {
-                    options.setTo(secureServer.getEndpointReference("SecureService" + i));
                     //Username token created with user/pass from options
                     options.setUserName("alice");
                     options.setPassword("password");
                 }
-                else {
-                    options.setTo(server.getEndpointReference("SecureService" + i));
-                }
                 
                 System.out.println("Testing WS-Sec: custom scenario " + i);
                 options.setAction("urn:echo");
@@ -120,7 +116,6 @@ public class RampartTest {
                 ServiceContext context = serviceClient.getServiceContext();
                 context.setProperty(RampartMessageData.KEY_RAMPART_POLICY, 
                         loadPolicy("/rampart/policy/" + i + ".xml"));
-                serviceClient.setOptions(options);
                 
                 if (i == 31) {
                     OMNamespace omNamespace = OMAbstractFactory.getOMFactory().createOMNamespace(
@@ -176,24 +171,21 @@ public class RampartTest {
                     //Skip the Basic256 tests
                     continue;
                 }
-                Options options = new Options();
+                
+                ServiceClient serviceClient = (i == 13 ? secureClientHelper : clientHelper).createServiceClient("SecureService" + i);
+                Options options = serviceClient.getOptions();
 
                 if (i == 13) {
-                    options.setTo(secureServer.getEndpointReference("SecureService" + i));
                     //Username token created with user/pass from options
                     options.setUserName("alice");
                     options.setPassword("password");
                 }
-                else {
-                    options.setTo(server.getEndpointReference("SecureService" + i));
-                }
                 System.out.println("Testing WS-Sec: negative scenario " + i);
                 options.setAction("urn:returnError");
 
                 ServiceContext context = serviceClient.getServiceContext();
                 context.setProperty(RampartMessageData.KEY_RAMPART_POLICY,
                         loadPolicy("/rampart/policy/" + i + ".xml"));
-                serviceClient.setOptions(options);
 
                 try {
                     //Blocking invocation
@@ -207,23 +199,19 @@ public class RampartTest {
 
             
             for (int i = 1; i <= 6; i++) { //<-The number of tests we have
-                Options options = new Options();
-                
+                ServiceClient serviceClient;
                 if (i == 3 || i == 6) {
-                    options.setTo(secureServer.getEndpointReference("SecureServiceSC" + i));
+                    serviceClient = secureClientHelper.createServiceClient("SecureServiceSC" + i);
                 }
                 else {
-                    options.setTo(server.getEndpointReference("SecureServiceSC" + i));
+                    serviceClient = clientHelper.createServiceClient("SecureServiceSC" + i);
                 }
+                Options options = serviceClient.getOptions();
 
                 System.out.println("Testing WS-SecConv: custom scenario " + i);
                 options.setAction("urn:echo");
 
-                //Create a new service client instance for each secure conversation scenario
-                serviceClient = getServiceClientInstance();
-
                 serviceClient.getServiceContext().setProperty(RampartMessageData.KEY_RAMPART_POLICY, loadPolicy("/rampart/policy/sc-" + i + ".xml"));
-                serviceClient.setOptions(options);
 
                 //Blocking invocation
                 serviceClient.sendReceive(getEchoElement());

Modified: axis/axis2/java/rampart/branches/RAMPART-426/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/branches/RAMPART-426/pom.xml?rev=1780728&r1=1780727&r2=1780728&view=diff
==============================================================================
--- axis/axis2/java/rampart/branches/RAMPART-426/pom.xml (original)
+++ axis/axis2/java/rampart/branches/RAMPART-426/pom.xml Sat Jan 28 18:26:39 2017
@@ -615,8 +615,6 @@
         <failIfNoTests>false</failIfNoTests>
 
         <jacoco.version>0.7.5.201505241946</jacoco.version>
-        
-        <jetty.version>7.6.15.v20140411</jetty.version>
     </properties>
 
     <pluginRepositories>