You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2014/10/01 09:52:41 UTC

[8/8] git commit: Adding another unit test

Adding another unit test


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

Branch: refs/heads/master
Commit: 4373b960b745e7c333643d2e6b26474c8e6575c7
Parents: f3887c2
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Tue Sep 30 18:14:33 2014 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Tue Sep 30 18:14:33 2014 +0100

----------------------------------------------------------------------
 .../cxf/fediz/core/samlsso/SAMLRequestTest.java | 27 +++++++++++++++++---
 1 file changed, 23 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/4373b960/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLRequestTest.java
----------------------------------------------------------------------
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLRequestTest.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLRequestTest.java
index f14d80e..06ae3a8 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLRequestTest.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/samlsso/SAMLRequestTest.java
@@ -98,7 +98,7 @@ public class SAMLRequestTest {
     }
     
     @org.junit.Test
-    public void createSAMLRequest() throws Exception {
+    public void createSAMLAuthnRequest() throws Exception {
         // Mock up a Request
         FedizContext config = getFederationConfigurator().getFedizContext("ROOT");
         
@@ -124,7 +124,7 @@ public class SAMLRequestTest {
     }
     
     @org.junit.Test
-    public void testRelayState() throws Exception {
+    public void testAuthnRelayState() throws Exception {
         // Mock up a Request
         FedizContext config = getFederationConfigurator().getFedizContext("ROOT");
         
@@ -150,7 +150,7 @@ public class SAMLRequestTest {
     }
     
     @org.junit.Test
-    public void testSAMLRequest() throws Exception {
+    public void testSAMLAuthnRequest() throws Exception {
         // Mock up a Request
         FedizContext config = getFederationConfigurator().getFedizContext("ROOT");
         
@@ -180,7 +180,7 @@ public class SAMLRequestTest {
     }
     
     @org.junit.Test
-    public void testSignedSAMLRequest() throws Exception {
+    public void testSignedSAMLAuthnRequest() throws Exception {
         // Mock up a Request
         FedizContext config = getFederationConfigurator().getFedizContext("SIGNED_ROOT");
         
@@ -228,4 +228,23 @@ public class SAMLRequestTest {
         Assert.assertEquals(TEST_REQUEST_URL, request.getIssuer().getValue());
     }
     
+    @org.junit.Test
+    public void testSignedSAMLLogoutRequest() throws Exception {
+        // Mock up a Request
+        FedizContext config = getFederationConfigurator().getFedizContext("SIGNED_ROOT");
+        
+        HttpServletRequest req = EasyMock.createMock(HttpServletRequest.class);
+        EasyMock.expect(req.getRequestURL()).andReturn(new StringBuffer(TEST_REQUEST_URL)).times(1, 2);
+        EasyMock.expect(req.getContextPath()).andReturn(TEST_REQUEST_URI);
+        EasyMock.expect(req.getRequestURI()).andReturn(TEST_REQUEST_URI).times(1, 2);
+        EasyMock.replay(req);
+        
+        FedizProcessor wfProc = new SAMLProcessorImpl();
+        RedirectionResponse response = wfProc.createSignOutRequest(req, config);
+        
+        String redirectionURL = response.getRedirectionURL();
+        String signature = 
+            redirectionURL.substring(redirectionURL.indexOf("Signature=") + "Signature=".length());
+        Assert.assertTrue(signature != null && signature.length() > 0);
+    }
 }
\ No newline at end of file