[java-idp-testbed COMMIT] in /trunk: launchconfig/SAML1UnsolicitedFlowTest.launch launchconfig/SAML2UnsolicitedFlowTe...

noreply at shibboleth.net noreply at shibboleth.net
Wed Jan 22 23:35:04 EST 2014


Author: tzeller
Date: Wed Jan 22 23:35:03 2014
New Revision: 126

URL: http://svn.shibboleth.net/view/java-idp-testbed?rev=126&view=rev
Log:
Remove need to set idp.home and app.home properties when running tests from Eclipse.

Added:
    trunk/src/main/java/common/PathPropertySupport.java   (with props)
Modified:
    trunk/launchconfig/SAML1UnsolicitedFlowTest.launch
    trunk/launchconfig/SAML2UnsolicitedFlowTest.launch
    trunk/pom.xml
    trunk/src/main/java/Main.java
    trunk/src/test/java/idp/AbstractFlowTest.java

Modified: trunk/pom.xml
URL: http://svn.shibboleth.net/view/java-idp-testbed/trunk/pom.xml?rev=126&r1=125&r2=126&view=diff
==============================================================================
--- trunk/pom.xml (original)
+++ trunk/pom.xml Wed Jan 22 23:35:03 2014
@@ -287,11 +287,12 @@
                         <phase>prepare-package</phase>
                         <configuration>
                             <tasks>
-                                <move todir="${project.build.directory}/${project.artifactId}-${project.version}/">
+                                <copy todir="${project.build.directory}/${project.artifactId}-${project.version}/">
                                     <fileset dir="${project.build.directory}/classes/">
                                         <include name="Main.class" />
+                                        <include name="common/PathPropertySupport.class" />
                                     </fileset>
-                                </move>
+                                </copy>
                             </tasks>
                         </configuration>
                         <goals>

Modified: trunk/src/main/java/Main.java
URL: http://svn.shibboleth.net/view/java-idp-testbed/trunk/src/main/java/Main.java?rev=126&r1=125&r2=126&view=diff
==============================================================================
--- trunk/src/main/java/Main.java (original)
+++ trunk/src/main/java/Main.java Wed Jan 22 23:35:03 2014
@@ -15,13 +15,10 @@
  * limitations under the License.
  */
 
-import java.io.File;
-import java.io.FileInputStream;
 import java.net.URL;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.security.ProtectionDomain;
-import java.util.Properties;
 
 import org.eclipse.jetty.security.HashLoginService;
 import org.eclipse.jetty.server.Server;
@@ -29,46 +26,10 @@
 import org.eclipse.jetty.webapp.WebAppContext;
 import org.eclipse.jetty.xml.XmlConfiguration;
 
+import common.PathPropertySupport;
+
 /** Start Jetty */
 public class Main {
-
-    /**
-     * Normalize a path for windows.<br/>
-     * 
-     * On operating systems which present filesystems not rooted in '\', we need to be careful about the construction of
-     * URLS. According to RFC 1738 a url of the form file://foo/bar is for <em>host</em>foo and <em>path</em> bar. Hence
-     * if we take a path of the form c:\foo\bar and (or normalized to c:/foo/bar) and prepend 'file://' the URL code
-     * will, quite correctly take this as host 'C:'. This will at best end up with a timeout because 'C:' cannot be
-     * found and at worst with getting the completely the wrong info. Contrast the case of passing in /opt/idp/config,
-     * this yields file:///opt/idp/config which the URL code interprets as '/opt/idp/config' on the null host.
-     * 
-     * 
-     * <br/>
-     * The canonical solution on windows is to prepend a '/'. We can deal with other operatring systems as the need
-     * arises.
-     * 
-     * @param path the input path
-     * @return the normalized path.
-     */
-    static private String normalizePath(String path) {
-
-        if (needsNormalized(path)) {
-            return '/' + path;
-        } 
-        return path;
-    }
-    
-    /**
-     * Does the path need to be normalized? <br/>
-     * Yes if it doesn't start with '/' (or '\') and the second character is ':'
-     * @param path the path to inspect
-     * @return whether we need to normalize.
-     */
-    static private boolean needsNormalized(String path) {
-        
-        return path.length() >= 2 && path.charAt(0) != '/' && path.charAt(0) != File.pathSeparatorChar && path.charAt(1) == ':';
-        
-    }
 
     /**
      * @param args
@@ -80,45 +41,12 @@
             ProtectionDomain protectionDomain = Main.class.getProtectionDomain();
             URL location = protectionDomain.getCodeSource().getLocation();
 
-            // Set idp.home system property if it has not been set as a command line option.
-            String idpHome = System.getProperty("idp.home");
-            if (idpHome == null) {
-                if (protectionDomain.getCodeSource().getLocation().toString().endsWith(".war")) {
-                    // Running from command line.
-                    idpHome = Paths.get("").toAbsolutePath().toString();
-                } else {
-                    // Running from Eclipse.
-                    idpHome = Paths.get(Paths.get("").toAbsolutePath().getParent().toAbsolutePath().toString(),

[... 65 lines stripped ...]


More information about the commits mailing list