cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject cxf-fediz git commit: Close WebClient in the tests
Date Wed, 02 Dec 2015 15:06:35 GMT
Repository: cxf-fediz
Updated Branches:
  refs/heads/master b56e6527e -> 7f3ed73cd


Close WebClient in the tests


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

Branch: refs/heads/master
Commit: 7f3ed73cd3566a38edd4bd288575ccba4a8212c4
Parents: b56e652
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Wed Dec 2 15:06:16 2015 +0000
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Wed Dec 2 15:06:16 2015 +0000

----------------------------------------------------------------------
 .../cxf/fediz/integrationtests/SAMLSSOTest.java  |  1 +
 .../cxf/fediz/integrationtests/WSFedTest.java    |  2 ++
 .../cxf/fediz/integrationtests/KerberosTest.java |  4 ++++
 .../AbstractClientCertTests.java                 |  4 ++++
 .../fediz/integrationtests/AbstractTests.java    | 19 +++++++++++++++++++
 .../fediz/integrationtests/HTTPTestUtils.java    |  7 +++++++
 .../EntityExpansionAttackTest.java               |  2 +-
 .../fediz/integrationtests/HolderOfKeyTest.java  |  2 ++
 .../cxf/fediz/integrationtests/WReqTest.java     |  1 +
 .../EntityExpansionAttackTest.java               |  2 +-
 .../fediz/integrationtests/HolderOfKeyTest.java  |  2 ++
 .../cxf/fediz/integrationtests/WReqTest.java     |  1 +
 12 files changed, 45 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/7f3ed73c/systests/federation/samlsso/src/test/java/org/apache/cxf/fediz/integrationtests/SAMLSSOTest.java
----------------------------------------------------------------------
diff --git a/systests/federation/samlsso/src/test/java/org/apache/cxf/fediz/integrationtests/SAMLSSOTest.java
b/systests/federation/samlsso/src/test/java/org/apache/cxf/fediz/integrationtests/SAMLSSOTest.java
index 01e1171..39311a6 100644
--- a/systests/federation/samlsso/src/test/java/org/apache/cxf/fediz/integrationtests/SAMLSSOTest.java
+++ b/systests/federation/samlsso/src/test/java/org/apache/cxf/fediz/integrationtests/SAMLSSOTest.java
@@ -290,6 +290,7 @@ public class SAMLSSOTest {
         final HtmlPage rpPage = button.click();
         Assert.assertEquals("WS Federation Systests Examples", rpPage.getTitleText());
 
+        webClient.close();
         return rpPage.getBody().getTextContent();
     }
     

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/7f3ed73c/systests/federation/wsfed/src/test/java/org/apache/cxf/fediz/integrationtests/WSFedTest.java
----------------------------------------------------------------------
diff --git a/systests/federation/wsfed/src/test/java/org/apache/cxf/fediz/integrationtests/WSFedTest.java
b/systests/federation/wsfed/src/test/java/org/apache/cxf/fediz/integrationtests/WSFedTest.java
index b5742a6..dae44a6 100644
--- a/systests/federation/wsfed/src/test/java/org/apache/cxf/fediz/integrationtests/WSFedTest.java
+++ b/systests/federation/wsfed/src/test/java/org/apache/cxf/fediz/integrationtests/WSFedTest.java
@@ -307,6 +307,7 @@ public class WSFedTest {
             }
         }
         Assert.assertTrue(wctx != null && wresult != null && wtrealm != null);
+        webClient.close();
 
         // Invoke on the IdP for "realm a"
         final WebClient webClient2 = new WebClient();
@@ -332,6 +333,7 @@ public class WSFedTest {
         final HtmlPage rpPage = button2.click();
         Assert.assertEquals("WS Federation Systests Examples", rpPage.getTitleText());
 
+        webClient2.close();
         return rpPage.getBody().getTextContent();
     }
     

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/7f3ed73c/systests/kerberos/src/test/java/org/apache/cxf/fediz/integrationtests/KerberosTest.java
----------------------------------------------------------------------
diff --git a/systests/kerberos/src/test/java/org/apache/cxf/fediz/integrationtests/KerberosTest.java
b/systests/kerberos/src/test/java/org/apache/cxf/fediz/integrationtests/KerberosTest.java
index cd26623..57c9876 100644
--- a/systests/kerberos/src/test/java/org/apache/cxf/fediz/integrationtests/KerberosTest.java
+++ b/systests/kerberos/src/test/java/org/apache/cxf/fediz/integrationtests/KerberosTest.java
@@ -327,6 +327,8 @@ public class KerberosTest extends AbstractLdapTestUnit {
         claim = ClaimTypes.EMAILADDRESS.toString();
         Assert.assertTrue("User " + user + " claim " + claim + " is not 'alice@realma.org'",
                           bodyTextContent.contains(claim + "=alice@realma.org"));
+        
+        webClient.close();
     }
     
     // To get this test to work, uncomment the "spnego" configuration in the STS's kerberos.xml
