[java-identity-provider COMMIT] in /trunk/idp-saml-impl/src: main/java/net/shibboleth/idp/saml/impl/profile/saml2/Add...

noreply at shibboleth.net noreply at shibboleth.net
Wed Oct 17 16:53:19 EDT 2012


Author: tzeller
Date: Wed Oct 17 16:53:19 2012
New Revision: 4223

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4223&view=rev
Log:
Updated tests to assert event ids rather than catch exceptions which are no longer thrown.

Modified:
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml2/AddOneTimeUseConditionToAssertions.java
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAudienceRestrictionToAssertionsTest.java
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml1/AddDoNotCacheConditionToAssertionsTest.java
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml1/AddNotBeforeConditionToAssertionsTest.java
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml1/AddNotOnOrAfterConditionToAssertionsTest.java
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml2/AddAudienceRestrictionToAssertionsTest.java
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml2/AddNotBeforeConditionToAssertionsTest.java
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml2/AddNotOnOrAfterConditionToAssertionsTest.java
    trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml2/AddOneTimeUseConditionToAssertionsTest.java

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml2/AddOneTimeUseConditionToAssertions.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml2/AddOneTimeUseConditionToAssertions.java?rev=4223&r1=4222&r2=4223&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml2/AddOneTimeUseConditionToAssertions.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/saml2/AddOneTimeUseConditionToAssertions.java Wed Oct 17 16:53:19 2012
@@ -58,6 +58,10 @@
         log.debug("Action {}: Attempting to add DoNotCache condition to every Assertion in outgoing Response", getId());
 
         final Response response = profileRequestContext.getOutboundMessageContext().getMessage();
+        if (response == null) {
+            log.error("Action {}: No SAML response located in current profile request context", getId());
+            return ActionSupport.buildEvent(this, SamlEventIds.NO_RESPONSE);
+        }
 
         final List<Assertion> assertions = response.getAssertions();
         if (assertions.isEmpty()) {

Modified: trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAudienceRestrictionToAssertionsTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAudienceRestrictionToAssertionsTest.java?rev=4223&r1=4222&r2=4223&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAudienceRestrictionToAssertionsTest.java (original)
+++ trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml1/AddAudienceRestrictionToAssertionsTest.java Wed Oct 17 16:53:19 2012
@@ -18,8 +18,8 @@
 package net.shibboleth.idp.saml.impl.profile.saml1;
 
 import net.shibboleth.idp.profile.ActionTestingSupport;
-import net.shibboleth.idp.profile.ProfileException;
 import net.shibboleth.idp.profile.RequestContextBuilder;
+import net.shibboleth.idp.saml.profile.SamlEventIds;
 import net.shibboleth.idp.saml.profile.saml1.Saml1ActionTestingSupport;
 
 import org.opensaml.core.OpenSAMLInitBaseTestCase;
@@ -44,12 +44,11 @@
         action.setId("test");
         action.initialize();
 
-        try {
-            action.execute(new RequestContextBuilder().buildRequestContext());
-            Assert.fail();
-        } catch (ProfileException e) {
-            // expected this
-        }
+        Event result = action.execute(new RequestContextBuilder().buildRequestContext());
+        
+        Assert.assertNotNull(result);
+        Assert.assertNotNull(result.getSource());
+        Assert.assertEquals(result.getId(), SamlEventIds.NO_RESPONSE);
     }
 
     /** Test that action errors out properly if there is no assertion in the response. */
@@ -64,12 +63,11 @@
         action.setId("test");
         action.initialize();
 
-        try {
-            action.execute(springRequestContext);
-            Assert.fail();
-        } catch (ProfileException e) {
-            // expected this
-        }
+        Event result = action.execute(springRequestContext);
+
+        Assert.assertNotNull(result);
+        Assert.assertNotNull(result.getSource());
+        Assert.assertEquals(result.getId(), SamlEventIds.NO_ASSERTION);
     }
 
     /**

Modified: trunk/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/impl/profile/saml1/AddDoNotCacheConditionToAssertionsTest.java

[... 365 lines stripped ...]


More information about the commits mailing list