[jbossws-commits] JBossWS SVN: r16194 - in stack/cxf/branches/jbossws-cxf-4.0.x: modules/dist/src/main/scripts and 3 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Fri Apr 20 06:01:53 EDT 2012


Author: alessio.soldano at jboss.com
Date: 2012-04-20 06:01:53 -0400 (Fri, 20 Apr 2012)
New Revision: 16194

Added:
   stack/cxf/branches/jbossws-cxf-4.0.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptHelper.java
Modified:
   stack/cxf/branches/jbossws-cxf-4.0.x/
   stack/cxf/branches/jbossws-cxf-4.0.x/modules/dist/src/main/scripts/assembly-bin-dist.xml
   stack/cxf/branches/jbossws-cxf-4.0.x/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml
   stack/cxf/branches/jbossws-cxf-4.0.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3098/ClientServerLifeCycleTestCase.java
   stack/cxf/branches/jbossws-cxf-4.0.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptGCMTestCase.java
   stack/cxf/branches/jbossws-cxf-4.0.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptTestCase.java
Log:
Merged revisions 16087,16096,16183 via svnmerge from 
https://svn.jboss.org/repos/jbossws/stack/cxf/trunk

.......
  r16087 | alessio.soldano at jboss.com | 2012-04-04 11:04:51 +0200 (Wed, 04 Apr 2012) | 2 lines
  
  Adding in-container wsse client testing
.......
  r16096 | alessio.soldano at jboss.com | 2012-04-04 15:08:29 +0200 (Wed, 04 Apr 2012) | 2 lines
  
  Fixing test potentially messing up with client thread default bus
.......
  r16183 | alessio.soldano at jboss.com | 2012-04-19 13:17:05 +0200 (Thu, 19 Apr 2012) | 2 lines
  
  [JBWS-3489] Adding modules-deploy.conf to binary distro
.......



Property changes on: stack/cxf/branches/jbossws-cxf-4.0.x
___________________________________________________________________
Modified: svnmerge-integrated
   - https://svn.jboss.org/repos/jbossws/stack/cxf/trunk:1-15635,15658,15668,15674-15675,15682,15695-15697,15708,15711,15713,15719,15723-15730,15738,15743,15748-15757,15765-15766,15768,15770-15773,15780-15781,15784,15794,15806-15808,15824,15835,15837-15883,15885-15896,15900-15920,15936,15965,15967,15973,16067-16075,16077-16083,16085-16086,16176
   + https://svn.jboss.org/repos/jbossws/stack/cxf/trunk:1-15635,15658,15668,15674-15675,15682,15695-15697,15708,15711,15713,15719,15723-15730,15738,15743,15748-15757,15765-15766,15768,15770-15773,15780-15781,15784,15794,15806-15808,15824,15835,15837-15883,15885-15896,15900-15920,15936,15965,15967,15973,16067-16075,16077-16083,16085-16087,16091-16093,16095-16096,16098-16100,16103-16107,16111-16121,16124-16126,16128-16157,16159-16160,16162-16163,16165-16183
Modified: svn:mergeinfo
   - /stack/cxf/branches/asoldano:14032-14050,14068
/stack/cxf/trunk:15658,15668,15674-15675,15682,15695-15697,15708,15711,15713,15719,15723-15730,15738,15743,15748,15750-15751,15754-15757,15765-15766,15768,15773,15780-15781,15784,15794,15806-15808,15824,15835,15837-15857,15859,15866,15879-15881,15886-15889,15896,15900-15920,15936,15965,15967,15973,16067,16071,16086,16176
   + /stack/cxf/branches/asoldano:14032-14050,14068
/stack/cxf/trunk:15658,15668,15674-15675,15682,15695-15697,15708,15711,15713,15719,15723-15730,15738,15743,15748,15750-15751,15754-15757,15765-15766,15768,15773,15780-15781,15784,15794,15806-15808,15824,15835,15837-15857,15859,15866,15879-15881,15886-15889,15896,15900-15920,15936,15965,15967,15973,16067,16071,16086-16087,16096,16176,16183

