You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2011/04/29 05:53:44 UTC

svn commit: r1097681 - in /camel/trunk/tests/camel-itest/src/test: java/org/apache/camel/itest/security/ resources/org/apache/camel/itest/restlet/example/

Author: ningjiang
Date: Fri Apr 29 03:53:44 2011
New Revision: 1097681

URL: http://svn.apache.org/viewvc?rev=1097681&view=rev
Log:
CAMEL-3879 Fixed the tests which are running with CXF 2.4.0

Modified:
    camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/security/GreeterClientTest.java
    camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/security/KeystorePasswordCallback.java
    camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/restlet/example/CxfRSDomainServiceTest-context.xml
    camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/restlet/example/RestletDomainServiceTest-context.xml

Modified: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/security/GreeterClientTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/security/GreeterClientTest.java?rev=1097681&r1=1097680&r2=1097681&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/security/GreeterClientTest.java (original)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/security/GreeterClientTest.java Fri Apr 29 03:53:44 2011
@@ -91,7 +91,6 @@ public class GreeterClientTest extends A
             fail("should fail");
         } catch (Exception ex) {
             assertTrue("Get a wrong type exception.", ex instanceof SOAPFaultException);
-            System.out.println("Exception message is " + ex.getMessage());
             assertTrue("Get a wrong exception message", ex.getMessage().startsWith("The security token could not be authenticated or authorized"));
             // CXF 2.4.0 WSecurity doesn't put the authentication exception
             //assertTrue("Get a wrong exception message", ex.getMessage().endsWith("java.io.IOException: Wrong password!"));

Modified: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/security/KeystorePasswordCallback.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/security/KeystorePasswordCallback.java?rev=1097681&r1=1097680&r2=1097681&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/security/KeystorePasswordCallback.java (original)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/security/KeystorePasswordCallback.java Fri Apr 29 03:53:44 2011
@@ -57,8 +57,14 @@ public class KeystorePasswordCallback im
                 }
             } 
             if (WSConstants.PASSWORD_TEXT.equals(type)) {
-                // As the PasswordType is PasswordDigest, we need to do the authentication in the call back
-                if (!pc.getPassword().equals(pass)) {
+                // Code for CXF 2.4.X
+                if (pc.getPassword() == null) {
+                    pc.setPassword(pass);
+                    return;
+                }
+                // Code for CXF 2.3.x
+                // As the PasswordType is not PasswordDigest, we need to do the authentication in the call back
+                if (!pass.equals(pc.getPassword())) {
                     throw new IOException("Wrong password!");
                 }
             }
@@ -85,7 +91,9 @@ public class KeystorePasswordCallback im
             if (getType == null) {
                 getType = pc.getClass().getMethod("getType", new Class[0]);
             }
-            return (String)getType.invoke(pc, new Object[0]);
+            String result = (String)getType.invoke(pc, new Object[0]);
+            return result;
+            
         } catch (Exception ex) {
             return null;
         }

Modified: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/restlet/example/CxfRSDomainServiceTest-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/restlet/example/CxfRSDomainServiceTest-context.xml?rev=1097681&r1=1097680&r2=1097681&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/restlet/example/CxfRSDomainServiceTest-context.xml (original)
+++ camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/restlet/example/CxfRSDomainServiceTest-context.xml Fri Apr 29 03:53:44 2011
@@ -23,10 +23,6 @@
         http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
         http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
 
-    <import resource="classpath:META-INF/cxf/cxf.xml"/>
-    <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"/>
-    <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml"/>
-
     <!-- setup REST server -->
     <jaxrs:server id="domainServiceRest" address="http://localhost:9000/">
         <jaxrs:serviceBeans>

Modified: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/restlet/example/RestletDomainServiceTest-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/restlet/example/RestletDomainServiceTest-context.xml?rev=1097681&r1=1097680&r2=1097681&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/restlet/example/RestletDomainServiceTest-context.xml (original)
+++ camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/restlet/example/RestletDomainServiceTest-context.xml Fri Apr 29 03:53:44 2011
@@ -23,10 +23,6 @@
         http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
         http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
 
-    <import resource="classpath:META-INF/cxf/cxf.xml"/>
-    <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"/>
-    <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml"/>
-
     <!-- setup REST server -->
     <jaxrs:server id="domainServiceRest" address="http://localhost:9000/">
         <jaxrs:serviceBeans>