[java-opensaml COMMIT] in /trunk/opensaml-xacml-impl/src/test/java/org/opensaml/xacml/ctx/provider: BaseObligationHan...

noreply at shibboleth.net noreply at shibboleth.net
Fri Jul 13 06:53:26 EDT 2012


Author: rdw
Date: Fri Jul 13 06:53:26 2012
New Revision: 3093

URL: http://svn.shibboleth.net/view/java-opensaml?rev=3093&view=rev
Log:
https://issues.shibboleth.net/jira/browse/OSJ-16 slightly increase the depth of testing of the Obligation handling code

Added:
    trunk/opensaml-xacml-impl/src/test/java/org/opensaml/xacml/ctx/provider/BaseObligationHandlerTest.java   (with props)
Modified:
    trunk/opensaml-xacml-impl/src/test/java/org/opensaml/xacml/ctx/provider/ObligationServiceTest.java

Modified: trunk/opensaml-xacml-impl/src/test/java/org/opensaml/xacml/ctx/provider/ObligationServiceTest.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-xacml-impl/src/test/java/org/opensaml/xacml/ctx/provider/ObligationServiceTest.java?rev=3093&r1=3092&r2=3093&view=diff
==============================================================================
--- trunk/opensaml-xacml-impl/src/test/java/org/opensaml/xacml/ctx/provider/ObligationServiceTest.java (original)
+++ trunk/opensaml-xacml-impl/src/test/java/org/opensaml/xacml/ctx/provider/ObligationServiceTest.java Fri Jul 13 06:53:26 2012
@@ -16,6 +16,9 @@
  */
 
 package org.opensaml.xacml.ctx.provider;
+
+import java.util.Arrays;
+import java.util.Collections;
 
 import org.testng.annotations.Test;
 import org.testng.annotations.BeforeMethod;
@@ -89,9 +92,18 @@
         obligSrvc.addObligationhandler(new MultiplicitiveObligationHandler("multiply1", 2, 2));
         
         // Test lexical ordering when two handlers have the same precedence
-        obligSrvc.addObligationhandler(new AdditiveObligationHandler("add2", 3, 2));
-        obligSrvc.addObligationhandler(new MultiplicitiveObligationHandler("multiply2", 3, 2));
+        obligSrvc.addObligationhandler(Arrays.asList(
+                new AdditiveObligationHandler("add2", 3, 2),
+                new MultiplicitiveObligationHandler("multiply2", 3, 2)));
 
+        obligSrvc.addObligationhandler(Collections.EMPTY_LIST);
+        
+        BaseObligationHandler toDel = new AdditiveObligationHandler("doo", -1, 3);
+        obligSrvc.addObligationhandler(toDel);
+        Assert.assertEquals(obligSrvc.getObligationHandlers().size(), 5);
+        obligSrvc.removeObligationHandler(toDel);
+        Assert.assertEquals(obligSrvc.getObligationHandlers().size(), 4);
+        
         obligSrvc.processObligations(processingCtx);
 
         Assert.assertEquals(count, 8);



More information about the commits mailing list