You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ff...@apache.org on 2010/01/23 04:34:05 UTC
svn commit: r902337 - in
/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/security:
CxfBcSecurityJAASTest.java KeystorePasswordCallback.java
Author: ffang
Date: Sat Jan 23 03:34:04 2010
New Revision: 902337
URL: http://svn.apache.org/viewvc?rev=902337&view=rev
Log:
[SMXCOMP-703]also add test to verify we can get the expected exception
Modified:
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/security/CxfBcSecurityJAASTest.java
servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/security/KeystorePasswordCallback.java
Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/security/CxfBcSecurityJAASTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/security/CxfBcSecurityJAASTest.java?rev=902337&r1=902336&r2=902337&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/security/CxfBcSecurityJAASTest.java (original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/security/CxfBcSecurityJAASTest.java Sat Jan 23 03:34:04 2010
@@ -81,6 +81,32 @@
assertEquals(ret, "Hello ffang");
}
+ public void testAuthFailed() {
+ LOG.info("test security");
+ Bus bus = new SpringBusFactory().createBus(
+ "org/apache/servicemix/cxfbc/ws/security/client-jaas-dummy.xml");
+ BusFactory.setDefaultBus(bus);
+ LoggingInInterceptor in = new LoggingInInterceptor();
+ bus.getInInterceptors().add(in);
+ bus.getInFaultInterceptors().add(in);
+ LoggingOutInterceptor out = new LoggingOutInterceptor();
+ bus.getOutInterceptors().add(out);
+ bus.getOutFaultInterceptors().add(out);
+ final javax.xml.ws.Service svc = javax.xml.ws.Service.create(WSDL_LOC,
+ new javax.xml.namespace.QName(
+ "http://apache.org/hello_world_soap_http",
+ "SOAPServiceWSSecurity"));
+ final Greeter greeter = svc.getPort(new javax.xml.namespace.QName(
+ "http://apache.org/hello_world_soap_http",
+ "TimestampSignEncrypt"), Greeter.class);
+ try {
+ greeter.sayHi();
+ fail("should catch exception");
+ } catch (Exception e) {
+ assertEquals(e.getMessage(), "User does not exist");
+ }
+ }
+
@Override
protected AbstractXmlApplicationContext createBeanFactory() {
// load cxf se and bc from spring config file
Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/security/KeystorePasswordCallback.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/security/KeystorePasswordCallback.java?rev=902337&r1=902336&r2=902337&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/security/KeystorePasswordCallback.java (original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/security/KeystorePasswordCallback.java Sat Jan 23 03:34:04 2010
@@ -34,6 +34,7 @@
public KeystorePasswordCallback() {
passwords.put("alice", "password");
passwords.put("bob", "password");
+ passwords.put("dummy", "dummy");
}
/**