Modified: stack/cxf/branches/jbossws-cxf-4.0.x/modules/dist/src/main/scripts/assembly-bin-dist.xml
===================================================================
--- stack/cxf/branches/jbossws-cxf-4.0.x/modules/dist/src/main/scripts/assembly-bin-dist.xml	2012-04-20 06:45:36 UTC (rev 16193)
+++ stack/cxf/branches/jbossws-cxf-4.0.x/modules/dist/src/main/scripts/assembly-bin-dist.xml	2012-04-20 10:01:53 UTC (rev 16194)
@@ -37,8 +37,7 @@
       <directory>../resources/src/main/resources/resources</directory>
       <outputDirectory>jbossws-cxf-bin-dist/build</outputDirectory>
       <includes>
-        <include>deploy.conf</include>
-        <include>server-deploy.conf</include>
+        <include>modules-deploy.conf</include>
         <include>jbossws-deploy-macros.xml</include>
       </includes>
     </fileSet>

Modified: stack/cxf/branches/jbossws-cxf-4.0.x/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml
===================================================================
--- stack/cxf/branches/jbossws-cxf-4.0.x/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml	2012-04-20 06:45:36 UTC (rev 16193)
+++ stack/cxf/branches/jbossws-cxf-4.0.x/modules/testsuite/cxf-tests/scripts/cxf-samples-jars-jaxws.xml	2012-04-20 10:01:53 UTC (rev 16194)
@@ -178,6 +178,22 @@
         <include name="alice.jks" />
       </metainf>
     </jar>
+    <war warfile="${tests.output.dir}/test-libs/jaxws-samples-wsse-policy-sign-encrypt-client.war" needxmlfile='false'>
+      <classes dir="${tests.output.dir}/test-classes">
+        <include name="org/jboss/wsf/test/ClientHelper.class"/>
+        <include name="org/jboss/wsf/test/TestServlet.class"/>
+        <include name="org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptHelper.class"/>
+      	<include name="org/jboss/test/ws/jaxws/samples/wsse/policy/basic/ServiceIface.class"/>
+        <include name="org/jboss/test/ws/jaxws/samples/wsse/policy/basic/KeystorePasswordCallback.class"/>
+      </classes>
+      <zipfileset dir="${tests.output.dir}/test-resources/jaxws/samples/wsse/policy/basic/sign-encrypt" prefix="WEB-INF/classes">
+          <include name="META-INF/alice.properties" />
+          <include name="META-INF/alice.jks" />
+      </zipfileset>
+      <manifest>
+        <attribute name="Dependencies" value="org.jboss.ws.cxf.jbossws-cxf-client services, org.apache.ws.security"/>
+      </manifest>
+    </war>
 
     <!-- jaxws-samples-wsse-policy-sign-encrypt-mc-client -->
     <jar destfile="${tests.output.dir}/test-libs/jaxws-samples-wsse-policy-sign-encrypt-mc-client.jar">

Modified: stack/cxf/branches/jbossws-cxf-4.0.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3098/ClientServerLifeCycleTestCase.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-4.0.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3098/ClientServerLifeCycleTestCase.java	2012-04-20 06:45:36 UTC (rev 16193)
+++ stack/cxf/branches/jbossws-cxf-4.0.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3098/ClientServerLifeCycleTestCase.java	2012-04-20 10:01:53 UTC (rev 16194)
@@ -74,11 +74,17 @@
       Service serviceOne = Service.create(wsdlOneURL, serviceOneName);
       Bus bus = BusFactory.getThreadDefaultBus(false);
       CustomClientLifeCycleListener listener = new CustomClientLifeCycleListener();
-      bus.getExtension(ClientLifeCycleManager.class).registerListener(listener);
-      assertEquals(0, listener.getCount());
-      EndpointOne portOne = (EndpointOne)serviceOne.getPort(EndpointOne.class);
-      assertEquals(1, listener.getCount());
-      assertEquals("Foo", portOne.echo("Foo"));
+      ClientLifeCycleManager mgr = bus.getExtension(ClientLifeCycleManager.class);
+      try {
+         mgr.registerListener(listener);
+         assertEquals(0, listener.getCount());
+         EndpointOne portOne = (EndpointOne)serviceOne.getPort(EndpointOne.class);
+         assertEquals(1, listener.getCount());
+         assertEquals("Foo", portOne.echo("Foo"));
+      } finally {
+         mgr.unRegisterListener(listener);
+      }
+      
    }
 
    private class CustomClientLifeCycleListener implements ClientLifeCycleListener

