portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ate Douma <...@douma.nu>
Subject Re: svn commit: r225779 - /portals/jetspeed-2/trunk/components/cm/src/java/org/apache/jetspeed/testhelpers/AbstractTestHelper.java
Date Fri, 29 Jul 2005 16:03:43 GMT
weaver@apache.org wrote:
> 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.
Not yet :-(
I'm gonna check in a fix which will use the different property files instead of only the user
build.properties.

Another problem I see with this solution is that it only works for testcases of subprojects
two directories down
from the root. It can't be used for the commons subprojects or the layout-portlets for example
...

> 
> 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: jetspeed-dev-unsubscribe@portals.apache.org
> For additional commands, e-mail: jetspeed-dev-help@portals.apache.org
> 
> 
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message