@@ -372,6 +374,8 @@ public class KerberosTest extends AbstractLdapTestUnit {
         claim = ClaimTypes.EMAILADDRESS.toString();
         Assert.assertTrue("User " + user + " claim " + claim + " is not 'alice@realma.org'",
                           bodyTextContent.contains(claim + "=alice@realma.org"));
+        
+        webClient.close();
     }
     
     private String getEncodedKerberosTicket(boolean spnego) throws Exception {

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/7f3ed73c/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractClientCertTests.java
----------------------------------------------------------------------
diff --git a/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractClientCertTests.java
b/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractClientCertTests.java
index 9c4982c..f0431b8 100644
--- a/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractClientCertTests.java
+++ b/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractClientCertTests.java
@@ -108,6 +108,8 @@ public abstract class AbstractClientCertTests {
         claim = ClaimTypes.EMAILADDRESS.toString();
         Assert.assertTrue("User " + user + " claim " + claim + " is not 'alice@realma.org'",
                           bodyTextContent.contains(claim + "=alice@realma.org"));
+        
+        webClient.close();
     }
     
     @org.junit.Test
@@ -146,6 +148,7 @@ public abstract class AbstractClientCertTests {
         Assert.assertTrue(wctx != null && wtrealm != null);
         Assert.assertTrue(wresult != null 
             && wresult.contains("urn:oasis:names:tc:SAML:2.0:cm:holder-of-key"));
+        webClient.close();
         
         // Now invoke on the RP using the saved parameters above, but a different client
cert!
         final WebClient webClient2 = new WebClient();
@@ -172,6 +175,7 @@ public abstract class AbstractClientCertTests {
                               || ex.getMessage().contains("403 Forbidden"));
         }
 
+        webClient2.close();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/7f3ed73c/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
----------------------------------------------------------------------
diff --git a/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
b/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
index 75725c4..63ff980 100644
--- a/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
+++ b/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/AbstractTests.java
@@ -352,6 +352,8 @@ public abstract class AbstractTests {
         Assert.assertNotNull(ki.getX509Certificate());
 
         Assert.assertTrue(signature.checkSignatureValue(ki.getX509Certificate()));
+        
+        webClient.close();
     }
     
     @Test
@@ -383,6 +385,8 @@ public abstract class AbstractTests {
         Assert.assertNotNull(ki.getX509Certificate());
 
         Assert.assertTrue(signature.checkSignatureValue(ki.getX509Certificate()));
+        
+        webClient.close();
     }
     
     @Test
@@ -414,6 +418,8 @@ public abstract class AbstractTests {
         Assert.assertNotNull(ki.getX509Certificate());
 
         Assert.assertTrue(signature.checkSignatureValue(ki.getX509Certificate()));
+        
+        webClient.close();
     }
     
     @Test
@@ -449,6 +455,7 @@ public abstract class AbstractTests {
         String rpUrl = "https://localhost:" + getRpHttpsPort() + "/" + getServletContextName()

             + "/secure/fedservlet";
 
+        webClient.close();
         webClient = new WebClient();
         webClient.setCookieManager(cookieManager);
         webClient.getOptions().setUseInsecureSSL(true);
@@ -456,6 +463,8 @@ public abstract class AbstractTests {
         final HtmlPage idpPage = webClient.getPage(rpUrl);
 
         Assert.assertEquals(401, idpPage.getWebResponse().getStatusCode());
+        
+        webClient.close();
     }
     
     @Test
@@ -491,6 +500,7 @@ public abstract class AbstractTests {
         String rpUrl = "https://localhost:" + getRpHttpsPort() + "/" + getServletContextName()

             + "/secure/fedservlet";
 
+        webClient.close();
         webClient = new WebClient();
         webClient.setCookieManager(cookieManager);
         webClient.getOptions().setUseInsecureSSL(true);
@@ -498,6 +508,8 @@ public abstract class AbstractTests {
         final HtmlPage idpPage = webClient.getPage(rpUrl);
 
         Assert.assertEquals(401, idpPage.getWebResponse().getStatusCode());
+        
+        webClient.close();
     }
     
     @Test
@@ -533,6 +545,7 @@ public abstract class AbstractTests {
         String rpUrl = "https://localhost:" + getRpHttpsPort() + "/" + getServletContextName()

             + "/secure/fedservlet";
 
+        webClient.close();
         webClient = new WebClient();
         webClient.setCookieManager(cookieManager);
         webClient.getOptions().setUseInsecureSSL(true);
@@ -540,6 +553,8 @@ public abstract class AbstractTests {
         final HtmlPage idpPage = webClient.getPage(rpUrl);
 
         Assert.assertEquals(401, idpPage.getWebResponse().getStatusCode());
+        
+        webClient.close();
     }
     
     @Test
@@ -590,6 +605,7 @@ public abstract class AbstractTests {
                               || ex.getMessage().contains("403 Forbidden"));
         }
 
+        webClient.close();
     }
     
     @Test
@@ -636,6 +652,7 @@ public abstract class AbstractTests {
 
         Assert.assertTrue("Unexpected content of RP page", bodyTextContent2.contains("Secure
Test"));
 
+        webClient.close();
     }
     
     @org.junit.Test
@@ -665,6 +682,7 @@ public abstract class AbstractTests {
         idpUrl += "?wa=wsignin1.0&wreply=" + URLEncoder.encode(maliciousURL, "UTF-8");
         idpUrl += "&wtrealm=urn%3Aorg%3Aapache%3Acxf%3Afediz%3Afedizhelloworld";
         idpUrl += "&whr=urn%3Aorg%3Aapache%3Acxf%3Afediz%3Aidp%3Arealm-A";
+        webClient.close();
         
         final WebClient webClient2 = new WebClient();
         webClient2.setCookieManager(cookieManager);
@@ -680,6 +698,7 @@ public abstract class AbstractTests {
         } catch (FailingHttpStatusCodeException ex) {
             Assert.assertEquals(ex.getStatusCode(), 400);
         }
+        webClient2.close();
     }
     
 }

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/7f3ed73c/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/HTTPTestUtils.java
----------------------------------------------------------------------
diff --git a/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/HTTPTestUtils.java
b/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/HTTPTestUtils.java
index 515842f..f69a088 100644
--- a/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/HTTPTestUtils.java
+++ b/systests/tests/src/test/java/org/apache/cxf/fediz/integrationtests/HTTPTestUtils.java
@@ -61,6 +61,7 @@ public final class HTTPTestUtils {
         Assert.assertTrue("WS Federation Systests Examples".equals(rpPage.getTitleText())
                             || "WS Federation Systests Spring Examples".equals(rpPage.getTitleText()));
 
+        webClient.close();
         return rpPage.getBody().getTextContent();
     }
     
@@ -74,6 +75,7 @@ public final class HTTPTestUtils {
         webClient.getOptions().setJavaScriptEnabled(false);
         final HtmlPage rpPage = webClient.getPage(url);
 
+        webClient.close();
         return rpPage.getBody().getTextContent();
     }
     
@@ -98,6 +100,7 @@ public final class HTTPTestUtils {
         Assert.assertTrue("WS Federation Systests Examples".equals(rpPage.getTitleText())
                           || "WS Federation Systests Spring Examples".equals(rpPage.getTitleText()));
 
+        webClient.close();
         return rpPage.getBody().getTextContent();
     }
     
@@ -122,6 +125,8 @@ public final class HTTPTestUtils {
             //we should get a fault if the image isn't available.
             webClient.getPage(imgSrc);
         }
+        
+        webClient.close();
     }
     
     public static void logoutCleanup(String url, CookieManager cookieManager) throws IOException
{
@@ -143,6 +148,8 @@ public final class HTTPTestUtils {
             //we should get a fault if the image isn't available.
             webClient.getPage(imgSrc);
         }
+        
+        webClient.close();
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/7f3ed73c/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/EntityExpansionAttackTest.java
----------------------------------------------------------------------
diff --git a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/EntityExpansionAttackTest.java
b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/EntityExpansionAttackTest.java
index c172962..4db1f94 100644
--- a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/EntityExpansionAttackTest.java
+++ b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/EntityExpansionAttackTest.java
@@ -235,13 +235,13 @@ public class EntityExpansionAttackTest {
             button.click();
             Assert.fail("Failure expected on an entity expansion attack");
         } catch (FailingHttpStatusCodeException ex) {
-            ex.printStackTrace();
             // expected
             Assert.assertTrue(ex.getMessage().contains("401 Unauthorized")
                               || ex.getMessage().contains("401 Authentication Failed")
                               || ex.getMessage().contains("403 Forbidden"));
         }
 
+        webClient.close();
     }
     
 }

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/7f3ed73c/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/HolderOfKeyTest.java
----------------------------------------------------------------------
diff --git a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/HolderOfKeyTest.java
b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/HolderOfKeyTest.java
index 5d4d894..872dd3c 100644
--- a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/HolderOfKeyTest.java
+++ b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/HolderOfKeyTest.java
@@ -244,6 +244,8 @@ public class HolderOfKeyTest {
         claim = ClaimTypes.EMAILADDRESS.toString();
         Assert.assertTrue("User " + user + " claim " + claim + " is not 'alice@realma.org'",
                           bodyTextContent.contains(claim + "=alice@realma.org"));
+        
+        webClient.close();
     }
     
 }

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/7f3ed73c/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/WReqTest.java
----------------------------------------------------------------------
diff --git a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/WReqTest.java
b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/WReqTest.java
index 68fc688..0af94dd 100644
--- a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/WReqTest.java
+++ b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/WReqTest.java
@@ -249,6 +249,7 @@ public class WReqTest {
         final HtmlPage rpPage = button.click();
         Assert.assertEquals("WS Federation Systests Examples", rpPage.getTitleText());
 
+        webClient.close();
         return rpPage.getBody().getTextContent();
     }
     

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/7f3ed73c/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/EntityExpansionAttackTest.java
----------------------------------------------------------------------
diff --git a/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/EntityExpansionAttackTest.java
b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/EntityExpansionAttackTest.java
index cbb726c..1758e0c 100644
--- a/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/EntityExpansionAttackTest.java
+++ b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/EntityExpansionAttackTest.java
@@ -235,13 +235,13 @@ public class EntityExpansionAttackTest {
             button.click();
             Assert.fail("Failure expected on an entity expansion attack");
         } catch (FailingHttpStatusCodeException ex) {
-            ex.printStackTrace();
             // expected
             Assert.assertTrue(ex.getMessage().contains("401 Unauthorized")
                               || ex.getMessage().contains("401 Authentication Failed")
                               || ex.getMessage().contains("403 Forbidden"));
         }
 
