cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbernha...@apache.org
Subject git commit: Extending unit test for ClaimUtils
Date Tue, 07 Oct 2014 12:14:33 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes 3762de320 -> 5489c942f


Extending unit test for ClaimUtils


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/5489c942
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/5489c942
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/5489c942

Branch: refs/heads/2.7.x-fixes
Commit: 5489c942f23a6f473820bab5a2ed257e3bd9f21f
Parents: 3762de320
Author: Jan Bernhardt <jbernhardt@talend.com>
Authored: Tue Oct 7 14:11:21 2014 +0200
Committer: Jan Bernhardt <jbernhardt@talend.com>
Committed: Tue Oct 7 14:12:00 2014 +0200

----------------------------------------------------------------------
 .../cxf/sts/claims/mapper/JexlClaimsMapperTest.java      |  1 -
 .../test/resources/jexlClaimMappingsWithFunctions.script | 11 ++++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/5489c942/services/sts/sts-core/src/test/java/org/apache/cxf/sts/claims/mapper/JexlClaimsMapperTest.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/claims/mapper/JexlClaimsMapperTest.java
b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/claims/mapper/JexlClaimsMapperTest.java
index c46fb85..c75a303 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/claims/mapper/JexlClaimsMapperTest.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/claims/mapper/JexlClaimsMapperTest.java
@@ -200,7 +200,6 @@ public class JexlClaimsMapperTest extends org.junit.Assert {
         assertTrue(claim.getValues().contains("second_match"));
     }
 
-    @SuppressWarnings("unchecked")
     protected ClaimCollection createClaimCollection() {
         ClaimCollection cc = new ClaimCollection();
         Claim c = new Claim();

http://git-wip-us.apache.org/repos/asf/cxf/blob/5489c942/services/sts/sts-core/src/test/resources/jexlClaimMappingsWithFunctions.script
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/resources/jexlClaimMappingsWithFunctions.script
b/services/sts/sts-core/src/test/resources/jexlClaimMappingsWithFunctions.script
index 4f25bd9..ccbd3e6 100644
--- a/services/sts/sts-core/src/test/resources/jexlClaimMappingsWithFunctions.script
+++ b/services/sts/sts-core/src/test/resources/jexlClaimMappingsWithFunctions.script
@@ -58,10 +58,19 @@
     var unfilterClaim = claims:create("http://my.schema.org/identity/claims/filter", "different",
"match", "second_match", "other");
     var filterClaim = claims:filterValues(unfilterClaim, ".*match");
 	
+	// Test with claims not available in sourceClaims -> should not result in an error
+    var nullClaim = claims:get(sourceClaims, 'resultShouldBeNull');
+    nullClaim = claims:mapValues(nullClaim, roleMappings, false);
+	nullClaim = claims:upperCaseValues(nullClaim);
+	nullClaim = claims:lowerCaseValues(nullClaim);
+	nullClaim = claims:singleToMultiValue(nullClaim, ",");
+	nullClaim = claims:multiToSingleValue(nullClaim, ",");
+	nullClaim = claims:filterValues(nullClaim, ".*match");
+	
     // Collect claims for new token
     targetClaims = claims:add(targetClaims, mappedRoles, mergedClaim, idpClaim);
     targetClaims = claims:add(targetClaims, uppercaseClaim, lowercaseClaim, wrappedUppercaseClaim,
emailClaim);
-	targetClaims = claims:add(targetClaims, singleValue, multiValue, filterClaim);
+	targetClaims = claims:add(targetClaims, singleValue, multiValue, filterClaim, nullClaim);
     
     // Set correct issuer
     targetClaims = claims:updateIssuer(targetClaims, claimsParameters.stsProperties.issuer);


Mime
View raw message