You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by jp...@apache.org on 2013/02/12 02:18:52 UTC

svn commit: r1445010 - in /cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy: JavaFirstPolicyServiceTest.java javafirst/OperationSimpleServiceImpl.java

Author: jpell
Date: Tue Feb 12 01:18:52 2013
New Revision: 1445010

URL: http://svn.apache.org/r1445010
Log:
CXF-4813 re-enabled disabled test and fixed an invalid test assertion, based on Dan's fix to wsp policy alternatives support at operation level

Modified:
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/OperationSimpleServiceImpl.java

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java?rev=1445010&r1=1445009&r2=1445010&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java (original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java Tue Feb 12 01:18:52 2013
@@ -50,7 +50,6 @@ import org.apache.ws.security.WSConstant
 import org.apache.ws.security.handler.WSHandlerConstants;
 
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 
 import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -206,7 +205,7 @@ public class JavaFirstPolicyServiceTest 
     }
 
     @Test
-    public void testNoAltOperationNoClientCertAlternativePolicy() {
+    public void testNoAltOperationNoClientCertPolicy() {
         System.setProperty("testutil.ports.JavaFirstPolicyServer.3", PORT3);
 
         ClassPathXmlApplicationContext clientContext = new ClassPathXmlApplicationContext(new String[] {
@@ -255,7 +254,7 @@ public class JavaFirstPolicyServiceTest 
     }
 
     @Test
-    public void testNoAltOperationClientCertAlternativePolicy() {
+    public void testNoAltOperationClientCertPolicy() {
         System.setProperty("testutil.ports.JavaFirstPolicyServer.3", PORT3);
 
         ClassPathXmlApplicationContext clientContext = new ClassPathXmlApplicationContext(new String[] {
@@ -309,6 +308,9 @@ public class JavaFirstPolicyServiceTest 
         OperationSimpleService simpleService = clientContext
             .getBean("OperationSimpleServiceClient", OperationSimpleService.class);
 
+        // no security on ping!
+        simpleService.ping();
+        
         try {
             simpleService.doStuff();
             fail("Expected exception as no credentials");
@@ -326,12 +328,12 @@ public class JavaFirstPolicyServiceTest 
             assertTrue(true);
         }
 
+        // this is successful because the alternative policy allows a password to be specified.
         wssOut.setProperties(getPasswordProperties("alice", "password"));
         simpleService.doStuff();
     }
 
     @Test
-    @Ignore
     public void testOperationClientCertAlternativePolicy() {
         System.setProperty("testutil.ports.JavaFirstPolicyServer.3", PORT3);
 
@@ -342,6 +344,9 @@ public class JavaFirstPolicyServiceTest 
         OperationSimpleService simpleService = clientContext
             .getBean("OperationSimpleServiceClient", OperationSimpleService.class);
 
+        // no security on ping!
+        simpleService.ping();
+        
         try {
             simpleService.doStuff();
             fail("Expected exception as no credentials");
@@ -354,14 +359,9 @@ public class JavaFirstPolicyServiceTest 
         wssOut.setProperties(getNoPasswordProperties("alice"));
         simpleService.doStuff();
 
+        // this is successful because the alternative policy allows a password to be specified.
         wssOut.setProperties(getPasswordProperties("alice", "password"));
-
-        try {
-            simpleService.doStuff();
-            fail("Expected exception password is not supported");
-        } catch (SOAPFaultException e) {
-            assertTrue(true);
-        }
+        simpleService.doStuff();
     }
 
     private WSS4JOutInterceptor addToClient(Object svc) {
@@ -528,3 +528,4 @@ public class JavaFirstPolicyServiceTest 
         }
     }
 }
+

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/OperationSimpleServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/OperationSimpleServiceImpl.java?rev=1445010&r1=1445009&r2=1445010&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/OperationSimpleServiceImpl.java (original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/javafirst/OperationSimpleServiceImpl.java Tue Feb 12 01:18:52 2013
@@ -28,7 +28,9 @@ import org.apache.cxf.annotations.Policy
 endpointInterface = "org.apache.cxf.systest.ws.policy.javafirst.OperationSimpleService", 
 serviceName = "OperationSimpleService", targetNamespace = "http://www.example.org/contract/OperationSimpleService")
 public class OperationSimpleServiceImpl implements OperationSimpleService {
-    @Policy(uri = "classpath:/java_first_policies/AlternativesPolicy.xml", placement = Placement.BINDING_OPERATION)
+    @Policy(uri = "classpath:/java_first_policies/AlternativesPolicy.xml", 
+        placement = Placement.BINDING_OPERATION_INPUT)
+
     @Override
     public void doStuff() {
     }