[java-identity-provider COMMIT] in /trunk/idp-profile-spring: pom.xml src/test/java/net/shibboleth/idp/profile/spring...

noreply at shibboleth.net noreply at shibboleth.net
Sun May 11 18:05:22 EDT 2014


Author: scantor
Date: Sun May 11 18:05:22 2014
New Revision: 5905

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5905&view=rev
Log:
Fix failing conditional predicate test.

Modified:
    trunk/idp-profile-spring/pom.xml
    trunk/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/saml/BaseSAMLProfileTest.java

Modified: trunk/idp-profile-spring/pom.xml
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-spring/pom.xml?rev=5905&r1=5904&r2=5905&view=diff
==============================================================================
--- trunk/idp-profile-spring/pom.xml (original)
+++ trunk/idp-profile-spring/pom.xml Sun May 11 18:05:22 2014
@@ -89,6 +89,13 @@
             <type>test-jar</type>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>idp-profile-api</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
         <!-- Managed Dependencies -->
     </dependencies>
     

Modified: trunk/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/saml/BaseSAMLProfileTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/saml/BaseSAMLProfileTest.java?rev=5905&r1=5904&r2=5905&view=diff
==============================================================================
--- trunk/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/saml/BaseSAMLProfileTest.java (original)
+++ trunk/idp-profile-spring/src/test/java/net/shibboleth/idp/profile/spring/relyingparty/saml/BaseSAMLProfileTest.java Sun May 11 18:05:22 2014
@@ -19,10 +19,12 @@
 
 import net.shibboleth.ext.spring.config.DurationToLongConverter;
 import net.shibboleth.ext.spring.config.StringToIPRangeConverter;
+import net.shibboleth.idp.profile.RequestContextBuilder;
 import net.shibboleth.idp.saml.profile.config.AbstractSAMLProfileConfiguration;
-import net.shibboleth.utilities.java.support.logic.ConstraintViolationException;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
 
 import org.opensaml.core.OpenSAMLInitBaseTestCase;
+import org.opensaml.messaging.context.MessageChannelSecurityContext;
 import org.opensaml.profile.context.ProfileRequestContext;
 import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.context.support.ConversionServiceFactoryBean;
@@ -72,15 +74,21 @@
     }
     
     protected static void assertConditionalPredicate(Predicate<ProfileRequestContext> predicate) {
-        // a conditional predicate will look at the parameter and fail immediately
         try {
-            predicate.apply(null);
-            Assert.fail("Was not a conditional Predicate");
-        } catch (ConstraintViolationException  ex) {
-            // expected   
-        } catch ( IllegalArgumentException ex) {
-            // expected
+            final ProfileRequestContext prc = new RequestContextBuilder().buildProfileRequestContext();
+            final MessageChannelSecurityContext mc =
+                    prc.getOutboundMessageContext().getSubcontext(MessageChannelSecurityContext.class, true);
+            
+            mc.setConfidentialityActive(true);
+            mc.setIntegrityActive(true);
+            Assert.assertFalse(predicate.apply(prc));
+            
+            mc.setConfidentialityActive(false);
+            mc.setIntegrityActive(false);
+            Assert.assertTrue(predicate.apply(prc));
+        } catch (final ComponentInitializationException e) {
+            Assert.fail("ComponentInitializationException");
         }
     }
 
-}
+}



More information about the commits mailing list