]> source.dussan.org Git - archiva.git/commitdiff
get RID of file ~/.m2/archiva.xml created during tests with a new sysprops to use...
authorOlivier Lamy <olamy@apache.org>
Tue, 13 Sep 2011 14:07:24 +0000 (14:07 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 13 Sep 2011 14:07:24 +0000 (14:07 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1170189 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultArchivaConfiguration.java
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/META-INF/spring-context.xml
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context-cleanup-released-snapshots.xml
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context-purge-consumer-test.xml
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/resources/spring-context.xml

index 7e68ff9c6725fbf121efe4e566d635210e95d8e0..ef78599b6bdfec1a493454d9f4b73b40fe95ddc9 100644 (file)
@@ -94,7 +94,6 @@ public class DefaultArchivaConfiguration
 
     /**
      * Plexus registry to read the configuration from.
-     *
      */
     @Inject
     @Named( value = "commons-configuration" )
@@ -495,7 +494,6 @@ public class DefaultArchivaConfiguration
             }
         }
 
-
         new ConfigurationRegistryWriter().write( configuration, section );
         section.save();
 
@@ -537,9 +535,8 @@ public class DefaultArchivaConfiguration
         }
 
         // olamy hackish I know :-)
-        contents = "<configuration><xml fileName=\"" + fileLocation +"\" config-forceCreate=\"true\" config-name=\"org.apache.maven.archiva.user\"/>"
-                    + "</configuration>";
-
+        contents = "<configuration><xml fileName=\"" + fileLocation
+            + "\" config-forceCreate=\"true\" config-name=\"org.apache.maven.archiva.user\"/>" + "</configuration>";
 
         ( (CommonsConfigurationRegistry) registry ).setProperties( contents );
 
@@ -655,7 +652,15 @@ public class DefaultArchivaConfiguration
         {
             ExpressionEvaluator expressionEvaluator = new DefaultExpressionEvaluator();
             expressionEvaluator.addExpressionSource( new SystemPropertyExpressionSource() );
-            userConfigFilename = expressionEvaluator.expand( userConfigFilename );
+            String userConfigFileNameSysProps = System.getProperty( "archiva.user.configFileName" );
+            if ( StringUtils.isNotBlank( userConfigFileNameSysProps ) )
+            {
+                userConfigFilename = userConfigFileNameSysProps;
+            }
+            else
+            {
+                userConfigFilename = expressionEvaluator.expand( userConfigFilename );
+            }
             altConfigFilename = expressionEvaluator.expand( altConfigFilename );
             loadConfiguration();
         }
@@ -720,8 +725,6 @@ public class DefaultArchivaConfiguration
             c.setRefreshCronExpression( unescapeCronExpression( c.getRefreshCronExpression() ) );
         }
 
-
-
         return config;
     }
 
index b080c2519d5cd8dbec5ad8b6f7821d6434065d43..a4f77bbcf45e442bd250a6d9a672e9ae3a7ec7dd 100644 (file)
             <appserver.base>${basedir}/target/appserver-base</appserver.base>
             <plexus.home>${project.build.outputDirectory}</plexus.home>
             <java.io.tmpdir>${project.build.outputDirectory}</java.io.tmpdir>
+            <archiva.user.configFileName>${basedir}/target/archiva.xml</archiva.user.configFileName>
           </systemPropertyVariables>
         </configuration>
       </plugin>
index 176462a2fdcfb45e3c496c20066d30c0e85d3b5b..97517e92bc2209c1eccd9ff821cbf3f623e662f3 100644 (file)
     </property>
   </bean>
 
+  <bean name="commons-configuration" class="org.codehaus.redback.components.registry.commons.CommonsConfigurationRegistry">
+    <property name="properties">
+      <value>
+        <![CDATA[
+        <configuration>
+          <system/>
+          <xml fileName="${appserver.base}/conf/archiva.xml" config-forceCreate="true"
+               config-optional="true"
+               config-name="org.apache.maven.archiva.base" config-at="org.apache.maven.archiva"/>
+        </configuration>
+        ]]>
+      </value>
+    </property>
+  </bean>
+
 </beans>
\ No newline at end of file
index 0a883cff437c42fa3b77ef71a044646a73224536..60fb7d7852f9c6b43fcf556f15cdf08810f3f801 100644 (file)
     <property name="archivaConfiguration" ref="archivaConfiguration#cleanup-released-snapshots"/>
   </bean>
 
+  <bean name="commons-configuration" class="org.codehaus.redback.components.registry.commons.CommonsConfigurationRegistry">
+    <property name="properties">
+      <value>
+        <![CDATA[
+        <configuration>
+          <system/>
+          <xml fileName="${appserver.base}/conf/archiva.xml" config-forceCreate="true"
+               config-optional="true"
+               config-name="org.apache.maven.archiva.base" config-at="org.apache.maven.archiva"/>
+        </configuration>
+        ]]>
+      </value>
+    </property>
+  </bean>
 
 </beans>
\ No newline at end of file
index ff3c158ffc6e9d0223e12ab19ebadafc062e2eaa..85f9eef3cff43a767190219f0d3db4554d099de0 100644 (file)
     <property name="archivaConfiguration" ref="archivaConfiguration#days-old"/>
   </bean>
 
+  <bean name="commons-configuration" class="org.codehaus.redback.components.registry.commons.CommonsConfigurationRegistry">
+    <property name="properties">
+      <value>
+        <![CDATA[
+        <configuration>
+          <system/>
+          <xml fileName="${appserver.base}/conf/archiva.xml" config-forceCreate="true"
+               config-optional="true"
+               config-name="org.apache.maven.archiva.base" config-at="org.apache.maven.archiva"/>
+        </configuration>
+        ]]>
+      </value>
+    </property>
+  </bean>
+
 
 </beans>
\ No newline at end of file
index 91491293883cc0baf91ba16e740c4ee344e5dac9..438ff55746a7148c7d848cd3b6ed80f4bd9ca7a9 100644 (file)
   <context:annotation-config/>
   <context:component-scan base-package="org.apache.archiva.metadata.repository"/>
 
+  <bean name="commons-configuration" class="org.codehaus.redback.components.registry.commons.CommonsConfigurationRegistry">
+    <property name="properties">
+      <value>
+        <![CDATA[
+        <configuration>
+          <system/>
+          <xml fileName="${appserver.base}/conf/archiva.xml" config-forceCreate="true"
+               config-optional="true"
+               config-name="org.apache.maven.archiva.base" config-at="org.apache.maven.archiva"/>
+        </configuration>
+        ]]>
+      </value>
+    </property>
+  </bean>
+
 </beans>
\ No newline at end of file