+        webClient.close();
     }
     
 }

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/7f3ed73c/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/HolderOfKeyTest.java
----------------------------------------------------------------------
diff --git a/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/HolderOfKeyTest.java
b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/HolderOfKeyTest.java
index 8cdb82b..1a2dc0a 100644
--- a/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/HolderOfKeyTest.java
+++ b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/HolderOfKeyTest.java
@@ -244,6 +244,8 @@ public class HolderOfKeyTest {
         claim = ClaimTypes.EMAILADDRESS.toString();
         Assert.assertTrue("User " + user + " claim " + claim + " is not 'alice@realma.org'",
                           bodyTextContent.contains(claim + "=alice@realma.org"));
+        
+        webClient.close();
     }
     
 }

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/7f3ed73c/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/WReqTest.java
----------------------------------------------------------------------
diff --git a/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/WReqTest.java
b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/WReqTest.java
index d010db1..2a2626c 100644
--- a/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/WReqTest.java
+++ b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/WReqTest.java
@@ -249,6 +249,7 @@ public class WReqTest {
         final HtmlPage rpPage = button.click();
         Assert.assertEquals("WS Federation Systests Examples", rpPage.getTitleText());
 
+        webClient.close();
         return rpPage.getBody().getTextContent();
     }
     


Mime
View raw message