Modified: stack/cxf/branches/jbossws-cxf-4.0.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptGCMTestCase.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-4.0.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptGCMTestCase.java	2012-04-20 06:45:36 UTC (rev 16193)
+++ stack/cxf/branches/jbossws-cxf-4.0.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptGCMTestCase.java	2012-04-20 10:01:53 UTC (rev 16194)
@@ -21,16 +21,12 @@
  */
 package org.jboss.test.ws.jaxws.samples.wsse.policy.basic;
 
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
 import java.net.URL;
 
-import javax.xml.namespace.QName;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.Service;
-import javax.xml.ws.soap.SOAPFaultException;
-
 import junit.framework.Test;
 
-import org.apache.cxf.ws.security.SecurityConstants;
 import org.jboss.wsf.test.JBossWSCXFTestSetup;
 import org.jboss.wsf.test.JBossWSTest;
 
@@ -47,32 +43,24 @@
    
    public static Test suite()
    {
-      return new JBossWSCXFTestSetup(SignEncryptGCMTestCase.class, "jaxws-samples-wsse-policy-sign-encrypt-client.jar jaxws-samples-wsse-policy-sign-encrypt-gcm.war");
+      return new JBossWSCXFTestSetup(SignEncryptGCMTestCase.class, 
+            "jaxws-samples-wsse-policy-sign-encrypt-client.jar " +
+            "jaxws-samples-wsse-policy-sign-encrypt-client.war " +
+            "jaxws-samples-wsse-policy-sign-encrypt-gcm.war");
    }
-
-   public void test() throws Exception
+   
+   public void testClientSide() throws Exception
    {
-      QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
-      URL wsdlURL = new URL(serviceURL + "?wsdl");
-      Service service = Service.create(wsdlURL, serviceName);
-      ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
-      setupWsse(proxy);
-      try
-      {
-         assertEquals("Secure Hello World!", proxy.sayHello());
-      }
-      catch (SOAPFaultException e)
-      {
-         throw new Exception("Please check that the Bouncy Castle provider is installed.", e);
-      }
+      SignEncryptHelper helper = new SignEncryptHelper();
+      helper.setTargetEndpoint(serviceURL);
+      assertTrue(helper.testSignEncrypt());
    }
    
-   private void setupWsse(ServiceIface proxy)
+   public void testServerSide() throws Exception
    {
-      ((BindingProvider)proxy).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback());
-      ((BindingProvider)proxy).getRequestContext().put(SecurityConstants.SIGNATURE_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/alice.properties"));
-      ((BindingProvider)proxy).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/alice.properties"));
-      ((BindingProvider)proxy).getRequestContext().put(SecurityConstants.SIGNATURE_USERNAME, "alice");
-      ((BindingProvider)proxy).getRequestContext().put(SecurityConstants.ENCRYPT_USERNAME, "bob");
+      URL url = new URL("http://" + getServerHost() + ":8080/jaxws-samples-wsse-policy-sign-encrypt-client?" +
+            "path=/jaxws-samples-wsse-policy-sign-encrypt-gcm&method=testSignEncrypt&helper=" + SignEncryptHelper.class.getName());
+      BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+      assertEquals("1", br.readLine());
    }
 }

Copied: stack/cxf/branches/jbossws-cxf-4.0.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptHelper.java (from rev 16087, stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptHelper.java)
===================================================================
--- stack/cxf/branches/jbossws-cxf-4.0.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptHelper.java	                        (rev 0)
+++ stack/cxf/branches/jbossws-cxf-4.0.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptHelper.java	2012-04-20 10:01:53 UTC (rev 16194)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.samples.wsse.policy.basic;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+import javax.xml.ws.soap.SOAPFaultException;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.ws.security.SecurityConstants;
+import org.jboss.wsf.test.ClientHelper;
+
+public class SignEncryptHelper implements ClientHelper
+{
+   private String targetEndpoint;
+   
+   @Override
+   public void setTargetEndpoint(String address)
+   {
+      targetEndpoint = address;
+   }
+   
+   public boolean testSignEncrypt() throws Exception
+   {
+      Bus bus = BusFactory.newInstance().createBus();
+      try
+      {
+         BusFactory.setThreadDefaultBus(bus);
+      
+         QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
+         URL wsdlURL = new URL(targetEndpoint + "?wsdl");
+         Service service = Service.create(wsdlURL, serviceName);
+         ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
+         setupWsse(proxy);
+         try
+         {
+            return "Secure Hello World!".equals(proxy.sayHello());
+         }
+         catch (SOAPFaultException e)
+         {
+            throw new Exception("Please check that the Bouncy Castle provider is installed.", e);
+         }
+      }
+      finally
+      {
+         bus.shutdown(true);
+      }
+   }
+   
+   private void setupWsse(ServiceIface proxy)
+   {
+      ((BindingProvider)proxy).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback());
+      ((BindingProvider)proxy).getRequestContext().put(SecurityConstants.SIGNATURE_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/alice.properties"));
+      ((BindingProvider)proxy).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/alice.properties"));
+      ((BindingProvider)proxy).getRequestContext().put(SecurityConstants.SIGNATURE_USERNAME, "alice");
+      ((BindingProvider)proxy).getRequestContext().put(SecurityConstants.ENCRYPT_USERNAME, "bob");
+   }
+
+}

