cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject cxf-fediz git commit: Make some of the systests runnable in eclipse
Date Fri, 08 Apr 2016 13:29:00 GMT
Repository: cxf-fediz
Updated Branches:
  refs/heads/master 08c526b9e -> 3fec4ba75


Make some of the systests runnable in eclipse


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

Branch: refs/heads/master
Commit: 3fec4ba75becc6ae2ef295c32651479ae299e813
Parents: 08c526b
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Fri Apr 8 14:28:04 2016 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Fri Apr 8 14:28:04 2016 +0100

----------------------------------------------------------------------
 .../ClientCertificatePreAuthSpringTest.java       | 12 ++++++++----
 .../integrationtests/ClientCertificateTest.java   | 12 ++++++++----
 .../integrationtests/JettyPreAuthSpringTest.java  | 12 ++++++++----
 .../cxf/fediz/integrationtests/JettyTest.java     | 12 ++++++++----
 .../apache/cxf/fediz/systests/oidc/OIDCTest.java  | 18 ++++++++++++++++++
 .../integrationtests/ClientCertificateTest.java   | 18 ++++++++++++++++++
 .../fediz/integrationtests/HolderOfKeyTest.java   | 18 ++++++++++++++++++
 .../cxf/fediz/integrationtests/TomcatTest.java    | 18 ++++++++++++++++++
 .../cxf/fediz/integrationtests/WReqTest.java      | 18 ++++++++++++++++++
 .../integrationtests/ClientCertificateTest.java   | 18 ++++++++++++++++++
 .../fediz/integrationtests/HolderOfKeyTest.java   | 18 ++++++++++++++++++
 .../cxf/fediz/integrationtests/TomcatTest.java    | 18 ++++++++++++++++++
 .../cxf/fediz/integrationtests/WReqTest.java      | 18 ++++++++++++++++++
 13 files changed, 194 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/3fec4ba7/systests/jetty9/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificatePreAuthSpringTest.java
