You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2019/05/11 12:55:06 UTC

[maven-indexer] branch MINDEXER-117 created (now 4b44144)

This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a change to branch MINDEXER-117
in repository https://gitbox.apache.org/repos/asf/maven-indexer.git.


      at 4b44144  [MINDEXER-117] Integration test for index temporary directory

This branch includes the following new commits:

     new bb1ef10  [MINDEXER-117] ability to set index temp directory for index uudpate
     new 4b44144  [MINDEXER-117] Integration test for index temporary directory

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-indexer] 01/02: [MINDEXER-117] ability to set index temp directory for index uudpate

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MINDEXER-117
in repository https://gitbox.apache.org/repos/asf/maven-indexer.git

commit bb1ef10a3950354a19db6cb6369654cf6dd231ac
Author: Przemyslaw Fusik <pr...@gmail.com>
AuthorDate: Thu Feb 1 22:46:55 2018 +0100

    [MINDEXER-117] ability to set index temp directory for index uudpate
    
    Closes #26
---
 .../apache/maven/index/updater/DefaultIndexUpdater.java    |  6 +++++-
 .../org/apache/maven/index/updater/IndexUpdateRequest.java | 14 +++++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/indexer-core/src/main/java/org/apache/maven/index/updater/DefaultIndexUpdater.java b/indexer-core/src/main/java/org/apache/maven/index/updater/DefaultIndexUpdater.java
index 38c8d0d..bcab914 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/updater/DefaultIndexUpdater.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/updater/DefaultIndexUpdater.java
@@ -186,7 +186,11 @@ public class DefaultIndexUpdater
                                      final boolean merge, final String remoteIndexFile )
         throws IOException
     {
-        File indexDir = File.createTempFile( remoteIndexFile, ".dir" );
+        if ( updateRequest.getIndexTempDir() != null )
+        {
+            updateRequest.getIndexTempDir().mkdirs();
+        }
+        File indexDir = File.createTempFile( remoteIndexFile, ".dir" , updateRequest.getIndexTempDir() );
         indexDir.delete();
         indexDir.mkdirs();
 
diff --git a/indexer-core/src/main/java/org/apache/maven/index/updater/IndexUpdateRequest.java b/indexer-core/src/main/java/org/apache/maven/index/updater/IndexUpdateRequest.java
index 9b4e7e3..8dfbe9a 100644
--- a/indexer-core/src/main/java/org/apache/maven/index/updater/IndexUpdateRequest.java
+++ b/indexer-core/src/main/java/org/apache/maven/index/updater/IndexUpdateRequest.java
@@ -43,6 +43,8 @@ public class IndexUpdateRequest
     
     private boolean incrementalOnly;
 
+    private File indexTempDir;
+
     private File localIndexCacheDir;
 
     private Locker locker;
@@ -153,4 +155,14 @@ public class IndexUpdateRequest
     {
         return directoryFactory != null ? directoryFactory : FSDirectoryFactory.DEFAULT;
     }
-}
\ No newline at end of file
+
+    public void setIndexTempDir( File indexTempDir )
+    {
+        this.indexTempDir = indexTempDir;
+    }
+
+    public File getIndexTempDir()
+    {
+        return indexTempDir;
+    }
+}


[maven-indexer] 02/02: [MINDEXER-117] Integration test for index temporary directory

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MINDEXER-117
in repository https://gitbox.apache.org/repos/asf/maven-indexer.git

commit 4b44144d8fd66698ae73e7ebc7793c249aa7e435
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sat May 11 14:53:23 2019 +0200

    [MINDEXER-117] Integration test for index temporary directory
---
 .../updater/DefaultIndexUpdaterEmbeddingIT.java    | 40 ++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/indexer-core/src/test/java/org/apache/maven/index/updater/DefaultIndexUpdaterEmbeddingIT.java b/indexer-core/src/test/java/org/apache/maven/index/updater/DefaultIndexUpdaterEmbeddingIT.java
index 83f719d..b1161b4 100644
--- a/indexer-core/src/test/java/org/apache/maven/index/updater/DefaultIndexUpdaterEmbeddingIT.java
+++ b/indexer-core/src/test/java/org/apache/maven/index/updater/DefaultIndexUpdaterEmbeddingIT.java
@@ -119,6 +119,46 @@ public class DefaultIndexUpdaterEmbeddingIT
         }
     }
 
+    public void testIndexTempDirB()
+            throws IOException, UnsupportedExistingLuceneIndexException, ComponentLookupException
+    {
+        File basedir = Files.createTempDirectory( "nexus-indexer." ).toFile();
+        basedir.delete();
+        basedir.mkdirs();
+
+        File indexTempDir = Files.createTempDirectory("index-temp" ).toFile();
+        indexTempDir.delete();
+        // temp dir should not exists
+        assertFalse( indexTempDir.exists());
+
+        try
+        {
+            IndexingContext ctx = newTestContext( basedir, baseUrl );
+
+            IndexUpdateRequest updateRequest =
+                    new IndexUpdateRequest( ctx, wagonHelper.getWagonResourceFetcher( new TransferListenerFixture(), null,
+                            null ) );
+            updateRequest.setIndexTempDir( indexTempDir );
+
+            updater.fetchAndUpdateIndex( updateRequest );
+
+            // dir should still exists after retrival
+            assertTrue( indexTempDir.exists() );
+            indexTempDir.delete();
+            ctx.close( false );
+        }
+        finally
+        {
+            try
+            {
+                FileUtils.forceDelete( basedir );
+            }
+            catch ( IOException e )
+            {
+            }
+        }
+    }
+
     public void testBasicAuthenticatedIndexRetrieval()
         throws IOException, UnsupportedExistingLuceneIndexException, ComponentLookupException
     {