]> source.dussan.org Git - archiva.git/commitdiff
move jdbc test url and jdbc test driver to properties to be able to change that in...
authorOlivier Lamy <olamy@apache.org>
Mon, 7 Nov 2011 08:29:35 +0000 (08:29 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 7 Nov 2011 08:29:35 +0000 (08:29 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1198646 13f79535-47bb-0310-9956-ffa450edef68

15 files changed:
archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resources/archetype-resources/pom.xml
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml
archiva-modules/archiva-base/archiva-indexer/pom.xml
archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java
archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMerger.java
archiva-modules/archiva-base/archiva-proxy/pom.xml
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml
archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml
archiva-modules/archiva-web/archiva-security/pom.xml
archiva-modules/archiva-web/archiva-webapp/pom.xml
archiva-modules/archiva-web/archiva-webdav/pom.xml
archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java
archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml
pom.xml

index 08c3752ed911b13dc254d8ec90a54ec12b65c8b0..ec49d4a95094c95ecd70fe30c4023e48cbd85cc4 100644 (file)
             <appserver.base>${project.build.directory}/appserver-base</appserver.base>
             <archiva.user.configFileName>${basedir}/target/archiva.xml</archiva.user.configFileName>
             <test.resources.path>${project.build.testOutputDirectory}</test.resources.path>
-            <redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url>
+            <!-- restore when we will be able to use a derby in memory database -->
+            <!--redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url-->
             <redback.jdbc.driver.name>org.apache.derby.jdbc.EmbeddedDriver</redback.jdbc.driver.name>
           </systemPropertyVariables>
         </configuration>
index 4222dfc0d68d5d1aa18a469a0b44794afadfa58c..0367aa66de6f1140b4bec03d335e169856b1fd84 100644 (file)
               <appserver.base>${project.build.directory}/appserver-base</appserver.base>
               <plexus.home>${project.build.directory}/appserver-base</plexus.home>
               <derby.system.home>${project.build.directory}/appserver-base</derby.system.home>
-              <redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url>
-              <redback.jdbc.driver.name>org.apache.derby.jdbc.EmbeddedDriver</redback.jdbc.driver.name>
+              <redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>
+              <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
               <archiva.user.configFileName>${project.build.directory}/archiva.xml</archiva.user.configFileName>
             </systemPropertyVariables>
           </configuration>
index ec70560dc75df5d394d047fc96bf0e8273eb8178..426f6d34e939aa2dd1766dd690d8e96ca8cd0adf 100644 (file)
             <appserver.base>${project.build.directory}/appserver-base</appserver.base>
             <plexus.home>${project.build.directory}/appserver-base</plexus.home>
             <derby.system.home>${project.build.directory}/appserver-base</derby.system.home>
-            <redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url>
-            <redback.jdbc.driver.name>org.apache.derby.jdbc.EmbeddedDriver</redback.jdbc.driver.name>
+            <redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>
+            <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
           </systemPropertyVariables>
         </configuration>
       </plugin>
index 045d2c28d66b5220e66ee8ce529ba9971d8d945d..11b0814c2440e752464359686cd12afdedcfde42 100644 (file)
@@ -24,6 +24,7 @@ import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
 import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
 import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.math.NumberUtils;
 import org.apache.maven.index.NexusIndexer;
 import org.apache.maven.index.context.IndexingContext;
 import org.apache.maven.index.context.UnsupportedExistingLuceneIndexException;
@@ -34,6 +35,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.PostConstruct;
 import javax.inject.Inject;
 import java.io.File;
 import java.io.IOException;
@@ -50,6 +52,11 @@ public class DefaultIndexMerger
     implements IndexMerger
 {
 
+    /**
+     * default tmp created group index ttl in minutes
+     */
+    static final int DEFAULT_GROUP_INDEX_TTL = 30;
+
     private Logger log = LoggerFactory.getLogger( getClass() );
 
     @Inject
@@ -63,6 +70,8 @@ public class DefaultIndexMerger
 
     private List<TemporaryGroupIndex> temporaryGroupIndexes = new CopyOnWriteArrayList<TemporaryGroupIndex>();
 
+    private int defaultGroupIndexTtl;
+
     @Inject
     public DefaultIndexMerger( PlexusSisuBridge plexusSisuBridge, MavenIndexerUtils mavenIndexerUtils )
         throws PlexusSisuBridgeException
@@ -72,6 +81,15 @@ public class DefaultIndexMerger
         indexPacker = plexusSisuBridge.lookup( IndexPacker.class, "default" );
     }
 
+    @PostConstruct
+    public void intialize()
+    {
+        String ttlStr =
+            System.getProperty( IndexMerger.TMP_GROUP_INDEX_SYS_KEY, Integer.toString( DEFAULT_GROUP_INDEX_TTL ) );
+        this.defaultGroupIndexTtl = NumberUtils.toInt( ttlStr, DEFAULT_GROUP_INDEX_TTL );
+
+    }
+
     public IndexingContext buildMergedIndex( Collection<String> repositoriesIds, boolean packIndex )
         throws IndexMergerException
     {
@@ -148,4 +166,9 @@ public class DefaultIndexMerger
     {
         return this.temporaryGroupIndexes;
     }
+
+    public int getDefaultGroupIndexTtl()
+    {
+        return this.defaultGroupIndexTtl;
+    }
 }
index 999d85bd55f9cbd69f2b63cacd15117b96d4c9ad..4dbe2a81986600717a8611f55cfa7392a0162fcc 100644 (file)
@@ -29,11 +29,12 @@ import java.util.Collection;
  */
 public interface IndexMerger
 {
+
     /**
-     * default tmp created group index ttl in minutes
+     * system property which contains the value in s for ttl of temporary index groups
      */
-    static final int DEFAULT_GROUP_INDEX_TTL = 30;
-
+    static final String TMP_GROUP_INDEX_SYS_KEY = "archiva.tmp.group.index.ttl";
+    
     /**
      * @param repositoriesIds repositories Ids to merge content
      * @param packIndex       will generate a downloadable index
@@ -47,5 +48,9 @@ public interface IndexMerger
 
     Collection<TemporaryGroupIndex> getTemporaryGroupIndexes();
 
+    /**
+     * @return ttl of temporay group index
+     */
+    int getDefaultGroupIndexTtl();
 
 }
index 3cf6f60bde868286612c6dde104f27a7af1c22fa..62e485ed2410c8b1271468ab23c150b72f019ec6 100644 (file)
             <appserver.base>${project.build.directory}/appserver-base</appserver.base>
             <plexus.home>${project.build.directory}/appserver-base</plexus.home>
             <derby.system.home>${project.build.directory}/appserver-base</derby.system.home>
-            <redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url>
-            <redback.jdbc.driver.name>org.apache.derby.jdbc.EmbeddedDriver</redback.jdbc.driver.name>
+            <redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>
+            <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
           </systemPropertyVariables>
         </configuration>
       </plugin>
index b01764f236b9505c3b7d0d22cd59f64dca181815..4e4524e2dda020fbcae7b3fa2851b9df4d89ee3c 100644 (file)
             <appserver.base>${project.build.directory}/appserver-base</appserver.base>
             <plexus.home>${project.build.directory}/appserver-base</plexus.home>
             <derby.system.home>${project.build.directory}/appserver-base</derby.system.home>
-            <redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url>
-            <redback.jdbc.driver.name>org.apache.derby.jdbc.EmbeddedDriver</redback.jdbc.driver.name>
+            <redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>
+            <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
           </systemPropertyVariables>
         </configuration>
       </plugin>
index 50375e7ab1fbade9ea7fbaa8deca9f3ce769b09d..11d084e000c415677e398a9d64cad405a91cf960 100644 (file)
             <appserver.base>${project.build.directory}/appserver-base</appserver.base>
             <plexus.home>${project.build.directory}/appserver-base</plexus.home>
             <derby.system.home>${project.build.directory}/appserver-base</derby.system.home>
-            <redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url>
-            <redback.jdbc.driver.name>org.apache.derby.jdbc.EmbeddedDriver</redback.jdbc.driver.name>
+            <redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>
+            <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
             <basedir>${basedir}</basedir>
           </systemPropertyVariables>
         </configuration>
index 06a428e707248f1c9b300ad89bb254eb93bee2cf..b2bae3f296c855821ca1a71b98cfdd57c70dff25 100644 (file)
             <archiva.baseRestUrl>${archiva.baseRestUrl}</archiva.baseRestUrl>
             <rest.admin.pwd>${rest.admin.pwd}</rest.admin.pwd>
             <test.useTomcat>${test.useTomcat}</test.useTomcat>
-            <redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url>
-            <redback.jdbc.driver.name>org.apache.derby.jdbc.EmbeddedDriver</redback.jdbc.driver.name>
+            <redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>
+            <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
           </systemPropertyVariables>
         </configuration>
       </plugin>
index cb9709f3e778ed0a664c5607741c444d31258787..99ac1d7a2155b3caba5a35388da0aa3768886c2d 100644 (file)
         <configuration>
           <systemPropertyVariables>
             <derby.system.home>${project.build.directory}/appserver-base</derby.system.home>
-            <redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url>
-            <redback.jdbc.driver.name>org.apache.derby.jdbc.EmbeddedDriver</redback.jdbc.driver.name>
+            <redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>
+            <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
           </systemPropertyVariables>
         </configuration>
       </plugin>
index a8e5b31db98f39f90dbcaab8d51ea2c5661e90a6..47ce9fd60b9702af88f8dfc55825c95c4ee9f60c 100644 (file)
             <rest.admin.pwd>${rest.admin.pwd}</rest.admin.pwd>
             <archiva.user.configFileName>${basedir}/target/archiva.xml</archiva.user.configFileName>
             <test.resources.path>${project.build.testOutputDirectory}</test.resources.path>
-            <redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url>
-            <redback.jdbc.driver.name>org.apache.derby.jdbc.EmbeddedDriver</redback.jdbc.driver.name>
+            <redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>
+            <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
             <basedir>${basedir}</basedir>
           </systemPropertyVariables>
         </configuration>
             <appserver.home>${project.build.directory}/appserver-home</appserver.home>
             <derby.system.home>${basedir}/appserver-base/logs</derby.system.home>
             <redback.admin.creation.file>${basedir}/target/auto-admin-creation.properties</redback.admin.creation.file>
+            <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
           </systemProperties>
         </configuration>
         <dependencies>
index 6047ef79766c28c2bf32b5b064f8dfba8bc0301d..3b6b83bcdcd9c9430cd4a64aeb4d341bdea6c958 100644 (file)
             <derby.system.home>${project.build.directory}/appserver-base</derby.system.home>
             <test.resources.path>${project.build.testOutputDirectory}</test.resources.path>
             <archiva.user.configFileName>${project.build.testOutputDirectory}/repository-archiva.xml</archiva.user.configFileName>
-            <redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url>
-            <redback.jdbc.driver.name>org.apache.derby.jdbc.EmbeddedDriver</redback.jdbc.driver.name>
+            <redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>
+            <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
           </systemPropertyVariables>
           <forkMode>${webdav.forkMode}</forkMode>
         </configuration>
index a4341ced0d52df9d0685308c881d8dbeb19f6290..de71e9d15351b770a629e60927742203e1c0381c 100644 (file)
@@ -1215,7 +1215,7 @@ public class ArchivaDavResourceFactory
 
             if ( tmp != null && tmp.getDirectory() != null && tmp.getDirectory().exists() )
             {
-                if ( System.currentTimeMillis() - tmp.getCreationTime() > ( IndexMerger.DEFAULT_GROUP_INDEX_TTL * 60
+                if ( System.currentTimeMillis() - tmp.getCreationTime() > ( indexMerger.getDefaultGroupIndexTtl() * 60
                     * 1000 ) )
                 {
                     log.debug( "tmp group index is too old so delete it" );
index 901eb48c817139566e96ef35cd9dffaef766e8c3..3a01a683d98328323aef032b10ec96ddef438899 100644 (file)
               <plexus.home>${project.build.directory}/appserver-base</plexus.home>
               <java.io.tmpdir>${project.build.testOutputDirectory}</java.io.tmpdir>
               <derby.system.home>${project.build.directory}/appserver-base</derby.system.home>
-              <redback.jdbc.url>jdbc:derby:memory:users-test;create=true</redback.jdbc.url>
-              <redback.jdbc.driver.name>org.apache.derby.jdbc.EmbeddedDriver</redback.jdbc.driver.name>
+              <redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>
+              <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
             </systemPropertyVariables>
           </configuration>
         </plugin>
diff --git a/pom.xml b/pom.xml
index d94192e811b742af4fd1f728bb35080088abcd30..61c2267d41adfd795c94c9d337378b2a71c60623 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -78,6 +78,9 @@
     <derbyVersion>10.1.3.1</derbyVersion>
     <javaxMailVersion>1.4</javaxMailVersion>
     <jettyVersion>7.4.5.v20110725</jettyVersion>
+    <!-- restore when we will be able to use a derby in memory database -->
+    <!--redbackTestJdbcUrl>jdbc:derby:memory:users-test;create=true</redbackTestJdbcUrl-->
+    <redbackTestJdbcDriver>org.apache.derby.jdbc.EmbeddedDriver</redbackTestJdbcDriver>
   </properties>
 
   <dependencyManagement>