Modified: stack/cxf/branches/jbossws-cxf-4.0.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptTestCase.java
===================================================================
--- stack/cxf/branches/jbossws-cxf-4.0.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptTestCase.java	2012-04-20 06:45:36 UTC (rev 16193)
+++ stack/cxf/branches/jbossws-cxf-4.0.x/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/samples/wsse/policy/basic/SignEncryptTestCase.java	2012-04-20 10:01:53 UTC (rev 16194)
@@ -1,6 +1,6 @@
 /*
  * JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
  * as indicated by the @author tags. See the copyright.txt file in the
  * distribution for a full listing of individual contributors.
  *
@@ -21,16 +21,12 @@
  */
 package org.jboss.test.ws.jaxws.samples.wsse.policy.basic;
 
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
 import java.net.URL;
 
-import javax.xml.namespace.QName;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.Service;
-import javax.xml.ws.soap.SOAPFaultException;
-
 import junit.framework.Test;
 
-import org.apache.cxf.ws.security.SecurityConstants;
 import org.jboss.wsf.test.JBossWSCXFTestSetup;
 import org.jboss.wsf.test.JBossWSTest;
 
@@ -46,32 +42,24 @@
    
    public static Test suite()
    {
-      return new JBossWSCXFTestSetup(SignEncryptTestCase.class, "jaxws-samples-wsse-policy-sign-encrypt-client.jar jaxws-samples-wsse-policy-sign-encrypt.war");
+      return new JBossWSCXFTestSetup(SignEncryptTestCase.class,
+            "jaxws-samples-wsse-policy-sign-encrypt-client.jar " +
+            "jaxws-samples-wsse-policy-sign-encrypt-client.war " +
+            "jaxws-samples-wsse-policy-sign-encrypt.war");
    }
-
-   public void test() throws Exception
+   
+   public void testClientSide() throws Exception
    {
-      QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");
-      URL wsdlURL = new URL(serviceURL + "?wsdl");
-      Service service = Service.create(wsdlURL, serviceName);
-      ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);
-      setupWsse(proxy);
-      try
-      {
-         assertEquals("Secure Hello World!", proxy.sayHello());
-      }
-      catch (SOAPFaultException e)
-      {
-         throw new Exception("Please check that the Bouncy Castle provider is installed.", e);
-      }
+      SignEncryptHelper helper = new SignEncryptHelper();
+      helper.setTargetEndpoint(serviceURL);
+      assertTrue(helper.testSignEncrypt());
    }
    
-   private void setupWsse(ServiceIface proxy)
+   public void testServerSide() throws Exception
    {
-      ((BindingProvider)proxy).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback());
-      ((BindingProvider)proxy).getRequestContext().put(SecurityConstants.SIGNATURE_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/alice.properties"));
-      ((BindingProvider)proxy).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/alice.properties"));
-      ((BindingProvider)proxy).getRequestContext().put(SecurityConstants.SIGNATURE_USERNAME, "alice");
-      ((BindingProvider)proxy).getRequestContext().put(SecurityConstants.ENCRYPT_USERNAME, "bob");
+      URL url = new URL("http://" + getServerHost() + ":8080/jaxws-samples-wsse-policy-sign-encrypt-client?" +
+      		"path=/jaxws-samples-wsse-policy-sign-encrypt&method=testSignEncrypt&helper=" + SignEncryptHelper.class.getName());
+      BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+      assertEquals("1", br.readLine());
    }
 }



More information about the jbossws-commits mailing list