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 2016/04/07 18:04:41 UTC
[1/2] cxf-fediz git commit: Consolidate Tomcat shutdown code + avoid
a NPE
Repository: cxf-fediz
Updated Branches:
refs/heads/1.2.x-fixes 54ad62c98 -> dffcc9e03
Consolidate Tomcat shutdown code + avoid a NPE
Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/0c2deab1
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/0c2deab1
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/0c2deab1
Branch: refs/heads/1.2.x-fixes
Commit: 0c2deab10236639ea30e5b5362fca407eb321f4e
Parents: 54ad62c
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Thu Apr 7 12:03:49 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Thu Apr 7 17:03:46 2016 +0100
----------------------------------------------------------------------
.../federation/FederationTest.java | 28 +++++++------------
.../cxf/fediz/integrationtests/SAMLSSOTest.java | 27 +++++++-----------
.../cxf/fediz/integrationtests/WSFedTest.java | 27 +++++++-----------
.../apache/cxf/fediz/systests/idp/IdpTest.java | 14 ++++++----
.../fediz/integrationtests/KerberosTest.java | 27 +++++++-----------
.../cxf/fediz/integrationtests/Spring2Test.java | 28 ++++++++-----------
.../cxf/fediz/integrationtests/SpringTest.java | 27 +++++++-----------
.../integrationtests/ClientCertificateTest.java | 27 +++++++-----------
.../fediz/integrationtests/HolderOfKeyTest.java | 29 ++++++++------------
.../cxf/fediz/integrationtests/TomcatTest.java | 27 +++++++-----------
.../cxf/fediz/integrationtests/WReqTest.java | 27 +++++++-----------
11 files changed, 111 insertions(+), 177 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/0c2deab1/systests/cxf/src/test/java/org/apache/cxf/fediz/integrationtests/federation/FederationTest.java
----------------------------------------------------------------------
diff --git a/systests/cxf/src/test/java/org/apache/cxf/fediz/integrationtests/federation/FederationTest.java b/systests/cxf/src/test/java/org/apache/cxf/fediz/integrationtests/federation/FederationTest.java
index 5404e49..937d5af 100644
--- a/systests/cxf/src/test/java/org/apache/cxf/fediz/integrationtests/federation/FederationTest.java
+++ b/systests/cxf/src/test/java/org/apache/cxf/fediz/integrationtests/federation/FederationTest.java
@@ -134,30 +134,22 @@ public class FederationTest extends AbstractTests {
@AfterClass
public static void cleanup() {
+ shutdownServer(idpServer);
+ shutdownServer(rpServer);
+ }
+
+ private static void shutdownServer(Tomcat server) {
try {
- if (idpServer.getServer() != null
- && idpServer.getServer().getState() != LifecycleState.DESTROYED) {
- if (idpServer.getServer().getState() != LifecycleState.STOPPED) {
- idpServer.stop();
- }
- idpServer.destroy();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- try {
- if (rpServer.getServer() != null
- && rpServer.getServer().getState() != LifecycleState.DESTROYED) {
- if (rpServer.getServer().getState() != LifecycleState.STOPPED) {
- rpServer.stop();
+ if (server != null && server.getServer() != null
+ && server.getServer().getState() != LifecycleState.DESTROYED) {
+ if (server.getServer().getState() != LifecycleState.STOPPED) {
+ server.stop();
}
- rpServer.destroy();
+ server.destroy();
}
} catch (Exception e) {
e.printStackTrace();
}
-
}
public String getIdpHttpsPort() {
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/0c2deab1/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 64e6b52..b42d4b5 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
@@ -204,25 +204,18 @@ public class SAMLSSOTest {
@AfterClass
public static void cleanup() {
+ shutdownServer(idpServer);
+ shutdownServer(rpServer);
+ }
+
+ private static void shutdownServer(Tomcat server) {
try {
- if (idpServer.getServer() != null
- && idpServer.getServer().getState() != LifecycleState.DESTROYED) {
- if (idpServer.getServer().getState() != LifecycleState.STOPPED) {
- idpServer.stop();
- }
- idpServer.destroy();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- try {
- if (rpServer.getServer() != null
- && rpServer.getServer().getState() != LifecycleState.DESTROYED) {
- if (rpServer.getServer().getState() != LifecycleState.STOPPED) {
- rpServer.stop();
+ if (server != null && server.getServer() != null
+ && server.getServer().getState() != LifecycleState.DESTROYED) {
+ if (server.getServer().getState() != LifecycleState.STOPPED) {
+ server.stop();
}
- rpServer.destroy();
+ server.destroy();
}
} catch (Exception e) {
e.printStackTrace();
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/0c2deab1/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 a4f62d3..98b429d 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
@@ -198,25 +198,18 @@ public class WSFedTest {
@AfterClass
public static void cleanup() {
+ shutdownServer(idpServer);
+ shutdownServer(rpServer);
+ }
+
+ private static void shutdownServer(Tomcat server) {
try {
- if (idpServer.getServer() != null
- && idpServer.getServer().getState() != LifecycleState.DESTROYED) {
- if (idpServer.getServer().getState() != LifecycleState.STOPPED) {
- idpServer.stop();
- }
- idpServer.destroy();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- try {
- if (rpServer.getServer() != null
- && rpServer.getServer().getState() != LifecycleState.DESTROYED) {
- if (rpServer.getServer().getState() != LifecycleState.STOPPED) {
- rpServer.stop();
+ if (server != null && server.getServer() != null
+ && server.getServer().getState() != LifecycleState.DESTROYED) {
+ if (server.getServer().getState() != LifecycleState.STOPPED) {
+ server.stop();
}
- rpServer.destroy();
+ server.destroy();
}
} catch (Exception e) {
e.printStackTrace();
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/0c2deab1/systests/idp/src/test/java/org/apache/cxf/fediz/systests/idp/IdpTest.java
----------------------------------------------------------------------
diff --git a/systests/idp/src/test/java/org/apache/cxf/fediz/systests/idp/IdpTest.java b/systests/idp/src/test/java/org/apache/cxf/fediz/systests/idp/IdpTest.java
index 78cbe56..62da812 100644
--- a/systests/idp/src/test/java/org/apache/cxf/fediz/systests/idp/IdpTest.java
+++ b/systests/idp/src/test/java/org/apache/cxf/fediz/systests/idp/IdpTest.java
@@ -117,13 +117,17 @@ public class IdpTest {
@AfterClass
public static void cleanup() {
+ shutdownServer(idpServer);
+ }
+
+ private static void shutdownServer(Tomcat server) {
try {
- if (idpServer.getServer() != null
- && idpServer.getServer().getState() != LifecycleState.DESTROYED) {
- if (idpServer.getServer().getState() != LifecycleState.STOPPED) {
- idpServer.stop();
+ if (server != null && server.getServer() != null
+ && server.getServer().getState() != LifecycleState.DESTROYED) {
+ if (server.getServer().getState() != LifecycleState.STOPPED) {
+ server.stop();
}
- idpServer.destroy();
+ server.destroy();
}
} catch (Exception e) {
e.printStackTrace();
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/0c2deab1/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 3dda898..1c28f98 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
@@ -242,25 +242,18 @@ public class KerberosTest extends AbstractLdapTestUnit {
@AfterClass
public static void cleanup() {
+ shutdownServer(idpServer);
+ shutdownServer(rpServer);
+ }
+
+ private static void shutdownServer(Tomcat server) {
try {
- if (idpServer.getServer() != null
- && idpServer.getServer().getState() != LifecycleState.DESTROYED) {
- if (idpServer.getServer().getState() != LifecycleState.STOPPED) {
- idpServer.stop();
- }
- idpServer.destroy();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- try {
- if (rpServer.getServer() != null
- && rpServer.getServer().getState() != LifecycleState.DESTROYED) {
- if (rpServer.getServer().getState() != LifecycleState.STOPPED) {
- rpServer.stop();
+ if (server != null && server.getServer() != null
+ && server.getServer().getState() != LifecycleState.DESTROYED) {
+ if (server.getServer().getState() != LifecycleState.STOPPED) {
+ server.stop();
}
- rpServer.destroy();
+ server.destroy();
}
} catch (Exception e) {
e.printStackTrace();
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/0c2deab1/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/Spring2Test.java
----------------------------------------------------------------------
diff --git a/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/Spring2Test.java b/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/Spring2Test.java
index 86a928f..f20a45f 100644
--- a/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/Spring2Test.java
+++ b/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/Spring2Test.java
@@ -72,25 +72,18 @@ public class Spring2Test extends AbstractTests {
@AfterClass
public static void cleanup() {
+ shutdownServer(idpServer);
+ shutdownServer(rpServer);
+ }
+
+ private static void shutdownServer(Tomcat server) {
try {
- if (idpServer.getServer() != null
- && idpServer.getServer().getState() != LifecycleState.DESTROYED) {
- if (idpServer.getServer().getState() != LifecycleState.STOPPED) {
- idpServer.stop();
- }
- idpServer.destroy();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- try {
- if (rpServer.getServer() != null
- && rpServer.getServer().getState() != LifecycleState.DESTROYED) {
- if (rpServer.getServer().getState() != LifecycleState.STOPPED) {
- rpServer.stop();
+ if (server != null && server.getServer() != null
+ && server.getServer().getState() != LifecycleState.DESTROYED) {
+ if (server.getServer().getState() != LifecycleState.STOPPED) {
+ server.stop();
}
- rpServer.destroy();
+ server.destroy();
}
} catch (Exception e) {
e.printStackTrace();
@@ -259,6 +252,7 @@ public class Spring2Test extends AbstractTests {
// || ex.getMessage().contains("403 Forbidden"));
}
+ webClient.close();
}
@Override
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/0c2deab1/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/SpringTest.java
----------------------------------------------------------------------
diff --git a/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/SpringTest.java b/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/SpringTest.java
index 5e100c8..4da2edc 100644
--- a/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/SpringTest.java
+++ b/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/SpringTest.java
@@ -58,25 +58,18 @@ public class SpringTest extends AbstractTests {
@AfterClass
public static void cleanup() {
+ shutdownServer(idpServer);
+ shutdownServer(rpServer);
+ }
+
+ private static void shutdownServer(Tomcat server) {
try {
- if (idpServer.getServer() != null
- && idpServer.getServer().getState() != LifecycleState.DESTROYED) {
- if (idpServer.getServer().getState() != LifecycleState.STOPPED) {
- idpServer.stop();
- }
- idpServer.destroy();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- try {
- if (rpServer.getServer() != null
- && rpServer.getServer().getState() != LifecycleState.DESTROYED) {
- if (rpServer.getServer().getState() != LifecycleState.STOPPED) {
- rpServer.stop();
+ if (server != null && server.getServer() != null
+ && server.getServer().getState() != LifecycleState.DESTROYED) {
+ if (server.getServer().getState() != LifecycleState.STOPPED) {
+ server.stop();
}
- rpServer.destroy();
+ server.destroy();
}
} catch (Exception e) {
e.printStackTrace();
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/0c2deab1/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
----------------------------------------------------------------------
diff --git a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
index 078e032..e7733e1 100644
--- a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
+++ b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
@@ -139,25 +139,18 @@ public class ClientCertificateTest extends AbstractClientCertTests {
@AfterClass
public static void cleanup() {
+ shutdownServer(idpServer);
+ shutdownServer(rpServer);
+ }
+
+ private static void shutdownServer(Tomcat server) {
try {
- if (idpServer.getServer() != null
- && idpServer.getServer().getState() != LifecycleState.DESTROYED) {
- if (idpServer.getServer().getState() != LifecycleState.STOPPED) {
- idpServer.stop();
- }
- idpServer.destroy();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- try {
- if (rpServer.getServer() != null
- && rpServer.getServer().getState() != LifecycleState.DESTROYED) {
- if (rpServer.getServer().getState() != LifecycleState.STOPPED) {
- rpServer.stop();
+ if (server != null && server.getServer() != null
+ && server.getServer().getState() != LifecycleState.DESTROYED) {
+ if (server.getServer().getState() != LifecycleState.STOPPED) {
+ server.stop();
}
- rpServer.destroy();
+ server.destroy();
}
} catch (Exception e) {
e.printStackTrace();
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/0c2deab1/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 2385ec7..d1547f7 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
@@ -149,31 +149,24 @@ public class HolderOfKeyTest {
@AfterClass
public static void cleanup() {
+ shutdownServer(idpServer);
+ shutdownServer(rpServer);
+ }
+
+ private static void shutdownServer(Tomcat server) {
try {
- if (idpServer.getServer() != null
- && idpServer.getServer().getState() != LifecycleState.DESTROYED) {
- if (idpServer.getServer().getState() != LifecycleState.STOPPED) {
- idpServer.stop();
- }
- idpServer.destroy();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- try {
- if (rpServer.getServer() != null
- && rpServer.getServer().getState() != LifecycleState.DESTROYED) {
- if (rpServer.getServer().getState() != LifecycleState.STOPPED) {
- rpServer.stop();
+ if (server != null && server.getServer() != null
+ && server.getServer().getState() != LifecycleState.DESTROYED) {
+ if (server.getServer().getState() != LifecycleState.STOPPED) {
+ server.stop();
}
- rpServer.destroy();
+ server.destroy();
}
} catch (Exception e) {
e.printStackTrace();
}
}
-
+
public String getIdpHttpsPort() {
return idpHttpsPort;
}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/0c2deab1/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/TomcatTest.java
----------------------------------------------------------------------
diff --git a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/TomcatTest.java b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/TomcatTest.java
index 18939f5..70b083c 100644
--- a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/TomcatTest.java
+++ b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/TomcatTest.java
@@ -138,25 +138,18 @@ public class TomcatTest extends AbstractTests {
@AfterClass
public static void cleanup() {
+ shutdownServer(idpServer);
+ shutdownServer(rpServer);
+ }
+
+ private static void shutdownServer(Tomcat server) {
try {
- if (idpServer.getServer() != null
- && idpServer.getServer().getState() != LifecycleState.DESTROYED) {
- if (idpServer.getServer().getState() != LifecycleState.STOPPED) {
- idpServer.stop();
- }
- idpServer.destroy();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- try {
- if (rpServer.getServer() != null
- && rpServer.getServer().getState() != LifecycleState.DESTROYED) {
- if (rpServer.getServer().getState() != LifecycleState.STOPPED) {
- rpServer.stop();
+ if (server != null && server.getServer() != null
+ && server.getServer().getState() != LifecycleState.DESTROYED) {
+ if (server.getServer().getState() != LifecycleState.STOPPED) {
+ server.stop();
}
- rpServer.destroy();
+ server.destroy();
}
} catch (Exception e) {
e.printStackTrace();
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/0c2deab1/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 b0a952d..e227621 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
@@ -152,25 +152,18 @@ public class WReqTest {
@AfterClass
public static void cleanup() {
+ shutdownServer(idpServer);
+ shutdownServer(rpServer);
+ }
+
+ private static void shutdownServer(Tomcat server) {
try {
- if (idpServer.getServer() != null
- && idpServer.getServer().getState() != LifecycleState.DESTROYED) {
- if (idpServer.getServer().getState() != LifecycleState.STOPPED) {
- idpServer.stop();
- }
- idpServer.destroy();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- try {
- if (rpServer.getServer() != null
- && rpServer.getServer().getState() != LifecycleState.DESTROYED) {
- if (rpServer.getServer().getState() != LifecycleState.STOPPED) {
- rpServer.stop();
+ if (server != null && server.getServer() != null
+ && server.getServer().getState() != LifecycleState.DESTROYED) {
+ if (server.getServer().getState() != LifecycleState.STOPPED) {
+ server.stop();
}
- rpServer.destroy();
+ server.destroy();
}
} catch (Exception e) {
e.printStackTrace();
[2/2] cxf-fediz git commit: Consolidate test launch code and avoid
stacktraces when launching Tomcat servers
Posted by co...@apache.org.
Consolidate test launch code and avoid stacktraces when launching Tomcat servers
Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/dffcc9e0
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/dffcc9e0
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/dffcc9e0
Branch: refs/heads/1.2.x-fixes
Commit: dffcc9e03ede3fa13d8c671f4cbc641264cff9b6
Parents: 0c2deab
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Thu Apr 7 17:02:40 2016 +0100
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Thu Apr 7 17:04:34 2016 +0100
----------------------------------------------------------------------
.../cxf/fediz/integrationtests/SAMLSSOTest.java | 329 -------------------
.../cxf/fediz/integrationtests/WSFedTest.java | 162 ++++-----
.../fediz/integrationtests/KerberosTest.java | 119 +++----
.../cxf/fediz/integrationtests/Spring2Test.java | 121 +++----
.../cxf/fediz/integrationtests/SpringTest.java | 120 +++----
.../integrationtests/ClientCertificateTest.java | 116 +++----
.../fediz/integrationtests/HolderOfKeyTest.java | 118 +++----
.../cxf/fediz/integrationtests/TomcatTest.java | 120 +++----
.../cxf/fediz/integrationtests/WReqTest.java | 119 +++----
.../src/main/webapp/META-INF/context.xml | 22 --
.../src/main/webapp/META-INF/context.xml | 22 --
11 files changed, 406 insertions(+), 962 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/dffcc9e0/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
deleted file mode 100644
index b42d4b5..0000000
--- a/systests/federation/samlsso/src/test/java/org/apache/cxf/fediz/integrationtests/SAMLSSOTest.java
+++ /dev/null
@@ -1,329 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.cxf.fediz.integrationtests;
-
-
-import java.io.File;
-import java.io.IOException;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import com.gargoylesoftware.htmlunit.CookieManager;
-import com.gargoylesoftware.htmlunit.WebClient;
-import com.gargoylesoftware.htmlunit.html.HtmlForm;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
-import com.gargoylesoftware.htmlunit.xml.XmlPage;
-
-import org.apache.catalina.Context;
-import org.apache.catalina.LifecycleState;
-import org.apache.catalina.connector.Connector;
-import org.apache.catalina.startup.Tomcat;
-import org.apache.cxf.fediz.core.ClaimTypes;
-import org.apache.cxf.fediz.core.util.DOMUtils;
-import org.apache.cxf.fediz.tomcat.FederationAuthenticator;
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.UsernamePasswordCredentials;
-import org.apache.xml.security.keys.KeyInfo;
-import org.apache.xml.security.signature.XMLSignature;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * This is a test for federation in the IdP. The RP application is configured to use a home realm of "realm b". The
- * client gets redirected to the IdP for "realm a", which in turn redirects to the IdP for "realm b", which is a
- * SAML SSO IdP. The IdP for "realm a" will convert the signin request to a SAML SSO sign in request. The IdP for
- * realm b authenticates the user, who is then redirected back to the IdP for "realm a" to get a SAML token from
- * the STS + then back to the application.
- */
-public class SAMLSSOTest {
-
- static String idpHttpsPort;
- static String idpSamlSSOHttpsPort;
- static String rpHttpsPort;
-
- private static Tomcat idpServer;
- private static Tomcat idpSamlSSOServer;
- private static Tomcat rpServer;
-
- @BeforeClass
- public static void init() {
- System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
- System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
- System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "info");
- System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient", "info");
- System.setProperty("org.apache.commons.logging.simplelog.log.org.springframework.webflow", "info");
- System.setProperty("org.apache.commons.logging.simplelog.log.org.springframework.security.web", "info");
- System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.cxf.fediz", "info");
- System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.cxf", "info");
-
- idpHttpsPort = System.getProperty("idp.https.port");
- Assert.assertNotNull("Property 'idp.https.port' null", idpHttpsPort);
- idpSamlSSOHttpsPort = System.getProperty("idp.samlsso.https.port");
- Assert.assertNotNull("Property 'idp.samlsso.https.port' null", idpSamlSSOHttpsPort);
- rpHttpsPort = System.getProperty("rp.https.port");
- Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort);
-
- initIdp();
- initSamlSSOIdp();
- initRp();
- }
-
- private static void initIdp() {
- try {
- idpServer = new Tomcat();
- idpServer.setPort(0);
- String currentDir = new File(".").getCanonicalPath();
- idpServer.setBaseDir(currentDir + File.separator + "target");
-
- idpServer.getHost().setAppBase("tomcat/idp/webapps");
- idpServer.getHost().setAutoDeploy(true);
- idpServer.getHost().setDeployOnStartup(true);
-
- Connector httpsConnector = new Connector();
- httpsConnector.setPort(Integer.parseInt(idpHttpsPort));
- httpsConnector.setSecure(true);
- httpsConnector.setScheme("https");
- //httpsConnector.setAttribute("keyAlias", keyAlias);
- httpsConnector.setAttribute("keystorePass", "tompass");
- httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("truststorePass", "tompass");
- httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("clientAuth", "want");
- // httpsConnector.setAttribute("clientAuth", "false");
- httpsConnector.setAttribute("sslProtocol", "TLS");
- httpsConnector.setAttribute("SSLEnabled", true);
-
- idpServer.getService().addConnector(httpsConnector);
-
- idpServer.addWebapp("/fediz-idp-sts", "fediz-idp-sts");
- idpServer.addWebapp("/fediz-idp", "fediz-idp");
-
- idpServer.start();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private static void initSamlSSOIdp() {
- try {
- idpSamlSSOServer = new Tomcat();
- idpSamlSSOServer.setPort(0);
- String currentDir = new File(".").getCanonicalPath();
- idpSamlSSOServer.setBaseDir(currentDir + File.separator + "target");
-
- idpSamlSSOServer.getHost().setAppBase("tomcat/idpsamlsso/webapps");
- idpSamlSSOServer.getHost().setAutoDeploy(true);
- idpSamlSSOServer.getHost().setDeployOnStartup(true);
-
- Connector httpsConnector = new Connector();
- httpsConnector.setPort(Integer.parseInt(idpSamlSSOHttpsPort));
- httpsConnector.setSecure(true);
- httpsConnector.setScheme("https");
- //httpsConnector.setAttribute("keyAlias", keyAlias);
- httpsConnector.setAttribute("keystorePass", "tompass");
- httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("truststorePass", "tompass");
- httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("clientAuth", "want");
- // httpsConnector.setAttribute("clientAuth", "false");
- httpsConnector.setAttribute("sslProtocol", "TLS");
- httpsConnector.setAttribute("SSLEnabled", true);
-
- idpSamlSSOServer.getService().addConnector(httpsConnector);
-
- idpSamlSSOServer.addWebapp("/idp", "idpsaml");
-
- idpSamlSSOServer.start();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private static void initRp() {
- try {
- rpServer = new Tomcat();
- rpServer.setPort(0);
- String currentDir = new File(".").getCanonicalPath();
- rpServer.setBaseDir(currentDir + File.separator + "target");
-
- rpServer.getHost().setAppBase("tomcat/rp/webapps");
- rpServer.getHost().setAutoDeploy(true);
- rpServer.getHost().setDeployOnStartup(true);
-
- Connector httpsConnector = new Connector();
- httpsConnector.setPort(Integer.parseInt(rpHttpsPort));
- httpsConnector.setSecure(true);
- httpsConnector.setScheme("https");
- //httpsConnector.setAttribute("keyAlias", keyAlias);
- httpsConnector.setAttribute("keystorePass", "tompass");
- httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("truststorePass", "tompass");
- httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
- // httpsConnector.setAttribute("clientAuth", "false");
- httpsConnector.setAttribute("clientAuth", "want");
- httpsConnector.setAttribute("sslProtocol", "TLS");
- httpsConnector.setAttribute("SSLEnabled", true);
-
- rpServer.getService().addConnector(httpsConnector);
-
- //Context ctx =
- Context cxt = rpServer.addWebapp("/fedizhelloworld", "simpleWebapp");
- FederationAuthenticator fa = new FederationAuthenticator();
- fa.setConfigFile(currentDir + File.separator + "target" + File.separator
- + "test-classes" + File.separator + "fediz_config_saml_sso.xml");
- cxt.getPipeline().addValve(fa);
-
-
- rpServer.start();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @AfterClass
- public static void cleanup() {
- shutdownServer(idpServer);
- shutdownServer(rpServer);
- }
-
- private static void shutdownServer(Tomcat server) {
- try {
- if (server != null && server.getServer() != null
- && server.getServer().getState() != LifecycleState.DESTROYED) {
- if (server.getServer().getState() != LifecycleState.STOPPED) {
- server.stop();
- }
- server.destroy();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public String getIdpHttpsPort() {
- return idpHttpsPort;
- }
-
- public String getRpHttpsPort() {
- return rpHttpsPort;
- }
-
- public String getServletContextName() {
- return "fedizhelloworld";
- }
-
- @org.junit.Test
- public void testSAMLSSO() throws Exception {
- String url = "https://localhost:" + getRpHttpsPort() + "/fedizhelloworld/secure/fedservlet";
- // System.out.println("URL: " + url);
- // Thread.sleep(60 * 2 * 1000);
- String user = "ALICE"; // realm b credentials
- String password = "ECILA";
-
- final String bodyTextContent =
- login(url, user, password, idpSamlSSOHttpsPort, idpHttpsPort);
-
- Assert.assertTrue("Principal not alice",
- bodyTextContent.contains("userPrincipal=alice"));
- Assert.assertTrue("User " + user + " does not have role Admin",
- bodyTextContent.contains("role:Admin=false"));
- Assert.assertTrue("User " + user + " does not have role Manager",
- bodyTextContent.contains("role:Manager=false"));
- Assert.assertTrue("User " + user + " must have role User",
- bodyTextContent.contains("role:User=true"));
-
- String claim = ClaimTypes.FIRSTNAME.toString();
- Assert.assertTrue("User " + user + " claim " + claim + " is not 'Alice'",
- bodyTextContent.contains(claim + "=Alice"));
- claim = ClaimTypes.LASTNAME.toString();
- Assert.assertTrue("User " + user + " claim " + claim + " is not 'Smith'",
- bodyTextContent.contains(claim + "=Smith"));
- claim = ClaimTypes.EMAILADDRESS.toString();
- Assert.assertTrue("User " + user + " claim " + claim + " is not 'alice@realma.org'",
- bodyTextContent.contains(claim + "=alice@realma.org"));
- }
-
- @Test
- public void testIdPServiceMetadata() throws Exception {
- String url = "https://localhost:" + getIdpHttpsPort()
- + "/fediz-idp/metadata/urn:org:apache:cxf:fediz:idp:realm-B";
-
- final WebClient webClient = new WebClient();
- webClient.getOptions().setUseInsecureSSL(true);
- webClient.getOptions().setSSLClientCertificate(
- this.getClass().getClassLoader().getResource("client.jks"), "storepass", "jks");
-
- final XmlPage rpPage = webClient.getPage(url);
- final String xmlContent = rpPage.asXml();
- Assert.assertTrue(xmlContent.startsWith("<md:EntityDescriptor"));
-
- // Now validate the Signature
- Document doc = rpPage.getXmlDocument();
-
- doc.getDocumentElement().setIdAttributeNS(null, "ID", true);
-
- Node signatureNode =
- DOMUtils.getChild(doc.getDocumentElement(), "Signature");
- Assert.assertNotNull(signatureNode);
-
- XMLSignature signature = new XMLSignature((Element)signatureNode, "");
- KeyInfo ki = signature.getKeyInfo();
- Assert.assertNotNull(ki);
- Assert.assertNotNull(ki.getX509Certificate());
-
- Assert.assertTrue(signature.checkSignatureValue(ki.getX509Certificate()));
- }
-
- private static String login(String url, String user, String password,
- String idpPort, String rpIdpPort) throws IOException {
- //
- // Access the RP + get redirected to the IdP for "realm a". Then get redirected to the IdP for
- // "realm b".
- //
- final WebClient webClient = new WebClient();
- CookieManager cookieManager = new CookieManager();
- webClient.setCookieManager(cookieManager);
- webClient.getOptions().setUseInsecureSSL(true);
- webClient.getCredentialsProvider().setCredentials(
- new AuthScope("localhost", Integer.parseInt(idpPort)),
- new UsernamePasswordCredentials(user, password));
-
- webClient.getOptions().setJavaScriptEnabled(false);
- final HtmlPage idpPage = webClient.getPage(url);
- webClient.getOptions().setJavaScriptEnabled(true);
- Assert.assertEquals("IDP SignIn Response Form", idpPage.getTitleText());
-
- // Now redirect back to the RP
- final HtmlForm form = idpPage.getFormByName("signinresponseform");
-
- final HtmlSubmitInput button = form.getInputByName("_eventId_submit");
-
- final HtmlPage rpPage = button.click();
- Assert.assertEquals("WS Federation Systests Examples", rpPage.getTitleText());
-
- return rpPage.getBody().getTextContent();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/dffcc9e0/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 98b429d..7028600 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
@@ -24,6 +24,8 @@ import java.io.File;
import java.io.IOException;
import java.net.URLEncoder;
+import javax.servlet.ServletException;
+
import com.gargoylesoftware.htmlunit.CookieManager;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.DomElement;
@@ -33,6 +35,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
import org.apache.catalina.Context;
+import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleState;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.startup.Tomcat;
@@ -61,7 +64,7 @@ public class WSFedTest {
private static Tomcat rpServer;
@BeforeClass
- public static void init() {
+ public static void init() throws Exception {
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "info");
@@ -78,127 +81,76 @@ public class WSFedTest {
rpHttpsPort = System.getProperty("rp.https.port");
Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort);
- initIdp();
- initRealmbIdp();
- initRp();
+ idpServer = startServer(true, false, idpHttpsPort);
+ idpRealmbServer = startServer(false, true, idpRealmbHttpsPort);
+ rpServer = startServer(false, false, rpHttpsPort);
}
- private static void initIdp() {
- try {
- idpServer = new Tomcat();
- idpServer.setPort(0);
- String currentDir = new File(".").getCanonicalPath();
- idpServer.setBaseDir(currentDir + File.separator + "target");
-
- idpServer.getHost().setAppBase("tomcat/idp/webapps");
- idpServer.getHost().setAutoDeploy(true);
- idpServer.getHost().setDeployOnStartup(true);
-
- Connector httpsConnector = new Connector();
- httpsConnector.setPort(Integer.parseInt(idpHttpsPort));
- httpsConnector.setSecure(true);
- httpsConnector.setScheme("https");
- //httpsConnector.setAttribute("keyAlias", keyAlias);
- httpsConnector.setAttribute("keystorePass", "tompass");
- httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("truststorePass", "tompass");
- httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("clientAuth", "want");
- // httpsConnector.setAttribute("clientAuth", "false");
- httpsConnector.setAttribute("sslProtocol", "TLS");
- httpsConnector.setAttribute("SSLEnabled", true);
+ private static Tomcat startServer(boolean idp, boolean realmb, String port)
+ throws ServletException, LifecycleException, IOException {
+ Tomcat server = new Tomcat();
+ server.setPort(0);
+ String currentDir = new File(".").getCanonicalPath();
+ String baseDir = currentDir + File.separator + "target";
+ server.setBaseDir(baseDir);
- idpServer.getService().addConnector(httpsConnector);
-
- idpServer.addWebapp("/fediz-idp-sts", "fediz-idp-sts");
- idpServer.addWebapp("/fediz-idp", "fediz-idp");
-
- idpServer.start();
- } catch (Exception e) {
- e.printStackTrace();
+ if (idp) {
+ server.getHost().setAppBase("tomcat/idp/webapps");
+ } else if (realmb) {
+ server.getHost().setAppBase("tomcat/idprealmb/webapps");
+ } else {
+ server.getHost().setAppBase("tomcat/rp/webapps");
}
- }
-
- private static void initRealmbIdp() {
- try {
- idpRealmbServer = new Tomcat();
- idpRealmbServer.setPort(0);
- String currentDir = new File(".").getCanonicalPath();
- idpRealmbServer.setBaseDir(currentDir + File.separator + "target");
-
- idpRealmbServer.getHost().setAppBase("tomcat/idprealmb/webapps");
- idpRealmbServer.getHost().setAutoDeploy(true);
- idpRealmbServer.getHost().setDeployOnStartup(true);
-
- Connector httpsConnector = new Connector();
- httpsConnector.setPort(Integer.parseInt(idpRealmbHttpsPort));
- httpsConnector.setSecure(true);
- httpsConnector.setScheme("https");
- //httpsConnector.setAttribute("keyAlias", keyAlias);
- httpsConnector.setAttribute("keystorePass", "tompass");
- httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("truststorePass", "tompass");
- httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("clientAuth", "want");
- // httpsConnector.setAttribute("clientAuth", "false");
- httpsConnector.setAttribute("sslProtocol", "TLS");
- httpsConnector.setAttribute("SSLEnabled", true);
+ server.getHost().setAutoDeploy(true);
+ server.getHost().setDeployOnStartup(true);
- idpRealmbServer.getService().addConnector(httpsConnector);
-
- idpRealmbServer.addWebapp("/fediz-idp-sts-realmb", "fediz-idp-sts-realmb");
- idpRealmbServer.addWebapp("/fediz-idp-realmb", "fediz-idp-realmb");
-
- idpRealmbServer.start();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private static void initRp() {
- try {
- rpServer = new Tomcat();
- rpServer.setPort(0);
- String currentDir = new File(".").getCanonicalPath();
- rpServer.setBaseDir(currentDir + File.separator + "target");
-
- rpServer.getHost().setAppBase("tomcat/rp/webapps");
- rpServer.getHost().setAutoDeploy(true);
- rpServer.getHost().setDeployOnStartup(true);
-
- Connector httpsConnector = new Connector();
- httpsConnector.setPort(Integer.parseInt(rpHttpsPort));
- httpsConnector.setSecure(true);
- httpsConnector.setScheme("https");
- //httpsConnector.setAttribute("keyAlias", keyAlias);
- httpsConnector.setAttribute("keystorePass", "tompass");
- httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("truststorePass", "tompass");
- httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
- // httpsConnector.setAttribute("clientAuth", "false");
- httpsConnector.setAttribute("clientAuth", "want");
- httpsConnector.setAttribute("sslProtocol", "TLS");
- httpsConnector.setAttribute("SSLEnabled", true);
+ Connector httpsConnector = new Connector();
+ httpsConnector.setPort(Integer.parseInt(port));
+ httpsConnector.setSecure(true);
+ httpsConnector.setScheme("https");
+ //httpsConnector.setAttribute("keyAlias", keyAlias);
+ httpsConnector.setAttribute("keystorePass", "tompass");
+ httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
+ httpsConnector.setAttribute("truststorePass", "tompass");
+ httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
+ httpsConnector.setAttribute("clientAuth", "want");
+ // httpsConnector.setAttribute("clientAuth", "false");
+ httpsConnector.setAttribute("sslProtocol", "TLS");
+ httpsConnector.setAttribute("SSLEnabled", true);
+
+ server.getService().addConnector(httpsConnector);
- rpServer.getService().addConnector(httpsConnector);
+ if (idp) {
+ File stsWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(), "fediz-idp-sts");
+ server.addWebapp("/fediz-idp-sts", stsWebapp.getAbsolutePath());
+
+ File idpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(), "fediz-idp");
+ server.addWebapp("/fediz-idp", idpWebapp.getAbsolutePath());
+ } else if (realmb) {
+ File stsWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(), "fediz-idp-sts-realmb");
+ server.addWebapp("/fediz-idp-sts-realmb", stsWebapp.getAbsolutePath());
+
+ File idpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(), "fediz-idp-realmb");
+ server.addWebapp("/fediz-idp-realmb", idpWebapp.getAbsolutePath());
+ } else {
+ File rpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(), "simpleWebapp");
+ Context cxt = server.addWebapp("/fedizhelloworld", rpWebapp.getAbsolutePath());
- //Context ctx =
- Context cxt = rpServer.addWebapp("/fedizhelloworld", "simpleWebapp");
FederationAuthenticator fa = new FederationAuthenticator();
fa.setConfigFile(currentDir + File.separator + "target" + File.separator
+ "test-classes" + File.separator + "fediz_config_wsfed.xml");
cxt.getPipeline().addValve(fa);
-
-
- rpServer.start();
- } catch (Exception e) {
- e.printStackTrace();
}
+
+ server.start();
+
+ return server;
}
@AfterClass
public static void cleanup() {
shutdownServer(idpServer);
+ shutdownServer(idpRealmbServer);
shutdownServer(rpServer);
}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/dffcc9e0/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 1c28f98..ec5ec40 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
@@ -23,10 +23,12 @@ package org.apache.cxf.fediz.integrationtests;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.security.PrivilegedExceptionAction;
import javax.security.auth.Subject;
import javax.security.auth.login.LoginContext;
+import javax.servlet.ServletException;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
@@ -34,6 +36,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
import org.apache.catalina.Context;
+import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleState;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.startup.Tomcat;
@@ -114,7 +117,7 @@ public class KerberosTest extends AbstractLdapTestUnit {
private static boolean portUpdated;
@BeforeClass
- public static void init() {
+ public static void init() throws Exception {
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "info");
@@ -131,8 +134,8 @@ public class KerberosTest extends AbstractLdapTestUnit {
WSSConfig.init();
- initIdp();
- initRp();
+ idpServer = startServer(true, idpHttpsPort);
+ rpServer = startServer(false, rpHttpsPort);
}
@Before
@@ -163,81 +166,57 @@ public class KerberosTest extends AbstractLdapTestUnit {
System.setProperty("java.security.auth.login.config", "src/test/resources/kerberos.jaas");
}
- private static void initIdp() {
- try {
- idpServer = new Tomcat();
- idpServer.setPort(0);
- String currentDir = new File(".").getCanonicalPath();
- idpServer.setBaseDir(currentDir + File.separator + "target");
-
- idpServer.getHost().setAppBase("tomcat/idp/webapps");
- idpServer.getHost().setAutoDeploy(true);
- idpServer.getHost().setDeployOnStartup(true);
-
- Connector httpsConnector = new Connector();
- httpsConnector.setPort(Integer.parseInt(idpHttpsPort));
- httpsConnector.setSecure(true);
- httpsConnector.setScheme("https");
- //httpsConnector.setAttribute("keyAlias", keyAlias);
- httpsConnector.setAttribute("keystorePass", "tompass");
- httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("truststorePass", "tompass");
- httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("clientAuth", "want");
- // httpsConnector.setAttribute("clientAuth", "false");
- httpsConnector.setAttribute("sslProtocol", "TLS");
- httpsConnector.setAttribute("SSLEnabled", true);
-
- idpServer.getService().addConnector(httpsConnector);
-
- idpServer.addWebapp("/fediz-idp-sts", "fediz-idp-sts");
- idpServer.addWebapp("/fediz-idp", "fediz-idp");
-
- idpServer.start();
- } catch (Exception e) {
- e.printStackTrace();
+ private static Tomcat startServer(boolean idp, String port)
+ throws ServletException, LifecycleException, IOException {
+ Tomcat server = new Tomcat();
+ server.setPort(0);
+ String currentDir = new File(".").getCanonicalPath();
+ String baseDir = currentDir + File.separator + "target";
+ server.setBaseDir(baseDir);
+
+ if (idp) {
+ server.getHost().setAppBase("tomcat/idp/webapps");
+ } else {
+ server.getHost().setAppBase("tomcat/rp/webapps");
}
- }
+ server.getHost().setAutoDeploy(true);
+ server.getHost().setDeployOnStartup(true);
+
+ Connector httpsConnector = new Connector();
+ httpsConnector.setPort(Integer.parseInt(port));
+ httpsConnector.setSecure(true);
+ httpsConnector.setScheme("https");
+ //httpsConnector.setAttribute("keyAlias", keyAlias);
+ httpsConnector.setAttribute("keystorePass", "tompass");
+ httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
+ httpsConnector.setAttribute("truststorePass", "tompass");
+ httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
+ httpsConnector.setAttribute("clientAuth", "want");
+ // httpsConnector.setAttribute("clientAuth", "false");
+ httpsConnector.setAttribute("sslProtocol", "TLS");
+ httpsConnector.setAttribute("SSLEnabled", true);
+
+ server.getService().addConnector(httpsConnector);
+
+ if (idp) {
+ File stsWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(), "fediz-idp-sts");
+ server.addWebapp("/fediz-idp-sts", stsWebapp.getAbsolutePath());
- private static void initRp() {
- try {
- rpServer = new Tomcat();
- rpServer.setPort(0);
- String currentDir = new File(".").getCanonicalPath();
- rpServer.setBaseDir(currentDir + File.separator + "target");
-
- rpServer.getHost().setAppBase("tomcat/rp/webapps");
- rpServer.getHost().setAutoDeploy(true);
- rpServer.getHost().setDeployOnStartup(true);
-
- Connector httpsConnector = new Connector();
- httpsConnector.setPort(Integer.parseInt(rpHttpsPort));
- httpsConnector.setSecure(true);
- httpsConnector.setScheme("https");
- //httpsConnector.setAttribute("keyAlias", keyAlias);
- httpsConnector.setAttribute("keystorePass", "tompass");
- httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("truststorePass", "tompass");
- httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
- // httpsConnector.setAttribute("clientAuth", "false");
- httpsConnector.setAttribute("clientAuth", "want");
- httpsConnector.setAttribute("sslProtocol", "TLS");
- httpsConnector.setAttribute("SSLEnabled", true);
-
- rpServer.getService().addConnector(httpsConnector);
+ File idpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(), "fediz-idp");
+ server.addWebapp("/fediz-idp", idpWebapp.getAbsolutePath());
+ } else {
+ File rpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(), "simpleWebapp");
+ Context cxt = server.addWebapp("/fedizhelloworld", rpWebapp.getAbsolutePath());
- //Context ctx =
- Context cxt = rpServer.addWebapp("/fedizhelloworld", "simpleWebapp");
FederationAuthenticator fa = new FederationAuthenticator();
fa.setConfigFile(currentDir + File.separator + "target" + File.separator
+ "test-classes" + File.separator + "fediz_config.xml");
cxt.getPipeline().addValve(fa);
-
-
- rpServer.start();
- } catch (Exception e) {
- e.printStackTrace();
}
+
+ server.start();
+
+ return server;
}
@AfterClass
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/dffcc9e0/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/Spring2Test.java
----------------------------------------------------------------------
diff --git a/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/Spring2Test.java b/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/Spring2Test.java
index f20a45f..d9e77ab 100644
--- a/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/Spring2Test.java
+++ b/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/Spring2Test.java
@@ -21,6 +21,9 @@ package org.apache.cxf.fediz.integrationtests;
import java.io.File;
+import java.io.IOException;
+
+import javax.servlet.ServletException;
import com.gargoylesoftware.htmlunit.CookieManager;
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
@@ -31,7 +34,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
-
+import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleState;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.startup.Tomcat;
@@ -52,7 +55,7 @@ public class Spring2Test extends AbstractTests {
private static Tomcat rpServer;
@BeforeClass
- public static void init() {
+ public static void init() throws Exception {
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
@@ -66,8 +69,8 @@ public class Spring2Test extends AbstractTests {
rpHttpsPort = System.getProperty("rp.https.port");
Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort);
- initIdp();
- initRp();
+ idpServer = startServer(true, idpHttpsPort);
+ rpServer = startServer(false, rpHttpsPort);
}
@AfterClass
@@ -90,75 +93,53 @@ public class Spring2Test extends AbstractTests {
}
}
- private static void initIdp() {
- try {
- idpServer = new Tomcat();
- idpServer.setPort(0);
- String currentDir = new File(".").getCanonicalPath();
- idpServer.setBaseDir(currentDir + File.separator + "target");
-
- idpServer.getHost().setAppBase("tomcat/idp/webapps");
- idpServer.getHost().setAutoDeploy(true);
- idpServer.getHost().setDeployOnStartup(true);
-
- Connector httpsConnector = new Connector();
- httpsConnector.setPort(Integer.parseInt(idpHttpsPort));
- httpsConnector.setSecure(true);
- httpsConnector.setScheme("https");
- //httpsConnector.setAttribute("keyAlias", keyAlias);
- httpsConnector.setAttribute("keystorePass", "tompass");
- httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("truststorePass", "tompass");
- httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("clientAuth", "want");
- // httpsConnector.setAttribute("clientAuth", "false");
- httpsConnector.setAttribute("sslProtocol", "TLS");
- httpsConnector.setAttribute("SSLEnabled", true);
-
- idpServer.getService().addConnector(httpsConnector);
-
- idpServer.addWebapp("/fediz-idp-sts", "fediz-idp-sts");
- idpServer.addWebapp("/fediz-idp", "fediz-idp");
-
- idpServer.start();
- } catch (Exception e) {
- e.printStackTrace();
+ private static Tomcat startServer(boolean idp, String port)
+ throws ServletException, LifecycleException, IOException {
+ Tomcat server = new Tomcat();
+ server.setPort(0);
+ String currentDir = new File(".").getCanonicalPath();
+ String baseDir = currentDir + File.separator + "target";
+ server.setBaseDir(baseDir);
+
+ if (idp) {
+ server.getHost().setAppBase("tomcat/idp/webapps");
+ } else {
+ server.getHost().setAppBase("tomcat/rp/webapps");
}
- }
+ server.getHost().setAutoDeploy(true);
+ server.getHost().setDeployOnStartup(true);
+
+ Connector httpsConnector = new Connector();
+ httpsConnector.setPort(Integer.parseInt(port));
+ httpsConnector.setSecure(true);
+ httpsConnector.setScheme("https");
+ //httpsConnector.setAttribute("keyAlias", keyAlias);
+ httpsConnector.setAttribute("keystorePass", "tompass");
+ httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
+ httpsConnector.setAttribute("truststorePass", "tompass");
+ httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
+ httpsConnector.setAttribute("clientAuth", "want");
+ // httpsConnector.setAttribute("clientAuth", "false");
+ httpsConnector.setAttribute("sslProtocol", "TLS");
+ httpsConnector.setAttribute("SSLEnabled", true);
+
+ server.getService().addConnector(httpsConnector);
+
+ if (idp) {
+ File stsWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(), "fediz-idp-sts");
+ server.addWebapp("/fediz-idp-sts", stsWebapp.getAbsolutePath());
- private static void initRp() {
- try {
- rpServer = new Tomcat();
- rpServer.setPort(0);
- String currentDir = new File(".").getCanonicalPath();
- rpServer.setBaseDir(currentDir + File.separator + "target");
-
- rpServer.getHost().setAppBase("tomcat/rp/webapps");
- rpServer.getHost().setAutoDeploy(true);
- rpServer.getHost().setDeployOnStartup(true);
-
- Connector httpsConnector = new Connector();
- httpsConnector.setPort(Integer.parseInt(rpHttpsPort));
- httpsConnector.setSecure(true);
- httpsConnector.setScheme("https");
- //httpsConnector.setAttribute("keyAlias", keyAlias);
- httpsConnector.setAttribute("keystorePass", "tompass");
- httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("truststorePass", "tompass");
- httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
- // httpsConnector.setAttribute("clientAuth", "false");
- httpsConnector.setAttribute("clientAuth", "want");
- httpsConnector.setAttribute("sslProtocol", "TLS");
- httpsConnector.setAttribute("SSLEnabled", true);
-
- rpServer.getService().addConnector(httpsConnector);
-
- rpServer.addWebapp("/fedizhelloworld_spring2", "fediz-systests-webapps-spring2");
-
- rpServer.start();
- } catch (Exception e) {
- e.printStackTrace();
+ File idpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(), "fediz-idp");
+ server.addWebapp("/fediz-idp", idpWebapp.getAbsolutePath());
+ } else {
+ File rpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(),
+ "fediz-systests-webapps-spring2");
+ server.addWebapp("/fedizhelloworld_spring2", rpWebapp.getAbsolutePath());
}
+
+ server.start();
+
+ return server;
}
@Override
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/dffcc9e0/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/SpringTest.java
----------------------------------------------------------------------
diff --git a/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/SpringTest.java b/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/SpringTest.java
index 4da2edc..036b189 100644
--- a/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/SpringTest.java
+++ b/systests/spring/src/test/java/org/apache/cxf/fediz/integrationtests/SpringTest.java
@@ -20,7 +20,11 @@
package org.apache.cxf.fediz.integrationtests;
import java.io.File;
+import java.io.IOException;
+import javax.servlet.ServletException;
+
+import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleState;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.startup.Tomcat;
@@ -38,7 +42,7 @@ public class SpringTest extends AbstractTests {
private static Tomcat rpServer;
@BeforeClass
- public static void init() {
+ public static void init() throws Exception {
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
@@ -52,8 +56,8 @@ public class SpringTest extends AbstractTests {
rpHttpsPort = System.getProperty("rp.https.port");
Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort);
- initIdp();
- initRp();
+ idpServer = startServer(true, idpHttpsPort);
+ rpServer = startServer(false, rpHttpsPort);
}
@AfterClass
@@ -76,75 +80,53 @@ public class SpringTest extends AbstractTests {
}
}
- private static void initIdp() {
- try {
- idpServer = new Tomcat();
- idpServer.setPort(0);
- String currentDir = new File(".").getCanonicalPath();
- idpServer.setBaseDir(currentDir + File.separator + "target");
-
- idpServer.getHost().setAppBase("tomcat/idp/webapps");
- idpServer.getHost().setAutoDeploy(true);
- idpServer.getHost().setDeployOnStartup(true);
-
- Connector httpsConnector = new Connector();
- httpsConnector.setPort(Integer.parseInt(idpHttpsPort));
- httpsConnector.setSecure(true);
- httpsConnector.setScheme("https");
- //httpsConnector.setAttribute("keyAlias", keyAlias);
- httpsConnector.setAttribute("keystorePass", "tompass");
- httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("truststorePass", "tompass");
- httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("clientAuth", "want");
- // httpsConnector.setAttribute("clientAuth", "false");
- httpsConnector.setAttribute("sslProtocol", "TLS");
- httpsConnector.setAttribute("SSLEnabled", true);
-
- idpServer.getService().addConnector(httpsConnector);
-
- idpServer.addWebapp("/fediz-idp-sts", "fediz-idp-sts");
- idpServer.addWebapp("/fediz-idp", "fediz-idp");
-
- idpServer.start();
- } catch (Exception e) {
- e.printStackTrace();
+ private static Tomcat startServer(boolean idp, String port)
+ throws ServletException, LifecycleException, IOException {
+ Tomcat server = new Tomcat();
+ server.setPort(0);
+ String currentDir = new File(".").getCanonicalPath();
+ String baseDir = currentDir + File.separator + "target";
+ server.setBaseDir(baseDir);
+
+ if (idp) {
+ server.getHost().setAppBase("tomcat/idp/webapps");
+ } else {
+ server.getHost().setAppBase("tomcat/rp/webapps");
}
- }
+ server.getHost().setAutoDeploy(true);
+ server.getHost().setDeployOnStartup(true);
+
+ Connector httpsConnector = new Connector();
+ httpsConnector.setPort(Integer.parseInt(port));
+ httpsConnector.setSecure(true);
+ httpsConnector.setScheme("https");
+ //httpsConnector.setAttribute("keyAlias", keyAlias);
+ httpsConnector.setAttribute("keystorePass", "tompass");
+ httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
+ httpsConnector.setAttribute("truststorePass", "tompass");
+ httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
+ httpsConnector.setAttribute("clientAuth", "want");
+ // httpsConnector.setAttribute("clientAuth", "false");
+ httpsConnector.setAttribute("sslProtocol", "TLS");
+ httpsConnector.setAttribute("SSLEnabled", true);
+
+ server.getService().addConnector(httpsConnector);
+
+ if (idp) {
+ File stsWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(), "fediz-idp-sts");
+ server.addWebapp("/fediz-idp-sts", stsWebapp.getAbsolutePath());
- private static void initRp() {
- try {
- rpServer = new Tomcat();
- rpServer.setPort(0);
- String currentDir = new File(".").getCanonicalPath();
- rpServer.setBaseDir(currentDir + File.separator + "target");
-
- rpServer.getHost().setAppBase("tomcat/rp/webapps");
- rpServer.getHost().setAutoDeploy(true);
- rpServer.getHost().setDeployOnStartup(true);
-
- Connector httpsConnector = new Connector();
- httpsConnector.setPort(Integer.parseInt(rpHttpsPort));
- httpsConnector.setSecure(true);
- httpsConnector.setScheme("https");
- //httpsConnector.setAttribute("keyAlias", keyAlias);
- httpsConnector.setAttribute("keystorePass", "tompass");
- httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("truststorePass", "tompass");
- httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
- // httpsConnector.setAttribute("clientAuth", "false");
- httpsConnector.setAttribute("clientAuth", "want");
- httpsConnector.setAttribute("sslProtocol", "TLS");
- httpsConnector.setAttribute("SSLEnabled", true);
-
- rpServer.getService().addConnector(httpsConnector);
-
- rpServer.addWebapp("/fedizhelloworld", "fediz-systests-webapps-spring");
-
- rpServer.start();
- } catch (Exception e) {
- e.printStackTrace();
+ File idpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(), "fediz-idp");
+ server.addWebapp("/fediz-idp", idpWebapp.getAbsolutePath());
+ } else {
+ File rpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(),
+ "fediz-systests-webapps-spring");
+ server.addWebapp("/fedizhelloworld", rpWebapp.getAbsolutePath());
}
+
+ server.start();
+
+ return server;
}
@Override
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/dffcc9e0/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
----------------------------------------------------------------------
diff --git a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
index e7733e1..db48b8f 100644
--- a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
+++ b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
@@ -20,8 +20,12 @@
package org.apache.cxf.fediz.integrationtests;
import java.io.File;
+import java.io.IOException;
+
+import javax.servlet.ServletException;
import org.apache.catalina.Context;
+import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleState;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.startup.Tomcat;
@@ -43,7 +47,7 @@ public class ClientCertificateTest extends AbstractClientCertTests {
private static Tomcat rpServer;
@BeforeClass
- public static void init() {
+ public static void init() throws Exception {
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "info");
@@ -58,83 +62,61 @@ public class ClientCertificateTest extends AbstractClientCertTests {
rpHttpsPort = System.getProperty("rp.https.port");
Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort);
- initIdp();
- initRp();
+ idpServer = startServer(true, idpHttpsPort);
+ rpServer = startServer(false, rpHttpsPort);
}
- private static void initIdp() {
- try {
- idpServer = new Tomcat();
- idpServer.setPort(0);
- String currentDir = new File(".").getCanonicalPath();
- idpServer.setBaseDir(currentDir + File.separator + "target");
-
- idpServer.getHost().setAppBase("tomcat/idp/webapps");
- idpServer.getHost().setAutoDeploy(true);
- idpServer.getHost().setDeployOnStartup(true);
-
- Connector httpsConnector = new Connector();
- httpsConnector.setPort(Integer.parseInt(idpHttpsPort));
- httpsConnector.setSecure(true);
- httpsConnector.setScheme("https");
- //httpsConnector.setAttribute("keyAlias", keyAlias);
- httpsConnector.setAttribute("keystorePass", "tompass");
- httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("truststorePass", "tompass");
- httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("clientAuth", "true");
- httpsConnector.setAttribute("sslProtocol", "TLS");
- httpsConnector.setAttribute("SSLEnabled", true);
+ private static Tomcat startServer(boolean idp, String port)
+ throws ServletException, LifecycleException, IOException {
+ Tomcat server = new Tomcat();
+ server.setPort(0);
+ String currentDir = new File(".").getCanonicalPath();
+ String baseDir = currentDir + File.separator + "target";
+ server.setBaseDir(baseDir);
- idpServer.getService().addConnector(httpsConnector);
-
- idpServer.addWebapp("/fediz-idp-sts", "fediz-idp-sts");
- idpServer.addWebapp("/fediz-idp", "fediz-idp");
-
- idpServer.start();
- } catch (Exception e) {
- e.printStackTrace();
+ if (idp) {
+ server.getHost().setAppBase("tomcat/idp/webapps");
+ } else {
+ server.getHost().setAppBase("tomcat/rp/webapps");
}
- }
-
- private static void initRp() {
- try {
- rpServer = new Tomcat();
- rpServer.setPort(0);
- String currentDir = new File(".").getCanonicalPath();
- rpServer.setBaseDir(currentDir + File.separator + "target");
-
- rpServer.getHost().setAppBase("tomcat/rp/webapps");
- rpServer.getHost().setAutoDeploy(true);
- rpServer.getHost().setDeployOnStartup(true);
-
- Connector httpsConnector = new Connector();
- httpsConnector.setPort(Integer.parseInt(rpHttpsPort));
- httpsConnector.setSecure(true);
- httpsConnector.setScheme("https");
- //httpsConnector.setAttribute("keyAlias", keyAlias);
- httpsConnector.setAttribute("keystorePass", "tompass");
- httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("truststorePass", "tompass");
- httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("clientAuth", "true");
- httpsConnector.setAttribute("sslProtocol", "TLS");
- httpsConnector.setAttribute("SSLEnabled", true);
+ server.getHost().setAutoDeploy(true);
+ server.getHost().setDeployOnStartup(true);
+
+ Connector httpsConnector = new Connector();
+ httpsConnector.setPort(Integer.parseInt(port));
+ httpsConnector.setSecure(true);
+ httpsConnector.setScheme("https");
+ //httpsConnector.setAttribute("keyAlias", keyAlias);
+ httpsConnector.setAttribute("keystorePass", "tompass");
+ httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
+ httpsConnector.setAttribute("truststorePass", "tompass");
+ httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
+ httpsConnector.setAttribute("clientAuth", "want");
+ // httpsConnector.setAttribute("clientAuth", "false");
+ httpsConnector.setAttribute("sslProtocol", "TLS");
+ httpsConnector.setAttribute("SSLEnabled", true);
- rpServer.getService().addConnector(httpsConnector);
+ server.getService().addConnector(httpsConnector);
+
+ if (idp) {
+ File stsWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(), "fediz-idp-sts");
+ server.addWebapp("/fediz-idp-sts", stsWebapp.getAbsolutePath());
+
+ File idpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(), "fediz-idp");
+ server.addWebapp("/fediz-idp", idpWebapp.getAbsolutePath());
+ } else {
+ File rpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(), "simpleWebapp");
+ Context cxt = server.addWebapp("/fedizhelloworld", rpWebapp.getAbsolutePath());
- //Context ctx =
- Context cxt = rpServer.addWebapp("/fedizhelloworld", "simpleWebapp");
FederationAuthenticator fa = new FederationAuthenticator();
fa.setConfigFile(currentDir + File.separator + "target" + File.separator
+ "test-classes" + File.separator + "fediz_config_client_cert.xml");
cxt.getPipeline().addValve(fa);
-
-
- rpServer.start();
- } catch (Exception e) {
- e.printStackTrace();
}
+
+ server.start();
+
+ return server;
}
@AfterClass
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/dffcc9e0/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 d1547f7..b21e3aa 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
@@ -20,6 +20,9 @@
package org.apache.cxf.fediz.integrationtests;
import java.io.File;
+import java.io.IOException;
+
+import javax.servlet.ServletException;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.DomElement;
@@ -29,6 +32,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
import org.apache.catalina.Context;
+import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleState;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.startup.Tomcat;
@@ -53,7 +57,7 @@ public class HolderOfKeyTest {
private static Tomcat rpServer;
@BeforeClass
- public static void init() {
+ public static void init() throws Exception {
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "info");
@@ -68,83 +72,61 @@ public class HolderOfKeyTest {
rpHttpsPort = System.getProperty("rp.https.port");
Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort);
- initIdp();
- initRp();
+ idpServer = startServer(true, idpHttpsPort);
+ rpServer = startServer(false, rpHttpsPort);
}
- private static void initIdp() {
- try {
- idpServer = new Tomcat();
- idpServer.setPort(0);
- String currentDir = new File(".").getCanonicalPath();
- idpServer.setBaseDir(currentDir + File.separator + "target");
-
- idpServer.getHost().setAppBase("tomcat/idp/webapps");
- idpServer.getHost().setAutoDeploy(true);
- idpServer.getHost().setDeployOnStartup(true);
-
- Connector httpsConnector = new Connector();
- httpsConnector.setPort(Integer.parseInt(idpHttpsPort));
- httpsConnector.setSecure(true);
- httpsConnector.setScheme("https");
- //httpsConnector.setAttribute("keyAlias", keyAlias);
- httpsConnector.setAttribute("keystorePass", "tompass");
- httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("truststorePass", "tompass");
- httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("clientAuth", "want");
- httpsConnector.setAttribute("sslProtocol", "TLS");
- httpsConnector.setAttribute("SSLEnabled", true);
-
- idpServer.getService().addConnector(httpsConnector);
-
- idpServer.addWebapp("/fediz-idp-sts", "fediz-idp-sts");
- idpServer.addWebapp("/fediz-idp", "fediz-idp");
-
- idpServer.start();
- } catch (Exception e) {
- e.printStackTrace();
+ private static Tomcat startServer(boolean idp, String port)
+ throws ServletException, LifecycleException, IOException {
+ Tomcat server = new Tomcat();
+ server.setPort(0);
+ String currentDir = new File(".").getCanonicalPath();
+ String baseDir = currentDir + File.separator + "target";
+ server.setBaseDir(baseDir);
+
+ if (idp) {
+ server.getHost().setAppBase("tomcat/idp/webapps");
+ } else {
+ server.getHost().setAppBase("tomcat/rp/webapps");
}
- }
+ server.getHost().setAutoDeploy(true);
+ server.getHost().setDeployOnStartup(true);
+
+ Connector httpsConnector = new Connector();
+ httpsConnector.setPort(Integer.parseInt(port));
+ httpsConnector.setSecure(true);
+ httpsConnector.setScheme("https");
+ //httpsConnector.setAttribute("keyAlias", keyAlias);
+ httpsConnector.setAttribute("keystorePass", "tompass");
+ httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
+ httpsConnector.setAttribute("truststorePass", "tompass");
+ httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
+ httpsConnector.setAttribute("clientAuth", "want");
+ // httpsConnector.setAttribute("clientAuth", "false");
+ httpsConnector.setAttribute("sslProtocol", "TLS");
+ httpsConnector.setAttribute("SSLEnabled", true);
+
+ server.getService().addConnector(httpsConnector);
+
+ if (idp) {
+ File stsWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(), "fediz-idp-sts");
+ server.addWebapp("/fediz-idp-sts", stsWebapp.getAbsolutePath());
- private static void initRp() {
- try {
- rpServer = new Tomcat();
- rpServer.setPort(0);
- String currentDir = new File(".").getCanonicalPath();
- rpServer.setBaseDir(currentDir + File.separator + "target");
+ File idpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(), "fediz-idp");
+ server.addWebapp("/fediz-idp", idpWebapp.getAbsolutePath());
+ } else {
+ File rpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(), "simpleWebapp");
+ Context cxt = server.addWebapp("/fedizhelloworld", rpWebapp.getAbsolutePath());
- rpServer.getHost().setAppBase("tomcat/rp/webapps");
- rpServer.getHost().setAutoDeploy(true);
- rpServer.getHost().setDeployOnStartup(true);
-
- Connector httpsConnector = new Connector();
- httpsConnector.setPort(Integer.parseInt(rpHttpsPort));
- httpsConnector.setSecure(true);
- httpsConnector.setScheme("https");
- //httpsConnector.setAttribute("keyAlias", keyAlias);
- httpsConnector.setAttribute("keystorePass", "tompass");
- httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("truststorePass", "tompass");
- httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("clientAuth", "want");
- httpsConnector.setAttribute("sslProtocol", "TLS");
- httpsConnector.setAttribute("SSLEnabled", true);
-
- rpServer.getService().addConnector(httpsConnector);
-
- //Context ctx =
- Context cxt = rpServer.addWebapp("/fedizhelloworld", "simpleWebapp");
FederationAuthenticator fa = new FederationAuthenticator();
fa.setConfigFile(currentDir + File.separator + "target" + File.separator
+ "test-classes" + File.separator + "fediz_config_hok.xml");
cxt.getPipeline().addValve(fa);
-
-
- rpServer.start();
- } catch (Exception e) {
- e.printStackTrace();
}
+
+ server.start();
+
+ return server;
}
@AfterClass
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/dffcc9e0/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/TomcatTest.java
----------------------------------------------------------------------
diff --git a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/TomcatTest.java b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/TomcatTest.java
index 70b083c..15e44ec 100644
--- a/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/TomcatTest.java
+++ b/systests/tomcat7/src/test/java/org/apache/cxf/fediz/integrationtests/TomcatTest.java
@@ -21,8 +21,12 @@ package org.apache.cxf.fediz.integrationtests;
import java.io.File;
+import java.io.IOException;
+
+import javax.servlet.ServletException;
import org.apache.catalina.Context;
+import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleState;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.startup.Tomcat;
@@ -40,7 +44,7 @@ public class TomcatTest extends AbstractTests {
private static Tomcat rpServer;
@BeforeClass
- public static void init() {
+ public static void init() throws Exception {
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "info");
@@ -55,85 +59,61 @@ public class TomcatTest extends AbstractTests {
rpHttpsPort = System.getProperty("rp.https.port");
Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort);
- initIdp();
- initRp();
+ idpServer = startServer(true, idpHttpsPort);
+ rpServer = startServer(false, rpHttpsPort);
}
- private static void initIdp() {
- try {
- idpServer = new Tomcat();
- idpServer.setPort(0);
- String currentDir = new File(".").getCanonicalPath();
- idpServer.setBaseDir(currentDir + File.separator + "target");
-
- idpServer.getHost().setAppBase("tomcat/idp/webapps");
- idpServer.getHost().setAutoDeploy(true);
- idpServer.getHost().setDeployOnStartup(true);
-
- Connector httpsConnector = new Connector();
- httpsConnector.setPort(Integer.parseInt(idpHttpsPort));
- httpsConnector.setSecure(true);
- httpsConnector.setScheme("https");
- //httpsConnector.setAttribute("keyAlias", keyAlias);
- httpsConnector.setAttribute("keystorePass", "tompass");
- httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("truststorePass", "tompass");
- httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("clientAuth", "want");
- // httpsConnector.setAttribute("clientAuth", "false");
- httpsConnector.setAttribute("sslProtocol", "TLS");
- httpsConnector.setAttribute("SSLEnabled", true);
-
- idpServer.getService().addConnector(httpsConnector);
-
- idpServer.addWebapp("/fediz-idp-sts", "fediz-idp-sts");
- idpServer.addWebapp("/fediz-idp", "fediz-idp");
-
- idpServer.start();
- } catch (Exception e) {
- e.printStackTrace();
+ private static Tomcat startServer(boolean idp, String port)
+ throws ServletException, LifecycleException, IOException {
+ Tomcat server = new Tomcat();
+ server.setPort(0);
+ String currentDir = new File(".").getCanonicalPath();
+ String baseDir = currentDir + File.separator + "target";
+ server.setBaseDir(baseDir);
+
+ if (idp) {
+ server.getHost().setAppBase("tomcat/idp/webapps");
+ } else {
+ server.getHost().setAppBase("tomcat/rp/webapps");
}
- }
+ server.getHost().setAutoDeploy(true);
+ server.getHost().setDeployOnStartup(true);
+
+ Connector httpsConnector = new Connector();
+ httpsConnector.setPort(Integer.parseInt(port));
+ httpsConnector.setSecure(true);
+ httpsConnector.setScheme("https");
+ //httpsConnector.setAttribute("keyAlias", keyAlias);
+ httpsConnector.setAttribute("keystorePass", "tompass");
+ httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
+ httpsConnector.setAttribute("truststorePass", "tompass");
+ httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
+ httpsConnector.setAttribute("clientAuth", "want");
+ // httpsConnector.setAttribute("clientAuth", "false");
+ httpsConnector.setAttribute("sslProtocol", "TLS");
+ httpsConnector.setAttribute("SSLEnabled", true);
+
+ server.getService().addConnector(httpsConnector);
+
+ if (idp) {
+ File stsWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(), "fediz-idp-sts");
+ server.addWebapp("/fediz-idp-sts", stsWebapp.getAbsolutePath());
- private static void initRp() {
- try {
- rpServer = new Tomcat();
- rpServer.setPort(0);
- String currentDir = new File(".").getCanonicalPath();
- rpServer.setBaseDir(currentDir + File.separator + "target");
+ File idpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(), "fediz-idp");
+ server.addWebapp("/fediz-idp", idpWebapp.getAbsolutePath());
+ } else {
+ File rpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(), "simpleWebapp");
+ Context cxt = server.addWebapp("/fedizhelloworld", rpWebapp.getAbsolutePath());
- rpServer.getHost().setAppBase("tomcat/rp/webapps");
- rpServer.getHost().setAutoDeploy(true);
- rpServer.getHost().setDeployOnStartup(true);
-
- Connector httpsConnector = new Connector();
- httpsConnector.setPort(Integer.parseInt(rpHttpsPort));
- httpsConnector.setSecure(true);
- httpsConnector.setScheme("https");
- //httpsConnector.setAttribute("keyAlias", keyAlias);
- httpsConnector.setAttribute("keystorePass", "tompass");
- httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("truststorePass", "tompass");
- httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
- // httpsConnector.setAttribute("clientAuth", "false");
- httpsConnector.setAttribute("clientAuth", "want");
- httpsConnector.setAttribute("sslProtocol", "TLS");
- httpsConnector.setAttribute("SSLEnabled", true);
-
- rpServer.getService().addConnector(httpsConnector);
-
- //Context ctx =
- Context cxt = rpServer.addWebapp("/fedizhelloworld", "simpleWebapp");
FederationAuthenticator fa = new FederationAuthenticator();
fa.setConfigFile(currentDir + File.separator + "target" + File.separator
+ "test-classes" + File.separator + "fediz_config.xml");
cxt.getPipeline().addValve(fa);
-
-
- rpServer.start();
- } catch (Exception e) {
- e.printStackTrace();
}
+
+ server.start();
+
+ return server;
}
@AfterClass
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/dffcc9e0/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 e227621..8249240 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
@@ -23,6 +23,8 @@ package org.apache.cxf.fediz.integrationtests;
import java.io.File;
import java.io.IOException;
+import javax.servlet.ServletException;
+
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.DomElement;
import com.gargoylesoftware.htmlunit.html.DomNodeList;
@@ -31,6 +33,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
import org.apache.catalina.Context;
+import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleState;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.startup.Tomcat;
@@ -54,7 +57,7 @@ public class WReqTest {
private static Tomcat rpServer;
@BeforeClass
- public static void init() {
+ public static void init() throws Exception {
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "info");
@@ -69,85 +72,61 @@ public class WReqTest {
rpHttpsPort = System.getProperty("rp.https.port");
Assert.assertNotNull("Property 'rp.https.port' null", rpHttpsPort);
- initIdp();
- initRp();
+ idpServer = startServer(true, idpHttpsPort);
+ rpServer = startServer(false, rpHttpsPort);
}
- private static void initIdp() {
- try {
- idpServer = new Tomcat();
- idpServer.setPort(0);
- String currentDir = new File(".").getCanonicalPath();
- idpServer.setBaseDir(currentDir + File.separator + "target");
-
- idpServer.getHost().setAppBase("tomcat/idp/webapps");
- idpServer.getHost().setAutoDeploy(true);
- idpServer.getHost().setDeployOnStartup(true);
-
- Connector httpsConnector = new Connector();
- httpsConnector.setPort(Integer.parseInt(idpHttpsPort));
- httpsConnector.setSecure(true);
- httpsConnector.setScheme("https");
- //httpsConnector.setAttribute("keyAlias", keyAlias);
- httpsConnector.setAttribute("keystorePass", "tompass");
- httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("truststorePass", "tompass");
- httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("clientAuth", "want");
- // httpsConnector.setAttribute("clientAuth", "false");
- httpsConnector.setAttribute("sslProtocol", "TLS");
- httpsConnector.setAttribute("SSLEnabled", true);
-
- idpServer.getService().addConnector(httpsConnector);
-
- idpServer.addWebapp("/fediz-idp-sts", "fediz-idp-sts");
- idpServer.addWebapp("/fediz-idp", "fediz-idp");
-
- idpServer.start();
- } catch (Exception e) {
- e.printStackTrace();
+ private static Tomcat startServer(boolean idp, String port)
+ throws ServletException, LifecycleException, IOException {
+ Tomcat server = new Tomcat();
+ server.setPort(0);
+ String currentDir = new File(".").getCanonicalPath();
+ String baseDir = currentDir + File.separator + "target";
+ server.setBaseDir(baseDir);
+
+ if (idp) {
+ server.getHost().setAppBase("tomcat/idp/webapps");
+ } else {
+ server.getHost().setAppBase("tomcat/rp/webapps");
}
- }
+ server.getHost().setAutoDeploy(true);
+ server.getHost().setDeployOnStartup(true);
+
+ Connector httpsConnector = new Connector();
+ httpsConnector.setPort(Integer.parseInt(port));
+ httpsConnector.setSecure(true);
+ httpsConnector.setScheme("https");
+ //httpsConnector.setAttribute("keyAlias", keyAlias);
+ httpsConnector.setAttribute("keystorePass", "tompass");
+ httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
+ httpsConnector.setAttribute("truststorePass", "tompass");
+ httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
+ httpsConnector.setAttribute("clientAuth", "want");
+ // httpsConnector.setAttribute("clientAuth", "false");
+ httpsConnector.setAttribute("sslProtocol", "TLS");
+ httpsConnector.setAttribute("SSLEnabled", true);
+
+ server.getService().addConnector(httpsConnector);
+
+ if (idp) {
+ File stsWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(), "fediz-idp-sts");
+ server.addWebapp("/fediz-idp-sts", stsWebapp.getAbsolutePath());
- private static void initRp() {
- try {
- rpServer = new Tomcat();
- rpServer.setPort(0);
- String currentDir = new File(".").getCanonicalPath();
- rpServer.setBaseDir(currentDir + File.separator + "target");
-
- rpServer.getHost().setAppBase("tomcat/rp/webapps");
- rpServer.getHost().setAutoDeploy(true);
- rpServer.getHost().setDeployOnStartup(true);
-
- Connector httpsConnector = new Connector();
- httpsConnector.setPort(Integer.parseInt(rpHttpsPort));
- httpsConnector.setSecure(true);
- httpsConnector.setScheme("https");
- //httpsConnector.setAttribute("keyAlias", keyAlias);
- httpsConnector.setAttribute("keystorePass", "tompass");
- httpsConnector.setAttribute("keystoreFile", "test-classes/server.jks");
- httpsConnector.setAttribute("truststorePass", "tompass");
- httpsConnector.setAttribute("truststoreFile", "test-classes/server.jks");
- // httpsConnector.setAttribute("clientAuth", "false");
- httpsConnector.setAttribute("clientAuth", "want");
- httpsConnector.setAttribute("sslProtocol", "TLS");
- httpsConnector.setAttribute("SSLEnabled", true);
-
- rpServer.getService().addConnector(httpsConnector);
+ File idpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(), "fediz-idp");
+ server.addWebapp("/fediz-idp", idpWebapp.getAbsolutePath());
+ } else {
+ File rpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(), "simpleWebapp");
+ Context cxt = server.addWebapp("/fedizhelloworld", rpWebapp.getAbsolutePath());
- //Context ctx =
- Context cxt = rpServer.addWebapp("/fedizhelloworld", "simpleWebapp");
FederationAuthenticator fa = new FederationAuthenticator();
fa.setConfigFile(currentDir + File.separator + "target" + File.separator
+ "test-classes" + File.separator + "fediz_config_wreq.xml");
cxt.getPipeline().addValve(fa);
-
-
- rpServer.start();
- } catch (Exception e) {
- e.printStackTrace();
}
+
+ server.start();
+
+ return server;
}
@AfterClass
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/dffcc9e0/systests/webapps/simpleWebapp/src/main/webapp/META-INF/context.xml
----------------------------------------------------------------------
diff --git a/systests/webapps/simpleWebapp/src/main/webapp/META-INF/context.xml b/systests/webapps/simpleWebapp/src/main/webapp/META-INF/context.xml
deleted file mode 100644
index 838f156..0000000
--- a/systests/webapps/simpleWebapp/src/main/webapp/META-INF/context.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<Context>
- <Valve className="org.apache.cxf.fediz.tomcat.FederationAuthenticator" configFile="conf/fediz_config.xml" />
-</Context>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/dffcc9e0/systests/webapps/springPreauthWebapp/src/main/webapp/META-INF/context.xml
----------------------------------------------------------------------
diff --git a/systests/webapps/springPreauthWebapp/src/main/webapp/META-INF/context.xml b/systests/webapps/springPreauthWebapp/src/main/webapp/META-INF/context.xml
deleted file mode 100644
index 838f156..0000000
--- a/systests/webapps/springPreauthWebapp/src/main/webapp/META-INF/context.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<Context>
- <Valve className="org.apache.cxf.fediz.tomcat.FederationAuthenticator" configFile="conf/fediz_config.xml" />
-</Context>