aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/plugins
diff options
context:
space:
mode:
authorolivier lamy <olamy@apache.org>2017-08-19 21:37:35 +1000
committerolivier lamy <olamy@apache.org>2017-08-19 21:37:35 +1000
commit7a2710ec0a566f44a1f135b71176addfdd7047e7 (patch)
tree48886c9c6e6d66035093df4c6bbb866b83253ead /archiva-modules/plugins
parentf93a787e74f048fd4fe393819c09d898da63b4f4 (diff)
parent88385088993b8121099f48371ce9e00689ccb547 (diff)
downloadarchiva-7a2710ec0a566f44a1f135b71176addfdd7047e7.tar.gz
archiva-7a2710ec0a566f44a1f135b71176addfdd7047e7.zip
Merge branch 'feature/jcr_oak'
Diffstat (limited to 'archiva-modules/plugins')
-rw-r--r--archiva-modules/plugins/maven2-repository/pom.xml2
-rw-r--r--archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraRepositorySessionFactory.java6
-rw-r--r--archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileRepositorySessionFactory.java15
-rw-r--r--archiva-modules/plugins/metadata-store-jcr/pom.xml95
-rw-r--r--archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/ArchivaJcrRepositoryConfig.java64
-rw-r--r--archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java22
-rw-r--r--archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrRepositorySessionFactory.java28
-rw-r--r--archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/RepositoryFactory.java350
-rw-r--r--archiva-modules/plugins/metadata-store-jcr/src/test/filtered-resources/META-INF/spring-context.xml8
-rw-r--r--archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepositoryTest.java32
-rw-r--r--archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java41
-rw-r--r--archiva-modules/plugins/metadata-store-jcr/src/test/resources/log4j2-test.xml37
-rw-r--r--archiva-modules/plugins/problem-reports/pom.xml2
-rw-r--r--archiva-modules/plugins/repository-statistics/pom.xml16
-rw-r--r--archiva-modules/plugins/stage-repository-merge/pom.xml2
15 files changed, 587 insertions, 133 deletions
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>