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 14:02:15 GMT
Repository: cxf-fediz
Updated Branches:
  refs/heads/1.2.x-fixes e856d93f1 -> b4410641c


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/b4410641
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/b4410641
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/b4410641

Branch: refs/heads/1.2.x-fixes
Commit: b4410641cbcd8abd595a5fc69a8eb7bac5409fdd
Parents: e856d93
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 15:02:05 2016 +0100

----------------------------------------------------------------------
 .../integrationtests/ClientCertificateTest.java   | 18 ++++++++++++++++++
 .../fediz/integrationtests/HolderOfKeyTest.java   | 18 ++++++++++++++++++
 .../cxf/fediz/integrationtests/TomcatTest.java    | 18 ++++++++++++++++++
 .../cxf/fediz/integrationtests/WReqTest.java      | 18 ++++++++++++++++++
 4 files changed, 72 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/b4410641/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 db48b8f..b2b10cf 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.tomcat.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");
+                FileOutputStream outputStream = new FileOutputStream(f2);
+                IOUtils.write(content, outputStream, "UTF-8");
+                outputStream.close();
+            }
+            
             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/b4410641/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 b21e3aa..f61b8a8 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.tomcat.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");
+                FileOutputStream outputStream = new FileOutputStream(f2);
+                IOUtils.write(content, outputStream, "UTF-8");
+                outputStream.close();
+            }
+            
             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/b4410641/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 15e44ec..3dfa9e9 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.tomcat.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");
+                FileOutputStream outputStream = new FileOutputStream(f2);
+                IOUtils.write(content, outputStream, "UTF-8");
+                outputStream.close();
+            }
+            
             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/b4410641/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 8249240..5064327 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.tomcat.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");
+                FileOutputStream outputStream = new FileOutputStream(f2);
+                IOUtils.write(content, outputStream, "UTF-8");
+                outputStream.close();
+            }
+            
             FederationAuthenticator fa = new FederationAuthenticator();
             fa.setConfigFile(currentDir + File.separator + "target" + File.separator
                              + "test-classes" + File.separator + "fediz_config_wreq.xml");


Mime
View raw message