cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gonza...@apache.org
Subject [cxf-fediz] branch 1.4.x-fixes updated: fix ut Spring Plugin relativePath
Date Tue, 14 Nov 2017 21:58:57 GMT
This is an automated email from the ASF dual-hosted git repository.

gonzalad pushed a commit to branch 1.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf-fediz.git


The following commit(s) were added to refs/heads/1.4.x-fixes by this push:
     new 9c4de94  fix ut Spring Plugin relativePath
9c4de94 is described below

commit 9c4de9473674727d2dbb81cb491719f8bebc6760
Author: gonzalad <adr_gonzalez@yahoo.fr>
AuthorDate: Tue Nov 14 22:59:08 2017 +0100

    fix ut Spring Plugin relativePath
    
    Fix unit tests for Spring Plugin relativePath.
---
 .../cxf/fediz/spring/FederationConfigImpl.java     | 23 ++++++++++++++++++++++
 .../spring/src/test/resources/fediz_config.xml     | 16 +++++++--------
 2 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java
b/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java
index 706bb91..3f575eb 100644
--- a/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java
+++ b/plugins/spring2/src/main/java/org/apache/cxf/fediz/spring/FederationConfigImpl.java
@@ -37,6 +37,7 @@ public class FederationConfigImpl implements FederationConfig {
 
     private Resource configFile;
     private String contextName;
+    private String relativePath;
 
     //private ServletContext servletContext;
     private FedizConfigurator configurator = new FedizConfigurator();
@@ -80,9 +81,27 @@ public class FederationConfigImpl implements FederationConfig {
             LOG.error("Federation context '" + context + "' not found.");
             throw new IllegalStateException("Federation context '" + context + "' not found.");
         }
+        initializeRelativePath(ctx);
         return ctx;
     }
 
+    private void initializeRelativePath(FedizContext ctx) {
+        if (relativePath != null && relativePath.length() > 0) {
+            ctx.setRelativePath(relativePath);
+        }
+        if (ctx.getRelativePath() == null) {
+            String catalinaBase = System.getProperty("catalina.base");
+            if (catalinaBase != null && catalinaBase.length() > 0) {
+                ctx.setRelativePath(catalinaBase);
+            }
+        }
+        if (ctx.getRelativePath() == null) {
+            String jettyHome = System.getProperty("jetty.home");
+            if (jettyHome != null && jettyHome.length() > 0) {
+                ctx.setRelativePath(jettyHome);
+            }
+        }
+    }
 
     @Override
     public FedizContext getFedizContext() {
@@ -103,4 +122,8 @@ public class FederationConfigImpl implements FederationConfig {
     }
     */
 
+    public void setRelativePath(String relativePath) {
+        this.relativePath = relativePath;
+    }
+
 }
diff --git a/systests/spring/src/test/resources/fediz_config.xml b/systests/spring/src/test/resources/fediz_config.xml
index 1803d05..7c78d75 100644
--- a/systests/spring/src/test/resources/fediz_config.xml
+++ b/systests/spring/src/test/resources/fediz_config.xml
@@ -28,7 +28,7 @@
 		</audienceUris>
 		<certificateStores>
 			<trustManager>
-				<keyStore file="clienttrust.jks" password="storepass" type="JKS" />
+				<keyStore file="test-classes/clienttrust.jks" password="storepass" type="JKS" />
 			</trustManager>
 		</certificateStores>
 		<trustedIssuers>
@@ -36,7 +36,7 @@
 		</trustedIssuers>
 		<maximumClockSkew>1000</maximumClockSkew>
 		<signingKey keyAlias="mytomidpkey" keyPassword="tompass">
-            <keyStore file="server.jks" password="tompass" type="JKS" />
+            <keyStore file="test-classes/server.jks" password="tompass" type="JKS" />
         </signingKey>
 		<protocol xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 			xsi:type="federationProtocolType" version="1.0.0">
@@ -67,7 +67,7 @@
 		</audienceUris>
 		<certificateStores>
 			<trustManager>
-				<keyStore file="clienttrust.jks" password="storepass" type="JKS" />
+				<keyStore file="test-classes/clienttrust.jks" password="storepass" type="JKS" />
 			</trustManager>
 		</certificateStores>
 		<trustedIssuers>
@@ -75,7 +75,7 @@
 		</trustedIssuers>
 		<maximumClockSkew>1000</maximumClockSkew>
 		<signingKey keyAlias="mytomidpkey" keyPassword="tompass">
-            <keyStore file="server.jks" password="tompass" type="JKS" />
+            <keyStore file="test-classes/server.jks" password="tompass" type="JKS" />
         </signingKey>
 		<protocol xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 			xsi:type="federationProtocolType" version="1.0.0">
@@ -106,7 +106,7 @@
 		</audienceUris>
 		<certificateStores>
 			<trustManager>
-				<keyStore file="clienttrust.jks" password="storepass" type="JKS" />
+				<keyStore file="test-classes/clienttrust.jks" password="storepass" type="JKS" />
 			</trustManager>
 		</certificateStores>
 		<trustedIssuers>
@@ -114,7 +114,7 @@
 		</trustedIssuers>
 		<maximumClockSkew>1000</maximumClockSkew>
 		<signingKey keyAlias="mytomidpkey" keyPassword="tompass">
-            <keyStore file="server.jks" password="tompass" type="JKS" />
+            <keyStore file="test-classes/server.jks" password="tompass" type="JKS" />
         </signingKey>
 		<protocol xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 			xsi:type="federationProtocolType" version="1.0.0">
@@ -145,7 +145,7 @@
         </audienceUris>
         <certificateStores>
 			<trustManager>
-				<keyStore file="clienttrust.jks" password="storepass" type="JKS" />
+				<keyStore file="test-classes/clienttrust.jks" password="storepass" type="JKS" />
 			</trustManager>
 		</certificateStores>
         <trustedIssuers>
@@ -153,7 +153,7 @@
         </trustedIssuers>
         <maximumClockSkew>1000</maximumClockSkew>
         <signingKey keyAlias="mytomidpkey" keyPassword="tompass">
-            <keyStore file="server.jks" password="tompass" type="JKS" />
+            <keyStore file="test-classes/server.jks" password="tompass" type="JKS" />
         </signingKey>
         <protocol xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:type="federationProtocolType" version="1.0.0">

-- 
To stop receiving notification emails like this one, please contact
['"commits@cxf.apache.org" <commits@cxf.apache.org>'].

Mime
View raw message