aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-scheduler
diff options
context:
space:
mode:
authorMartin Stockhammer <martin.stockhammer@ars.de>2018-03-29 23:47:13 +0200
committerMartin Stockhammer <martin.stockhammer@ars.de>2018-03-29 23:47:13 +0200
commit9cd3c61340d8c62df6c88c82b4dfdce429eb947e (patch)
tree03c88d9b706e77ab63fb81e6bf0f49d543fa814c /archiva-modules/archiva-scheduler
parentf18aa86c68f475c5932d818446f6dec644be635b (diff)
downloadarchiva-9cd3c61340d8c62df6c88c82b4dfdce429eb947e.tar.gz
archiva-9cd3c61340d8c62df6c88c82b4dfdce429eb947e.zip
Adding packedIndexDir
Diffstat (limited to 'archiva-modules/archiva-scheduler')
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java11
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DefaultDownloadRemoteIndexScheduler.java63
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java55
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskRequest.java15
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java22
5 files changed, 73 insertions, 93 deletions
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java
index 4893bcda8..03a95be75 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutor.java
@@ -67,9 +67,6 @@ public class ArchivaIndexingTaskExecutor
private ArtifactContextProducer artifactContextProducer;
@Inject
- private ManagedRepositoryAdmin managedRepositoryAdmin;
-
- @Inject
private NexusIndexer nexusIndexer;
@@ -241,23 +238,25 @@ public class ArchivaIndexingTaskExecutor
try
{
+ log.debug("Finishing indexing");
context.optimize( );
if ( repository.supportsFeature( IndexCreationFeature.class ) )
{
IndexCreationFeature icf = repository.getFeature( IndexCreationFeature.class ).get( );
- if ( !icf.isSkipPackedIndexCreation( ) )
+ if ( !icf.isSkipPackedIndexCreation( ) && icf.getLocalPackedIndexPath()!=null)
{
+ log.debug("Creating packed index from {} on {}", context.getIndexDirectoryFile(), icf.getLocalPackedIndexPath());
IndexPackingRequest request = new IndexPackingRequest( context, //
context.acquireIndexSearcher( ).getIndexReader( ),
//
- context.getIndexDirectoryFile( ) );
+ icf.getLocalPackedIndexPath().toFile() );
indexPacker.packIndex( request );
context.updateTimestamp( true );
- log.debug( "Index file packaged at '{}'.", context.getIndexDirectoryFile( ) );
+ log.debug( "Index file packed at '{}'.", icf.getLocalPackedIndexPath() );
} else {
log.debug( "skip packed index creation" );
}
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DefaultDownloadRemoteIndexScheduler.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DefaultDownloadRemoteIndexScheduler.java
index d936bddd2..d5da807d9 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DefaultDownloadRemoteIndexScheduler.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DefaultDownloadRemoteIndexScheduler.java
@@ -20,10 +20,7 @@ package org.apache.archiva.scheduler.indexing;
import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.beans.NetworkProxy;
-import org.apache.archiva.admin.model.beans.RemoteRepository;
import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin;
-import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin;
-import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
import org.apache.archiva.common.ArchivaException;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
import org.apache.archiva.configuration.ArchivaConfiguration;
@@ -34,7 +31,6 @@ import org.apache.archiva.proxy.common.WagonFactory;
import org.apache.archiva.repository.RepositoryRegistry;
import org.apache.archiva.repository.features.RemoteIndexFeature;
import org.apache.commons.lang.StringUtils;
-import org.apache.maven.index.NexusIndexer;
import org.apache.maven.index.context.IndexingContext;
import org.apache.maven.index.context.UnsupportedExistingLuceneIndexException;
import org.apache.maven.index.packer.IndexPacker;
@@ -46,7 +42,6 @@ import org.springframework.scheduling.support.CronTrigger;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.IOException;
@@ -79,18 +74,9 @@ public class DefaultDownloadRemoteIndexScheduler
private WagonFactory wagonFactory;
@Inject
- private RemoteRepositoryAdmin remoteRepositoryAdmin;
-
- @Inject
- private ProxyConnectorAdmin proxyConnectorAdmin;
-
- @Inject
private NetworkProxyAdmin networkProxyAdmin;
@Inject
- private NexusIndexer nexusIndexer;
-
- @Inject
private IndexUpdater indexUpdater;
@Inject
@@ -101,8 +87,8 @@ public class DefaultDownloadRemoteIndexScheduler
@PostConstruct
public void startup()
- throws ArchivaException, RepositoryAdminException, PlexusSisuBridgeException, IOException,
- UnsupportedExistingLuceneIndexException, DownloadRemoteIndexException, UnsupportedBaseContextException {
+ throws
+ DownloadRemoteIndexException, UnsupportedBaseContextException {
archivaConfiguration.addListener( this );
// TODO add indexContexts even if null
@@ -129,22 +115,6 @@ public class DefaultDownloadRemoteIndexScheduler
}
- @PreDestroy
- public void shutdown()
- throws RepositoryAdminException, IOException
- {
- for ( RemoteRepository remoteRepository : remoteRepositoryAdmin.getRemoteRepositories() )
- {
- String contextKey = "remote-" + remoteRepository.getId();
- IndexingContext context = nexusIndexer.getIndexingContexts().get( contextKey );
- if ( context == null )
- {
- continue;
- }
- nexusIndexer.removeIndexingContext( context, false );
- }
- }
-
@Override
public void configurationEvent( ConfigurationEvent event )
{
@@ -158,36 +128,41 @@ public class DefaultDownloadRemoteIndexScheduler
{
try
{
- RemoteRepository remoteRepository = remoteRepositoryAdmin.getRemoteRepository( repositoryId );
- if ( remoteRepository == null )
+ org.apache.archiva.repository.RemoteRepository remoteRepo = repositoryRegistry.getRemoteRepository(repositoryId);
+
+ if ( remoteRepo == null )
{
log.warn( "ignore scheduleDownloadRemote for repo with id {} as not exists", repositoryId );
return;
}
+ if (!remoteRepo.supportsFeature(RemoteIndexFeature.class)) {
+ log.warn("ignore scheduleDownloadRemote for repo with id {}. Does not support remote index.", repositoryId);
+ return;
+ }
+ RemoteIndexFeature rif = remoteRepo.getFeature(RemoteIndexFeature.class).get();
NetworkProxy networkProxy = null;
- if ( StringUtils.isNotBlank( remoteRepository.getRemoteDownloadNetworkProxyId() ) )
+ if ( StringUtils.isNotBlank( rif.getProxyId() ) )
{
- networkProxy = networkProxyAdmin.getNetworkProxy( remoteRepository.getRemoteDownloadNetworkProxyId() );
+ networkProxy = networkProxyAdmin.getNetworkProxy( rif.getProxyId() );
if ( networkProxy == null )
{
log.warn(
"your remote repository is configured to download remote index trought a proxy we cannot find id:{}",
- remoteRepository.getRemoteDownloadNetworkProxyId() );
+ rif.getProxyId() );
}
}
DownloadRemoteIndexTaskRequest downloadRemoteIndexTaskRequest = new DownloadRemoteIndexTaskRequest() //
- .setRemoteRepository( remoteRepository ) //
+ .setRemoteRepository( remoteRepo ) //
.setNetworkProxy( networkProxy ) //
.setFullDownload( fullDownload ) //
.setWagonFactory( wagonFactory ) //
- .setRemoteRepositoryAdmin( remoteRepositoryAdmin ) //
.setIndexUpdater( indexUpdater ) //
.setIndexPacker( this.indexPacker );
if ( now )
{
- log.info( "schedule download remote index for repository {}", remoteRepository.getId() );
+ log.info( "schedule download remote index for repository {}", remoteRepo.getId() );
// do it now
taskScheduler.schedule(
new DownloadRemoteIndexTask( downloadRemoteIndexTaskRequest, this.runningRemoteDownloadIds ),
@@ -196,10 +171,10 @@ public class DefaultDownloadRemoteIndexScheduler
else
{
log.info( "schedule download remote index for repository {} with cron expression {}",
- remoteRepository.getId(), remoteRepository.getCronExpression() );
+ remoteRepo.getId(), remoteRepo.getSchedulingDefinition());
try
{
- CronTrigger cronTrigger = new CronTrigger( remoteRepository.getCronExpression() );
+ CronTrigger cronTrigger = new CronTrigger( remoteRepo.getSchedulingDefinition());
taskScheduler.schedule(
new DownloadRemoteIndexTask( downloadRemoteIndexTaskRequest, this.runningRemoteDownloadIds ),
cronTrigger );
@@ -209,11 +184,11 @@ public class DefaultDownloadRemoteIndexScheduler
log.warn( "Unable to schedule remote index download: {}", e.getLocalizedMessage() );
}
- if ( remoteRepository.isDownloadRemoteIndexOnStartup() )
+ if ( rif.isDownloadRemoteIndexOnStartup() )
{
log.info(
"remote repository {} configured with downloadRemoteIndexOnStartup schedule now a download",
- remoteRepository.getId() );
+ remoteRepo.getId() );
taskScheduler.schedule(
new DownloadRemoteIndexTask( downloadRemoteIndexTaskRequest, this.runningRemoteDownloadIds ),
new Date() );
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java
index 96acdfb44..63c8b5e0d 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java
@@ -19,15 +19,22 @@ package org.apache.archiva.scheduler.indexing;
*/
import org.apache.archiva.admin.model.beans.NetworkProxy;
-import org.apache.archiva.admin.model.beans.RemoteRepository;
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
import org.apache.archiva.proxy.common.WagonFactory;
import org.apache.archiva.proxy.common.WagonFactoryRequest;
+import org.apache.archiva.repository.PasswordCredentials;
+import org.apache.archiva.repository.RemoteRepository;
+import org.apache.archiva.repository.RepositoryException;
+import org.apache.archiva.repository.RepositoryType;
+import org.apache.archiva.repository.features.RemoteIndexFeature;
import org.apache.commons.lang.time.StopWatch;
+import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.maven.index.context.IndexingContext;
import org.apache.maven.index.updater.IndexUpdateRequest;
+import org.apache.maven.index.updater.IndexUpdateResult;
import org.apache.maven.index.updater.IndexUpdater;
import org.apache.maven.index.updater.ResourceFetcher;
+import org.apache.maven.index_shaded.lucene.index.IndexNotFoundException;
import org.apache.maven.wagon.ResourceDoesNotExistException;
import org.apache.maven.wagon.StreamWagon;
import org.apache.maven.wagon.TransferFailedException;
@@ -65,8 +72,6 @@ public class DownloadRemoteIndexTask
private RemoteRepository remoteRepository;
- private RemoteRepositoryAdmin remoteRepositoryAdmin;
-
private WagonFactory wagonFactory;
private NetworkProxy networkProxy;
@@ -87,7 +92,6 @@ public class DownloadRemoteIndexTask
this.fullDownload = downloadRemoteIndexTaskRequest.isFullDownload();
this.runningRemoteDownloadIds = runningRemoteDownloadIds;
this.indexUpdater = downloadRemoteIndexTaskRequest.getIndexUpdater();
- this.remoteRepositoryAdmin = downloadRemoteIndexTaskRequest.getRemoteRepositoryAdmin();
}
@Override
@@ -112,8 +116,17 @@ public class DownloadRemoteIndexTask
try
{
log.info( "start download remote index for remote repository {}", this.remoteRepository.getId() );
- IndexingContext indexingContext = remoteRepositoryAdmin.createIndexContext( this.remoteRepository );
-
+ if (this.remoteRepository.getIndexingContext()==null) {
+ throw new IndexNotFoundException("No index context set for repository "+remoteRepository.getId());
+ }
+ if (this.remoteRepository.getType()!= RepositoryType.MAVEN) {
+ throw new RepositoryException("Bad repository type");
+ }
+ if (!this.remoteRepository.supportsFeature(RemoteIndexFeature.class)) {
+ throw new RepositoryException("Repository does not support RemotIndexFeature "+remoteRepository.getId());
+ }
+ RemoteIndexFeature rif = this.remoteRepository.getFeature(RemoteIndexFeature.class).get();
+ IndexingContext indexingContext = this.remoteRepository.getIndexingContext().getBaseContext(IndexingContext.class);
// create a temp directory to download files
tempIndexDirectory = Paths.get(indexingContext.getIndexDirectoryFile().getParent(), ".tmpIndex" );
Path indexCacheDirectory = Paths.get( indexingContext.getIndexDirectoryFile().getParent(), ".indexCache" );
@@ -126,22 +139,22 @@ public class DownloadRemoteIndexTask
tempIndexDirectory.toFile().deleteOnExit();
String baseIndexUrl = indexingContext.getIndexUpdateUrl();
- String wagonProtocol = new URL( this.remoteRepository.getUrl() ).getProtocol();
+ String wagonProtocol = this.remoteRepository.getLocation().getScheme();
final StreamWagon wagon = (StreamWagon) wagonFactory.getWagon(
new WagonFactoryRequest( wagonProtocol, this.remoteRepository.getExtraHeaders() ).networkProxy(
this.networkProxy )
);
// FIXME olamy having 2 config values
- wagon.setReadTimeout( remoteRepository.getRemoteDownloadTimeout() * 1000 );
- wagon.setTimeout( remoteRepository.getTimeout() * 1000 );
+ wagon.setReadTimeout( (int)rif.getDownloadTimeout().toMillis());
+ wagon.setTimeout( (int)remoteRepository.getTimeout().toMillis());
if ( wagon instanceof AbstractHttpClientWagon )
{
HttpConfiguration httpConfiguration = new HttpConfiguration();
HttpMethodConfiguration httpMethodConfiguration = new HttpMethodConfiguration();
httpMethodConfiguration.setUsePreemptive( true );
- httpMethodConfiguration.setReadTimeout( remoteRepository.getRemoteDownloadTimeout() * 1000 );
+ httpMethodConfiguration.setReadTimeout( (int)rif.getDownloadTimeout().toMillis() );
httpConfiguration.setGet( httpMethodConfiguration );
AbstractHttpClientWagon.class.cast( wagon ).setHttpConfiguration( httpConfiguration );
}
@@ -158,12 +171,14 @@ public class DownloadRemoteIndexTask
proxyInfo.setPassword( this.networkProxy.getPassword() );
}
AuthenticationInfo authenticationInfo = null;
- if ( this.remoteRepository.getUserName() != null )
+ if ( this.remoteRepository.getLoginCredentials()!=null && this.remoteRepository.getLoginCredentials() instanceof PasswordCredentials )
{
+ PasswordCredentials creds = (PasswordCredentials) this.remoteRepository.getLoginCredentials();
authenticationInfo = new AuthenticationInfo();
- authenticationInfo.setUserName( this.remoteRepository.getUserName() );
- authenticationInfo.setPassword( this.remoteRepository.getPassword() );
+ authenticationInfo.setUserName( creds.getUsername());
+ authenticationInfo.setPassword( new String(creds.getPassword()) );
}
+ log.debug("Connection to {}, authInfo={}", this.remoteRepository.getId(), authenticationInfo);
wagon.connect( new Repository( this.remoteRepository.getId(), baseIndexUrl ), authenticationInfo,
proxyInfo );
@@ -172,6 +187,8 @@ public class DownloadRemoteIndexTask
{
Files.createDirectories( indexDirectory );
}
+ log.debug("Downloading index file to {}", indexDirectory);
+ log.debug("Index cache dir {}", indexCacheDirectory);
ResourceFetcher resourceFetcher =
new WagonResourceFetcher( log, tempIndexDirectory, wagon, remoteRepository );
@@ -179,10 +196,11 @@ public class DownloadRemoteIndexTask
request.setForceFullUpdate( this.fullDownload );
request.setLocalIndexCacheDir( indexCacheDirectory.toFile() );
- this.indexUpdater.fetchAndUpdateIndex( request );
+ IndexUpdateResult result = this.indexUpdater.fetchAndUpdateIndex(request);
+ log.debug("Update result success: {}", result.isSuccessful());
stopWatch.stop();
- log.info( "time update index from remote for repository {}: {} s", this.remoteRepository.getId(),
- ( stopWatch.getTime() / 1000 ) );
+ log.info( "time update index from remote for repository {}: {}ms", this.remoteRepository.getId(),
+ ( stopWatch.getTime() ) );
// index packing optionnal ??
//IndexPackingRequest indexPackingRequest =
@@ -241,6 +259,7 @@ public class DownloadRemoteIndexTask
{
this.totalLength = 0;
resourceName = transferEvent.getResource().getName();
+ log.info("Transferring: {}, {}", transferEvent.getResource().getContentLength(), transferEvent.getLocalFile().toString());
log.info( "start transfer of {}", transferEvent.getResource().getName() );
}
@@ -256,8 +275,8 @@ public class DownloadRemoteIndexTask
{
resourceName = transferEvent.getResource().getName();
long endTime = System.currentTimeMillis();
- log.info( "end of transfer file {} {} kb: {}s", transferEvent.getResource().getName(),
- this.totalLength / 1024, ( endTime - startTime ) / 1000 );
+ log.info( "end of transfer file {}: {}b, {}ms", transferEvent.getResource().getName(),
+ this.totalLength, ( endTime - startTime ) );
}
@Override
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskRequest.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskRequest.java
index f797ac4ab..9c5223c7a 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskRequest.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskRequest.java
@@ -19,9 +19,9 @@ package org.apache.archiva.scheduler.indexing;
*/
import org.apache.archiva.admin.model.beans.NetworkProxy;
-import org.apache.archiva.admin.model.beans.RemoteRepository;
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
import org.apache.archiva.proxy.common.WagonFactory;
+import org.apache.archiva.repository.RemoteRepository;
import org.apache.maven.index.packer.IndexPacker;
import org.apache.maven.index.updater.IndexUpdater;
@@ -33,8 +33,6 @@ public class DownloadRemoteIndexTaskRequest
{
private RemoteRepository remoteRepository;
- private RemoteRepositoryAdmin remoteRepositoryAdmin;
-
private WagonFactory wagonFactory;
private NetworkProxy networkProxy;
@@ -106,17 +104,6 @@ public class DownloadRemoteIndexTaskRequest
return this;
}
- public RemoteRepositoryAdmin getRemoteRepositoryAdmin()
- {
- return remoteRepositoryAdmin;
- }
-
- public DownloadRemoteIndexTaskRequest setRemoteRepositoryAdmin( RemoteRepositoryAdmin remoteRepositoryAdmin )
- {
- this.remoteRepositoryAdmin = remoteRepositoryAdmin;
- return this;
- }
-
public IndexPacker getIndexPacker()
{
return indexPacker;
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java
index ebfcb5546..2cc9af6fa 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java
@@ -160,7 +160,7 @@ public class ArchivaIndexingTaskExecutorTest
FlatSearchResponse response = indexer.searchFlat( request );
assertTrue( Files.exists(basePath.resolve( ".indexer" )) );
- assertFalse( Files.exists(basePath.resolve(".index" )) );
+ assertTrue( Files.exists(basePath.resolve(".index" )) );
assertEquals( 1, response.getTotalHits() );
Set<ArtifactInfo> results = response.getResults();
@@ -204,7 +204,7 @@ public class ArchivaIndexingTaskExecutorTest
ctx.releaseIndexSearcher( searcher );
assertTrue( Files.exists(basePath.resolve(".indexer" )) );
- assertFalse( Files.exists(basePath.resolve(".index" )) );
+ assertTrue( Files.exists(basePath.resolve(".index" )) );
// should only return 1 hit!
assertEquals( 1, topDocs.totalHits );
@@ -239,7 +239,7 @@ public class ArchivaIndexingTaskExecutorTest
FlatSearchResponse response = indexer.searchFlat( flatSearchRequest );
assertTrue( Files.exists(basePath.resolve(".indexer" )) );
- assertFalse( Files.exists(basePath.resolve( ".index" )) );
+ assertTrue( Files.exists(basePath.resolve( ".index" )) );
// should return 1 hit
assertEquals( 1, response.getTotalHitsCount() );
@@ -261,7 +261,7 @@ public class ArchivaIndexingTaskExecutorTest
BooleanClause.Occur.SHOULD );
assertTrue( Files.exists(basePath.resolve( ".indexer" )) );
- assertFalse( Files.exists(basePath.resolve(".index" )) );
+ assertTrue( Files.exists(basePath.resolve(".index" )) );
flatSearchRequest = new FlatSearchRequest( q, getIndexingContext() );
@@ -278,9 +278,9 @@ public class ArchivaIndexingTaskExecutorTest
{
Path basePath = PathUtil.getPathFromUri( repositoryConfig.getLocation());
- Path indexerDirectory =basePath.resolve( ".indexer" );
+ Path indexDirectory = basePath.resolve(".index");
- Files.list(indexerDirectory).filter( path -> path.getFileName().toString().startsWith("nexus-maven-repository-index") )
+ Files.list(indexDirectory).filter( path -> path.getFileName().toString().startsWith("nexus-maven-repository-index") )
.forEach( path ->
{
try
@@ -311,19 +311,19 @@ public class ArchivaIndexingTaskExecutorTest
indexingExecutor.executeTask( task );
- assertTrue( Files.exists(indexerDirectory) );
+ assertTrue( Files.exists(indexDirectory) );
// test packed index file creation
//no more zip
//Assertions.assertThat(new File( indexerDirectory, "nexus-maven-repository-index.zip" )).exists();
- Assertions.assertThat( Files.exists(indexerDirectory.resolve("nexus-maven-repository-index.properties" ) ));
- Assertions.assertThat( Files.exists(indexerDirectory.resolve("nexus-maven-repository-index.gz" ) ));
+ Assertions.assertThat( Files.exists(indexDirectory.resolve("nexus-maven-repository-index.properties" ) ));
+ Assertions.assertThat( Files.exists(indexDirectory.resolve("nexus-maven-repository-index.gz" ) ));
// unpack .zip index
- Path destDir = basePath.resolve( ".indexer/tmp" );
+ Path destDir = basePath.resolve( ".index/tmp" );
//unzipIndex( indexerDirectory.getPath(), destDir.getPath() );
- DefaultIndexUpdater.FileFetcher fetcher = new DefaultIndexUpdater.FileFetcher( indexerDirectory.toFile() );
+ DefaultIndexUpdater.FileFetcher fetcher = new DefaultIndexUpdater.FileFetcher( indexDirectory.toFile() );
IndexUpdateRequest updateRequest = new IndexUpdateRequest( getIndexingContext(), fetcher );
//updateRequest.setLocalIndexCacheDir( indexerDirectory );
indexUpdater.fetchAndUpdateIndex( updateRequest );