diff options
author | olivier lamy <olamy@apache.org> | 2017-08-19 21:37:35 +1000 |
---|---|---|
committer | olivier lamy <olamy@apache.org> | 2017-08-19 21:37:35 +1000 |
commit | 7a2710ec0a566f44a1f135b71176addfdd7047e7 (patch) | |
tree | 48886c9c6e6d66035093df4c6bbb866b83253ead /archiva-modules | |
parent | f93a787e74f048fd4fe393819c09d898da63b4f4 (diff) | |
parent | 88385088993b8121099f48371ce9e00689ccb547 (diff) | |
download | archiva-7a2710ec0a566f44a1f135b71176addfdd7047e7.tar.gz archiva-7a2710ec0a566f44a1f135b71176addfdd7047e7.zip |
Merge branch 'feature/jcr_oak'
Diffstat (limited to 'archiva-modules')
99 files changed, 1126 insertions, 1117 deletions
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml index f8af4626c..bb331e01e 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml @@ -86,6 +86,26 @@ <version>1.9</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-core</artifactId> + <version>5.5.4</version> + </dependency> + <dependency> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-highlighter</artifactId> + <version>5.5.4</version> + </dependency> + <dependency> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-memory</artifactId> + <version>5.5.4</version> + </dependency> + <dependency> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-queries</artifactId> + <version>5.5.4</version> + </dependency> <!-- for some reasons this help sonar to run --> <dependency> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java index 1176bc59c..715dc684c 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java @@ -56,7 +56,7 @@ public abstract class AbstractArtifactConsumerTest ArchivaConfiguration archivaConfiguration; @Inject - protected PlexusSisuBridge plexusSisuBridge; + protected NexusIndexer nexusIndexer; @Before @@ -75,7 +75,6 @@ public abstract class AbstractArtifactConsumerTest public void tearDown() throws Exception { - NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class ); for ( IndexingContext indexingContext : nexusIndexer.getIndexingContexts().values() ) { nexusIndexer.removeIndexingContext( indexingContext, false ); diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java index 1a997eea7..b1bd0c50d 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/AbstractRepositoryPurgeTest.java @@ -98,7 +98,7 @@ public abstract class AbstractRepositoryPurgeTest protected ApplicationContext applicationContext; @Inject - protected PlexusSisuBridge plexusSisuBridge; + protected NexusIndexer nexusIndexer; @Before @@ -132,7 +132,6 @@ public abstract class AbstractRepositoryPurgeTest protected void removeMavenIndexes() throws Exception { - NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class ); for ( IndexingContext indexingContext : nexusIndexer.getIndexingContexts().values() ) { nexusIndexer.removeIndexingContext( indexingContext, false ); diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml index 6eed0b863..208825140 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml @@ -66,10 +66,31 @@ <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> + <exclusions> + <exclusion> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-queryparser</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-analyzers-common</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.apache.maven.indexer</groupId> <artifactId>indexer-core</artifactId> + <classifier>shaded-lucene</classifier> + <exclusions> + <exclusion> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-queryparser</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-analyzers-common</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>javax.inject</groupId> @@ -111,21 +132,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.apache.jackrabbit</groupId> - <artifactId>jackrabbit-core</artifactId> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>jcl-over-slf4j</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> <scope>test</scope> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java index 66f067f34..8399af0bc 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java @@ -22,9 +22,6 @@ package org.apache.archiva.consumers.lucene; import org.apache.archiva.admin.model.RepositoryAdminException; import org.apache.archiva.admin.model.beans.ManagedRepository; import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; -import org.apache.archiva.common.plexusbridge.MavenIndexerUtils; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.configuration.ConfigurationNames; import org.apache.archiva.configuration.FileTypes; @@ -32,13 +29,13 @@ import org.apache.archiva.consumers.AbstractMonitoredConsumer; import org.apache.archiva.consumers.ConsumerException; import org.apache.archiva.consumers.KnownRepositoryContentConsumer; import org.apache.archiva.redback.components.registry.Registry; +import org.apache.archiva.redback.components.registry.RegistryListener; +import org.apache.archiva.redback.components.taskqueue.TaskQueueException; import org.apache.archiva.scheduler.ArchivaTaskScheduler; import org.apache.archiva.scheduler.indexing.ArtifactIndexingTask; import org.apache.maven.index.NexusIndexer; import org.apache.maven.index.context.IndexCreator; import org.apache.maven.index.context.IndexingContext; -import org.apache.archiva.redback.components.registry.RegistryListener; -import org.apache.archiva.redback.components.taskqueue.TaskQueueException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Scope; @@ -88,15 +85,13 @@ public class NexusIndexerConsumer public NexusIndexerConsumer( @Named( value = "archivaTaskScheduler#indexing" ) ArchivaTaskScheduler<ArtifactIndexingTask> scheduler, @Named( value = "archivaConfiguration" ) ArchivaConfiguration configuration, FileTypes filetypes, - PlexusSisuBridge plexusSisuBridge, MavenIndexerUtils mavenIndexerUtils, - ManagedRepositoryAdmin managedRepositoryAdmin ) - throws PlexusSisuBridgeException + List<IndexCreator> indexCreators, ManagedRepositoryAdmin managedRepositoryAdmin, NexusIndexer nexusIndexer ) { this.configuration = configuration; this.filetypes = filetypes; this.scheduler = scheduler; - this.nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class ); - this.allIndexCreators = mavenIndexerUtils.getAllIndexCreators(); + this.nexusIndexer = nexusIndexer; + this.allIndexCreators = indexCreators; this.managedRepositoryAdmin = managedRepositoryAdmin; } diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java index 5ce2781cd..91d0c107c 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumerTest.java @@ -22,14 +22,15 @@ package org.apache.archiva.consumers.lucene; import junit.framework.TestCase; import org.apache.archiva.admin.model.beans.ManagedRepository; import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; -import org.apache.archiva.common.plexusbridge.MavenIndexerUtils; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.configuration.FileTypes; +import org.apache.archiva.redback.components.taskqueue.TaskQueueException; import org.apache.archiva.scheduler.ArchivaTaskScheduler; import org.apache.archiva.scheduler.indexing.ArtifactIndexingTask; +import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.apache.commons.io.FileUtils; -import org.apache.archiva.redback.components.taskqueue.TaskQueueException; +import org.apache.maven.index.NexusIndexer; +import org.apache.maven.index.context.IndexCreator; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -45,7 +46,6 @@ import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Set; -import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; /** * NexusIndexerConsumerTest @@ -58,7 +58,7 @@ public class NexusIndexerConsumerTest private final class ArchivaTaskSchedulerStub implements ArchivaTaskScheduler<ArtifactIndexingTask> { - Set<File> indexed = new HashSet<File>(); + Set<File> indexed = new HashSet<>(); @Override public void queueTask( ArtifactIndexingTask task ) @@ -96,10 +96,10 @@ public class NexusIndexerConsumerTest private ApplicationContext applicationContext; @Inject - private PlexusSisuBridge plexusSisuBridge; + private NexusIndexer nexusIndexer; @Inject - private MavenIndexerUtils mavenIndexerUtils; + private List<IndexCreator> indexCreators; @Inject private ManagedRepositoryAdmin managedRepositoryAdmin; @@ -119,11 +119,11 @@ public class NexusIndexerConsumerTest FileTypes filetypes = applicationContext.getBean( FileTypes.class ); nexusIndexerConsumer = - new NexusIndexerConsumer( scheduler, configuration, filetypes, plexusSisuBridge, mavenIndexerUtils, - managedRepositoryAdmin ); + new NexusIndexerConsumer( scheduler, configuration, filetypes, indexCreators, + managedRepositoryAdmin, nexusIndexer ); // initialize to set the file types to be processed - ( (NexusIndexerConsumer) nexusIndexerConsumer ).initialize(); + nexusIndexerConsumer.initialize(); repositoryConfig = new ManagedRepository(); repositoryConfig.setId( "test-repo" ); diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/resources/spring-context.xml index db01db735..a89137295 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/resources/spring-context.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/test/resources/spring-context.xml @@ -59,6 +59,7 @@ <alias name="roleManager#test" alias="roleManager"/> + <!-- <bean id="jcr-config" class="org.apache.archiva.metadata.repository.jcr.ArchivaJcrRepositoryConfig" factory-method="create"> <constructor-arg value="${appserver.base}/conf/repository.xml"/> <constructor-arg value="${appserver.base}/data/jcr"/> @@ -67,7 +68,7 @@ <bean id="jcr-repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown" lazy-init="true"> <constructor-arg ref="jcr-config"/> </bean> - + --> </beans>
\ No newline at end of file diff --git a/archiva-modules/archiva-base/archiva-filelock/src/test/resources/log4j2-test.xml b/archiva-modules/archiva-base/archiva-filelock/src/test/resources/log4j2-test.xml index 93e519df7..f915e53b0 100644 --- a/archiva-modules/archiva-base/archiva-filelock/src/test/resources/log4j2-test.xml +++ b/archiva-modules/archiva-base/archiva-filelock/src/test/resources/log4j2-test.xml @@ -16,25 +16,15 @@ ~ KIND, either express or implied. See the License for the ~ specific language governing permissions and limitations ~ under the License. - --> - - +--> <configuration status="debug"> - - - <appenders> <Console name="console" target="SYSTEM_OUT"> - <!--PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/--> <PatternLayout pattern="%highlight{%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n}" /> </Console> - </appenders> <loggers> - - - <logger name="org.apache.archiva.common.filelock" level="debug"/> - + <logger name="org.apache.archiva.common.filelock" level="info"/> <root level="info" includeLocation="true"> <appender-ref ref="console"/> </root> diff --git a/archiva-modules/archiva-base/archiva-indexer/pom.xml b/archiva-modules/archiva-base/archiva-indexer/pom.xml index 5695593b7..a9f24ef0e 100644 --- a/archiva-modules/archiva-base/archiva-indexer/pom.xml +++ b/archiva-modules/archiva-base/archiva-indexer/pom.xml @@ -49,14 +49,6 @@ </dependency> <dependency> - <groupId>org.apache.lucene</groupId> - <artifactId>lucene-core</artifactId> - </dependency> - <dependency> - <groupId>org.apache.lucene</groupId> - <artifactId>lucene-queries</artifactId> - </dependency> - <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-utils</artifactId> </dependency> @@ -84,7 +76,22 @@ </dependency> <dependency> <groupId>org.apache.maven.indexer</groupId> + <artifactId>indexer-reader</artifactId> + </dependency> + <dependency> + <groupId>org.apache.maven.indexer</groupId> <artifactId>indexer-core</artifactId> + <classifier>shaded-lucene</classifier> + <exclusions> + <exclusion> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-queryparser</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-analyzers-common</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.eclipse.sisu</groupId> diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java index 225cc78e8..de9342c74 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java @@ -18,12 +18,10 @@ package org.apache.archiva.indexer.merger; * under the License. */ -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.time.StopWatch; import org.apache.maven.index.NexusIndexer; +import org.apache.maven.index.context.IndexCreator; import org.apache.maven.index.context.IndexingContext; import org.apache.maven.index.context.UnsupportedExistingLuceneIndexException; import org.apache.maven.index.packer.IndexPacker; @@ -51,23 +49,22 @@ public class DefaultIndexMerger private Logger log = LoggerFactory.getLogger( getClass() ); - private MavenIndexerUtils mavenIndexerUtils; + private final NexusIndexer indexer; - private NexusIndexer indexer; + private final IndexPacker indexPacker; - private IndexPacker indexPacker; + private final List<IndexCreator> indexCreators; private List<TemporaryGroupIndex> temporaryGroupIndexes = new CopyOnWriteArrayList<>(); - private List<String> runningGroups = new CopyOnWriteArrayList<String>(); + private List<String> runningGroups = new CopyOnWriteArrayList<>(); @Inject - public DefaultIndexMerger( PlexusSisuBridge plexusSisuBridge, MavenIndexerUtils mavenIndexerUtils ) - throws PlexusSisuBridgeException + public DefaultIndexMerger( NexusIndexer nexusIndexer, IndexPacker indexPacker, List<IndexCreator> indexCreators ) { - this.indexer = plexusSisuBridge.lookup( NexusIndexer.class ); - this.mavenIndexerUtils = mavenIndexerUtils; - indexPacker = plexusSisuBridge.lookup( IndexPacker.class, "default" ); + this.indexer = nexusIndexer; + this.indexPacker = indexPacker; + this.indexCreators = indexCreators; } @Override @@ -97,7 +94,7 @@ public class DefaultIndexMerger File indexLocation = new File( mergedIndexDirectory, indexMergerRequest.getMergedIndexPath() ); IndexingContext indexingContext = indexer.addIndexingContext( tempRepoId, tempRepoId, mergedIndexDirectory, indexLocation, null, null, - mavenIndexerUtils.getAllIndexCreators() ); + indexCreators ); for ( String repoId : indexMergerRequest.getRepositoriesIds() ) { @@ -112,7 +109,9 @@ public class DefaultIndexMerger if ( indexMergerRequest.isPackIndex() ) { - IndexPackingRequest request = new IndexPackingRequest( indexingContext, indexLocation ); + IndexPackingRequest request = new IndexPackingRequest( indexingContext, // + indexingContext.acquireIndexSearcher().getIndexReader(), // + indexLocation ); indexPacker.packIndex( request ); } @@ -126,11 +125,7 @@ public class DefaultIndexMerger stopWatch.getTime() ); return indexingContext; } - catch ( IOException e ) - { - throw new IndexMergerException( e.getMessage(), e ); - } - catch ( UnsupportedExistingLuceneIndexException e ) + catch ( IOException | UnsupportedExistingLuceneIndexException e ) { throw new IndexMergerException( e.getMessage(), e ); } diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java index 322d82e06..dc7f5c03a 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java @@ -44,10 +44,10 @@ public class TemporaryGroupIndexCleaner private NexusIndexer indexer; @Inject - public TemporaryGroupIndexCleaner( PlexusSisuBridge plexusSisuBridge ) + public TemporaryGroupIndexCleaner( NexusIndexer nexusIndexer ) throws PlexusSisuBridgeException { - indexer = plexusSisuBridge.lookup( NexusIndexer.class ); + this.indexer = nexusIndexer; } // 900000 @@ -55,15 +55,19 @@ public class TemporaryGroupIndexCleaner public void cleanTemporaryIndex() { - for ( TemporaryGroupIndex temporaryGroupIndex : indexMerger.getTemporaryGroupIndexes() ) - { - // cleanup files older than the ttl - if ( new Date().getTime() - temporaryGroupIndex.getCreationTime() > temporaryGroupIndex.getMergedIndexTtl() ) - { - log.info( "cleanTemporaryIndex for groupId {}", temporaryGroupIndex.getGroupId() ); - indexMerger.cleanTemporaryGroupIndex( temporaryGroupIndex ); + indexMerger.getTemporaryGroupIndexes() + .stream() + .forEach( temporaryGroupIndex -> + { + // cleanup files older than the ttl + if ( new Date().getTime() - temporaryGroupIndex.getCreationTime() > + temporaryGroupIndex.getMergedIndexTtl() ) + { + log.info( "cleanTemporaryIndex for groupId {}", temporaryGroupIndex.getGroupId() ); + indexMerger.cleanTemporaryGroupIndex( temporaryGroupIndex ); - } - } + } + } + ); } } diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java index 848ca78c1..0e4101648 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java @@ -24,16 +24,9 @@ import org.apache.archiva.admin.model.beans.ManagedRepository; import org.apache.archiva.admin.model.beans.ProxyConnector; import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin; -import org.apache.archiva.common.plexusbridge.MavenIndexerUtils; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; import org.apache.archiva.indexer.util.SearchUtil; import org.apache.commons.lang.StringUtils; -import org.apache.lucene.queryParser.ParseException; -import org.apache.lucene.search.BooleanClause; -import org.apache.lucene.search.BooleanClause.Occur; -import org.apache.lucene.search.BooleanQuery; -import org.apache.lucene.search.Query; import org.apache.maven.index.ArtifactInfo; import org.apache.maven.index.FlatSearchRequest; import org.apache.maven.index.FlatSearchResponse; @@ -42,12 +35,14 @@ import org.apache.maven.index.NexusIndexer; import org.apache.maven.index.OSGI; import org.apache.maven.index.QueryCreator; import org.apache.maven.index.SearchType; -import org.apache.maven.index.context.IndexCreator; import org.apache.maven.index.context.IndexingContext; import org.apache.maven.index.expr.SearchExpression; import org.apache.maven.index.expr.SearchTyped; import org.apache.maven.index.expr.SourcedSearchExpression; import org.apache.maven.index.expr.UserInputSearchExpression; +import org.apache.maven.index_shaded.lucene.search.BooleanClause; +import org.apache.maven.index_shaded.lucene.search.BooleanClause.Occur; +import org.apache.maven.index_shaded.lucene.search.BooleanQuery; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; @@ -79,22 +74,19 @@ public class MavenRepositorySearch private ProxyConnectorAdmin proxyConnectorAdmin; - private MavenIndexerUtils mavenIndexerUtils; - protected MavenRepositorySearch() { // for test purpose } @Inject - public MavenRepositorySearch( PlexusSisuBridge plexusSisuBridge, ManagedRepositoryAdmin managedRepositoryAdmin, - MavenIndexerUtils mavenIndexerUtils, ProxyConnectorAdmin proxyConnectorAdmin ) + public MavenRepositorySearch( NexusIndexer nexusIndexer, ManagedRepositoryAdmin managedRepositoryAdmin, + ProxyConnectorAdmin proxyConnectorAdmin, QueryCreator queryCreator ) throws PlexusSisuBridgeException { - this.indexer = plexusSisuBridge.lookup( NexusIndexer.class ); - this.queryCreator = plexusSisuBridge.lookup( QueryCreator.class ); + this.indexer = nexusIndexer; + this.queryCreator = queryCreator; this.managedRepositoryAdmin = managedRepositoryAdmin; - this.mavenIndexerUtils = mavenIndexerUtils; this.proxyConnectorAdmin = proxyConnectorAdmin; } @@ -124,12 +116,12 @@ public class MavenRepositorySearch BooleanQuery iQuery = new BooleanQuery(); constructQuery( previousTerm, iQuery ); - q.add( iQuery, Occur.MUST ); + q.add( iQuery, BooleanClause.Occur.MUST ); } BooleanQuery iQuery = new BooleanQuery(); constructQuery( term, iQuery ); - q.add( iQuery, Occur.MUST ); + q.add( iQuery, BooleanClause.Occur.MUST ); } // we retun only artifacts without classifier in quick search, olamy cannot find a way to say with this field empty @@ -163,11 +155,9 @@ public class MavenRepositorySearch BooleanQuery q = new BooleanQuery(); if ( StringUtils.isNotBlank( searchFields.getGroupId() ) ) { - q.add( indexer.constructQuery( MAVEN.GROUP_ID, searchFields.isExactSearch() - ? new SourcedSearchExpression( searchFields.getGroupId() ) - : new UserInputSearchExpression( searchFields.getGroupId() ) - ), Occur.MUST - ); + q.add( indexer.constructQuery( MAVEN.GROUP_ID, searchFields.isExactSearch() ? new SourcedSearchExpression( + searchFields.getGroupId() ) : new UserInputSearchExpression( searchFields.getGroupId() ) ), + BooleanClause.Occur.MUST ); } if ( StringUtils.isNotBlank( searchFields.getArtifactId() ) ) @@ -175,69 +165,64 @@ public class MavenRepositorySearch q.add( indexer.constructQuery( MAVEN.ARTIFACT_ID, searchFields.isExactSearch() ? new SourcedSearchExpression( searchFields.getArtifactId() ) - : new UserInputSearchExpression( searchFields.getArtifactId() ) - ), Occur.MUST - ); + : new UserInputSearchExpression( searchFields.getArtifactId() ) ), + BooleanClause.Occur.MUST ); } if ( StringUtils.isNotBlank( searchFields.getVersion() ) ) { q.add( indexer.constructQuery( MAVEN.VERSION, searchFields.isExactSearch() ? new SourcedSearchExpression( - searchFields.getVersion() ) : new SourcedSearchExpression( searchFields.getVersion() ) ), Occur.MUST ); + searchFields.getVersion() ) : new SourcedSearchExpression( searchFields.getVersion() ) ), + BooleanClause.Occur.MUST ); } if ( StringUtils.isNotBlank( searchFields.getPackaging() ) ) { q.add( indexer.constructQuery( MAVEN.PACKAGING, searchFields.isExactSearch() ? new SourcedSearchExpression( searchFields.getPackaging() ) : new UserInputSearchExpression( searchFields.getPackaging() ) ), - Occur.MUST - ); + BooleanClause.Occur.MUST ); } if ( StringUtils.isNotBlank( searchFields.getClassName() ) ) { q.add( indexer.constructQuery( MAVEN.CLASSNAMES, - new UserInputSearchExpression( searchFields.getClassName() ) ), Occur.MUST ); + new UserInputSearchExpression( searchFields.getClassName() ) ), + BooleanClause.Occur.MUST ); } if ( StringUtils.isNotBlank( searchFields.getBundleSymbolicName() ) ) { q.add( indexer.constructQuery( OSGI.SYMBOLIC_NAME, new UserInputSearchExpression( searchFields.getBundleSymbolicName() ) ), - Occur.MUST - ); + BooleanClause.Occur.MUST ); } if ( StringUtils.isNotBlank( searchFields.getBundleVersion() ) ) { q.add( indexer.constructQuery( OSGI.VERSION, new UserInputSearchExpression( searchFields.getBundleVersion() ) ), - Occur.MUST - ); + BooleanClause.Occur.MUST ); } if ( StringUtils.isNotBlank( searchFields.getBundleExportPackage() ) ) { q.add( indexer.constructQuery( OSGI.EXPORT_PACKAGE, new UserInputSearchExpression( searchFields.getBundleExportPackage() ) ), - Occur.MUST - ); + Occur.MUST ); } if ( StringUtils.isNotBlank( searchFields.getBundleExportService() ) ) { q.add( indexer.constructQuery( OSGI.EXPORT_SERVICE, new UserInputSearchExpression( searchFields.getBundleExportService() ) ), - Occur.MUST - ); + Occur.MUST ); } if ( StringUtils.isNotBlank( searchFields.getBundleImportPackage() ) ) { q.add( indexer.constructQuery( OSGI.IMPORT_PACKAGE, new UserInputSearchExpression( searchFields.getBundleImportPackage() ) ), - Occur.MUST - ); + Occur.MUST ); } if ( StringUtils.isNotBlank( searchFields.getBundleName() ) ) @@ -250,24 +235,21 @@ public class MavenRepositorySearch { q.add( indexer.constructQuery( OSGI.IMPORT_PACKAGE, new UserInputSearchExpression( searchFields.getBundleImportPackage() ) ), - Occur.MUST - ); + Occur.MUST ); } if ( StringUtils.isNotBlank( searchFields.getBundleRequireBundle() ) ) { q.add( indexer.constructQuery( OSGI.REQUIRE_BUNDLE, new UserInputSearchExpression( searchFields.getBundleRequireBundle() ) ), - Occur.MUST - ); + Occur.MUST ); } if ( StringUtils.isNotBlank( searchFields.getClassifier() ) ) { q.add( indexer.constructQuery( MAVEN.CLASSIFIER, searchFields.isExactSearch() ? new SourcedSearchExpression( searchFields.getClassifier() ) : new UserInputSearchExpression( searchFields.getClassifier() ) ), - Occur.MUST - ); + Occur.MUST ); } else if ( searchFields.isExactSearch() ) { @@ -284,7 +266,8 @@ public class MavenRepositorySearch searchFields.getRepositories(), searchFields.isIncludePomArtifacts() ); } - private static class NullSearch implements SearchTyped, SearchExpression + private static class NullSearch + implements SearchTyped, SearchExpression { private static final NullSearch INSTANCE = new NullSearch(); @@ -477,13 +460,6 @@ public class MavenRepositorySearch } - - protected List<? extends IndexCreator> getAllIndexCreators() - { - return mavenIndexerUtils.getAllIndexCreators(); - } - - private SearchResults convertToSearchResults( FlatSearchResponse response, SearchResultLimits limits, List<? extends ArtifactInfoFilter> artifactInfoFilters, List<String> selectedRepos, boolean includePoms ) @@ -494,12 +470,14 @@ public class MavenRepositorySearch for ( ArtifactInfo artifactInfo : artifactInfos ) { - if ( StringUtils.equalsIgnoreCase( "pom", artifactInfo.fextension ) && !includePoms ) + if ( StringUtils.equalsIgnoreCase( "pom", artifactInfo.getFileExtension() ) && !includePoms ) { continue; } - String id = SearchUtil.getHitId( artifactInfo.groupId, artifactInfo.artifactId, artifactInfo.classifier, - artifactInfo.packaging ); + String id = SearchUtil.getHitId( artifactInfo.getGroupId(), // + artifactInfo.getArtifactId(), // + artifactInfo.getClassifier(), // + artifactInfo.getPackaging() ); Map<String, SearchResultHit> hitsMap = results.getHitsMap(); if ( !applyArtifactInfoFilters( artifactInfo, artifactInfoFilters, hitsMap ) ) @@ -510,34 +488,34 @@ public class MavenRepositorySearch SearchResultHit hit = hitsMap.get( id ); if ( hit != null ) { - if ( !hit.getVersions().contains( artifactInfo.version ) ) + if ( !hit.getVersions().contains( artifactInfo.getVersion() ) ) { - hit.addVersion( artifactInfo.version ); + hit.addVersion( artifactInfo.getVersion() ); } } else { hit = new SearchResultHit(); - hit.setArtifactId( artifactInfo.artifactId ); - hit.setGroupId( artifactInfo.groupId ); - hit.setRepositoryId( artifactInfo.repository ); - hit.addVersion( artifactInfo.version ); - hit.setBundleExportPackage( artifactInfo.bundleExportPackage ); - hit.setBundleExportService( artifactInfo.bundleExportService ); - hit.setBundleSymbolicName( artifactInfo.bundleSymbolicName ); - hit.setBundleVersion( artifactInfo.bundleVersion ); - hit.setBundleDescription( artifactInfo.bundleDescription ); - hit.setBundleDocUrl( artifactInfo.bundleDocUrl ); - hit.setBundleRequireBundle( artifactInfo.bundleRequireBundle ); - hit.setBundleImportPackage( artifactInfo.bundleImportPackage ); - hit.setBundleLicense( artifactInfo.bundleLicense ); - hit.setBundleName( artifactInfo.bundleName ); - hit.setContext( artifactInfo.context ); - hit.setGoals( artifactInfo.goals ); - hit.setPrefix( artifactInfo.prefix ); - hit.setPackaging( artifactInfo.packaging ); - hit.setClassifier( artifactInfo.classifier ); - hit.setFileExtension( artifactInfo.fextension ); + hit.setArtifactId( artifactInfo.getArtifactId() ); + hit.setGroupId( artifactInfo.getGroupId() ); + hit.setRepositoryId( artifactInfo.getRepository() ); + hit.addVersion( artifactInfo.getVersion() ); + hit.setBundleExportPackage( artifactInfo.getBundleExportPackage() ); + hit.setBundleExportService( artifactInfo.getBundleExportService() ); + hit.setBundleSymbolicName( artifactInfo.getBundleSymbolicName() ); + hit.setBundleVersion( artifactInfo.getBundleVersion() ); + hit.setBundleDescription( artifactInfo.getBundleDescription() ); + hit.setBundleDocUrl( artifactInfo.getBundleDocUrl() ); + hit.setBundleRequireBundle( artifactInfo.getBundleRequireBundle() ); + hit.setBundleImportPackage( artifactInfo.getBundleImportPackage() ); + hit.setBundleLicense( artifactInfo.getBundleLicense() ); + hit.setBundleName( artifactInfo.getBundleName() ); + hit.setContext( artifactInfo.getContext() ); + hit.setGoals( artifactInfo.getGoals() ); + hit.setPrefix( artifactInfo.getPrefix() ); + hit.setPackaging( artifactInfo.getPackaging() ); + hit.setClassifier( artifactInfo.getClassifier() ); + hit.setFileExtension( artifactInfo.getFileExtension() ); hit.setUrl( getBaseUrl( artifactInfo, selectedRepos ) ); } @@ -569,40 +547,40 @@ public class MavenRepositorySearch throws RepositoryAdminException { StringBuilder sb = new StringBuilder(); - if ( StringUtils.startsWith( artifactInfo.context, "remote-" ) ) + if ( StringUtils.startsWith( artifactInfo.getContext(), "remote-" ) ) { // it's a remote index result we search a managed which proxying this remote and on which // current user has read karma String managedRepoId = - getManagedRepoId( StringUtils.substringAfter( artifactInfo.context, "remote-" ), selectedRepos ); + getManagedRepoId( StringUtils.substringAfter( artifactInfo.getContext(), "remote-" ), selectedRepos ); if ( managedRepoId != null ) { sb.append( '/' ).append( managedRepoId ); - artifactInfo.context = managedRepoId; + artifactInfo.setContext( managedRepoId ); } } else { - sb.append( '/' ).append( artifactInfo.context ); + sb.append( '/' ).append( artifactInfo.getContext() ); } - sb.append( '/' ).append( StringUtils.replaceChars( artifactInfo.groupId, '.', '/' ) ); - sb.append( '/' ).append( artifactInfo.artifactId ); - sb.append( '/' ).append( artifactInfo.version ); - sb.append( '/' ).append( artifactInfo.artifactId ); - sb.append( '-' ).append( artifactInfo.version ); - if ( StringUtils.isNotBlank( artifactInfo.classifier ) ) + sb.append( '/' ).append( StringUtils.replaceChars( artifactInfo.getGroupId(), '.', '/' ) ); + sb.append( '/' ).append( artifactInfo.getArtifactId() ); + sb.append( '/' ).append( artifactInfo.getVersion() ); + sb.append( '/' ).append( artifactInfo.getArtifactId() ); + sb.append( '-' ).append( artifactInfo.getVersion() ); + if ( StringUtils.isNotBlank( artifactInfo.getClassifier() ) ) { - sb.append( '-' ).append( artifactInfo.classifier ); + sb.append( '-' ).append( artifactInfo.getClassifier() ); } // maven-plugin packaging is a jar - if ( StringUtils.equals( "maven-plugin", artifactInfo.packaging ) ) + if ( StringUtils.equals( "maven-plugin", artifactInfo.getPackaging() ) ) { sb.append( "jar" ); } else { - sb.append( '.' ).append( artifactInfo.packaging ); + sb.append( '.' ).append( artifactInfo.getPackaging() ); } return sb.toString(); diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NoClassifierArtifactInfoFilter.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NoClassifierArtifactInfoFilter.java index 6068aa720..49feb2d81 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NoClassifierArtifactInfoFilter.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NoClassifierArtifactInfoFilter.java @@ -38,6 +38,6 @@ public class NoClassifierArtifactInfoFilter @Override public boolean addArtifactInResult( ArtifactInfo artifact, Map<String, SearchResultHit> currentResult ) { - return StringUtils.isBlank( artifact.classifier ); + return StringUtils.isBlank( artifact.getClassifier() ); } } diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java index 461a4d76b..e3b96f043 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java @@ -22,7 +22,6 @@ package org.apache.archiva.indexer.search; import junit.framework.TestCase; import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin; import org.apache.archiva.admin.repository.proxyconnector.DefaultProxyConnectorAdmin; -import org.apache.archiva.common.plexusbridge.MavenIndexerUtils; import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; import org.apache.archiva.common.utils.FileUtil; import org.apache.archiva.configuration.ArchivaConfiguration; @@ -35,7 +34,9 @@ import org.apache.maven.index.ArtifactContext; import org.apache.maven.index.ArtifactContextProducer; import org.apache.maven.index.ArtifactScanningListener; import org.apache.maven.index.NexusIndexer; +import org.apache.maven.index.QueryCreator; import org.apache.maven.index.ScanningResult; +import org.apache.maven.index.context.IndexCreator; import org.apache.maven.index.context.IndexingContext; import org.easymock.EasyMock; import org.easymock.IMocksControl; @@ -72,6 +73,7 @@ public abstract class AbstractMavenRepositorySearch ArchivaConfiguration archivaConfig; + @Inject ArtifactContextProducer artifactContextProducer; IMocksControl archivaConfigControl; @@ -82,10 +84,14 @@ public abstract class AbstractMavenRepositorySearch PlexusSisuBridge plexusSisuBridge; @Inject - MavenIndexerUtils mavenIndexerUtils; + List<IndexCreator> indexCreators; + @Inject NexusIndexer nexusIndexer; + @Inject + QueryCreator queryCreator; + @Before @Override public void setUp() @@ -99,7 +105,7 @@ public abstract class AbstractMavenRepositorySearch FileUtils.deleteDirectory( new File( FileUtil.getBasedir(), "/target/repos/" + TEST_REPO_2 + "/.indexer" ) ); assertFalse( new File( FileUtil.getBasedir(), "/target/repos/" + TEST_REPO_2 + "/.indexer" ).exists() ); - archivaConfigControl = EasyMock.createControl( ); + archivaConfigControl = EasyMock.createControl(); archivaConfig = archivaConfigControl.createMock( ArchivaConfiguration.class ); @@ -109,16 +115,11 @@ public abstract class AbstractMavenRepositorySearch DefaultProxyConnectorAdmin defaultProxyConnectorAdmin = new DefaultProxyConnectorAdmin(); defaultProxyConnectorAdmin.setArchivaConfiguration( archivaConfig ); - search = new MavenRepositorySearch( plexusSisuBridge, defaultManagedRepositoryAdmin, mavenIndexerUtils, - defaultProxyConnectorAdmin ); + search = new MavenRepositorySearch( nexusIndexer, defaultManagedRepositoryAdmin, defaultProxyConnectorAdmin, + queryCreator ); - nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class ); - - artifactContextProducer = plexusSisuBridge.lookup( ArtifactContextProducer.class ); - - defaultManagedRepositoryAdmin.setMavenIndexerUtils( mavenIndexerUtils ); defaultManagedRepositoryAdmin.setIndexer( nexusIndexer ); - defaultManagedRepositoryAdmin.setIndexCreators( mavenIndexerUtils.getAllIndexCreators() ); + defaultManagedRepositoryAdmin.setIndexCreators( indexCreators ); config = new Configuration(); config.addManagedRepository( createRepositoryConfig( TEST_REPO_1 ) ); @@ -201,12 +202,11 @@ public abstract class AbstractMavenRepositorySearch context = nexusIndexer.addIndexingContext( repository, repository, repo, indexDirectory, repo.toURI().toURL().toExternalForm(), - indexDirectory.toURI().toURL().toString(), - search.getAllIndexCreators() ); + indexDirectory.toURI().toURL().toString(), indexCreators ); // minimize datas in memory - context.getIndexWriter().setMaxBufferedDocs( -1 ); - context.getIndexWriter().setRAMBufferSizeMB( 1 ); +// context.getIndexWriter().setMaxBufferedDocs( -1 ); +// context.getIndexWriter().setRAMBufferSizeMB( 1 ); for ( File artifactFile : filesToBeIndexed ) { assertTrue( "file not exists " + artifactFile.getPath(), artifactFile.exists() ); @@ -214,9 +214,9 @@ public abstract class AbstractMavenRepositorySearch if ( artifactFile.getPath().endsWith( ".pom" ) ) { - ac.getArtifactInfo().fextension = "pom"; - ac.getArtifactInfo().packaging = "pom"; - ac.getArtifactInfo().classifier = "pom"; + ac.getArtifactInfo().setFileExtension( "pom" ); + ac.getArtifactInfo().setPackaging( "pom" ); + ac.getArtifactInfo().setClassifier( "pom" ); } nexusIndexer.addArtifactToIndex( ac, context ); context.updateTimestamp( true ); @@ -240,13 +240,13 @@ public abstract class AbstractMavenRepositorySearch @Override public void scanningStarted( IndexingContext ctx ) { - + // } @Override public void scanningFinished( IndexingContext ctx, ScanningResult result ) { - + // no op } @Override @@ -258,7 +258,9 @@ public abstract class AbstractMavenRepositorySearch @Override public void artifactDiscovered( ArtifactContext ac ) { - log.debug( "artifactDiscovered {}:{}", ac.getArtifact().getPath(), ac.getArtifactInfo() ); + log.debug( "artifactDiscovered {}:{}", // + ac.getArtifact() == null ? "" : ac.getArtifact().getPath(), // + ac.getArtifact() == null ? "" : ac.getArtifactInfo() ); } } diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchTest.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchTest.java index 4b0d993ef..6d4f6acab 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchTest.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/MavenRepositorySearchTest.java @@ -22,6 +22,7 @@ package org.apache.archiva.indexer.search; import org.apache.archiva.common.utils.FileUtil; import org.apache.archiva.indexer.util.SearchUtil; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; +import org.apache.maven.index_shaded.lucene.index.IndexUpgrader; import org.codehaus.plexus.util.FileUtils; import org.easymock.EasyMock; import org.junit.Test; @@ -29,10 +30,7 @@ import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import java.io.File; -import java.nio.file.Files; -import java.nio.file.Path; import java.nio.file.Paths; -import java.nio.file.StandardCopyOption; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -40,8 +38,8 @@ import java.util.Collections; import java.util.List; -@RunWith(ArchivaSpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" }) +@RunWith( ArchivaSpringJUnit4ClassRunner.class ) +@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } ) public class MavenRepositorySearchTest extends AbstractMavenRepositorySearch { @@ -290,13 +288,13 @@ public class MavenRepositorySearchTest archivaConfigControl.replay(); - SearchResults results = search.search( "user", selectedRepos, "org", limits, Collections.<String>emptyList() ); + SearchResults results = search.search( "user", selectedRepos, "org", limits, Collections.emptyList() ); archivaConfigControl.verify(); assertNotNull( results ); assertEquals( 1, results.getHits().size() ); - assertEquals( "total hits not 8 for page1 " + results, 8, results.getTotalHits() ); + assertEquals( "total hits not 9 for page1 " + results, 9, results.getTotalHits() ); assertEquals( "returned hits not 1 for page1 " + results, 1, results.getReturnedHitsCount() ); assertEquals( limits, results.getLimits() ); @@ -317,7 +315,7 @@ public class MavenRepositorySearchTest assertNotNull( results ); assertEquals( "hits not 1", 1, results.getHits().size() ); - assertEquals( "total hits not 8 for page 2 " + results, 8, results.getTotalHits() ); + assertEquals( "total hits not 9 for page 2 " + results, 9, results.getTotalHits() ); assertEquals( "returned hits not 1 for page2 " + results, 1, results.getReturnedHitsCount() ); assertEquals( limits, results.getLimits() ); } @@ -873,11 +871,13 @@ public class MavenRepositorySearchTest File indexDirectory = new File( repo, ".index" ); FileUtils.copyDirectoryStructure( new File( "src/test/repo-release" ), repo ); - createIndex( "repo-release", Collections.<File>emptyList(), false ); + IndexUpgrader.main( new String[]{ indexDirectory.getAbsolutePath() } ); + + createIndex( "repo-release", Collections.emptyList(), false ); nexusIndexer.addIndexingContext( REPO_RELEASE, REPO_RELEASE, repo, indexDirectory, repo.toURI().toURL().toExternalForm(), - indexDirectory.toURI().toURL().toString(), search.getAllIndexCreators() ); + indexDirectory.toURI().toURL().toString(), indexCreators ); SearchResultLimits limits = new SearchResultLimits( SearchResultLimits.ALL_PAGES ); limits.setPageSize( 300 ); @@ -886,8 +886,9 @@ public class MavenRepositorySearchTest archivaConfigControl.replay(); - SearchResults searchResults = search.search( null, Arrays.asList( REPO_RELEASE ), "org.example", limits, - Collections.<String>emptyList() ); + SearchResults searchResults = search.search( null, Arrays.asList( REPO_RELEASE ), // + "org.example", limits, // + Collections.emptyList() ); log.info( "results: {}", searchResults.getHits().size() ); diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.fdt b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.fdt Binary files differdeleted file mode 100644 index 9c708cae2..000000000 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.fdt +++ /dev/null diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.fdx b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.fdx Binary files differdeleted file mode 100644 index 9c6ebd91b..000000000 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.fdx +++ /dev/null diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.fnm b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.fnm deleted file mode 100644 index b57e72100..000000000 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.fnm +++ /dev/null @@ -1,5 +0,0 @@ -þÿÿÿ -DESCRIPTORIDXINFOumigavgroupId -artifactIdversionp1c -classnamesBundle-SymbolicNameBundle-VersionExport-PackageExport-ServiceBundle-NameImport-PackageRequire-Bundle -rootGroupsrootGroupsList allGroups
allGroupsList
\ No newline at end of file diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.frq b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.frq deleted file mode 100644 index d966170eb..000000000 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.frq +++ /dev/null @@ -1,262 +0,0 @@ -‡‹Y·%…5¥ÕõÙ‰ÃÕyq‘Ù•ãu•W£
…µù˧åÁ硽«¥£©õݹÃIñűµÓïû•å¡íãᣗÉ_óŸŸ›…#ës›§¯×ëŸû§¿³ÿÑ·Ñ+½‰Õljõý—¿‹1?©·¥—÷Çí;w奱‡ëÕ¯ñ…ͳūíßÓÝóÁ‡i§ƒgÉ‘K!µ)Í›ÉÇíU¿ýÿÇ—Óé÷ÿ•§çõÝ×AÉ3¯±Ïû»½¯'ý{·«“ÙË㩛뙓óù£‰¹“‘Ë9÷ùý±…ß“™£¡¥éÿëÏmÛ›·åßÕͽ™íÛ‘Ÿßáቅóïñ×=¹ÇQÏËeɃÁÇû÷±¿•™³ãçï‰û}ñÛëÓãÛÙ›«Á7E¯÷‡ó£éõ½¡µ©©ÅMÏkñͱ絋·Ã¹‹éѳ-“»Ñ³©ŸÅµ»¥Ý/ùÓ‘ÑÍGOááé]—»cËÅùÙ¯o¿ýC«§ÿ׃ïϹ‡×ƒ‘[™Á“ ³Så‹ß‹ç¡—ÝŸ•»Ûƒ™µ‡ ©±1e åK^X¥••™…ù‘1e åK^X¡í çåµß×ÑËÿ·½¯‘§¡™•‘…ùíçáÙÕÓÑÍ™·¯§ŸÉÅÁ½™‰…ýùõñíéåáÝÙÕÑÍÉÅÁ½¹µ±©¡™•‘‰…ýùóëÛϽ “‡¥ õéãáÝ•…{Õɽ±£si_[W¥•OIC;3+#%
7/ 1
3
1u§ %
7
J]9$/@µ‡ ©±1e åK^X¥••™…ù‘1e åK^X¡í çåµß×ÑËÿ·½¯‘§¡™•‘…ùíçáÙÕÓÑ™‰áÃ1“WëÍ™·¯§ŸÉÅÁ½™‰…ýùõñíéåáÝÙÕÑÍÉÅÁ½¹µ±©¡™•‘‰…ýùóëÛϽ “‡¥ õéãáÝ•…{Õɽ±£si_[ËW# 5
'>"7,%%*(¥•OIC;3+# -
AÁ
)
`L
/ +
)
1YO¯
'G?+ (,<½
3 )(( ! !1
7AÇ
9
|æ%
7/ 1
3
1u§
7
9MF$#5:!1
7AÇ
9
|æ%
7/ 1
3
1u§ %
7
J]9$/@µ‡ 9 ±`†t(6àI* P„E
=
9SV*64ç u77â*Šç u77â*Šæt.6âK* P†H¥••™…ù‘sßrÃœ¡'%
_%
=
óeIŒí çsßåµç u77â*Šµß×ÑËÿ·½‘a‡ u17à*ˆ -
<
9-S%V*64rÞ§'1_%=ó{Iª¡™•‘…ùíçÙÕÓç u77â*Š™‰áÃ1“WëÍ'$
_%
=
; ( tlM* `i:ç u77â*Š™·¯§ŸÉÅÁ½™‰…ýùõñíéåáÝÙÕÑÍÉÅÁ½¹µ±©¡™•‘‰…ý
=
9SV*64ùrÞóÛÏ“‡õéãáÝ•…Õɱ£s'1_%
=
ó{Iª
=
#
1BnŒË
=
9SV*64W'1_%
=
ó{Iª
!
3
.%(*$ "#¥•OI;3#
=
9SV*64ç u77â*Š'$
_%
=
ódIŒ -&0^$< :!7!†\*~µ‡ 9 ±
3 )(( ! ¥••™…ù‘¡í çåµß×ÑËÿ·½‘
3« --$(q 1§¡™•‘…ùíçÙÕÓ
3 )(( ! Í™·¯§ŸÉÅÁ½ç u75Ô X™‰…ýùõñíéåáÝÙÕÑÍÉÅÁ½¹µ±©¡™•‘‰…ý
3 )(( ! ùóÛÏ“‡õéãáÝ•…Õɱ£s
3 )(( !
3 )(( ! W
3 )(( ! ¥•OI;3#æ## ###t64Ô« ùX ü1e 9(&4>h0 PL - -1e - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -9( - - - - - -& - -4 - - - - - - - - - ->!h0’ ¢PLŽ1e 9(&4>h0r €PdLráç u75Ô X¢
Yæt64Ôx €X €¦
=
9SV* 64Ÿ qW÷™Vö˜Ý
§§W÷™£ç u77â* Š §§'1_%
=
!!†N 'XVöZ8¦§¦
F - - - - - - - - -
4 - -
c
4 - -
d %m#•/ ¶ À!††%ê"
3 )(( ! W÷™§¦¦¦¦§0>rÚ ">1¹2§§Vö˜§§§§Vö˜1 ?
sç!
u
¹! ?
s#!
!
z\ 6Z"¦W÷™ç u15Ô X ¦W÷[9§Þ§W÷™§ç u/5Ô X§§1 ?
sÛ
!
#?
1¹× -<
95S H ƒ ª' •1 J< yW÷[?¦Í™ßVçq(W÷™1e åC ^XW÷[?¦VöZ01 ?
sÛ
!
"?
1¹1 ?
sÚ
!
""
0 ¹W÷[?0>rÏ "R¹-¦
>r 4 1 zc^$ P2F.§IË $ 9A
1)
„!W÷[?W÷[?½VöZ>0>rË 9<¹<Vö˜W÷™W÷[?͙ߦVöZ8§1e åK^X¦W÷Z?W÷™¦VËZ -§ « ! /!!,$r!4W÷™§VöZ>PW÷[?§ - - - - - ,( - -! - -!9!(,d8$V1"./9+:W÷™§§ßy
7?1 ?
sç!
#S
1¹§W÷™§§W÷™µÌ˜§W÷™
=
9S.V * 6!4$ -<94S :V >* @6 84 =1 ?
sç!
[
¹V -ö -Z> -¦W÷[?¦W÷[?Í™§¦§W÷[?0"rÛ #+€-ÞW÷™µ1e 6
Y=K^XVöZ9§W÷™Q§W÷Z?Í™¦s´+W0>ræ t0
¹.1 ?
sÚ
!
#>
1¹¦¡ ) !ùˆ§ç u /7â* ˆ´¦9§¦Í™D£ A)Ò %oW÷™Vö˜§§§§½¦Ž¦0W÷Z?W÷™¦9W÷Z9Q¦0>rG„ "#0¹J0>rF• a¹<§Wö[>Qñ§žpD‡ 4A+)ÑV"J7W÷™§§§§¦1 ?
sç!
"S
0¹WÉ k/W÷™
=
9SV* 64&W÷™´§Vö˜§¦W÷™§ - - / - - - - - - - - - - - - - - - - - - - - - - - - - - -& - - - - - -J -& - - - - - - - - - -#v‚C ‚.!j „ ž£t¾ q ˜1 ?
sç!
u
¹´§rÊt1 ?
sç!
u
¹Vö˜W÷™Vö˜W÷[?¦W÷Z?V -ö -˜ -W÷™§¦ ÞW÷[?V†dZ>W÷™W÷™1e åK^Xá¦W÷™Vö˜¦WË[ß1 ?
sç!
#S
¹W÷Z8¦'1_%=; 0 †N BX ¦§¦1§W÷™W÷™sßµ§9ç u17â* ˆ!W÷[?W÷™§¦µ§
! ?
s 4
!
1
z"^ P"H!W÷[?§VÈj.ç u17â* ˆ - - - - - - - - -%+$ $%+#§1 ?
sç!
u
¹W÷[?̘§Vö˜W÷Z?§Vö˜§1 ?
sÛ
!
a
¹áµ´¦ -¦µÞE£ 5A1)Ò VJ§¦¦Ì˜Í™Vö˜¦ŽÌ˜§Vö˜W÷™ )
=
5
?k, =CVöZ(Q1 ?
s
!
"(
0¹§W÷Z?¦Vö˜W÷™§¦W÷[?¦1 -11¿ -111111111120´111Ä%2´11[†)!ð( Ä Š( c' §* å î!!À"!«!Ò ò € - - - - - - -
n - -Ð - n - --¤ Þ%“#Á6J ¡ ²!òô%¦"…§1e (
(=h/* 0'(C+W÷™Í™¦W÷™W÷“Wã•™§
=
9SV*64§§W÷™§¦Vö˜Vö˜§¦§¦æt06â-* 1ˆ 4W÷™§W÷™W÷™Wã•™rÊt§Vö’¦Þ̘¦ŽVöZ>Qצ§µW÷[)§W÷™1 -11¿ -111111111120´111Ä%2´11[†)!ð( Ä Š( c' §* ã î!!À"!«!Ò òµVö[>§§
3 )(( ! µrÊue§VöZ0QW÷™£¦§§µ
=
9SV* 64'µ0>ræ "R0¹.¦
! %@B/9#! $!5B..Í™Vö˜ßVö[>1e
9) '5>h0 PJ$£
]0>rÚ "80¹!§¦§ç u5Ö X Þ - -2 $* &( & &( # 3%%!"µ¦W÷[?Q¦
=
9SH '1:%§Vö˜VöZ>
=
9SV*641 ?
s
!
#(
1¹§¦§'1_%
=
ó{Iª )
I¬
")
0jɧ
=
9S$V* 6 45VöZ>VöZ8
3 )(( ! W÷[91e
9) '7>h: * |W÷Z9W÷Z9ßVö’¦§Vö˜§1 ?
sÚ
!
"8
¹#§W÷Z?Q
<
¬"0Bn'£0§1 ?
sË
!
")
¹ 1 ?
sË!
9=
¹W÷™
=
9SV* 64¦Ž¦W÷™§§×W÷[9Qµ1 ?
s
!
"(
0¹)W÷[?W÷“1e åC ^X¦¦§Vö˜¦Ž - -1e - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -9( - - - - - -& - -4 - - - - - - - - - ->!h0’ ¢PLŽç u15Ô X
=
9SV* 64¦¦W÷™W÷™W÷™Í™§´§ - & '" (+§0>ræ t0 -¹[´1 ?
sç!
u
¹Í[?§¦Vö˜1 ?
sç!
u
¹ , RM0 T W'I [ mUN C hW÷Z -?§§Vö“¦D£ 4A)à!* ‚'W÷™§Vö“¦t1e åK^X -
- - - - - - 9 - - - -%!!/*+ @-!u1e åK^X
Ý'/($/@" - - - -2ô - -6 - -.D8/´æt64Ô X u1e åK^X1e åK^X1e
9)'5>h0 PL
Ý'/($/@#
3õ7/D8/´uu%
5õ
7
/S1°Jutu1e åK^X - - - - - - - - 8 - - - -%.! :/ 3 . ; @+-'1e åK^Xuut -0däJ^X " - - - -2ô - -6 - -.D8/´u -0däJ^-X 0·µ³±¯«©§¥£¡Ÿ›™—•“‘‹…ÿùóíçåãßÛ×ÓÑÏËÇÿ½»·³¯«§£¡Ÿ›™—•“‘‹…ÿùóíçáÛÙ×ÕÓÑÏÍËÉÇÅÃÁ¿½»·³¯«§£Ÿ›™—•“‘‹‰‡…ƒÿýûù÷õóñïíëéçåãáßÝÛÙ×ÕÓÑÏÍËÉÇÅÃÁ¿½»¹·µ³±¯«©§¡›™—•“‘‹‰‡…ƒÿýûù÷óïëçáÛÕÏÉý·±«¥Ÿ™“‡ûõïéãáßÝÛÕÏÉý·±«¥Ÿ›•‹…{wsoica_][YWUOIC=;93-+)#
»³‡ ¯1e åK^X£“
‹“—ÿó1e åK^XŸí çã
! !
,%'+," ( (³ÛÓÏÇÿ³»«‹£Ÿ›—“‹ÿóíçÛ×ÕÓϛˋ›—³«£›Çÿ»—‡ƒ‹ÿû÷óïëçãßÛ×ÓÏËÇÿ»·³«¯§›—“‹‡ƒÿû÷ïçÛÏ·“‡ŸûïéãßÛ›‹…wÏ÷«oca]YU£“OI=9-)#™™••‘‘‰‰×קååáᥥÁWˉýñëÍÅÁ‰ýñë¥åßÙÓ—‘‹…ùí癉ƒÙ͵©SM7'!·‡ûïéáÙÿ¹‡ûïé¹±©¡£õãÝ×Ñ›•‰ƒ÷ëå—‡×˳§uQK5%µ±±©©¡¡™™••‘‘…ùí çåßÑ·½©¡¡™™••‘‘…ùíçÙÕÓÍ·¯§ŸÉŽ™™‰‰……••‘‘ýýùùõõññííééÝÝÙÙÕÕÑÑÍÍÉÉÅÅÁÁ½½¹¹µµ±±©©¡¡……ýýùùóáÛÕÏ™“‡õéãáÝ•…Õɱ¥sOI;3#
3 )(( ! !1
7AÇ
9
|æ%
7/ 1
3
1u§
7
9MF$ #5:!1
7AÇ
9
|æ%
7/ 1
3
1u§ %
7
J]9$ /@´†8°¤”Œ”˜„ø ì -æä´ÞÖÐʾ¶¼Œ¦ œ˜”Œ„øìæØÔÒœ˜ˆàÃ0’WëÌŒœ˜¶®¦žÈÄÀ¼˜ˆ„Œ€üøôðìèäàÜØÔÐÌÈÄÀ¼¸´¬°¨ ˜”Œˆ„€üøòÚÎ’†€ôèâàÜœ”„~ÔÈ°¢rËç u77Ø XV
!
3 .%(*$ "#¤”NH:2"þÿÿ0þÿÿ0þÿÿ0 a
! !
,%'+," ( (¹³·µ¯±«§©£¥Ÿ¡›—™“•‘‹ƒÿ‰‡…÷õóýûùñïíëéçãåÝÛáßÕÓÙ×ÏÑÉÇÍËÅÃÁ¿»½µ³¹·±¯«£¥§©Ÿ¡›—™“•‘‹ƒÿ‰‡…÷õóýûùñïíëéçåãáßÝÛ×ÙÕÓÑÏËÍÇÉÃÅ¿Á»½µ³¹·«±¯¥£©§›¡Ÿ—™“‘•‹‡‰ƒ…ÿûý÷ùóõïñëíçéãåßáÛÝ×ÙÓÕÏÑËÍÇÉÃÅ¿Á»½·¹³µ¯±«§©Ÿ›¥£¡—™“•‘‹‡‰ƒ…ÿûý÷ùñïõóíëéçßÝÛåãáÓÑÏÙ×ÕÍËÉÇÅÃÁ¿½»¹·µ³±¯«©§¥£¡Ÿ—•“›™‹‰‡‘ÿýû…ƒóñïù÷õíëéçåãßáÛÝÓÑÏÙ×ÕÇÅÃÍËÉÁ¿½»¹·¯«µ³±£¡Ÿ©§¥›“‘™—•‹‰‡…ƒ}{ywqousmkigeca_][YUWSQOMKIGECA?=9;1/-753+)'%#!
;»%A80·){%% 1;70tI¥
*(/' diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.nrm b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.nrm deleted file mode 100644 index 6579c2991..000000000 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.nrm +++ /dev/null @@ -1 +0,0 @@ -NRMÿ|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy|||xx||||y|y|yyxx||||||yxyyy|||y|yyyxxx||||||y|yxyx|yyyxxxyy||yyxx||||||yxyyy|||y|yyy|||yyy|||yyyxxxyyy|||yyy|||y|y|||||||yyy|||yyy|||yyy|||yyy|||xxxxxxyyyxxxxxxxxxyyyxxxyyy|||yyy|||yyxxyy||y|y|y|y|y|y|y|y|y|yyy|||y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|xyxyxyy|yy||yy||yy||yy||y|y|y|y|y|yx||y|yyyxxx||||||yyy|||yyy|||y|y|y|y|y|y|yy||yyxxyy||y|||||yy||y|yy||yy||y|||||||yyy|||yyy|||xyxyxyxyxyxyxyxyxyy|xyy|||xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxyxyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||y|y||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||y|y|y|y|y|y|y|y|y|||y|||y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|y|||||||||||||||||||||||||||||||||||||||||||||||||||||||||y|y|y|y|y|y||||||||||||||||||||||||||y||||||||||||||||||||||||||y|y|y|y|y|y|y|y|y|y|||||||uvvvv|u|u||||vvvvvv|||||vvv|v||||||vvvvvv|w|||||||||||||vv||||vvvvvv|||||vvv|v|||vvv|||vvv|||||||||vvv|||vvv|v|vvvvvvv|||vvv|||vvvuuuvvvuuuvvv||||||||||||||||||||||||uuuvvvuuuvvv||||||vv|t|t|t|t|u|u|u|u|u|||tvv|t|t|t|t|t|t|t|t|t|t|t|t|t|t|u|u|t|t|t|t|t|t|t|t|t|t|t|t|t||vv||vv||vv||vv|v|w|v|v|v||vv|v||||||vvvvvv|||vvv|||vvv|t|t|t|t|t|t||wv||||||vv|vvvvv||wv|v||uv||vv|vvvvvvv|||vvv|||vvv|t|t|t|t|t|t|t|t|t|t|uu||||wxxxx|y|y||xxxx|xx||x|||xx||x|||xxxxx|xx||y|x|x||||xxx||xx||xxxx|xx||x|||xx||x|||xx||||xx||||xxx|||xx||||xx||x|xxx|xx||||xx||||xx|xxyxx|xxyxx||||xxx|||xxx|||xxx|||xxxxxyxx|xxyxx|||xx||xx|x|x|x|x|y|y|y|y|y|||xx||x|x|x|x|x|x|x|x|x|x|x|x|x|x|y|y|x|x|x|x|x|x|x|x|x|x|x|x|x||xx||xx||xx||xx|x|y|x|x|x|xxx|x|||xxxxx|xx||||xx||||xx||x|x|x|x|x|x||yx||xx||xx|xx|x|||y||x||yx||xx|xxx|xx||||xx||||xx||x|x|x|x|x|x|x|x|x|x|xx||||xxxxx|x|x||xxxyxxyx|x|||xxx|x|||xxxxyxxyx|x|x|x||||xxx||xx||xxxyxxyx|x|||xxx|x|||xxx|||xxx|||xxx|||xxx|||xxx|x|xxyxxyx|||xxx|||xxxyyxxyxyyxxyx|||xxx|||xxx|||xxx|||xxxyyxxyxyyxxyx||xx||xx|x|x|x|x|x|x|x|x|x|||xyx|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x||xx||xx||xx||xx|x|x|x|x|x|xxx|x|||xxxxyxxyx|||xxx|||xxx|x|x|x|x|x|x||xy||xx||xx|xyxyx||xx|x||xy||xx|xxyxxyx|||xxx|||xxx|x|x|x|x|x|x|x|x|x|x|xy||||trrrr|q|q||||rwwrww|||||tww|t||||||rwwrww|u|||||||||||||qw||||rwwrww|||||tww|t|||tww|||tww|||||||||tww|||tww|t|trwwrww|||tww|||twwvvvrwwvvvrww||||||||||||||||||||||||vvvrwwvvvrww||||||tw|q|q|q|q|x|x|x|x|x|||qww|q|q|q|q|q|q|q|q|w|w|w|w|w|q|q|q|q|q|q|q|q|q|q|q|q|q|q|q|q||tw||tw||tw||tw|t|u|t|t|t||rr|t||||||rwwrww|||tww|||tww|q|q|q|q|q|q||tt||||||tw|twwww||xw|q||qw||tw|trwwrww|||tww|||tww|q|q|q|q|q|q|q|q|q|q|rv||||uuuuu|u|u||||uuuuuu|||||uuu|u||||||uuuuuu|u|||||||||||||uu||||uuuuuu|||||uuu|u|||uuu|||uuu|||||||||uuu|||uuu|u|uuuuuuu|||uuu|||uuuuuuuuuuuuuuu||||||||||||||||||||||||uuuuuuuuuuuu||||||uu|u|u|u|u|u|u|u|u|u|||uuu|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u|u||uu||uu||uu||uu|u|u|u|u|u||uu|u||||||uuuuuu|||uuu|||uuu|u|u|u|u|u|u||uu||||||uu|uuuuu||uu|u||uu||uu|uuuuuuu|||uuu|||uuu|u|u|u|u|u|u|u|u|u|u|uu||||x||||||||||xx|||||||x|||||||||||xxx|||||||||x|x||||xxx||||||xx|||||||x|||||||||||||||||||||||xxx||||||||||||||||||||||||||||||||||yyy|||yyy||||||xxx|||xxx|||xxx|||xxxyyy|||yyy|||||xx|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||y|y|y|||||||||||||||||||||||||||||x|||||||xxx||||||||||||||||||||||||||||||||||||xx|||||||||||||||||||||||||||||||||||||||||||||y|y|y|y|y|y|y|y|y|||yy||||knnnn|l|l||rrnrtnrt|r|||krt|k|||rrrnrtnrt|g|r|r||||rrr||mr||rrnrtnrt|r|||krt|k|||krt|||krt|||rrr|||krt|||krt|k|knrtnrt|||krt|||krtrrtnrtrrtnrt|||rrr|||rrr|||rrr|||rrrrrtnrtrrtnrt||rr||kr|l|l|l|l|m|m|m|m|m|||lmm|l|l|l|l|l|l|l|l|m|m|m|m|m|l|l|l|l|l|l|l|l|l|l|l|l|l|l|l|l||mr||mr||mr||mr|m|m|n|n|g|rnn|k|||rrrnrtnrt|||krt|||krt|l|l|l|l|l|l||eo||rr||mr|lrtrt||tt|m||lm||kr|gnrtnrt|||krt|||krt|l|l|l|l|l|l|l|l|l|l|ir||||||||||w|w||ss|tt|tu|s||||tt|||||sss|tt|tu|||s|s||||sss|||p||ss|tt|tu|s||||tt||||||tt||||tt|||sss||||tt||||tt|||||tt|tu||||tt||||ttttt|ttttu|tu|||sss|||sss|||sss|||sssttt|ttttu|tu||ss|||t|w|w|w|w|w|w|w|w|w|||www|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|w|||||||||||||||||||||||||||s|||||||sss|tt|tu||||tt||||tt|w|w|w|w|w|w||||||ss||||||tttu||tt||||ww|||||||tt|tu||||tt||||tt|w|w|w|w|w|w|w|w|w|w||s|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
\ No newline at end of file diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.prx b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.prx Binary files differdeleted file mode 100644 index 601fb22d7..000000000 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.prx +++ /dev/null diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.tii b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.tii Binary files differdeleted file mode 100644 index 52941c7db..000000000 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.tii +++ /dev/null diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.tis b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.tis Binary files differdeleted file mode 100644 index d018fa672..000000000 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_7.tis +++ /dev/null diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.fdt b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.fdt Binary files differnew file mode 100644 index 000000000..9ab6d4d90 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.fdt diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.fdx b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.fdx Binary files differnew file mode 100644 index 000000000..a26fbfa6b --- /dev/null +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.fdx diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.fnm b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.fnm Binary files differnew file mode 100644 index 000000000..b9f92430c --- /dev/null +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.fnm diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.nvd b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.nvd Binary files differnew file mode 100644 index 000000000..d832c2f6f --- /dev/null +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.nvd diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.nvm b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.nvm Binary files differnew file mode 100644 index 000000000..a27cff81a --- /dev/null +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.nvm diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.si b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.si Binary files differnew file mode 100644 index 000000000..2539c768d --- /dev/null +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8.si diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8_Lucene41_0.doc b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8_Lucene41_0.doc Binary files differnew file mode 100644 index 000000000..0a2394bd2 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8_Lucene41_0.doc diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8_Lucene41_0.pos b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8_Lucene41_0.pos Binary files differnew file mode 100644 index 000000000..4d9bbaad5 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8_Lucene41_0.pos diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8_Lucene41_0.tim b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8_Lucene41_0.tim Binary files differnew file mode 100644 index 000000000..ac8475263 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8_Lucene41_0.tim diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8_Lucene41_0.tip b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8_Lucene41_0.tip Binary files differnew file mode 100644 index 000000000..d94d9c92b --- /dev/null +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/_8_Lucene41_0.tip diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/segments.gen b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/segments.gen Binary files differindex e76c9033a..077a451a0 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/segments.gen +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/segments.gen diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/segments_8 b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/segments_8 Binary files differdeleted file mode 100644 index 8d4ef95e8..000000000 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/segments_8 +++ /dev/null diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/segments_9 b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/segments_9 Binary files differnew file mode 100644 index 000000000..a01b84fd7 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/repo-release/.index/segments_9 diff --git a/archiva-modules/archiva-base/archiva-mock/src/main/java/org/apache/archiva/mock/MockRepositorySessionFactory.java b/archiva-modules/archiva-base/archiva-mock/src/main/java/org/apache/archiva/mock/MockRepositorySessionFactory.java index a1a27dcb9..d293d5247 100644 --- a/archiva-modules/archiva-base/archiva-mock/src/main/java/org/apache/archiva/mock/MockRepositorySessionFactory.java +++ b/archiva-modules/archiva-base/archiva-mock/src/main/java/org/apache/archiva/mock/MockRepositorySessionFactory.java @@ -73,4 +73,10 @@ public class MockRepositorySessionFactory } }; } + + @Override + public void close() + { + // no op + } } diff --git a/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml b/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml index fe40f6284..3e85ac5a5 100644 --- a/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml +++ b/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml @@ -58,6 +58,7 @@ <dependency> <groupId>org.apache.maven.indexer</groupId> <artifactId>indexer-core</artifactId> + <classifier>shaded-lucene</classifier> </dependency> <dependency> <groupId>org.codehaus.plexus</groupId> diff --git a/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/MavenIndexerUtils.java b/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/MavenIndexerUtils.java deleted file mode 100644 index 448851ee7..000000000 --- a/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/java/org/apache/archiva/common/plexusbridge/MavenIndexerUtils.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.apache.archiva.common.plexusbridge; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.maven.index.context.IndexCreator; -import org.apache.maven.index.creator.JarFileContentsIndexCreator; -import org.apache.maven.index.creator.MavenArchetypeArtifactInfoIndexCreator; -import org.apache.maven.index.creator.MavenPluginArtifactInfoIndexCreator; -import org.apache.maven.index.creator.MinimalArtifactInfoIndexCreator; -import org.apache.maven.index.creator.OsgiArtifactIndexCreator; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import javax.inject.Inject; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * @author Olivier Lamy - * @since 1.4-M1 - */ -@Service( "mavenIndexerUtils" ) -public class MavenIndexerUtils -{ - - private Logger log = LoggerFactory.getLogger( getClass() ); - - private List<? extends IndexCreator> allIndexCreators; - - @Inject - public MavenIndexerUtils( PlexusSisuBridge plexusSisuBridge ) - throws PlexusSisuBridgeException - { - allIndexCreators = new ArrayList( plexusSisuBridge.lookupList( IndexCreator.class ) ); - - if ( allIndexCreators == null || allIndexCreators.isEmpty() ) - { - // olamy when the TCL is not a URLClassLoader lookupList fail ! - // when using tomcat maven plugin so adding a simple hack - log.warn( "using lookupList from sisu plexus failed so build indexCreator manually" ); - - allIndexCreators = - Arrays.asList( plexusSisuBridge.lookup( IndexCreator.class, OsgiArtifactIndexCreator.ID ), - plexusSisuBridge.lookup( IndexCreator.class, MavenArchetypeArtifactInfoIndexCreator.ID ), - plexusSisuBridge.lookup( IndexCreator.class, MinimalArtifactInfoIndexCreator.ID ), - plexusSisuBridge.lookup( IndexCreator.class, JarFileContentsIndexCreator.ID ), - plexusSisuBridge.lookup( IndexCreator.class, MavenPluginArtifactInfoIndexCreator.ID ) ); - - } - - if ( allIndexCreators == null || allIndexCreators.isEmpty() ) - { - throw new PlexusSisuBridgeException( "no way to initiliaze IndexCreator" ); - } - - log.debug( "allIndexCreators {}", allIndexCreators ); - } - - public List<? extends IndexCreator> getAllIndexCreators() - { - return allIndexCreators; - } - - public void setAllIndexCreators( List<IndexCreator> allIndexCreators ) - { - this.allIndexCreators = allIndexCreators; - } -} diff --git a/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/resources/META-INF/spring-context.xml index 41188dcd8..9c12ec813 100644 --- a/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/resources/META-INF/spring-context.xml +++ b/archiva-modules/archiva-base/archiva-plexus-bridge/src/main/resources/META-INF/spring-context.xml @@ -21,12 +21,43 @@ <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" + xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context - http://www.springframework.org/schema/context/spring-context-3.0.xsd" - default-lazy-init="true"> + http://www.springframework.org/schema/context/spring-context.xsd + http://www.springframework.org/schema/util + http://www.springframework.org/schema/util/spring-util.xsd" + default-lazy-init="true"> <context:annotation-config/> - <context:component-scan base-package="org.apache.archiva.common.plexusbridge"/> + <context:component-scan base-package="org.apache.archiva.common.plexusbridge + org.apache.maven.index"/> + + <!-- + <bean id="indexer" class="org.apache.maven.index.DefaultIndexer"/> + <bean id="scanner" class="org.apache.maven.index.DefaultScanner"/> + <bean id="indexerEngine" class="org.apache.maven.index.DefaultIndexerEngine"/> + <bean id="searchEngine" class="org.apache.maven.index.DefaultSearchEngine"/> + <bean id="queryCreator" class="org.apache.maven.index.DefaultQueryCreator"/> + <bean id="artifactContextProducer" class="org.apache.maven.index.DefaultArtifactContextProducer"/> + <bean id="artifactPackagingMapper" class="org.apache.maven.index.artifact.DefaultArtifactPackagingMapper"/> + --> + + <!-- Index creators: + <bean id="minimalArtifactInfoIndexCreator" class="org.apache.maven.index.creator.MinimalArtifactInfoIndexCreator"/> + <bean id="jarFileContentsIndexCreator" class="org.apache.maven.index.creator.JarFileContentsIndexCreator"/> + <bean id="mavenPluginArtifactInfoIndexCreator" class="org.apache.maven.index.creator.MavenPluginArtifactInfoIndexCreator"/> + --> + <!-- Index creators. + + <util:map id="indexers" + key-type="java.lang.String" + value-type="org.apache.maven.index.context.IndexCreator" + map-class="java.util.LinkedHashMap"> + <entry key="min" value-ref="minimalArtifactInfoIndexCreator"/> + <entry key="jarContent" value-ref="jarFileContentsIndexCreator"/> + <entry key="maven-plugin" value-ref="mavenPluginArtifactInfoIndexCreator"/> + </util:map> + --> </beans>
\ No newline at end of file diff --git a/archiva-modules/archiva-base/archiva-proxy-common/pom.xml b/archiva-modules/archiva-base/archiva-proxy-common/pom.xml index 5fa20f65d..42226575f 100644 --- a/archiva-modules/archiva-base/archiva-proxy-common/pom.xml +++ b/archiva-modules/archiva-base/archiva-proxy-common/pom.xml @@ -37,6 +37,10 @@ <artifactId>archiva-repository-admin-api</artifactId> </dependency> <dependency> + <groupId>org.apache.maven.archetype</groupId> + <artifactId>archetype-common</artifactId> + </dependency> + <dependency> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-provider-api</artifactId> </dependency> diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-proxy-common/src/main/resources/META-INF/spring-context.xml index 217a33d3b..7374f3685 100644 --- a/archiva-modules/archiva-base/archiva-proxy-common/src/main/resources/META-INF/spring-context.xml +++ b/archiva-modules/archiva-base/archiva-proxy-common/src/main/resources/META-INF/spring-context.xml @@ -22,9 +22,9 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context - http://www.springframework.org/schema/context/spring-context-3.0.xsd" + http://www.springframework.org/schema/context/spring-context.xsd" default-lazy-init="true"> <context:annotation-config/> diff --git a/archiva-modules/archiva-base/archiva-proxy-common/src/test/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-proxy-common/src/test/resources/META-INF/spring-context.xml index c19b3e867..7afd4a422 100644 --- a/archiva-modules/archiva-base/archiva-proxy-common/src/test/resources/META-INF/spring-context.xml +++ b/archiva-modules/archiva-base/archiva-proxy-common/src/test/resources/META-INF/spring-context.xml @@ -20,11 +20,8 @@ <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans-3.0.xsd - http://www.springframework.org/schema/context - http://www.springframework.org/schema/context/spring-context-3.0.xsd" + http://www.springframework.org/schema/beans/spring-beans.xsd" default-lazy-init="true"> <bean name="wagon#file" scope="prototype" class="org.apache.maven.wagon.providers.file.FileWagon"/> diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java index 08226d2e8..4d0a9a810 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java @@ -120,7 +120,7 @@ public abstract class AbstractProxyTestCase protected ManagedRepositoryAdmin managedRepositoryAdmin; @Inject - protected PlexusSisuBridge plexusSisuBridge; + protected NexusIndexer nexusIndexer; @Before public void setUp() @@ -198,7 +198,6 @@ public abstract class AbstractProxyTestCase protected void removeMavenIndexes() throws Exception { - NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class ); for ( IndexingContext indexingContext : nexusIndexer.getIndexingContexts().values() ) { diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml index a57c21fb2..b7e8ad21a 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml @@ -44,6 +44,7 @@ <dependency> <groupId>org.apache.maven.indexer</groupId> <artifactId>indexer-core</artifactId> + <classifier>shaded-lucene</classifier> <exclusions> <exclusion> <groupId>org.codehaus.plexus</groupId> @@ -73,6 +74,14 @@ <groupId>com.google.code.atinject</groupId> <artifactId>atinject</artifactId> </exclusion> + <exclusion> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-queryparser</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-analyzers-common</artifactId> + </exclusion> </exclusions> </dependency> </dependencies> diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml index 46e9ccfdb..724d838f8 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml @@ -38,6 +38,19 @@ <artifactId>archiva-security-common</artifactId> </dependency> <dependency> + <groupId>org.apache.maven.indexer</groupId> + <artifactId>indexer-core</artifactId> + <classifier>shaded-lucene</classifier> + </dependency> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + </dependency> + <dependency> + <groupId>org.apache.maven.archetype</groupId> + <artifactId>archetype-common</artifactId> + </dependency> + <dependency> <groupId>org.apache.archiva</groupId> <artifactId>archiva-scheduler-repository-api</artifactId> </dependency> @@ -113,7 +126,6 @@ <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> - <version>${spring.version}</version> <exclusions> <exclusion> <groupId>commons-logging</groupId> @@ -124,7 +136,6 @@ <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> - <version>${spring.version}</version> <exclusions> <exclusion> <groupId>commons-logging</groupId> diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java index 7975d1f46..dea091287 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java @@ -23,9 +23,6 @@ import org.apache.archiva.admin.model.RepositoryAdminException; import org.apache.archiva.admin.model.beans.ManagedRepository; import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; import org.apache.archiva.admin.repository.AbstractRepositoryAdmin; -import org.apache.archiva.common.plexusbridge.MavenIndexerUtils; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; import org.apache.archiva.configuration.Configuration; import org.apache.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.archiva.configuration.ProxyConnectorConfiguration; @@ -49,6 +46,7 @@ import org.apache.maven.index.NexusIndexer; import org.apache.maven.index.context.IndexCreator; import org.apache.maven.index.context.IndexingContext; import org.apache.maven.index.context.UnsupportedExistingLuceneIndexException; +import org.apache.maven.index_shaded.lucene.index.IndexFormatTooOldException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; @@ -96,12 +94,6 @@ public class DefaultManagedRepositoryAdmin private RepositoryStatisticsManager repositoryStatisticsManager; @Inject - private PlexusSisuBridge plexusSisuBridge; - - @Inject - private MavenIndexerUtils mavenIndexerUtils; - - @Inject protected RoleManager roleManager; @Inject @@ -109,23 +101,16 @@ public class DefaultManagedRepositoryAdmin private Cache<String, Collection<String>> namespacesCache; // fields - List<? extends IndexCreator> indexCreators; + @Inject + private List<? extends IndexCreator> indexCreators; - NexusIndexer indexer; + @Inject + private NexusIndexer indexer; @PostConstruct public void initialize() throws RepositoryAdminException, RoleManagerException { - try - { - indexCreators = mavenIndexerUtils.getAllIndexCreators(); - indexer = plexusSisuBridge.lookup( NexusIndexer.class ); - } - catch ( PlexusSisuBridgeException e ) - { - throw new RepositoryAdminException( e.getMessage(), e ); - } // initialize index context on start and check roles here for ( ManagedRepository managedRepository : getManagedRepositories() ) { @@ -367,20 +352,14 @@ public class DefaultManagedRepositoryAdmin try { - NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class ); - - IndexingContext context = nexusIndexer.getIndexingContexts().get( repository.getId() ); + IndexingContext context = indexer.getIndexingContexts().get( repository.getId() ); if ( context != null ) { // delete content only if directory exists - nexusIndexer.removeIndexingContext( context, + indexer.removeIndexingContext( context, deleteContent && context.getIndexDirectoryFile().exists() ); } } - catch ( PlexusSisuBridgeException e ) - { - throw new RepositoryAdminException( e.getMessage(), e ); - } catch ( IOException e ) { throw new RepositoryAdminException( e.getMessage(), e ); @@ -660,24 +639,33 @@ public class DefaultManagedRepositoryAdmin if ( context == null ) { - context = indexer.addIndexingContext( repository.getId(), repository.getId(), repositoryDirectory, - indexDirectory, - repositoryDirectory.toURI().toURL().toExternalForm(), - indexDirectory.toURI().toURL().toString(), indexCreators ); + try + { + context = indexer.addIndexingContext( repository.getId(), repository.getId(), repositoryDirectory, + indexDirectory, + repositoryDirectory.toURI().toURL().toExternalForm(), + indexDirectory.toURI().toURL().toString(), indexCreators ); - context.setSearchable( repository.isScanned() ); + context.setSearchable( repository.isScanned() ); + } + catch ( IndexFormatTooOldException e ) + { + // existing index with an old lucene format so we need to delete it!!! + // delete it first then recreate it. + log.warn( "the index of repository {} is too old we have to delete and recreate it", // + repository.getId() ); + FileUtils.deleteDirectory( indexDirectory ); + context = indexer.addIndexingContext( repository.getId(), repository.getId(), repositoryDirectory, + indexDirectory, + repositoryDirectory.toURI().toURL().toExternalForm(), + indexDirectory.toURI().toURL().toString(), indexCreators ); + + context.setSearchable( repository.isScanned() ); + } } return context; } - catch ( MalformedURLException e ) - { - throw new RepositoryAdminException( e.getMessage(), e ); - } - catch ( IOException e ) - { - throw new RepositoryAdminException( e.getMessage(), e ); - } - catch ( UnsupportedExistingLuceneIndexException e ) + catch ( IOException| UnsupportedExistingLuceneIndexException e ) { throw new RepositoryAdminException( e.getMessage(), e ); } @@ -824,26 +812,6 @@ public class DefaultManagedRepositoryAdmin this.repositoryTaskScheduler = repositoryTaskScheduler; } - public PlexusSisuBridge getPlexusSisuBridge() - { - return plexusSisuBridge; - } - - public void setPlexusSisuBridge( PlexusSisuBridge plexusSisuBridge ) - { - this.plexusSisuBridge = plexusSisuBridge; - } - - public MavenIndexerUtils getMavenIndexerUtils() - { - return mavenIndexerUtils; - } - - public void setMavenIndexerUtils( MavenIndexerUtils mavenIndexerUtils ) - { - this.mavenIndexerUtils = mavenIndexerUtils; - } - public NexusIndexer getIndexer() { return indexer; diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java index 8f390530b..01f733767 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java @@ -23,19 +23,19 @@ import org.apache.archiva.admin.model.RepositoryAdminException; import org.apache.archiva.admin.model.beans.RemoteRepository; import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin; import org.apache.archiva.admin.repository.AbstractRepositoryAdmin; -import org.apache.archiva.common.plexusbridge.MavenIndexerUtils; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; +import org.apache.archiva.common.utils.FileUtil; import org.apache.archiva.configuration.Configuration; import org.apache.archiva.configuration.ProxyConnectorConfiguration; import org.apache.archiva.configuration.RemoteRepositoryConfiguration; import org.apache.archiva.configuration.RepositoryCheckPath; import org.apache.archiva.metadata.model.facets.AuditEvent; +import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; import org.apache.maven.index.NexusIndexer; import org.apache.maven.index.context.IndexCreator; import org.apache.maven.index.context.IndexingContext; import org.apache.maven.index.context.UnsupportedExistingLuceneIndexException; +import org.apache.maven.index_shaded.lucene.index.IndexFormatTooOldException; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; @@ -60,29 +60,15 @@ public class DefaultRemoteRepositoryAdmin { @Inject - private PlexusSisuBridge plexusSisuBridge; - - @Inject - private MavenIndexerUtils mavenIndexerUtils; - - // fields private List<? extends IndexCreator> indexCreators; + @Inject private NexusIndexer indexer; @PostConstruct private void initialize() throws RepositoryAdminException { - try - { - indexCreators = mavenIndexerUtils.getAllIndexCreators(); - indexer = plexusSisuBridge.lookup( NexusIndexer.class ); - } - catch ( PlexusSisuBridgeException e ) - { - throw new RepositoryAdminException( e.getMessage(), e ); - } for ( RemoteRepository remoteRepository : getRemoteRepositories() ) { createIndexContext( remoteRepository ); @@ -321,19 +307,28 @@ public class DefaultRemoteRepositoryAdmin { indexDirectory.mkdirs(); } - return indexer.addIndexingContext( contextKey, remoteRepository.getId(), repoDir, indexDirectory, - remoteRepository.getUrl(), calculateIndexRemoteUrl( remoteRepository ), - mavenIndexerUtils.getAllIndexCreators() ); - } - catch ( MalformedURLException e ) - { - throw new RepositoryAdminException( e.getMessage(), e ); - } - catch ( IOException e ) - { - throw new RepositoryAdminException( e.getMessage(), e ); + + try + { + + return indexer.addIndexingContext( contextKey, remoteRepository.getId(), repoDir, indexDirectory, + remoteRepository.getUrl(), calculateIndexRemoteUrl( remoteRepository ), + indexCreators ); + } + catch ( IndexFormatTooOldException e ) + { + // existing index with an old lucene format so we need to delete it!!! + // delete it first then recreate it. + log.warn( "the index of repository {} is too old we have to delete and recreate it", // + remoteRepository.getId() ); + FileUtils.deleteDirectory( indexDirectory ); + return indexer.addIndexingContext( contextKey, remoteRepository.getId(), repoDir, indexDirectory, + remoteRepository.getUrl(), calculateIndexRemoteUrl( remoteRepository ), + indexCreators ); + + } } - catch ( UnsupportedExistingLuceneIndexException e ) + catch ( IOException | UnsupportedExistingLuceneIndexException e ) { throw new RepositoryAdminException( e.getMessage(), e ); } diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/resources/META-INF/spring-context.xml index aa4743ccc..15d377058 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/resources/META-INF/spring-context.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/resources/META-INF/spring-context.xml @@ -22,14 +22,13 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context - http://www.springframework.org/schema/context/spring-context-3.0.xsd" default-lazy-init="true"> - + http://www.springframework.org/schema/context/spring-context.xsd" + default-lazy-init="true"> <context:annotation-config /> - <context:component-scan - base-package="org.apache.archiva.admin.repository"/> + <context:component-scan base-package="org.apache.archiva.admin.repository"/> <alias name="redbackRuntimeConfigurationAdmin#default" alias="userConfiguration#archiva"/> diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/spring-context.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/spring-context.xml index 2901cbb46..84adf6d01 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/spring-context.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/resources/spring-context.xml @@ -20,11 +20,14 @@ --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" + xmlns:context="http://www.springframework.org/schema/context" + xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context - http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" + http://www.springframework.org/schema/context/spring-context.xsd + http://www.springframework.org/schema/tx + http://www.springframework.org/schema/tx/spring-tx.xsd" default-lazy-init="true"> <context:annotation-config/> diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml index 5aca8e1ad..2f2c6244e 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml @@ -44,6 +44,7 @@ <dependency> <groupId>org.apache.maven.indexer</groupId> <artifactId>indexer-core</artifactId> + <classifier>shaded-lucene</classifier> </dependency> <dependency> <groupId>com.google.guava</groupId> 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 1509bef12..69ec1ec44 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 @@ -23,13 +23,9 @@ package org.apache.archiva.scheduler.indexing; import org.apache.archiva.admin.model.RepositoryAdminException; import org.apache.archiva.admin.model.beans.ManagedRepository; import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; import org.apache.archiva.redback.components.taskqueue.Task; import org.apache.archiva.redback.components.taskqueue.execution.TaskExecutionException; import org.apache.archiva.redback.components.taskqueue.execution.TaskExecutor; -import org.apache.lucene.search.BooleanClause; -import org.apache.lucene.search.BooleanQuery; import org.apache.maven.index.ArtifactContext; import org.apache.maven.index.ArtifactContextProducer; import org.apache.maven.index.FlatSearchRequest; @@ -40,11 +36,12 @@ import org.apache.maven.index.context.IndexingContext; import org.apache.maven.index.expr.SourcedSearchExpression; import org.apache.maven.index.packer.IndexPacker; import org.apache.maven.index.packer.IndexPackingRequest; +import org.apache.maven.index_shaded.lucene.search.BooleanClause; +import org.apache.maven.index_shaded.lucene.search.BooleanQuery; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; -import javax.annotation.PostConstruct; import javax.inject.Inject; import java.io.File; import java.io.IOException; @@ -54,37 +51,24 @@ import java.io.IOException; * all performed by this executor. Add and update artifact in index tasks are added in the indexing task queue by the * NexusIndexerConsumer while remove artifact from index tasks are added by the LuceneCleanupRemoveIndexedConsumer. */ -@Service ( "taskExecutor#indexing" ) +@Service( "taskExecutor#indexing" ) public class ArchivaIndexingTaskExecutor implements TaskExecutor { private Logger log = LoggerFactory.getLogger( ArchivaIndexingTaskExecutor.class ); + @Inject private IndexPacker indexPacker; - private ArtifactContextProducer artifactContextProducer; - @Inject - private PlexusSisuBridge plexusSisuBridge; + private ArtifactContextProducer artifactContextProducer; @Inject private ManagedRepositoryAdmin managedRepositoryAdmin; + @Inject private NexusIndexer nexusIndexer; - @PostConstruct - public void initialize() - throws PlexusSisuBridgeException - { - log.info( "Initialized {}", this.getClass().getName() ); - - artifactContextProducer = plexusSisuBridge.lookup( ArtifactContextProducer.class ); - - indexPacker = plexusSisuBridge.lookup( IndexPacker.class, "default" ); - - nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class ); - - } /** * depending on current {@link Task} you have. @@ -128,9 +112,10 @@ public class ArchivaIndexingTaskExecutor { try { - log.debug( "Creating indexing context on resource: {}", ( indexingTask.getResourceFile() == null - ? "none" - : indexingTask.getResourceFile().getPath() ) ); + log.debug( "Creating indexing context on resource: {}", // + ( indexingTask.getResourceFile() == null + ? "none" + : indexingTask.getResourceFile().getPath() ) ); context = managedRepositoryAdmin.createIndexContext( repository ); } catch ( RepositoryAdminException e ) @@ -162,9 +147,9 @@ public class ArchivaIndexingTaskExecutor // TODO make that configurable? if ( artifactFile.getPath().endsWith( ".pom" ) ) { - ac.getArtifactInfo().fextension = "pom"; - ac.getArtifactInfo().packaging = "pom"; - ac.getArtifactInfo().classifier = "pom"; + ac.getArtifactInfo().setFileExtension( "pom" ); + ac.getArtifactInfo().setPackaging( "pom" ); + ac.getArtifactInfo().setClassifier( "pom" ); } if ( indexingTask.getAction().equals( ArtifactIndexingTask.Action.ADD ) ) { @@ -174,20 +159,20 @@ public class ArchivaIndexingTaskExecutor BooleanQuery q = new BooleanQuery(); q.add( nexusIndexer.constructQuery( MAVEN.GROUP_ID, new SourcedSearchExpression( - ac.getArtifactInfo().groupId ) ), BooleanClause.Occur.MUST ); + ac.getArtifactInfo().getGroupId() ) ), BooleanClause.Occur.MUST ); q.add( nexusIndexer.constructQuery( MAVEN.ARTIFACT_ID, new SourcedSearchExpression( - ac.getArtifactInfo().artifactId ) ), BooleanClause.Occur.MUST ); + ac.getArtifactInfo().getArtifactId() ) ), BooleanClause.Occur.MUST ); q.add( nexusIndexer.constructQuery( MAVEN.VERSION, new SourcedSearchExpression( - ac.getArtifactInfo().version ) ), BooleanClause.Occur.MUST ); - if ( ac.getArtifactInfo().classifier != null ) + ac.getArtifactInfo().getVersion() ) ), BooleanClause.Occur.MUST ); + if ( ac.getArtifactInfo().getClassifier() != null ) { q.add( nexusIndexer.constructQuery( MAVEN.CLASSIFIER, new SourcedSearchExpression( - ac.getArtifactInfo().classifier ) ), BooleanClause.Occur.MUST ); + ac.getArtifactInfo().getClassifier() ) ), BooleanClause.Occur.MUST ); } - if ( ac.getArtifactInfo().packaging != null ) + if ( ac.getArtifactInfo().getPackaging() != null ) { q.add( nexusIndexer.constructQuery( MAVEN.PACKAGING, new SourcedSearchExpression( - ac.getArtifactInfo().packaging ) ), BooleanClause.Occur.MUST ); + ac.getArtifactInfo().getPackaging() ) ), BooleanClause.Occur.MUST ); } FlatSearchRequest flatSearchRequest = new FlatSearchRequest( q, context ); FlatSearchResponse flatSearchResponse = nexusIndexer.searchFlat( flatSearchRequest ); @@ -248,7 +233,11 @@ public class ArchivaIndexingTaskExecutor if ( !repository.isSkipPackedIndexCreation() ) { - IndexPackingRequest request = new IndexPackingRequest( context, context.getIndexDirectoryFile() ); + IndexPackingRequest request = new IndexPackingRequest( context, // + context.acquireIndexSearcher().getIndexReader(), + // + context.getIndexDirectoryFile() ); + indexPacker.packIndex( request ); context.updateTimestamp( true ); @@ -272,13 +261,4 @@ public class ArchivaIndexingTaskExecutor this.indexPacker = indexPacker; } - public PlexusSisuBridge getPlexusSisuBridge() - { - return plexusSisuBridge; - } - - public void setPlexusSisuBridge( PlexusSisuBridge plexusSisuBridge ) - { - this.plexusSisuBridge = plexusSisuBridge; - } } diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArtifactIndexingTask.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArtifactIndexingTask.java index 0029bc096..2da5ab779 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArtifactIndexingTask.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/ArtifactIndexingTask.java @@ -20,8 +20,8 @@ package org.apache.archiva.scheduler.indexing; */ import org.apache.archiva.admin.model.beans.ManagedRepository; -import org.apache.maven.index.context.IndexingContext; import org.apache.archiva.redback.components.taskqueue.Task; +import org.apache.maven.index.context.IndexingContext; import java.io.File; @@ -80,7 +80,13 @@ public class ArtifactIndexingTask public void setExecuteOnEntireRepo( boolean executeOnEntireRepo ) { + this.executeOnEntireRepo( executeOnEntireRepo ); + } + + public ArtifactIndexingTask executeOnEntireRepo( boolean executeOnEntireRepo ) + { this.executeOnEntireRepo = executeOnEntireRepo; + return this; } @Override 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 42a6b72a6..b1f39558b 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 @@ -25,8 +25,6 @@ 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.MavenIndexerUtils; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.configuration.ConfigurationEvent; @@ -57,7 +55,7 @@ import java.util.concurrent.CopyOnWriteArrayList; * @author Olivier Lamy * @since 1.4-M1 */ -@Service ("downloadRemoteIndexScheduler#default") +@Service( "downloadRemoteIndexScheduler#default" ) public class DefaultDownloadRemoteIndexScheduler implements ConfigurationListener, DownloadRemoteIndexScheduler { @@ -65,7 +63,7 @@ public class DefaultDownloadRemoteIndexScheduler private Logger log = LoggerFactory.getLogger( getClass() ); @Inject - @Named (value = "taskScheduler#indexDownloadRemote") + @Named( value = "taskScheduler#indexDownloadRemote" ) private TaskScheduler taskScheduler; @Inject @@ -84,15 +82,12 @@ public class DefaultDownloadRemoteIndexScheduler private NetworkProxyAdmin networkProxyAdmin; @Inject - private PlexusSisuBridge plexusSisuBridge; - - @Inject - private MavenIndexerUtils mavenIndexerUtils; - private NexusIndexer nexusIndexer; + @Inject private IndexUpdater indexUpdater; + @Inject private IndexPacker indexPacker; // store ids about currently running remote download : updated in DownloadRemoteIndexTask @@ -106,12 +101,6 @@ public class DefaultDownloadRemoteIndexScheduler archivaConfiguration.addListener( this ); // TODO add indexContexts even if null - nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class ); - - indexUpdater = plexusSisuBridge.lookup( IndexUpdater.class ); - - this.indexPacker = plexusSisuBridge.lookup( IndexPacker.class ); - for ( RemoteRepository remoteRepository : remoteRepositoryAdmin.getRemoteRepositories() ) { String contextKey = "remote-" + remoteRepository.getId(); @@ -180,11 +169,14 @@ public class DefaultDownloadRemoteIndexScheduler } } - DownloadRemoteIndexTaskRequest downloadRemoteIndexTaskRequest = - new DownloadRemoteIndexTaskRequest().setRemoteRepository( remoteRepository ).setNetworkProxy( - networkProxy ).setFullDownload( fullDownload ).setWagonFactory( - wagonFactory ).setRemoteRepositoryAdmin( remoteRepositoryAdmin ).setIndexUpdater( - indexUpdater ).setIndexPacker( this.indexPacker ); + DownloadRemoteIndexTaskRequest downloadRemoteIndexTaskRequest = new DownloadRemoteIndexTaskRequest() // + .setRemoteRepository( remoteRepository ) // + .setNetworkProxy( networkProxy ) // + .setFullDownload( fullDownload ) // + .setWagonFactory( wagonFactory ) // + .setRemoteRepositoryAdmin( remoteRepositoryAdmin ) // + .setIndexUpdater( indexUpdater ) // + .setIndexPacker( this.indexPacker ); if ( now ) { diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DefaultIndexUpdateSideEffect.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DefaultIndexUpdateSideEffect.java new file mode 100644 index 000000000..0dcadd9d7 --- /dev/null +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DefaultIndexUpdateSideEffect.java @@ -0,0 +1,47 @@ +package org.apache.archiva.scheduler.indexing; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.index.context.IndexingContext; +import org.apache.maven.index_shaded.lucene.store.Directory; +import org.apache.maven.index.updater.IndexUpdateSideEffect; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +/** + * Not doing much but required at least one implementation + * + * @since 3.0.0 + */ +@Service +public class DefaultIndexUpdateSideEffect + implements IndexUpdateSideEffect +{ + private static final Logger LOGGER = LoggerFactory.getLogger( DefaultIndexUpdateSideEffect.class ); + + @Override + public void updateIndex( Directory directory, IndexingContext indexingContext, boolean b ) + { + LOGGER.info( "updating index: {} with directory: {}", // + indexingContext.getId(), // + directory.toString() ); + } +} 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 f8fd42a24..436e7bb0b 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 @@ -196,32 +196,7 @@ public class DownloadRemoteIndexTask indexingContext.updateTimestamp( true ); } - catch ( MalformedURLException e ) - { - log.error( e.getMessage(), e ); - throw new RuntimeException( e.getMessage(), e ); - } - catch ( WagonFactoryException e ) - { - log.error( e.getMessage(), e ); - throw new RuntimeException( e.getMessage(), e ); - } - catch ( ConnectionException e ) - { - log.error( e.getMessage(), e ); - throw new RuntimeException( e.getMessage(), e ); - } - catch ( AuthenticationException e ) - { - log.error( e.getMessage(), e ); - throw new RuntimeException( e.getMessage(), e ); - } - catch ( IOException e ) - { - log.error( e.getMessage(), e ); - throw new RuntimeException( e.getMessage(), e ); - } - catch ( RepositoryAdminException e ) + catch ( Exception e ) { log.error( e.getMessage(), e ); throw new RuntimeException( e.getMessage(), e ); 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 1f07c52ac..14bf7fc50 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 @@ -22,21 +22,24 @@ package org.apache.archiva.scheduler.indexing; import junit.framework.TestCase; import org.apache.archiva.admin.model.beans.ManagedRepository; import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; -import org.apache.archiva.common.plexusbridge.MavenIndexerUtils; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; -import org.apache.lucene.search.BooleanClause.Occur; -import org.apache.lucene.search.BooleanQuery; -import org.apache.lucene.search.IndexSearcher; -import org.apache.lucene.search.TopDocs; import org.apache.maven.index.ArtifactInfo; import org.apache.maven.index.FlatSearchRequest; import org.apache.maven.index.FlatSearchResponse; import org.apache.maven.index.MAVEN; import org.apache.maven.index.NexusIndexer; +import org.apache.maven.index.context.IndexCreator; import org.apache.maven.index.context.IndexingContext; import org.apache.maven.index.expr.SourcedSearchExpression; import org.apache.maven.index.expr.StringSearchExpression; +import org.apache.maven.index_shaded.lucene.search.BooleanClause; +import org.apache.maven.index_shaded.lucene.search.BooleanQuery; +import org.apache.maven.index_shaded.lucene.search.IndexSearcher; +import org.apache.maven.index_shaded.lucene.search.TopDocs; +import org.apache.maven.index.updater.DefaultIndexUpdater; +import org.apache.maven.index.updater.IndexUpdateRequest; +import org.apache.maven.index.updater.IndexUpdater; +import org.assertj.core.api.Assertions; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -44,18 +47,10 @@ import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import javax.inject.Inject; -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; import java.io.File; import java.io.FilenameFilter; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.file.Files; -import java.nio.file.Paths; +import java.util.List; import java.util.Set; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; /** * ArchivaIndexingTaskExecutorTest @@ -70,16 +65,17 @@ public class ArchivaIndexingTaskExecutorTest private ManagedRepository repositoryConfig; + @Inject private NexusIndexer indexer; @Inject - PlexusSisuBridge plexusSisuBridge; + List<IndexCreator> indexCreators; @Inject - MavenIndexerUtils mavenIndexerUtils; + ManagedRepositoryAdmin managedRepositoryAdmin; @Inject - ManagedRepositoryAdmin managedRepositoryAdmin; + private IndexUpdater indexUpdater; @Before @Override @@ -98,8 +94,6 @@ public class ArchivaIndexingTaskExecutorTest repositoryConfig.setSnapshots( false ); repositoryConfig.setReleases( true ); - indexer = plexusSisuBridge.lookup( NexusIndexer.class ); - managedRepositoryAdmin.createIndexContext( repositoryConfig ); } @@ -147,19 +141,19 @@ public class ArchivaIndexingTaskExecutorTest BooleanQuery q = new BooleanQuery(); q.add( indexer.constructQuery( MAVEN.GROUP_ID, new StringSearchExpression( "org.apache.archiva" ) ), - Occur.SHOULD ); + BooleanClause.Occur.SHOULD ); q.add( indexer.constructQuery( MAVEN.ARTIFACT_ID, new StringSearchExpression( "archiva-index-methods-jar-test" ) ), - Occur.SHOULD ); + BooleanClause.Occur.SHOULD ); if ( !indexer.getIndexingContexts().containsKey( repositoryConfig.getId() ) ) { - IndexingContext context = indexer.addIndexingContext( repositoryConfig.getId(), repositoryConfig.getId(), - new File( repositoryConfig.getLocation() ), - new File( repositoryConfig.getLocation(), - ".indexer" ), null, null, - mavenIndexerUtils.getAllIndexCreators() - ); + IndexingContext context = indexer.addIndexingContext( repositoryConfig.getId(), // + repositoryConfig.getId(), // + new File( repositoryConfig.getLocation() ), // + new File( repositoryConfig.getLocation(), ".indexer" ) + // + , null, null, indexCreators ); context.setSearchable( true ); } @@ -173,9 +167,9 @@ public class ArchivaIndexingTaskExecutorTest Set<ArtifactInfo> results = response.getResults(); ArtifactInfo artifactInfo = results.iterator().next(); - assertEquals( "org.apache.archiva", artifactInfo.groupId ); - assertEquals( "archiva-index-methods-jar-test", artifactInfo.artifactId ); - assertEquals( "test-repo", artifactInfo.repository ); + assertEquals( "org.apache.archiva", artifactInfo.getGroupId() ); + assertEquals( "archiva-index-methods-jar-test", artifactInfo.getArtifactId() ); + assertEquals( "test-repo", artifactInfo.getRepository() ); } @@ -195,10 +189,10 @@ public class ArchivaIndexingTaskExecutorTest BooleanQuery q = new BooleanQuery(); q.add( indexer.constructQuery( MAVEN.GROUP_ID, new StringSearchExpression( "org.apache.archiva" ) ), - Occur.SHOULD ); + BooleanClause.Occur.SHOULD ); q.add( indexer.constructQuery( MAVEN.ARTIFACT_ID, new StringSearchExpression( "archiva-index-methods-jar-test" ) ), - Occur.SHOULD ); + BooleanClause.Occur.SHOULD ); IndexingContext ctx = indexer.getIndexingContexts().get( repositoryConfig.getId() ); @@ -231,7 +225,7 @@ public class ArchivaIndexingTaskExecutorTest BooleanQuery q = new BooleanQuery(); q.add( indexer.constructQuery( MAVEN.GROUP_ID, new SourcedSearchExpression( "org.apache.archiva" ) ), - Occur.SHOULD ); + BooleanClause.Occur.SHOULD ); //q.add( // indexer.constructQuery( MAVEN.ARTIFACT_ID, new SourcedSearchExpression( "archiva-index-methods-jar-test" ) ), // Occur.SHOULD ); @@ -258,10 +252,10 @@ public class ArchivaIndexingTaskExecutorTest q = new BooleanQuery(); q.add( indexer.constructQuery( MAVEN.GROUP_ID, new SourcedSearchExpression( "org.apache.archiva" ) ), - Occur.SHOULD ); + BooleanClause.Occur.SHOULD ); q.add( indexer.constructQuery( MAVEN.ARTIFACT_ID, - new SourcedSearchExpression( "archiva-index-methods-jar-test" ) ), Occur.SHOULD - ); + new SourcedSearchExpression( "archiva-index-methods-jar-test" ) ), + BooleanClause.Occur.SHOULD ); assertTrue( new File( repositoryConfig.getLocation(), ".indexer" ).exists() ); assertFalse( new File( repositoryConfig.getLocation(), ".index" ).exists() ); @@ -315,20 +309,26 @@ public class ArchivaIndexingTaskExecutorTest assertTrue( indexerDirectory.exists() ); // test packed index file creation - assertTrue( new File( indexerDirectory, "nexus-maven-repository-index.zip" ).exists() ); - assertTrue( new File( indexerDirectory, "nexus-maven-repository-index.properties" ).exists() ); - assertTrue( new File( indexerDirectory, "nexus-maven-repository-index.gz" ).exists() ); + //no more zip + //Assertions.assertThat(new File( indexerDirectory, "nexus-maven-repository-index.zip" )).exists(); + Assertions.assertThat( new File( indexerDirectory, "nexus-maven-repository-index.properties" ) ).exists(); + Assertions.assertThat( new File( indexerDirectory, "nexus-maven-repository-index.gz" ) ).exists(); // unpack .zip index File destDir = new File( repositoryConfig.getLocation(), ".indexer/tmp" ); - unzipIndex( indexerDirectory.getPath(), destDir.getPath() ); + //unzipIndex( indexerDirectory.getPath(), destDir.getPath() ); + + DefaultIndexUpdater.FileFetcher fetcher = new DefaultIndexUpdater.FileFetcher( indexerDirectory ); + IndexUpdateRequest updateRequest = new IndexUpdateRequest( getIndexingContext(), fetcher ); + //updateRequest.setLocalIndexCacheDir( indexerDirectory ); + indexUpdater.fetchAndUpdateIndex( updateRequest ); BooleanQuery q = new BooleanQuery(); q.add( indexer.constructQuery( MAVEN.GROUP_ID, new StringSearchExpression( "org.apache.archiva" ) ), - Occur.SHOULD ); + BooleanClause.Occur.SHOULD ); q.add( indexer.constructQuery( MAVEN.ARTIFACT_ID, new StringSearchExpression( "archiva-index-methods-jar-test" ) ), - Occur.SHOULD ); + BooleanClause.Occur.SHOULD ); FlatSearchRequest request = new FlatSearchRequest( q, getIndexingContext() ); FlatSearchResponse response = indexer.searchFlat( request ); @@ -336,42 +336,11 @@ public class ArchivaIndexingTaskExecutorTest Set<ArtifactInfo> results = response.getResults(); ArtifactInfo artifactInfo = results.iterator().next(); - assertEquals( "org.apache.archiva", artifactInfo.groupId ); - assertEquals( "archiva-index-methods-jar-test", artifactInfo.artifactId ); - assertEquals( "test-repo", artifactInfo.repository ); + assertEquals( "org.apache.archiva", artifactInfo.getGroupId() ); + assertEquals( "archiva-index-methods-jar-test", artifactInfo.getArtifactId() ); + assertEquals( "test-repo", artifactInfo.getRepository() ); assertEquals( 1, response.getTotalHits() ); } - private void unzipIndex( String indexDir, String destDir ) - throws IOException - { - final int buff = 2048; - - Files.createDirectories( Paths.get( destDir ) ); - - try (InputStream fin = Files.newInputStream( Paths.get( indexDir, "nexus-maven-repository-index.zip" ) )) - { - ZipInputStream in = new ZipInputStream( new BufferedInputStream( fin ) ); - ZipEntry entry; - - while ( ( entry = in.getNextEntry() ) != null ) - { - int count; - byte data[] = new byte[buff]; - try (OutputStream fout = Files.newOutputStream( Paths.get( destDir, entry.getName() ) )) - { - try (BufferedOutputStream out = new BufferedOutputStream( fout, buff )) - { - - while ( ( count = in.read( data, 0, buff ) ) != -1 ) - { - out.write( data, 0, count ); - } - } - } - } - - } - } } diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskTest.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskTest.java index 7e95b4f26..ef0dd86ed 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskTest.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTaskTest.java @@ -20,16 +20,15 @@ package org.apache.archiva.scheduler.indexing; import org.apache.archiva.admin.model.beans.RemoteRepository; import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; import org.apache.archiva.common.utils.FileUtil; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; -import org.apache.lucene.search.BooleanClause; -import org.apache.lucene.search.BooleanQuery; import org.apache.maven.index.FlatSearchRequest; import org.apache.maven.index.FlatSearchResponse; import org.apache.maven.index.MAVEN; import org.apache.maven.index.NexusIndexer; import org.apache.maven.index.expr.StringSearchExpression; +import org.apache.maven.index_shaded.lucene.search.BooleanClause; +import org.apache.maven.index_shaded.lucene.search.BooleanQuery; import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.ServerConnector; @@ -75,8 +74,6 @@ public class DownloadRemoteIndexTaskTest DefaultDownloadRemoteIndexScheduler downloadRemoteIndexScheduler; @Inject - PlexusSisuBridge plexusSisuBridge; - NexusIndexer nexusIndexer; @Before @@ -90,7 +87,6 @@ public class DownloadRemoteIndexTaskTest this.server.start(); this.port = serverConnector.getLocalPort(); log.info( "start server on port {}", this.port ); - nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class ); } protected void createContext( Server server, File repositoryDirectory ) diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/repositories/default-repository/.indexer/_0.cfe b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/repositories/default-repository/.indexer/_0.cfe Binary files differnew file mode 100644 index 000000000..4ece53663 --- /dev/null +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/repositories/default-repository/.indexer/_0.cfe diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/repositories/default-repository/.indexer/_0.cfs b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/repositories/default-repository/.indexer/_0.cfs Binary files differnew file mode 100644 index 000000000..a66fea159 --- /dev/null +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/repositories/default-repository/.indexer/_0.cfs diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/repositories/default-repository/.indexer/_0.si b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/repositories/default-repository/.indexer/_0.si Binary files differnew file mode 100644 index 000000000..84e9c5aaf --- /dev/null +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/repositories/default-repository/.indexer/_0.si diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/repositories/default-repository/.indexer/segments_2 b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/repositories/default-repository/.indexer/segments_2 Binary files differnew file mode 100644 index 000000000..3d64213c6 --- /dev/null +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/repositories/default-repository/.indexer/segments_2 diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/repositories/default-repository/.indexer/write.lock b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/repositories/default-repository/.indexer/write.lock new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/repositories/default-repository/.indexer/write.lock diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml index 882cd6f25..fd293fa26 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml @@ -329,22 +329,6 @@ </dependency> <dependency> - <groupId>org.apache.jackrabbit</groupId> - <artifactId>jackrabbit-core</artifactId> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>jcl-over-slf4j</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> <groupId>org.apache.lucene</groupId> <artifactId>lucene-core</artifactId> <scope>test</scope> @@ -451,11 +435,12 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> + <reuseForks>false</reuseForks> <includes> <include>**/*Tests.java</include> <include>**/*Test.java</include> </includes> - <argLine>-Xmx512m -Xms512m -server -XX:MaxPermSize=256m @{jacocoproperty}</argLine> + <argLine>-Xms1024m -Xmx3072m -server -XX:MaxPermSize=256m @{jacocoproperty}</argLine> <systemPropertyVariables> <appserver.base>${project.build.directory}/appserver-base</appserver.base> <plexus.home>${project.build.directory}/appserver-base</plexus.home> diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java index a5f6844ca..fc78a9a94 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java @@ -23,16 +23,15 @@ import org.apache.archiva.admin.model.RepositoryAdminException; import org.apache.archiva.admin.model.admin.ArchivaAdministration; import org.apache.archiva.admin.model.beans.ManagedRepository; import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; -import org.apache.archiva.metadata.model.facets.AuditEvent; import org.apache.archiva.checksum.ChecksumAlgorithm; import org.apache.archiva.checksum.ChecksummedFile; -import org.apache.archiva.common.plexusbridge.MavenIndexerUtils; import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; import org.apache.archiva.common.utils.VersionComparator; import org.apache.archiva.common.utils.VersionUtil; import org.apache.archiva.maven2.metadata.MavenMetadataReader; import org.apache.archiva.maven2.model.Artifact; import org.apache.archiva.metadata.model.ArtifactMetadata; +import org.apache.archiva.metadata.model.facets.AuditEvent; import org.apache.archiva.metadata.model.maven2.MavenArtifactFacet; import org.apache.archiva.metadata.repository.MetadataRepository; import org.apache.archiva.metadata.repository.MetadataRepositoryException; @@ -126,9 +125,6 @@ public class DefaultRepositoriesService private PlexusSisuBridge plexusSisuBridge; @Inject - private MavenIndexerUtils mavenIndexerUtils; - - @Inject private SecuritySystem securitySystem; @Inject diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java index 0d924f723..bc1b545ab 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java @@ -45,6 +45,7 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; import org.apache.cxf.jaxrs.client.WebClient; +import org.junit.After; import org.junit.Assume; import org.junit.Before; import org.junit.BeforeClass; @@ -77,6 +78,7 @@ public abstract class AbstractArchivaRestTest // END SNIPPET: authz-header + @BeforeClass public static void chekRepo() { @@ -102,6 +104,7 @@ public abstract class AbstractArchivaRestTest super.startServer(); } + private void removeAppsubFolder( File appServerBase, String folder ) throws Exception { diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/utils/MavenIndexerCleaner.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/utils/MavenIndexerCleaner.java index c2453c8eb..c633adb0c 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/utils/MavenIndexerCleaner.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/utils/MavenIndexerCleaner.java @@ -37,7 +37,7 @@ public class MavenIndexerCleaner Logger log = LoggerFactory.getLogger( getClass() ); @Inject - private PlexusSisuBridge plexusSisuBridge; + private NexusIndexer nexusIndexer; @PreDestroy public void shutdown() @@ -45,7 +45,6 @@ public class MavenIndexerCleaner { log.info( "cleanup IndexingContext" ); - NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class ); for ( IndexingContext context : nexusIndexer.getIndexingContexts().values() ) { nexusIndexer.removeIndexingContext( context, true ); diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml index 49c0748e1..830a3e6e3 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml @@ -75,6 +75,7 @@ <property name="queue" ref="taskQueue#repository-scanning"/> </bean> + <!-- <bean id="repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown"> <constructor-arg ref="config"/> </bean> @@ -83,6 +84,7 @@ <constructor-arg value="${basedir}/src/test/repository.xml"/> <constructor-arg value="${appserver.base}/jcr"/> </bean> + --> <bean name="commons-configuration" class="org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry" init-method="initialize"> diff --git a/archiva-modules/archiva-web/archiva-web-common/pom.xml b/archiva-modules/archiva-web/archiva-web-common/pom.xml index 71ac238ad..92c056de4 100644 --- a/archiva-modules/archiva-web/archiva-web-common/pom.xml +++ b/archiva-modules/archiva-web/archiva-web-common/pom.xml @@ -369,21 +369,6 @@ </dependency> <dependency> - <groupId>org.apache.jackrabbit</groupId> - <artifactId>jackrabbit-core</artifactId> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>jcl-over-slf4j</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> <groupId>org.assertj</groupId> <artifactId>assertj-core</artifactId> <scope>test</scope> @@ -509,7 +494,8 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> - <argLine>-Xmx1024m -Xms512m -XX:MaxPermSize=256m @{jacocoproperty}</argLine> + <reuseForks>false</reuseForks> + <argLine>-Xms1024m -Xmx2048m -server -XX:MaxPermSize=256m @{jacocoproperty}</argLine> <systemPropertyVariables> <appserver.base>${project.build.directory}/appserver-base</appserver.base> <plexus.home>${project.build.directory}/appserver-base</plexus.home> diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/ArchivaStartup.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/ArchivaStartup.java index f82304243..1da71bc89 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/ArchivaStartup.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/ArchivaStartup.java @@ -53,8 +53,6 @@ public class ArchivaStartup private DefaultRepositoryArchivaTaskScheduler repositoryTaskScheduler; - private PlexusSisuBridge plexusSisuBridge; - private NexusIndexer nexusIndexer; @Override @@ -74,18 +72,10 @@ public class ArchivaStartup tqeIndexing = wac.getBean( "taskQueueExecutor#indexing", ThreadedTaskQueueExecutor.class ); - plexusSisuBridge = wac.getBean( PlexusSisuBridge.class ); + nexusIndexer = wac.getBean( NexusIndexer.class ); try { - nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class ); - } - catch ( PlexusSisuBridgeException e ) - { - throw new RuntimeException( "Unable to get NexusIndexer: " + e.getMessage(), e ); - } - try - { securitySync.startup(); repositoryTaskScheduler.startup(); Banner.display( (String) archivaRuntimeProperties.get( "archiva.version" ) ); diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/TestRepositorySessionFactoryBean.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/TestRepositorySessionFactoryBean.java index 880ac94b2..82bd3602d 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/TestRepositorySessionFactoryBean.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/TestRepositorySessionFactoryBean.java @@ -58,4 +58,10 @@ public class TestRepositorySessionFactoryBean logger.info( "create RepositorySessionFactory instance of {}", repositorySessionFactory.getClass().getName() ); return repositorySessionFactory; } + + @Override + public String getId() + { + return this.beanId; + } } diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestRepositorySessionFactory.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestRepositorySessionFactory.java index 0e10a5254..31e5a299a 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestRepositorySessionFactory.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestRepositorySessionFactory.java @@ -55,4 +55,10 @@ public class TestRepositorySessionFactory { return this; } + + @Override + public void close() + { + // no op + } } diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-test-common.xml b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-test-common.xml index 3e8195d6a..d62446b45 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-test-common.xml +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-test-common.xml @@ -72,6 +72,7 @@ <property name="queue" ref="taskQueue#repository-scanning"/> </bean> + <!-- <bean id="repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown"> <constructor-arg ref="config"/> </bean> @@ -79,6 +80,7 @@ <constructor-arg value="${basedir}/src/test/repository.xml"/> <constructor-arg value="${appserver.base}/jcr"/> </bean> + --> <alias name="repositorySessionFactory#jcr" alias="repositorySessionFactory"/> <alias name="userConfiguration#archiva" alias="userConfiguration#default"/> diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-with-jcr.xml b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-with-jcr.xml index 1e02fbcc7..f29dbcb16 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-with-jcr.xml +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-with-jcr.xml @@ -21,13 +21,13 @@ <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" + xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd - http://www.springframework.org/schema/context - http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" default-lazy-init="true"> + <!-- <bean id="repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown"> <constructor-arg ref="config"/> </bean> @@ -35,6 +35,7 @@ <constructor-arg value="${basedir}/src/test/repository.xml"/> <constructor-arg value="${appserver.base}/jcr"/> </bean> + --> <alias name="repositorySessionFactory#jcr" alias="repositorySessionFactory"/> diff --git a/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-modules/archiva-web/archiva-webapp/pom.xml index 1d3c53ed1..13678bfd1 100644 --- a/archiva-modules/archiva-web/archiva-webapp/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp/pom.xml @@ -131,29 +131,6 @@ </dependency> <dependency> - <groupId>org.apache.jackrabbit</groupId> - <artifactId>jackrabbit-jcr-commons</artifactId> - </dependency> - <dependency> - <groupId>org.apache.jackrabbit</groupId> - <artifactId>jackrabbit-core</artifactId> - <exclusions> - <exclusion> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </exclusion> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>jcl-over-slf4j</artifactId> - </exclusion> - <exclusion> - <groupId>commons-dbcp</groupId> - <artifactId>commons-dbcp</artifactId> - </exclusion> - </exclusions> - </dependency> - - <dependency> <groupId>commons-configuration</groupId> <artifactId>commons-configuration</artifactId> <exclusions> @@ -278,6 +255,7 @@ <dependency> <groupId>org.apache.maven.indexer</groupId> <artifactId>indexer-core</artifactId> + <classifier>shaded-lucene</classifier> <exclusions> <exclusion> <groupId>org.codehaus.plexus</groupId> @@ -811,8 +789,6 @@ <version>${spring.version}</version> </dependency> - - </dependencies> <build> @@ -928,8 +904,7 @@ <webApp> <contextPath>/archiva</contextPath> </webApp> - <jettyXml>${basedir}/src/test/jetty/jetty-env.xml</jettyXml> - + <jettyXml>${basedir}/src/test/jetty-env.xml</jettyXml> <systemProperties> <systemProperty> <name>plexus.home</name> @@ -945,7 +920,7 @@ </systemProperty> <systemProperty> <name>derby.system.home</name> - <value>${archivaAppServerBase}/logs</value> + <value>${archivaAppServerBase}/database</value> </systemProperty> <systemProperty> <name>java.io.tmpdir</name> @@ -980,6 +955,10 @@ <value>${archiva.repositorySessionFactory.id}</value> </systemProperty> <systemProperty> + <name>log4j.configurationFile</name> + <value>${basedir}/src/test/log4j2-test.xml</value> + </systemProperty> + <systemProperty> <name>AsyncLoggerConfig.WaitStrategy</name> <value>Block</value> </systemProperty> @@ -1025,7 +1004,6 @@ <artifactId>serp</artifactId> <version>1.15.1</version> </dependency> - <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-io</artifactId> diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/META-INF/spring-context.xml index b0b3840b6..a66c9253b 100755 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/META-INF/spring-context.xml +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/META-INF/spring-context.xml @@ -37,6 +37,7 @@ <util:properties id="archivaRuntimeProperties" location="classpath:application.properties" /> + <!-- <bean id="jcr-repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown" lazy-init="true"> <constructor-arg ref="jcr-config"/> </bean> @@ -46,7 +47,7 @@ <constructor-arg value="${appserver.base}/conf/repository.xml"/> <constructor-arg value="${appserver.base}/data/jcr"/> </bean> - + --> <jee:jndi-lookup id="dataSource" jndi-name="java:/comp/env/jdbc/users" /> diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/log4j2.xml b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/log4j2.xml index f22ee0691..5496e442a 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/resources/log4j2.xml +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/resources/log4j2.xml @@ -78,12 +78,6 @@ <logger name="org.quartz" level="info"/> - <logger name="org.apache.jasper" level="info"/> - - <logger name="com.opensymphony.xwork2" level="info"/> - - <logger name="org.apache.struts2" level="info"/> - --> <!-- WebDav objects --> diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/tomcat/auto-admin-creation.properties b/archiva-modules/archiva-web/archiva-webapp/src/test/auto-admin-creation.properties index 7c8c5815b..7c8c5815b 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/tomcat/auto-admin-creation.properties +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/auto-admin-creation.properties diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/jetty/jetty-env.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/jetty-env.xml index bed63bfa3..bed63bfa3 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/jetty/jetty-env.xml +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/jetty-env.xml diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/tomcat/log4j2-test.xml b/archiva-modules/archiva-web/archiva-webapp/src/test/log4j2-test.xml index 55668911a..55668911a 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/tomcat/log4j2-test.xml +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/log4j2-test.xml diff --git a/archiva-modules/archiva-web/archiva-webdav/pom.xml b/archiva-modules/archiva-web/archiva-webdav/pom.xml index 33c876011..1a2887918 100644 --- a/archiva-modules/archiva-web/archiva-webdav/pom.xml +++ b/archiva-modules/archiva-web/archiva-webdav/pom.xml @@ -95,20 +95,6 @@ <artifactId>archiva-filelock</artifactId> </dependency> <dependency> - <groupId>org.apache.jackrabbit</groupId> - <artifactId>jackrabbit-webdav</artifactId> - <exclusions> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>jcl-over-slf4j</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.jackrabbit</groupId> - <artifactId>jackrabbit-jcr-commons</artifactId> - </dependency> - <dependency> <groupId>joda-time</groupId> <artifactId>joda-time</artifactId> </dependency> @@ -117,6 +103,10 @@ <artifactId>spring-web</artifactId> </dependency> <dependency> + <groupId>org.apache.jackrabbit</groupId> + <artifactId>jackrabbit-webdav</artifactId> + </dependency> + <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> </dependency> @@ -302,8 +292,6 @@ org.apache.archiva.metadata.repository.storage;version=${project.version}, org.apache.commons.io;version="[1.4,2)", org.apache.commons.lang;version="[2.4,3)", - org.apache.jackrabbit.util;version="[1,3)", - org.apache.jackrabbit.webdav*;version="[1,3)", org.joda.time*;version="[1.5,2)", org.springframework*;version="[3,4)", org.apache.maven.index*, diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/MavenIndexerCleaner.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/MavenIndexerCleaner.java index 079828fbe..cd59302e7 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/MavenIndexerCleaner.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/MavenIndexerCleaner.java @@ -18,23 +18,18 @@ package org.apache.archiva.webdav.util; * under the License. */ -import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; -import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; import org.apache.maven.index.NexusIndexer; import org.apache.maven.index.context.IndexingContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Service; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.inject.Inject; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; -import java.io.IOException; /** * @author Olivier Lamy @@ -46,15 +41,16 @@ public class MavenIndexerCleaner Logger log = LoggerFactory.getLogger( getClass() ); - private PlexusSisuBridge plexusSisuBridge; @Inject private ApplicationContext applicationContext; + @Inject + NexusIndexer nexusIndexer; + @PostConstruct public void startup() { - plexusSisuBridge = applicationContext.getBean( PlexusSisuBridge.class ); cleanupIndex(); } @@ -70,9 +66,6 @@ public class MavenIndexerCleaner { try { - WebApplicationContext wacu = - WebApplicationContextUtils.getRequiredWebApplicationContext( servletContextEvent.getServletContext() ); - plexusSisuBridge = wacu.getBean( PlexusSisuBridge.class ); cleanupIndex(); } @@ -103,7 +96,6 @@ public class MavenIndexerCleaner log.info( "cleanup IndexingContext" ); try { - NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class ); for ( IndexingContext context : nexusIndexer.getIndexingContexts().values() ) { nexusIndexer.removeIndexingContext( context, true ); diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/RepositorySessionFactory.java b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/RepositorySessionFactory.java index ff6be9517..ba2c585d8 100644 --- a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/RepositorySessionFactory.java +++ b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/RepositorySessionFactory.java @@ -22,4 +22,6 @@ package org.apache.archiva.metadata.repository; public interface RepositorySessionFactory { RepositorySession createSession(); + + void close(); } diff --git a/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java b/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java index fef84df1b..d117cb847 100644 --- a/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java +++ b/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java @@ -827,14 +827,7 @@ public abstract class AbstractMetadataRepositoryTest Collection<ArtifactMetadata> artifacts = repository.getArtifacts( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION ); ArrayList<ArtifactMetadata> actual = new ArrayList<>( artifacts ); - Collections.sort( actual, new Comparator<ArtifactMetadata>() - { - @Override - public int compare( ArtifactMetadata o1, ArtifactMetadata o2 ) - { - return o1.getId().compareTo( o2.getId() ); - } - } ); + Collections.sort( actual,( o1, o2 ) -> o1.getId().compareTo( o2.getId() ) ); assertEquals( Arrays.asList( artifact1, artifact2 ), actual ); } diff --git a/archiva-modules/plugins/maven2-repository/pom.xml b/archiva-modules/plugins/maven2-repository/pom.xml index 4c978436b..ab01552b5 100644 --- a/archiva-modules/plugins/maven2-repository/pom.xml +++ b/archiva-modules/plugins/maven2-repository/pom.xml @@ -277,7 +277,7 @@ <executions> <execution> <id>test-repository</id> - <phase>generate-test-resources</phase> + <phase>process-test-classes</phase> <goals> <goal>unpack-dependencies</goal> </goals> diff --git a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraRepositorySessionFactory.java b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraRepositorySessionFactory.java index d45e2cb10..2e434fc6e 100644 --- a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraRepositorySessionFactory.java +++ b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraRepositorySessionFactory.java @@ -82,4 +82,10 @@ public class CassandraRepositorySessionFactory return new RepositorySession( metadataRepository, metadataResolver ); } + + @Override + public void close() + { + cassandraArchivaManager.shutdown(); + } } diff --git a/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileRepositorySessionFactory.java b/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileRepositorySessionFactory.java index 0d63f4ee9..ce640fe1d 100644 --- a/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileRepositorySessionFactory.java +++ b/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileRepositorySessionFactory.java @@ -42,21 +42,12 @@ import java.util.Map; public class FileRepositorySessionFactory implements RepositorySessionFactory { - /** - * - */ private Map<String, MetadataFacetFactory> metadataFacetFactories; - /** - * - */ @Inject @Named( value = "archivaConfiguration#default" ) private ArchivaConfiguration configuration; - /** - * - */ @Inject private MetadataResolver metadataResolver; @@ -87,4 +78,10 @@ public class FileRepositorySessionFactory return new RepositorySession( metadataRepository, metadataResolver ); } + + @Override + public void close() + { + // no op + } } diff --git a/archiva-modules/plugins/metadata-store-jcr/pom.xml b/archiva-modules/plugins/metadata-store-jcr/pom.xml index 8e71c4c89..609011387 100644 --- a/archiva-modules/plugins/metadata-store-jcr/pom.xml +++ b/archiva-modules/plugins/metadata-store-jcr/pom.xml @@ -52,6 +52,12 @@ <artifactId>archiva-test-utils</artifactId> <version>${project.version}</version> <scope>test</scope> + <exclusions> + <exclusion> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>javax.jcr</groupId> @@ -59,25 +65,40 @@ </dependency> <dependency> <groupId>org.apache.jackrabbit</groupId> - <artifactId>jackrabbit-jcr-commons</artifactId> + <artifactId>oak-jcr</artifactId> </dependency> <dependency> <groupId>org.apache.jackrabbit</groupId> - <artifactId>jackrabbit-core</artifactId> - <scope>provided</scope> - <!-- could trim more, but since it's just for test we don't need to worry --> + <artifactId>oak-segment-tar</artifactId> + </dependency> + <dependency> + <groupId>org.apache.jackrabbit</groupId> + <artifactId>oak-lucene</artifactId> + <version>${jcr-oak.version}</version> <exclusions> <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>jcl-over-slf4j</artifactId> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-misc</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-facet</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-jcl</artifactId> </dependency> <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-slf4j-impl</artifactId> + </dependency> + <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <scope>test</scope> @@ -102,6 +123,57 @@ <artifactId>xercesImpl</artifactId> <scope>test</scope> </dependency> + + <dependency> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-core</artifactId> + <version>${lucene.version}</version> + </dependency> + <dependency> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-misc</artifactId> + <version>${lucene.version}</version> + </dependency> + <dependency> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-facet</artifactId> + <version>${lucene.version}</version> + </dependency> + <dependency> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-codecs</artifactId> + <version>${lucene.version}</version> + </dependency> + <dependency> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-queryparser</artifactId> + <version>${lucene.version}</version> + </dependency> + <dependency> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-sandbox</artifactId> + <version>${lucene.version}</version> + </dependency> + <dependency> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-highlighter</artifactId> + <version>${lucene.version}</version> + </dependency> + <dependency> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-memory</artifactId> + <version>${lucene.version}</version> + </dependency> + <dependency> + <groupId>org.apache.lucene</groupId> + <artifactId>lucene-analyzers-common</artifactId> + <version>${lucene.version}</version> + </dependency> + <dependency> + <groupId>io.dropwizard.metrics</groupId> + <artifactId>metrics-core</artifactId> + <version>3.1.0</version> + </dependency> </dependencies> <build> <testResources> @@ -134,8 +206,6 @@ org.apache.archiva.metadata.model;version=${project.version}, org.apache.archiva.metadata.repository;version=${project.version}, org.apache.commons.lang;version="[2.4,3)", - org.apache.jackrabbit.commons;version="[2.3,3)", - org.apache.jackrabbit.core.config, org.springframework*;version="[3,4)", org.slf4j;resolution:=optional, org.apache.commons.lang.time @@ -143,6 +213,15 @@ </instructions> </configuration> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <systemPropertyVariables> + <appserver.base>${project.build.directory}/jcr/repo</appserver.base> + </systemPropertyVariables> + </configuration> + </plugin> </plugins> </build> </project> diff --git a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/ArchivaJcrRepositoryConfig.java b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/ArchivaJcrRepositoryConfig.java deleted file mode 100644 index 8271e2bec..000000000 --- a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/ArchivaJcrRepositoryConfig.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.apache.archiva.metadata.repository.jcr; -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.jackrabbit.core.config.ConfigurationException; -import org.apache.jackrabbit.core.config.RepositoryConfig; -import org.slf4j.LoggerFactory; - -import java.io.File; - -/** - * @author Olivier Lamy - * @since 1.4-M1 - */ -public class ArchivaJcrRepositoryConfig -{ - // Recommended to avoid inconsistencies caused by race conditions. - static - { - if ( !System.getProperties( ).containsKey( "org.apache.jackrabbit.core.state.validatehierarchy" ) ) - { - System.setProperty( "org.apache.jackrabbit.core.state.validatehierarchy", "true" ); - } - } - - public static RepositoryConfig create( String file, String home ) - throws ConfigurationException - { - File homeFile = new File( home ); - if ( !homeFile.exists( ) ) - { - homeFile.mkdirs( ); - } - - File configurationFile = new File( file ); - if ( !configurationFile.exists( ) ) - { - String resourcePath = "org/apache/archiva/metadata/repository/jcr/repository.xml"; - LoggerFactory.getLogger( ArchivaJcrRepositoryConfig.class ).info( - "no repository.xml file in path {} so use default from resources path {}", file, resourcePath ); - // use bundled repository.xml - return RepositoryConfig.create( - Thread.currentThread( ).getContextClassLoader( ).getResourceAsStream( resourcePath ), home ); - } - - return RepositoryConfig.create( file, home ); - } -} diff --git a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java index f8393b888..9fca6b848 100644 --- a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java +++ b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java @@ -40,6 +40,8 @@ import org.apache.archiva.metadata.repository.stats.model.RepositoryStatistics; import org.apache.archiva.metadata.repository.stats.model.RepositoryStatisticsProvider; import org.apache.commons.lang.StringUtils; import org.apache.jackrabbit.commons.JcrUtils; +import org.apache.jackrabbit.oak.plugins.index.IndexUtils; +import org.apache.jackrabbit.oak.spi.state.NodeBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -143,6 +145,8 @@ public class JcrMetadataRepository registerMixinNodeType( nodeTypeManager, JcrMetadataRepository.FACET_NODE_TYPE ); registerMixinNodeType( nodeTypeManager, JcrMetadataRepository.DEPENDENCY_NODE_TYPE ); + + } private static void registerMixinNodeType( NodeTypeManager nodeTypeManager, String name ) @@ -160,6 +164,8 @@ public class JcrMetadataRepository } } + + @Override public void updateProject( String repositoryId, ProjectMetadata project ) throws MetadataRepositoryException @@ -759,6 +765,10 @@ public class JcrMetadataRepository { throw new MetadataRepositoryException( e.getMessage(), e ); } + log.info("Artifacts found {}", artifacts.size()); + for (ArtifactMetadata meta : artifacts) { + log.info("Artifact: "+meta.getVersion()+" "+meta.getFacetList()); + } return artifacts; } @@ -1422,11 +1432,9 @@ public class JcrMetadataRepository } @Override - public List<ArtifactMetadata> searchArtifacts( String key, String text, String repositoryId, boolean exact ) + public List<ArtifactMetadata> searchArtifacts( String key, String text, String repositoryId, boolean e ) throws MetadataRepositoryException { - // we can't do exact search in any property (*), we need a key - boolean e = exact && key != null; String theKey = key == null ? "*" : "[" + key + "]"; String projectVersionCondition = e ? "(projectVersion." + theKey + " = $value)" : "contains([projectVersion]." + theKey + ", $value)"; @@ -1436,7 +1444,6 @@ public class JcrMetadataRepository + ARTIFACT_NODE_TYPE + "] AS artifact ON ISCHILDNODE(artifact, projectVersion) LEFT OUTER JOIN [" + FACET_NODE_TYPE + "] AS facet ON ISCHILDNODE(facet, projectVersion) WHERE (" + projectVersionCondition + " OR " + facetCondition + ")"; - return runJcrQuery( repositoryId, q, ImmutableMap.of( "value", text ) ); } @@ -1559,7 +1566,7 @@ public class JcrMetadataRepository private static String getRepositoryContentPath( String repositoryId ) { - return getRepositoryPath( repositoryId ) + "/content/"; + return getRepositoryPath( repositoryId ) + "/content"; } private static String getFacetPath( String repositoryId, String facetId ) @@ -1569,7 +1576,7 @@ public class JcrMetadataRepository private static String getNamespacePath( String repositoryId, String namespace ) { - return getRepositoryContentPath( repositoryId ) + namespace.replace( '.', '/' ); + return getRepositoryContentPath( repositoryId ) + "/" + namespace.replace( '.', '/' ); } private static String getProjectPath( String repositoryId, String namespace, String projectId ) @@ -1598,6 +1605,7 @@ public class JcrMetadataRepository private Node getOrAddNodeByPath( Node baseNode, String name, String nodeType ) throws RepositoryException { + log.debug("getOrAddNodeByPath"+baseNode+" "+name+" "+nodeType); Node node = baseNode; for ( String n : name.split( "/" ) ) { @@ -1618,8 +1626,10 @@ public class JcrMetadataRepository private Node getOrAddRepositoryNode( String repositoryId ) throws RepositoryException { + log.debug("getOrAddRepositoryNode "+repositoryId); Node root = getJcrSession().getRootNode(); Node node = JcrUtils.getOrAddNode( root, "repositories" ); + log.debug("Repositories "+node); node = JcrUtils.getOrAddNode( node, repositoryId ); return node; } diff --git a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrRepositorySessionFactory.java b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrRepositorySessionFactory.java index 1c51dfc73..0b775c796 100644 --- a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrRepositorySessionFactory.java +++ b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrRepositorySessionFactory.java @@ -33,16 +33,19 @@ import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; import javax.inject.Inject; import javax.jcr.Repository; import javax.jcr.RepositoryException; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.HashMap; import java.util.Map; /** * */ -@Service("repositorySessionFactory#jcr") +@Service( "repositorySessionFactory#jcr" ) public class JcrRepositorySessionFactory implements RepositorySessionFactory { @@ -54,7 +57,6 @@ public class JcrRepositorySessionFactory private Map<String, MetadataFacetFactory> metadataFacetFactories; - @Inject private Repository repository; // Lazy evaluation to avoid problems with circular dependencies during initialization @@ -63,6 +65,8 @@ public class JcrRepositorySessionFactory @Inject private RepositorySessionFactoryBean repositorySessionFactoryBean; + private RepositoryFactory repositoryFactory; + @Override public RepositorySession createSession() { @@ -85,8 +89,10 @@ public class JcrRepositorySessionFactory } // Lazy evaluation to avoid problems with circular dependencies during initialization - private MetadataResolver getMetadataResolver() { - if (this.metadataResolver==null) { + private MetadataResolver getMetadataResolver() + { + if ( this.metadataResolver == null ) + { this.metadataResolver = applicationContext.getBean( MetadataResolver.class ); } return this.metadataResolver; @@ -97,7 +103,7 @@ public class JcrRepositorySessionFactory throws Exception { - // skip initialisation if not cassandra + // skip initialisation if not jcr if ( !StringUtils.equals( repositorySessionFactoryBean.getId(), "jcr" ) ) { return; @@ -123,6 +129,12 @@ public class JcrRepositorySessionFactory JcrMetadataRepository metadataRepository = null; try { + + repositoryFactory = new RepositoryFactory(); + // FIXME this need to be configurable + Path directoryPath = Paths.get( System.getProperty( "appserver.base" ), "data/jcr" ); + repositoryFactory.setRepositoryPath( directoryPath ); + repository = repositoryFactory.createRepository(); metadataRepository = new JcrMetadataRepository( metadataFacetFactories, repository ); JcrMetadataRepository.initialize( metadataRepository.getJcrSession() ); } @@ -141,4 +153,10 @@ public class JcrRepositorySessionFactory stopWatch.stop(); logger.info( "time to initialize JcrRepositorySessionFactory: {}", stopWatch.getTime() ); } + + @PreDestroy + public void close() + { + repositoryFactory.close(); + } } diff --git a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/RepositoryFactory.java b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/RepositoryFactory.java new file mode 100644 index 000000000..b1b821dc8 --- /dev/null +++ b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/RepositoryFactory.java @@ -0,0 +1,350 @@ +package org.apache.archiva.metadata.repository.jcr; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import com.google.common.collect.ImmutableSet; +import org.apache.commons.lang.time.StopWatch; +import org.apache.jackrabbit.JcrConstants; +import org.apache.jackrabbit.oak.Oak; +import org.apache.jackrabbit.oak.api.Type; +import org.apache.jackrabbit.oak.jcr.Jcr; +import org.apache.jackrabbit.oak.plugins.index.IndexUtils; +import org.apache.jackrabbit.oak.plugins.index.lucene.ExtractedTextCache; +import org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier; +import org.apache.jackrabbit.oak.plugins.index.lucene.IndexTracker; +import org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider; +import org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider; +import org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.DocumentQueue; +import org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.LocalIndexObserver; +import org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.NRTIndexFactory; +import org.apache.jackrabbit.oak.plugins.index.lucene.reader.DefaultIndexReaderFactory; +import org.apache.jackrabbit.oak.segment.SegmentNodeStoreBuilders; +import org.apache.jackrabbit.oak.segment.file.FileStore; +import org.apache.jackrabbit.oak.segment.file.FileStoreBuilder; +import org.apache.jackrabbit.oak.segment.file.InvalidFileStoreVersionException; +import org.apache.jackrabbit.oak.spi.commit.Observer; +import org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer; +import org.apache.jackrabbit.oak.spi.mount.MountInfoProvider; +import org.apache.jackrabbit.oak.spi.mount.Mounts; +import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider; +import org.apache.jackrabbit.oak.spi.state.NodeBuilder; +import org.apache.jackrabbit.oak.spi.state.NodeStore; +import org.apache.jackrabbit.oak.stats.StatisticsProvider; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.annotation.Nonnull; +import javax.jcr.Repository; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import static org.apache.archiva.metadata.repository.jcr.RepositoryFactory.StoreType.IN_MEMORY_TYPE; +import static org.apache.archiva.metadata.repository.jcr.RepositoryFactory.StoreType.SEGMENT_FILE_TYPE; +import static org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexConstants.INCLUDE_PROPERTY_TYPES; + +/** + * Created by martin on 14.06.17. + * + * @author Martin Stockhammer + * @since 3.0.0 + */ +public class RepositoryFactory +{ + + private Logger log = LoggerFactory.getLogger( RepositoryFactory.class ); + + private FileStore fileStore; + + private NodeStore nodeStore; + + private ExecutorService executorService; + + public enum StoreType + { + SEGMENT_FILE_TYPE, + IN_MEMORY_TYPE; + } + + private StoreType storeType = SEGMENT_FILE_TYPE; + + private Path repositoryPath = Paths.get( "repository" ); + + public Repository createRepository() + throws IOException, InvalidFileStoreVersionException + { + createExecutor(); + + if ( SEGMENT_FILE_TYPE == storeType ) + { + fileStore = FileStoreBuilder.fileStoreBuilder( repositoryPath.toFile() ).build(); + nodeStore = SegmentNodeStoreBuilders.builder( fileStore ) // + .withStatisticsProvider( StatisticsProvider.NOOP ) // + .build(); + } + else if ( IN_MEMORY_TYPE == storeType ) + { + nodeStore = null; + } + else + { + throw new IllegalArgumentException( "Store type " + storeType + " not recognized" ); + } + + Oak oak = nodeStore == null ? new Oak() : new Oak( nodeStore ); + oak.with( new RepositoryInitializer() + { + @Override + public void initialize( @Nonnull NodeBuilder root ) + { + log.info( "Creating index " ); + + NodeBuilder lucene = IndexUtils.getOrCreateOakIndex( root ).child( "lucene" ); + lucene.setProperty( JcrConstants.JCR_PRIMARYTYPE, "oak:QueryIndexDefinition", Type.NAME ); + + lucene.setProperty( "compatVersion", 2 ); + lucene.setProperty( "type", "lucene" ); + // lucene.setProperty("async", "async"); + lucene.setProperty( INCLUDE_PROPERTY_TYPES, ImmutableSet.of( "String" ), Type.STRINGS ); + // lucene.setProperty("refresh",true); + lucene.setProperty( "async", ImmutableSet.of( "async", "sync" ), Type.STRINGS ); + NodeBuilder rules = lucene.child( "indexRules" ). + setProperty( JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED, Type.NAME ); + rules.setProperty( ":childOrder", ImmutableSet.of( "archiva:projectVersion", // + "archiva:artifact", // + "archiva:facet", // + "archiva:namespace", // + "archiva:project" ), // + Type.STRINGS ); + NodeBuilder allProps = rules.child( "archiva:projectVersion" ) // + .child( "properties" ) // + .setProperty( JcrConstants.JCR_PRIMARYTYPE, "nt:unstructured", Type.NAME ) // + .setProperty( ":childOrder", ImmutableSet.of( "allProps" ), Type.STRINGS ) // + .setProperty( "indexNodeName", true ) // + .child( "allProps" ) // + .setProperty( JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED, Type.NAME ); + allProps.setProperty( "name", ".*" ); + allProps.setProperty( "isRegexp", true ); + allProps.setProperty( "nodeScopeIndex", true ); + allProps.setProperty( "index", true ); + allProps.setProperty( "analyzed", true ); + // allProps.setProperty("propertyIndex",true); + allProps = rules.child( "archiva:artifact" ) // + .child( "properties" ) // + .setProperty( JcrConstants.JCR_PRIMARYTYPE, "nt:unstructured", Type.NAME ) // + .setProperty( ":childOrder", ImmutableSet.of( "allProps" ), Type.STRINGS ) // + .setProperty( "indexNodeName", true ).child( "allProps" ) // + .setProperty( JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED, Type.NAME ); + allProps.setProperty( "name", ".*" ); + allProps.setProperty( "isRegexp", true ); + allProps.setProperty( "nodeScopeIndex", true ); + allProps.setProperty( "index", true ); + allProps.setProperty( "analyzed", true ); + allProps = rules.child( "archiva:facet" ) // + .child( "properties" ) // + .setProperty( JcrConstants.JCR_PRIMARYTYPE, "nt:unstructured", Type.NAME ) // + .setProperty( ":childOrder", ImmutableSet.of( "allProps" ), Type.STRINGS ) // + .setProperty( "indexNodeName", true ) // + .child( "allProps" ) // + .setProperty( JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED, Type.NAME ); + allProps.setProperty( "name", ".*" ); + allProps.setProperty( "isRegexp", true ); + allProps.setProperty( "nodeScopeIndex", true ); + allProps.setProperty( "index", true ); + allProps.setProperty( "analyzed", true ); + allProps = rules.child( "archiva:namespace" ) // + .child( "properties" ) // + .setProperty( JcrConstants.JCR_PRIMARYTYPE, "nt:unstructured", Type.NAME ) // + .setProperty( ":childOrder", ImmutableSet.of( "allProps" ), Type.STRINGS ) // + .setProperty( "indexNodeName", true ) // + .child( "allProps" ) // + .setProperty( JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED, Type.NAME ); + allProps.setProperty( "name", ".*" ); + allProps.setProperty( "isRegexp", true ); + allProps.setProperty( "nodeScopeIndex", true ); + allProps.setProperty( "index", true ); + allProps.setProperty( "analyzed", true ); + allProps = rules.child( "archiva:project" ) // + .child( "properties" ) // + .setProperty( JcrConstants.JCR_PRIMARYTYPE, "nt:unstructured", Type.NAME ) // + .setProperty( ":childOrder", ImmutableSet.of( "allProps" ), Type.STRINGS ) // + .setProperty( "indexNodeName", true ) // + .child( "allProps" ) // + .setProperty( JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED, Type.NAME ); + allProps.setProperty( "name", ".*" ); + allProps.setProperty( "isRegexp", true ); + allProps.setProperty( "nodeScopeIndex", true ); + allProps.setProperty( "index", true ); + allProps.setProperty( "analyzed", true ); + + log.info( "Index: {} myIndex {}", lucene, lucene.getChildNode( "myIndex" ) ); + log.info( "myIndex {}", lucene.getChildNode( "myIndex" ).getProperties() ); + // IndexUtils.createIndexDefinition( ) + + } + } ); + + StatisticsProvider statsProvider = StatisticsProvider.NOOP; + int queueSize = Integer.getInteger( "queueSize", 10000 ); + File indexDir = Files.createTempDirectory( "archiva_index" ).toFile(); + log.info( "Queue Index {}", indexDir.toString() ); + IndexCopier indexCopier = new IndexCopier( executorService, indexDir, true ); + NRTIndexFactory nrtIndexFactory = new NRTIndexFactory( indexCopier, statsProvider ); + MountInfoProvider mountInfoProvider = Mounts.defaultMountInfoProvider(); + IndexTracker tracker = + new IndexTracker( new DefaultIndexReaderFactory( mountInfoProvider, indexCopier ), nrtIndexFactory ); + DocumentQueue queue = new DocumentQueue( queueSize, tracker, executorService, statsProvider ); + LocalIndexObserver localIndexObserver = new LocalIndexObserver( queue, statsProvider ); + LuceneIndexProvider provider = new LuceneIndexProvider( tracker ); + + // ExternalObserverBuilder builder = new ExternalObserverBuilder(queue, tracker, statsProvider, +// executorService, queueSize); +// Observer observer = builder.build(); +// builder.getBackgroundObserver(); + + LuceneIndexEditorProvider editorProvider = // + new LuceneIndexEditorProvider( null, tracker, // + new ExtractedTextCache( 0, 0 ), // + null, mountInfoProvider ); + editorProvider.setIndexingQueue( queue ); + + log.info( "Oak: {} with nodeStore {}", oak, nodeStore ); + Jcr jcr = new Jcr( oak ).with( editorProvider ) // + .with( (Observer) provider ) // + .with( localIndexObserver ) + // .with(observer) + .with( (QueryIndexProvider) provider ); // + //.withAsyncIndexing( "async", 5 ); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + Repository r = jcr.createRepository(); + stopWatch.stop(); + log.info( "time to create jcr repository: {} ms", stopWatch.getTime() ); +// try +// { +// Thread.currentThread().sleep( 1000 ); +// } +// catch ( InterruptedException e ) +// { +// log.error( e.getMessage(), e ); +// } + return r; + + + } + + public void close() + { + if ( fileStore != null ) + { + fileStore.close(); + } + if (executorService != null) + { + executorService.shutdownNow(); + } + } + + public StoreType getStoreType() + { + return storeType; + } + + public void setStoreType( StoreType storeType ) + { + this.storeType = storeType; + } + + public Path getRepositoryPath() + { + return repositoryPath; + } + + public void setRepositoryPath( Path repositoryPath ) + { + this.repositoryPath = repositoryPath; + } + + public void setRepositoryPath( String repositoryPath ) + { + this.repositoryPath = Paths.get( repositoryPath ); + if ( !Files.exists( this.repositoryPath ) ) + { + try + { + Files.createDirectories( this.repositoryPath ); + } + catch ( IOException e ) + { + log.error( e.getMessage(), e ); + throw new IllegalArgumentException( "cannot create directory:" + repositoryPath, e ); + } + } + } + + private void createExecutor() + { + if (executorService ==null ) + { + executorService = Executors.newCachedThreadPool(); + } + +// +// ThreadPoolExecutor executor = +// new ThreadPoolExecutor( 0, 5, 60L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), +// new ThreadFactory() +// { +// private final AtomicInteger counter = new AtomicInteger(); +// +// private final Thread.UncaughtExceptionHandler handler = +// new Thread.UncaughtExceptionHandler() +// { +// @Override +// public void uncaughtException( Thread t, Throwable e ) +// { +// log.warn( "Error occurred in asynchronous processing ", e ); +// } +// }; +// +// @Override +// public Thread newThread( @Nonnull Runnable r ) +// { +// Thread thread = new Thread( r, createName() ); +// thread.setDaemon( true ); +// thread.setPriority( Thread.MIN_PRIORITY ); +// thread.setUncaughtExceptionHandler( handler ); +// return thread; +// } +// +// private String createName() +// { +// return "oak-lucene-" + counter.getAndIncrement(); +// } +// } ); +// executor.setKeepAliveTime( 1, TimeUnit.MINUTES ); +// executor.allowCoreThreadTimeOut( true ); +// return executor; + } + +} diff --git a/archiva-modules/plugins/metadata-store-jcr/src/test/filtered-resources/META-INF/spring-context.xml b/archiva-modules/plugins/metadata-store-jcr/src/test/filtered-resources/META-INF/spring-context.xml index 43f6d0829..c07cc52d5 100644 --- a/archiva-modules/plugins/metadata-store-jcr/src/test/filtered-resources/META-INF/spring-context.xml +++ b/archiva-modules/plugins/metadata-store-jcr/src/test/filtered-resources/META-INF/spring-context.xml @@ -22,11 +22,5 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - <bean id="repository" class="org.apache.jackrabbit.core.RepositoryImpl" destroy-method="shutdown"> - <constructor-arg ref="config"/> - </bean> - <bean id="config" class="org.apache.jackrabbit.core.config.RepositoryConfig" factory-method="create"> - <constructor-arg value="${basedir}/src/test/repository.xml"/> - <constructor-arg value="${project.build.directory}/jcr"/> - </bean> + </beans>
\ No newline at end of file diff --git a/archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepositoryTest.java b/archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepositoryTest.java index 5efabdfad..e87d53f98 100644 --- a/archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepositoryTest.java +++ b/archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepositoryTest.java @@ -22,17 +22,19 @@ package org.apache.archiva.metadata.repository.jcr; import org.apache.archiva.metadata.model.MetadataFacetFactory; import org.apache.archiva.metadata.repository.AbstractMetadataRepositoryTest; import org.apache.commons.io.FileUtils; +import org.apache.jackrabbit.oak.segment.file.InvalidFileStoreVersionException; import org.junit.After; import org.junit.Before; -import org.junit.Test; +import org.junit.BeforeClass; import org.springframework.context.ApplicationContext; -import java.io.File; -import java.util.Map; import javax.inject.Inject; import javax.jcr.Repository; import javax.jcr.RepositoryException; import javax.jcr.Session; +import java.io.File; +import java.io.IOException; +import java.util.Map; public class JcrMetadataRepositoryTest extends AbstractMetadataRepositoryTest @@ -42,6 +44,21 @@ public class JcrMetadataRepositoryTest @Inject private ApplicationContext applicationContext; + private static Repository jcrRepository; + + @BeforeClass + public static void setupSpec() throws IOException, InvalidFileStoreVersionException + { + File directory = new File( "target/test-repositories" ); + if ( directory.exists() ) + { + FileUtils.deleteDirectory( directory ); + } + RepositoryFactory factory = new RepositoryFactory(); + factory.setRepositoryPath( directory.getPath() ); + jcrRepository = factory.createRepository(); + } + @Before @Override public void setUp() @@ -49,17 +66,11 @@ public class JcrMetadataRepositoryTest { super.setUp(); - File directory = new File( "target/test-repositories" ); - if ( directory.exists() ) - { - FileUtils.deleteDirectory( directory ); - } Map<String, MetadataFacetFactory> factories = createTestMetadataFacetFactories(); // TODO: probably don't need to use Spring for this - Repository repository = applicationContext.getBean( Repository.class ); - jcrMetadataRepository = new JcrMetadataRepository( factories, repository ); + jcrMetadataRepository = new JcrMetadataRepository( factories, jcrRepository ); try { @@ -70,6 +81,7 @@ public class JcrMetadataRepositoryTest // removing content is faster than deleting and re-copying the files from target/jcr session.getRootNode().getNode( "repositories" ).remove(); + session.save(); } catch ( RepositoryException e ) { diff --git a/archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java b/archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java index 63bfffb6f..be07e2e73 100644 --- a/archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java +++ b/archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java @@ -24,32 +24,26 @@ import org.apache.archiva.metadata.model.MetadataFacetFactory; import org.apache.archiva.metadata.repository.AbstractMetadataRepositoryTest; import org.apache.archiva.metadata.repository.RepositorySessionFactory; import org.apache.archiva.metadata.repository.jcr.JcrMetadataRepository; +import org.apache.archiva.metadata.repository.jcr.RepositoryFactory; import org.apache.archiva.metadata.repository.stats.model.DefaultRepositoryStatistics; -import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; import org.apache.commons.io.FileUtils; import org.apache.jackrabbit.commons.JcrUtils; -import org.apache.jackrabbit.core.TransientRepository; -import org.apache.jackrabbit.core.config.RepositoryConfig; -import org.apache.regexp.RE; +import org.apache.jackrabbit.oak.segment.file.InvalidFileStoreVersionException; import org.junit.After; -import org.junit.Assert; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.context.ApplicationContext; import org.springframework.test.context.ContextConfiguration; import javax.inject.Inject; -import javax.inject.Named; import javax.jcr.ImportUUIDBehavior; -import javax.jcr.NamespaceRegistry; import javax.jcr.Node; import javax.jcr.Repository; import javax.jcr.RepositoryException; import javax.jcr.Session; -import javax.jcr.SimpleCredentials; -import javax.jcr.Workspace; import javax.jcr.nodetype.NodeTypeManager; import javax.jcr.nodetype.NodeTypeTemplate; import java.io.File; @@ -59,12 +53,9 @@ import java.util.Date; import java.util.Map; import java.util.zip.GZIPInputStream; -import static org.junit.Assert.assertEquals; - @RunWith( ArchivaSpringJUnit4ClassRunner.class ) @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } ) public class JcrRepositoryStatisticsGatheringTest extends TestCase - { private static final int TOTAL_FILE_COUNT = 1000; @@ -80,25 +71,30 @@ public class JcrRepositoryStatisticsGatheringTest extends TestCase @Inject private ApplicationContext applicationContext; - @Inject - @Named("repository") - Repository jcrRepository; - Session session; + private static Repository jcrRepository; - - @Before - public void setUp() - throws Exception + @BeforeClass + public static void setupSpec() throws IOException, InvalidFileStoreVersionException { - File directory = new File( "target/test-repositories" ); if ( directory.exists() ) { FileUtils.deleteDirectory( directory ); } + RepositoryFactory factory = new RepositoryFactory(); + factory.setRepositoryPath( directory.getPath() ); + factory.setStoreType( RepositoryFactory.StoreType.IN_MEMORY_TYPE ); + jcrRepository = factory.createRepository(); + } + + + @Before + public void setUp() + throws Exception + { Map<String, MetadataFacetFactory> factories = AbstractMetadataRepositoryTest.createTestMetadataFacetFactories(); @@ -106,6 +102,9 @@ public class JcrRepositoryStatisticsGatheringTest extends TestCase // TODO: probably don't need to use Spring for this JcrMetadataRepository jcrMetadataRepository = new JcrMetadataRepository( factories, jcrRepository ); + + session = jcrMetadataRepository.getJcrSession(); + try { session = jcrMetadataRepository.getJcrSession(); diff --git a/archiva-modules/plugins/metadata-store-jcr/src/test/resources/log4j2-test.xml b/archiva-modules/plugins/metadata-store-jcr/src/test/resources/log4j2-test.xml new file mode 100644 index 000000000..7f4b0cd9c --- /dev/null +++ b/archiva-modules/plugins/metadata-store-jcr/src/test/resources/log4j2-test.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. + --> + + +<configuration status="debug"> + + <appenders> + <Console name="console" target="SYSTEM_OUT"> + <!--PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/--> + <PatternLayout pattern="%highlight{%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n}" /> + </Console> + + </appenders> + <loggers> + <logger name="org.apache.jackrabbit" level="info"/> + <root level="info" includeLocation="true"> + <appender-ref ref="console"/> + </root> + </loggers> +</configuration>
\ No newline at end of file diff --git a/archiva-modules/plugins/problem-reports/pom.xml b/archiva-modules/plugins/problem-reports/pom.xml index 20db52b92..d08bccb6b 100644 --- a/archiva-modules/plugins/problem-reports/pom.xml +++ b/archiva-modules/plugins/problem-reports/pom.xml @@ -112,7 +112,7 @@ <executions> <execution> <id>test-repository</id> - <phase>generate-test-resources</phase> + <phase>process-test-classes</phase> <goals> <goal>unpack-dependencies</goal> </goals> diff --git a/archiva-modules/plugins/repository-statistics/pom.xml b/archiva-modules/plugins/repository-statistics/pom.xml index acfea4f97..2a1926d42 100644 --- a/archiva-modules/plugins/repository-statistics/pom.xml +++ b/archiva-modules/plugins/repository-statistics/pom.xml @@ -45,6 +45,10 @@ <artifactId>slf4j-api</artifactId> </dependency> <dependency> + <groupId>javax.jcr</groupId> + <artifactId>jcr</artifactId> + </dependency> + <dependency> <groupId>org.apache.archiva</groupId> <artifactId>archiva-test-utils</artifactId> <version>${project.version}</version> @@ -65,6 +69,16 @@ <artifactId>xercesImpl</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.jackrabbit</groupId> + <artifactId>jackrabbit-jcr-commons</artifactId> + <version>2.15.2</version> + </dependency> + <dependency> + <groupId>org.apache.archiva</groupId> + <artifactId>metadata-store-jcr</artifactId> + <scope>test</scope> + </dependency> </dependencies> <build> <plugins> @@ -79,6 +93,8 @@ org.apache.archiva.metadata.repository.stats;version=${project.version} </Export-Package> <Import-Package> + javax.jcr, + javax.jcr.query, org.apache.archiva.metadata.model;version=${project.version}, org.apache.archiva.metadata.repository;version=${project.version}, org.apache.archiva.metadata.repository.storage.maven2;version=${project.version}, diff --git a/archiva-modules/plugins/stage-repository-merge/pom.xml b/archiva-modules/plugins/stage-repository-merge/pom.xml index d425434e0..4023b24a1 100644 --- a/archiva-modules/plugins/stage-repository-merge/pom.xml +++ b/archiva-modules/plugins/stage-repository-merge/pom.xml @@ -153,7 +153,7 @@ <executions> <execution> <id>test-repository</id> - <phase>generate-test-resources</phase> + <phase>process-test-classes</phase> <goals> <goal>unpack-dependencies</goal> </goals> |