Author: weaver
Date: Thu Jul 28 07:16:55 2005
New Revision: 225779

URL: http://svn.apache.org/viewcvs?rev=225779&view=rev
Log:
Hopefully this will work in everyone's development environment.

I added checks to make sure the properties file exists before trying to load 
them.
I have also added the loading of ${PROJECT_HOME}/build.properties and 
${PROJECT_HOME}/project.properties.

Modified:
    
portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/testhelpers/AbstractTestHelper.java

Modified: 
portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/testhelpers/AbstractTestHelper.java
URL: 
http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/testhelpers/AbstractTestHelper.java?rev=225779&r1=225778&r2=225779&view=diff
==============================================================================
--- 
portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/testhelpers/AbstractTestHelper.java
 (original)
+++ 
portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/testhelpers/AbstractTestHelper.java
 Thu Jul 28 07:16:55 2005
@@ -3,6 +3,8 @@
 import java.io.File;
 import java.util.Map;
 
+import org.apache.commons.configuration.CompositeConfiguration;
+import org.apache.commons.configuration.Configuration;
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.PropertiesConfiguration;
 import org.springframework.beans.factory.config.ConfigurableBeanFactory;
@@ -13,17 +15,41 @@
     public static final String APP_CONTEXT = "AppContext";
     private final Map context;
 
-    private static final PropertiesConfiguration USER_PROPERTIES;
+    private static final CompositeConfiguration USER_PROPERTIES;
     static
     {
         try
         {
-            USER_PROPERTIES= new PropertiesConfiguration(new 
File(System.getProperty("user.home"), "build.properties"));
+            File userBuildFile = new File(System.getProperty("user.home"), 
"build.properties");
+            Configuration userBuildProps = loadConfiguration(userBuildFile);
+            
+            File mavenBuildFile = new File("../../build.properties");
+            Configuration mavenBuildProps = loadConfiguration(userBuildFile);
+            
+            File mavenProjectFile = new File("../../project.properties");
+            Configuration mavenProjectProps = loadConfiguration(userBuildFile);
+            
+            USER_PROPERTIES = new CompositeConfiguration();
+            USER_PROPERTIES.addConfiguration(userBuildProps);
+            USER_PROPERTIES.addConfiguration(mavenBuildProps);
+            USER_PROPERTIES.addConfiguration(mavenProjectProps);            
         }
         catch (ConfigurationException e)
         {
             
            throw new IllegalStateException("Unable to load 
${USER_HOME}/build.properties");
+        }
+    }
+
+    private static Configuration loadConfiguration(File propsFile) throws 
ConfigurationException
+    {
+        if(propsFile.exists())
+        {
+            return new PropertiesConfiguration(propsFile);
+        }
+        else
+        {
+            return new PropertiesConfiguration();
         }
     }   
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to