----------------------------------------------------------------------
diff --git a/systests/jetty9/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificatePreAuthSpringTest.java
b/systests/jetty9/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificatePreAuthSpringTest.java
index 86a988c..a1db4fe 100644
--- a/systests/jetty9/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificatePreAuthSpringTest.java
+++ b/systests/jetty9/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificatePreAuthSpringTest.java
@@ -75,7 +75,7 @@ public class ClientCertificatePreAuthSpringTest extends AbstractClientCertTests
     @AfterClass
     public static void cleanup() {
         try {
-            if (idpServer.getServer() != null
+            if (idpServer != null && idpServer.getServer() != null
                 && idpServer.getServer().getState() != LifecycleState.DESTROYED)
{
                 if (idpServer.getServer().getState() != LifecycleState.STOPPED) {
                     idpServer.stop();
@@ -100,7 +100,8 @@ public class ClientCertificatePreAuthSpringTest extends AbstractClientCertTests
             idpServer = new Tomcat();
             idpServer.setPort(0);
             String currentDir = new File(".").getCanonicalPath();
-            idpServer.setBaseDir(currentDir + File.separator + "target");
+            String baseDir = currentDir + File.separator + "target";
+            idpServer.setBaseDir(baseDir);
             
             idpServer.getHost().setAppBase("tomcat/idp/webapps");
             idpServer.getHost().setAutoDeploy(true);
@@ -122,8 +123,11 @@ public class ClientCertificatePreAuthSpringTest extends AbstractClientCertTests
 
             idpServer.getService().addConnector(httpsConnector);
             
-            idpServer.addWebapp("/fediz-idp-sts", "fediz-idp-sts");
-            idpServer.addWebapp("/fediz-idp", "fediz-idp");
+            File stsWebapp = new File(baseDir + File.separator + idpServer.getHost().getAppBase(),
"fediz-idp-sts");
+            idpServer.addWebapp("/fediz-idp-sts", stsWebapp.getAbsolutePath());
+    
+            File idpWebapp = new File(baseDir + File.separator + idpServer.getHost().getAppBase(),
"fediz-idp");
+            idpServer.addWebapp("/fediz-idp", idpWebapp.getAbsolutePath());
             
             idpServer.start();
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/3fec4ba7/systests/jetty9/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
----------------------------------------------------------------------
diff --git a/systests/jetty9/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
b/systests/jetty9/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
index d1a1fa5..b53c3ee 100644
--- a/systests/jetty9/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
+++ b/systests/jetty9/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
@@ -75,7 +75,7 @@ public class ClientCertificateTest extends AbstractClientCertTests {
     @AfterClass
     public static void cleanup() {
         try {
-            if (idpServer.getServer() != null
+            if (idpServer != null && idpServer.getServer() != null
                 && idpServer.getServer().getState() != LifecycleState.DESTROYED)
{
                 if (idpServer.getServer().getState() != LifecycleState.STOPPED) {
                     idpServer.stop();
@@ -100,7 +100,8 @@ public class ClientCertificateTest extends AbstractClientCertTests {
             idpServer = new Tomcat();
             idpServer.setPort(0);
             String currentDir = new File(".").getCanonicalPath();
-            idpServer.setBaseDir(currentDir + File.separator + "target");
+            String baseDir = currentDir + File.separator + "target";
+            idpServer.setBaseDir(baseDir);
             
             idpServer.getHost().setAppBase("tomcat/idp/webapps");
             idpServer.getHost().setAutoDeploy(true);
@@ -122,8 +123,11 @@ public class ClientCertificateTest extends AbstractClientCertTests {
 
             idpServer.getService().addConnector(httpsConnector);
             
-            idpServer.addWebapp("/fediz-idp-sts", "fediz-idp-sts");
-            idpServer.addWebapp("/fediz-idp", "fediz-idp");
+            File stsWebapp = new File(baseDir + File.separator + idpServer.getHost().getAppBase(),
"fediz-idp-sts");
+            idpServer.addWebapp("/fediz-idp-sts", stsWebapp.getAbsolutePath());
+    
+            File idpWebapp = new File(baseDir + File.separator + idpServer.getHost().getAppBase(),
"fediz-idp");
+            idpServer.addWebapp("/fediz-idp", idpWebapp.getAbsolutePath());
             
             idpServer.start();
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/3fec4ba7/systests/jetty9/src/test/java/org/apache/cxf/fediz/integrationtests/JettyPreAuthSpringTest.java
----------------------------------------------------------------------
diff --git a/systests/jetty9/src/test/java/org/apache/cxf/fediz/integrationtests/JettyPreAuthSpringTest.java
b/systests/jetty9/src/test/java/org/apache/cxf/fediz/integrationtests/JettyPreAuthSpringTest.java
index 69191fe..cca8d6a 100644
--- a/systests/jetty9/src/test/java/org/apache/cxf/fediz/integrationtests/JettyPreAuthSpringTest.java
+++ b/systests/jetty9/src/test/java/org/apache/cxf/fediz/integrationtests/JettyPreAuthSpringTest.java
@@ -63,7 +63,7 @@ public class JettyPreAuthSpringTest extends AbstractTests {
     @AfterClass
     public static void cleanup() {
         try {
-            if (idpServer.getServer() != null
+            if (idpServer != null && idpServer.getServer() != null
                 && idpServer.getServer().getState() != LifecycleState.DESTROYED)
{
                 if (idpServer.getServer().getState() != LifecycleState.STOPPED) {
                     idpServer.stop();
@@ -82,7 +82,8 @@ public class JettyPreAuthSpringTest extends AbstractTests {
             idpServer = new Tomcat();
             idpServer.setPort(0);
             String currentDir = new File(".").getCanonicalPath();
-            idpServer.setBaseDir(currentDir + File.separator + "target");
+            String baseDir = currentDir + File.separator + "target";
+            idpServer.setBaseDir(baseDir);
             
             idpServer.getHost().setAppBase("tomcat/idp/webapps");
             idpServer.getHost().setAutoDeploy(true);
@@ -104,8 +105,11 @@ public class JettyPreAuthSpringTest extends AbstractTests {
 
             idpServer.getService().addConnector(httpsConnector);
             
-            idpServer.addWebapp("/fediz-idp-sts", "fediz-idp-sts");
-            idpServer.addWebapp("/fediz-idp", "fediz-idp");
+            File stsWebapp = new File(baseDir + File.separator + idpServer.getHost().getAppBase(),
"fediz-idp-sts");
+            idpServer.addWebapp("/fediz-idp-sts", stsWebapp.getAbsolutePath());
+    
+            File idpWebapp = new File(baseDir + File.separator + idpServer.getHost().getAppBase(),
"fediz-idp");
+            idpServer.addWebapp("/fediz-idp", idpWebapp.getAbsolutePath());
             
             idpServer.start();
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/3fec4ba7/systests/jetty9/src/test/java/org/apache/cxf/fediz/integrationtests/JettyTest.java
----------------------------------------------------------------------
diff --git a/systests/jetty9/src/test/java/org/apache/cxf/fediz/integrationtests/JettyTest.java
b/systests/jetty9/src/test/java/org/apache/cxf/fediz/integrationtests/JettyTest.java
index 765fa2a..b961449 100644
--- a/systests/jetty9/src/test/java/org/apache/cxf/fediz/integrationtests/JettyTest.java
+++ b/systests/jetty9/src/test/java/org/apache/cxf/fediz/integrationtests/JettyTest.java
@@ -63,7 +63,7 @@ public class JettyTest extends AbstractTests {
     @AfterClass
     public static void cleanup() {
         try {
-            if (idpServer.getServer() != null
+            if (idpServer != null && idpServer.getServer() != null
                 && idpServer.getServer().getState() != LifecycleState.DESTROYED)
{
                 if (idpServer.getServer().getState() != LifecycleState.STOPPED) {
                     idpServer.stop();
@@ -82,7 +82,8 @@ public class JettyTest extends AbstractTests {
             idpServer = new Tomcat();
             idpServer.setPort(0);
             String currentDir = new File(".").getCanonicalPath();
-            idpServer.setBaseDir(currentDir + File.separator + "target");
+            String baseDir = currentDir + File.separator + "target";
+            idpServer.setBaseDir(baseDir);
             
             idpServer.getHost().setAppBase("tomcat/idp/webapps");
             idpServer.getHost().setAutoDeploy(true);
@@ -104,8 +105,11 @@ public class JettyTest extends AbstractTests {
 
             idpServer.getService().addConnector(httpsConnector);
             
-            idpServer.addWebapp("/fediz-idp-sts", "fediz-idp-sts");
-            idpServer.addWebapp("/fediz-idp", "fediz-idp");
+            File stsWebapp = new File(baseDir + File.separator + idpServer.getHost().getAppBase(),
"fediz-idp-sts");
+            idpServer.addWebapp("/fediz-idp-sts", stsWebapp.getAbsolutePath());
+    
+            File idpWebapp = new File(baseDir + File.separator + idpServer.getHost().getAppBase(),
"fediz-idp");
+            idpServer.addWebapp("/fediz-idp", idpWebapp.getAbsolutePath());
             
             idpServer.start();
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/3fec4ba7/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/OIDCTest.java
----------------------------------------------------------------------
diff --git a/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/OIDCTest.java
b/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/OIDCTest.java
index c37bf09..ccb3bc9 100644
--- a/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/OIDCTest.java
+++ b/systests/oidc/src/test/java/org/apache/cxf/fediz/systests/oidc/OIDCTest.java
@@ -21,6 +21,8 @@ package org.apache.cxf.fediz.systests.oidc;
 
 
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.net.URL;
 import java.security.KeyStore;
@@ -60,6 +62,7 @@ import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
+import org.apache.commons.io.IOUtils;
 import org.apache.cxf.fediz.tomcat7.FederationAuthenticator;
 import org.apache.cxf.rs.security.jose.jwa.SignatureAlgorithm;
 import org.apache.cxf.rs.security.jose.jws.JwsJwtCompactConsumer;
@@ -150,6 +153,21 @@ public class OIDCTest {
             File rpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(),
"fediz-oidc");
             Context cxt = server.addWebapp("/fediz-oidc", rpWebapp.getAbsolutePath());
             
+            // Substitute the IDP port. Necessary if running the test in eclipse where port
filtering doesn't seem
+            // to work
+            File f = new File(currentDir + "/src/test/resources/fediz_config.xml");
+            FileInputStream inputStream = new FileInputStream(f);
+            String content = IOUtils.toString(inputStream, "UTF-8");
+            inputStream.close();
+            if (content.contains("idp.https.port")) {
+                content = content.replaceAll("\\$\\{idp.https.port\\}", "" + idpHttpsPort);
+            
+                File f2 = new File(baseDir + "/test-classes/fediz_config.xml");
+                try (FileOutputStream outputStream = new FileOutputStream(f2)) {
+                    IOUtils.write(content, outputStream, "UTF-8");
+                }
+            }
+            
             FederationAuthenticator fa = new FederationAuthenticator();
             fa.setConfigFile(currentDir + File.separator + "target" + File.separator
                              + "test-classes" + File.separator + "fediz_config.xml");

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/3fec4ba7/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 a67838a..547d03a 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,6 +20,8 @@
 package org.apache.cxf.fediz.integrationtests;
 
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.IOException;
 
 import javax.servlet.ServletException;
@@ -29,6 +31,7 @@ import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
+import org.apache.commons.io.IOUtils;
 import org.apache.cxf.fediz.tomcat7.FederationAuthenticator;
 import org.junit.AfterClass;
 import org.junit.Assert;
@@ -108,6 +111,21 @@ public class ClientCertificateTest extends AbstractClientCertTests {
             File rpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(),
"simpleWebapp");
             Context cxt = server.addWebapp("/fedizhelloworld", rpWebapp.getAbsolutePath());
             
+            // Substitute the IDP port. Necessary if running the test in eclipse where port
filtering doesn't seem
+            // to work
+            File f = new File(currentDir + "/src/test/resources/fediz_config_client_cert.xml");
+            FileInputStream inputStream = new FileInputStream(f);
+            String content = IOUtils.toString(inputStream, "UTF-8");
+            inputStream.close();
+            if (content.contains("idp.https.port")) {
+                content = content.replaceAll("\\$\\{idp.https.port\\}", "" + idpHttpsPort);
+            
+                File f2 = new File(baseDir + "/test-classes/fediz_config_client_cert.xml");
+                try (FileOutputStream outputStream = new FileOutputStream(f2)) {
+                    IOUtils.write(content, outputStream, "UTF-8");
+                }
+            }
+            
             FederationAuthenticator fa = new FederationAuthenticator();
             fa.setConfigFile(currentDir + File.separator + "target" + File.separator
                              + "test-classes" + File.separator + "fediz_config_client_cert.xml");

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/3fec4ba7/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 915744e..cd86f28 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,8 @@
 package org.apache.cxf.fediz.integrationtests;
 
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.IOException;
 
 import javax.servlet.ServletException;
@@ -36,6 +38,7 @@ import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
+import org.apache.commons.io.IOUtils;
 import org.apache.cxf.fediz.core.ClaimTypes;
 import org.apache.cxf.fediz.tomcat7.FederationAuthenticator;
 import org.apache.http.auth.AuthScope;
@@ -118,6 +121,21 @@ public class HolderOfKeyTest {
             File rpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(),
"simpleWebapp");
             Context cxt = server.addWebapp("/fedizhelloworld", rpWebapp.getAbsolutePath());
             
+            // Substitute the IDP port. Necessary if running the test in eclipse where port
filtering doesn't seem
+            // to work
+            File f = new File(currentDir + "/src/test/resources/fediz_config_hok.xml");
+            FileInputStream inputStream = new FileInputStream(f);
+            String content = IOUtils.toString(inputStream, "UTF-8");
+            inputStream.close();
+            if (content.contains("idp.https.port")) {
+                content = content.replaceAll("\\$\\{idp.https.port\\}", "" + idpHttpsPort);
+            
+                File f2 = new File(baseDir + "/test-classes/fediz_config_hok.xml");
+                try (FileOutputStream outputStream = new FileOutputStream(f2)) {
+                    IOUtils.write(content, outputStream, "UTF-8");
+                }
+            }
+            
             FederationAuthenticator fa = new FederationAuthenticator();
             fa.setConfigFile(currentDir + File.separator + "target" + File.separator
                              + "test-classes" + File.separator + "fediz_config_hok.xml");

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/3fec4ba7/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 ded4581..2dcd8ec 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,6 +21,8 @@ package org.apache.cxf.fediz.integrationtests;
 
 
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.IOException;
 
 import javax.servlet.ServletException;
@@ -30,6 +32,7 @@ import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
+import org.apache.commons.io.IOUtils;
 import org.apache.cxf.fediz.tomcat7.FederationAuthenticator;
 import org.junit.AfterClass;
 import org.junit.Assert;
@@ -105,6 +108,21 @@ public class TomcatTest extends AbstractTests {
             File rpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(),
"simpleWebapp");
             Context cxt = server.addWebapp("/fedizhelloworld", rpWebapp.getAbsolutePath());
             
+            // Substitute the IDP port. Necessary if running the test in eclipse where port
filtering doesn't seem
+            // to work
+            File f = new File(currentDir + "/src/test/resources/fediz_config.xml");
+            FileInputStream inputStream = new FileInputStream(f);
+            String content = IOUtils.toString(inputStream, "UTF-8");
+            inputStream.close();
+            if (content.contains("idp.https.port")) {
+                content = content.replaceAll("\\$\\{idp.https.port\\}", "" + idpHttpsPort);
+            
+                File f2 = new File(baseDir + "/test-classes/fediz_config.xml");
+                try (FileOutputStream outputStream = new FileOutputStream(f2)) {
+                    IOUtils.write(content, outputStream, "UTF-8");
+                }
+            }
+            
             FederationAuthenticator fa = new FederationAuthenticator();
             fa.setConfigFile(currentDir + File.separator + "target" + File.separator
                              + "test-classes" + File.separator + "fediz_config.xml");

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/3fec4ba7/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 57a1575..2afb162 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
@@ -21,6 +21,8 @@ package org.apache.cxf.fediz.integrationtests;
 
 
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.IOException;
 
 import javax.servlet.ServletException;
@@ -37,6 +39,7 @@ import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
+import org.apache.commons.io.IOUtils;
 import org.apache.cxf.fediz.core.ClaimTypes;
 import org.apache.cxf.fediz.tomcat7.FederationAuthenticator;
 import org.apache.http.auth.AuthScope;
@@ -118,6 +121,21 @@ public class WReqTest {
             File rpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(),
"simpleWebapp");
             Context cxt = server.addWebapp("/fedizhelloworld", rpWebapp.getAbsolutePath());
             
+            // Substitute the IDP port. Necessary if running the test in eclipse where port
filtering doesn't seem
+            // to work
+            File f = new File(currentDir + "/src/test/resources/fediz_config_wreq.xml");
+            FileInputStream inputStream = new FileInputStream(f);
+            String content = IOUtils.toString(inputStream, "UTF-8");
+            inputStream.close();
+            if (content.contains("idp.https.port")) {
+                content = content.replaceAll("\\$\\{idp.https.port\\}", "" + idpHttpsPort);
+            
+                File f2 = new File(baseDir + "/test-classes/fediz_config_wreq.xml");
+                try (FileOutputStream outputStream = new FileOutputStream(f2)) {
+                    IOUtils.write(content, outputStream, "UTF-8");
+                }
+            }
+            
             FederationAuthenticator fa = new FederationAuthenticator();
             fa.setConfigFile(currentDir + File.separator + "target" + File.separator
                              + "test-classes" + File.separator + "fediz_config_wreq.xml");

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/3fec4ba7/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
----------------------------------------------------------------------
diff --git a/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
index 04d9e33..9faf41d 100644
--- a/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
+++ b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/ClientCertificateTest.java
@@ -20,6 +20,8 @@
 package org.apache.cxf.fediz.integrationtests;
 
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.IOException;
 
 import javax.servlet.ServletException;
@@ -29,6 +31,7 @@ import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
+import org.apache.commons.io.IOUtils;
 import org.apache.cxf.fediz.tomcat8.FederationAuthenticator;
 import org.junit.AfterClass;
 import org.junit.Assert;
@@ -108,6 +111,21 @@ public class ClientCertificateTest extends AbstractClientCertTests {
             File rpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(),
"simpleWebapp");
             Context cxt = server.addWebapp("/fedizhelloworld", rpWebapp.getAbsolutePath());
             
+            // Substitute the IDP port. Necessary if running the test in eclipse where port
filtering doesn't seem
+            // to work
+            File f = new File(currentDir + "/src/test/resources/fediz_config_client_cert.xml");
+            FileInputStream inputStream = new FileInputStream(f);
+            String content = IOUtils.toString(inputStream, "UTF-8");
+            inputStream.close();
+            if (content.contains("idp.https.port")) {
+                content = content.replaceAll("\\$\\{idp.https.port\\}", "" + idpHttpsPort);
+            
+                File f2 = new File(baseDir + "/test-classes/fediz_config_client_cert.xml");
+                try (FileOutputStream outputStream = new FileOutputStream(f2)) {
+                    IOUtils.write(content, outputStream, "UTF-8");
+                }
+            }
+            
             FederationAuthenticator fa = new FederationAuthenticator();
             fa.setConfigFile(currentDir + File.separator + "target" + File.separator
                              + "test-classes" + File.separator + "fediz_config_client_cert.xml");

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/3fec4ba7/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/HolderOfKeyTest.java
----------------------------------------------------------------------
diff --git a/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/HolderOfKeyTest.java
b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/HolderOfKeyTest.java
index 7526acd..b82ed9d 100644
--- a/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/HolderOfKeyTest.java
+++ b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/HolderOfKeyTest.java
@@ -20,6 +20,8 @@
 package org.apache.cxf.fediz.integrationtests;
 
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.IOException;
 
 import javax.servlet.ServletException;
@@ -36,6 +38,7 @@ import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
+import org.apache.commons.io.IOUtils;
 import org.apache.cxf.fediz.core.ClaimTypes;
 import org.apache.cxf.fediz.tomcat8.FederationAuthenticator;
 import org.apache.http.auth.AuthScope;
@@ -118,6 +121,21 @@ public class HolderOfKeyTest {
             File rpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(),
"simpleWebapp");
             Context cxt = server.addWebapp("/fedizhelloworld", rpWebapp.getAbsolutePath());
             
+            // Substitute the IDP port. Necessary if running the test in eclipse where port
filtering doesn't seem
+            // to work
+            File f = new File(currentDir + "/src/test/resources/fediz_config_hok.xml");
+            FileInputStream inputStream = new FileInputStream(f);
+            String content = IOUtils.toString(inputStream, "UTF-8");
+            inputStream.close();
+            if (content.contains("idp.https.port")) {
+                content = content.replaceAll("\\$\\{idp.https.port\\}", "" + idpHttpsPort);
+            
+                File f2 = new File(baseDir + "/test-classes/fediz_config_hok.xml");
+                try (FileOutputStream outputStream = new FileOutputStream(f2)) {
+                    IOUtils.write(content, outputStream, "UTF-8");
+                }
+            }
+            
             FederationAuthenticator fa = new FederationAuthenticator();
             fa.setConfigFile(currentDir + File.separator + "target" + File.separator
                              + "test-classes" + File.separator + "fediz_config_hok.xml");

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/3fec4ba7/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/TomcatTest.java
----------------------------------------------------------------------
diff --git a/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/TomcatTest.java
b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/TomcatTest.java
index f675c6b..9fce8e6 100644
--- a/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/TomcatTest.java
+++ b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/TomcatTest.java
@@ -21,6 +21,8 @@ package org.apache.cxf.fediz.integrationtests;
 
 
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.IOException;
 
 import javax.servlet.ServletException;
@@ -30,6 +32,7 @@ import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
+import org.apache.commons.io.IOUtils;
 import org.apache.cxf.fediz.tomcat8.FederationAuthenticator;
 import org.junit.AfterClass;
 import org.junit.Assert;
@@ -105,6 +108,21 @@ public class TomcatTest extends AbstractTests {
             File rpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(),
"simpleWebapp");
             Context cxt = server.addWebapp("/fedizhelloworld", rpWebapp.getAbsolutePath());
             
+            // Substitute the IDP port. Necessary if running the test in eclipse where port
filtering doesn't seem
+            // to work
+            File f = new File(currentDir + "/src/test/resources/fediz_config.xml");
+            FileInputStream inputStream = new FileInputStream(f);
+            String content = IOUtils.toString(inputStream, "UTF-8");
+            inputStream.close();
+            if (content.contains("idp.https.port")) {
+                content = content.replaceAll("\\$\\{idp.https.port\\}", "" + idpHttpsPort);
+            
+                File f2 = new File(baseDir + "/test-classes/fediz_config.xml");
+                try (FileOutputStream outputStream = new FileOutputStream(f2)) {
+                    IOUtils.write(content, outputStream, "UTF-8");
+                }
+            }
+            
             FederationAuthenticator fa = new FederationAuthenticator();
             fa.setConfigFile(currentDir + File.separator + "target" + File.separator
                              + "test-classes" + File.separator + "fediz_config.xml");

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/3fec4ba7/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/WReqTest.java
----------------------------------------------------------------------
diff --git a/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/WReqTest.java
b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/WReqTest.java
index d13d214..3b90b82 100644
--- a/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/WReqTest.java
+++ b/systests/tomcat8/src/test/java/org/apache/cxf/fediz/integrationtests/WReqTest.java
@@ -21,6 +21,8 @@ package org.apache.cxf.fediz.integrationtests;
 
 
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.IOException;
 
 import javax.servlet.ServletException;
@@ -37,6 +39,7 @@ import org.apache.catalina.LifecycleException;
 import org.apache.catalina.LifecycleState;
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.startup.Tomcat;
+import org.apache.commons.io.IOUtils;
 import org.apache.cxf.fediz.core.ClaimTypes;
 import org.apache.cxf.fediz.tomcat8.FederationAuthenticator;
 import org.apache.http.auth.AuthScope;
@@ -118,6 +121,21 @@ public class WReqTest {
             File rpWebapp = new File(baseDir + File.separator + server.getHost().getAppBase(),
"simpleWebapp");
             Context cxt = server.addWebapp("/fedizhelloworld", rpWebapp.getAbsolutePath());
             
+            // Substitute the IDP port. Necessary if running the test in eclipse where port
filtering doesn't seem
+            // to work
+            File f = new File(currentDir + "/src/test/resources/fediz_config_wreq.xml");
+            FileInputStream inputStream = new FileInputStream(f);
+            String content = IOUtils.toString(inputStream, "UTF-8");
+            inputStream.close();
+            if (content.contains("idp.https.port")) {
+                content = content.replaceAll("\\$\\{idp.https.port\\}", "" + idpHttpsPort);
+            
+                File f2 = new File(baseDir + "/test-classes/fediz_config_wreq.xml");
+                try (FileOutputStream outputStream = new FileOutputStream(f2)) {
+                    IOUtils.write(content, outputStream, "UTF-8");
+                }
+            }
+            
             FederationAuthenticator fa = new FederationAuthenticator();
             fa.setConfigFile(currentDir + File.separator + "target" + File.separator
                              + "test-classes" + File.separator + "fediz_config_wreq.xml");


Mime
View raw message