cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [2/2] cxf-fediz git commit: Fixing Jetty tests
Date Thu, 23 Apr 2015 19:50:47 GMT
Fixing Jetty 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/b203c025
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/b203c025
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/b203c025

Branch: refs/heads/master
Commit: b203c025318580a71295a4e5bdf43109dcc3774c
Parents: 18f4f41
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Thu Apr 23 20:50:32 2015 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Thu Apr 23 20:50:32 2015 +0100

----------------------------------------------------------------------
 .../ClientCertificatePreAuthSpringTest.java     | 27 +++++++++++++++++---
 .../integrationtests/ClientCertificateTest.java | 25 +++++++++++++++---
 .../cxf/fediz/integrationtests/JettyUtils.java  |  6 ++---
 3 files changed, 47 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/b203c025/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificatePreAuthSpringTest.java
----------------------------------------------------------------------
diff --git a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificatePreAuthSpringTest.java
b/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificatePreAuthSpringTest.java
index 0542bd1..6d47264 100644
--- a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificatePreAuthSpringTest.java
+++ b/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificatePreAuthSpringTest.java
@@ -19,6 +19,9 @@
 
 package org.apache.cxf.fediz.integrationtests;
 
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.util.resource.Resource;
+import org.eclipse.jetty.xml.XmlConfiguration;
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
@@ -32,6 +35,8 @@ public class ClientCertificatePreAuthSpringTest extends AbstractClientCertTests
     static String idpHttpsPort;
     static String rpHttpsPort;
     
+    private static Server rpServer;
+    
     @BeforeClass
     public static void init() {
         System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
@@ -48,17 +53,31 @@ public class ClientCertificatePreAuthSpringTest extends AbstractClientCertTests
         Assert.assertNotNull("Property 'idp.https.port' null", idpHttpsPort);
         rpHttpsPort = System.getProperty("rp.https.port");
         Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort);
-
+        
         JettyUtils.initIdpServer();
         JettyUtils.startIdpServer();
-        JettyUtils.initRpServer("rp-client-cert-server.xml");
-        JettyUtils.startRpServer();
+        
+        try {
+            Resource testServerConfig = Resource.newSystemResource("rp-client-cert-server.xml");
+            XmlConfiguration configuration = new XmlConfiguration(testServerConfig.getInputStream());
+            rpServer = (Server)configuration.configure();   
+            rpServer.start();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
     }
     
     @AfterClass
     public static void cleanup() {
         JettyUtils.stopIdpServer();
-        JettyUtils.stopRpServer();
+        
+        if (rpServer != null && rpServer.isStarted()) {
+            try {
+                rpServer.stop();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/b203c025/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
----------------------------------------------------------------------
diff --git a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
b/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
index 8e7d734..2955b52 100644
--- a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
+++ b/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
@@ -19,6 +19,9 @@
 
 package org.apache.cxf.fediz.integrationtests;
 
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.util.resource.Resource;
+import org.eclipse.jetty.xml.XmlConfiguration;
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
@@ -32,6 +35,8 @@ public class ClientCertificateTest extends AbstractClientCertTests {
     static String idpHttpsPort;
     static String rpHttpsPort;
     
+    private static Server rpServer;
+    
     @BeforeClass
     public static void init() {
         System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
@@ -51,14 +56,28 @@ public class ClientCertificateTest extends AbstractClientCertTests {
 
         JettyUtils.initIdpServer();
         JettyUtils.startIdpServer();
-        JettyUtils.initRpServer("rp-client-cert-server.xml");
-        JettyUtils.startRpServer();
+        
+        try {
+            Resource testServerConfig = Resource.newSystemResource("rp-client-cert-server.xml");
+            XmlConfiguration configuration = new XmlConfiguration(testServerConfig.getInputStream());
+            rpServer = (Server)configuration.configure();   
+            rpServer.start();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
     }
     
     @AfterClass
     public static void cleanup() {
         JettyUtils.stopIdpServer();
-        JettyUtils.stopRpServer();
+        
+        if (rpServer != null && rpServer.isStarted()) {
+            try {
+                rpServer.stop();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/b203c025/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyUtils.java
----------------------------------------------------------------------
diff --git a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyUtils.java
b/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyUtils.java
index fb6859d..8696870 100644
--- a/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyUtils.java
+++ b/systests/jetty8/src/test/java/org/apache/cxf/fediz/integrationtests/JettyUtils.java
@@ -58,8 +58,7 @@ public final class JettyUtils {
     public static void stopIdpServer() {
         if (idpServer != null && idpServer.isStarted()) {
             try {
-                idpServer.setGracefulShutdown(2000);
-                idpServer.setStopAtShutdown(true);
+                idpServer.stop();
             } catch (Exception e) {
                 e.printStackTrace();
             }
@@ -96,8 +95,7 @@ public final class JettyUtils {
     public static void stopRpServer() {
         if (rpServer != null && rpServer.isStarted()) {
             try {
-                rpServer.setGracefulShutdown(2000);
-                rpServer.setStopAtShutdown(true);
+                rpServer.stop();
             } catch (Exception e) {
                 e.printStackTrace();
             }


Mime
View raw message