aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules
diff options
context:
space:
mode:
Diffstat (limited to 'archiva-modules')
-rw-r--r--archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryStorage.java1
-rw-r--r--archiva-modules/plugins/maven2-repository/pom.xml2
-rw-r--r--archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java24
-rw-r--r--archiva-modules/plugins/metadata-store-cassandra/pom.xml1
-rw-r--r--archiva-modules/plugins/metadata-store-cassandra/src/test/filtered-resources/META-INF/spring-context.xml4
-rw-r--r--archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/MockRepositoryStorage.java147
-rw-r--r--archiva-modules/plugins/metadata-store-file/pom.xml9
7 files changed, 173 insertions, 15 deletions
diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryStorage.java b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryStorage.java
index b8769ab4f..664103dea 100644
--- a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryStorage.java
+++ b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/storage/RepositoryStorage.java
@@ -27,7 +27,6 @@ import org.apache.archiva.metadata.repository.filter.Filter;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.policies.ProxyDownloadException;
import org.apache.archiva.repository.ManagedRepositoryContent;
-import org.apache.archiva.repository.layout.LayoutException;
import org.apache.archiva.xml.XMLException;
import java.util.Collection;
diff --git a/archiva-modules/plugins/maven2-repository/pom.xml b/archiva-modules/plugins/maven2-repository/pom.xml
index 218d8b5e5..334802c24 100644
--- a/archiva-modules/plugins/maven2-repository/pom.xml
+++ b/archiva-modules/plugins/maven2-repository/pom.xml
@@ -20,8 +20,8 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>plugins</artifactId>
<groupId>org.apache.archiva</groupId>
+ <artifactId>plugins</artifactId>
<version>2.0.2-SNAPSHOT</version>
</parent>
<artifactId>maven2-repository</artifactId>
diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java
index 85ca42828..47f34d266 100644
--- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java
+++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/Maven2RepositoryStorage.java
@@ -35,7 +35,6 @@ import org.apache.archiva.maven2.metadata.MavenMetadataReader;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.model.ProjectMetadata;
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
-import org.apache.archiva.metadata.repository.RepositorySessionFactory;
import org.apache.archiva.metadata.repository.filter.Filter;
import org.apache.archiva.metadata.repository.storage.ReadMetadataRequest;
import org.apache.archiva.metadata.repository.storage.RelocationException;
@@ -74,7 +73,6 @@ import org.apache.maven.model.building.ModelBuildingException;
import org.apache.maven.model.building.ModelBuildingRequest;
import org.apache.maven.model.building.ModelProblem;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-import org.apache.maven.wagon.PathUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -111,6 +109,9 @@ import java.util.Map;
public class Maven2RepositoryStorage
implements RepositoryStorage
{
+
+ private static final Logger LOGGER = LoggerFactory.getLogger( Maven2RepositoryStorage.class );
+
private ModelBuilder builder;
@Inject
@@ -139,8 +140,6 @@ public class Maven2RepositoryStorage
@Named( value = "pathParser#default" )
private PathParser pathParser;
- private static final Logger log = LoggerFactory.getLogger( Maven2RepositoryStorage.class );
-
private static final String METADATA_FILENAME_START = "maven-metadata";
private static final String METADATA_FILENAME = METADATA_FILENAME_START + ".xml";
@@ -173,10 +172,9 @@ public class Maven2RepositoryStorage
// olamy: in case of browsing via the ui we can mix repos (parent of a SNAPSHOT can come from release repo)
if ( !readMetadataRequest.isBrowsingRequest() )
{
-
- if ( VersionUtil.isSnapshot(
- artifactVersion ) ) // skygo trying to improve speed by honoring managed configuration MRM-1658
+ if ( VersionUtil.isSnapshot( artifactVersion ) )
{
+ // skygo trying to improve speed by honoring managed configuration MRM-1658
if ( managedRepository.isReleases() && !managedRepository.isSnapshots() )
{
throw new RepositoryStorageRuntimeException( "lookforsnaponreleaseonly",
@@ -214,8 +212,8 @@ public class Maven2RepositoryStorage
}
catch ( XMLException e )
{
- // unable to parse metadata - log it, and continue with the version as the original SNAPSHOT version
- log.warn( "Invalid metadata: {} - {}", metadataFile, e.getMessage() );
+ // unable to parse metadata - LOGGER it, and continue with the version as the original SNAPSHOT version
+ LOGGER.warn( "Invalid metadata: {} - {}", metadataFile, e.getMessage() );
}
}
@@ -301,8 +299,8 @@ public class Maven2RepositoryStorage
if ( ( problem.getException() instanceof FileNotFoundException && e.getModelId() != null &&
!e.getModelId().equals( problem.getModelId() ) ) )
{
- log.warn( "The artifact's parent POM file '{}' cannot be resolved. "
- + "Using defaults for project version metadata..", file );
+ LOGGER.warn( "The artifact's parent POM file '{}' cannot be resolved. "
+ + "Using defaults for project version metadata..", file );
ProjectVersionMetadata metadata = new ProjectVersionMetadata();
metadata.setId( readMetadataRequest.getProjectVersion() );
@@ -871,7 +869,7 @@ public class Maven2RepositoryStorage
}
catch ( IOException e )
{
- log.error( "Unable to checksum file {}: {},MD5", file, e.getMessage() );
+ LOGGER.error( "Unable to checksum file {}: {},MD5", file, e.getMessage() );
}
try
{
@@ -879,7 +877,7 @@ public class Maven2RepositoryStorage
}
catch ( IOException e )
{
- log.error( "Unable to checksum file {}: {},SHA1", file, e.getMessage() );
+ LOGGER.error( "Unable to checksum file {}: {},SHA1", file, e.getMessage() );
}
metadata.setSize( file.length() );
}
diff --git a/archiva-modules/plugins/metadata-store-cassandra/pom.xml b/archiva-modules/plugins/metadata-store-cassandra/pom.xml
index c644e00f8..0d7436795 100644
--- a/archiva-modules/plugins/metadata-store-cassandra/pom.xml
+++ b/archiva-modules/plugins/metadata-store-cassandra/pom.xml
@@ -277,6 +277,7 @@
<configuration>
<systemPropertyVariables>
<cassandra.port>${cassandraPort}</cassandra.port>
+ <archiva.repositorySessionFactory.id>cassandra</archiva.repositorySessionFactory.id>
</systemPropertyVariables>
</configuration>
</plugin>
diff --git a/archiva-modules/plugins/metadata-store-cassandra/src/test/filtered-resources/META-INF/spring-context.xml b/archiva-modules/plugins/metadata-store-cassandra/src/test/filtered-resources/META-INF/spring-context.xml
index 74bb0240f..49f80f869 100644
--- a/archiva-modules/plugins/metadata-store-cassandra/src/test/filtered-resources/META-INF/spring-context.xml
+++ b/archiva-modules/plugins/metadata-store-cassandra/src/test/filtered-resources/META-INF/spring-context.xml
@@ -22,4 +22,8 @@
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 name="repositoryStorage#maven2" class="org.apache.archiva.metadata.repository.cassandra.MockRepositoryStorage"/>
+
+ <bean name="mockrepo#listener" class="org.apache.archiva.metadata.repository.cassandra.MockRepositoryStorage"/>
+
</beans> \ No newline at end of file
diff --git a/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/MockRepositoryStorage.java b/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/MockRepositoryStorage.java
new file mode 100644
index 000000000..e96be30a9
--- /dev/null
+++ b/archiva-modules/plugins/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/cassandra/MockRepositoryStorage.java
@@ -0,0 +1,147 @@
+package org.apache.archiva.metadata.repository.cassandra;
+
+/*
+ * 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.archiva.admin.model.beans.ManagedRepository;
+import org.apache.archiva.metadata.model.ArtifactMetadata;
+import org.apache.archiva.metadata.model.ProjectMetadata;
+import org.apache.archiva.metadata.model.ProjectVersionMetadata;
+import org.apache.archiva.metadata.repository.MetadataRepository;
+import org.apache.archiva.metadata.repository.RepositorySession;
+import org.apache.archiva.metadata.repository.filter.Filter;
+import org.apache.archiva.metadata.repository.storage.ReadMetadataRequest;
+import org.apache.archiva.metadata.repository.storage.RelocationException;
+import org.apache.archiva.metadata.repository.storage.RepositoryStorage;
+import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataException;
+import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataInvalidException;
+import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException;
+import org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeException;
+import org.apache.archiva.model.ArtifactReference;
+import org.apache.archiva.policies.ProxyDownloadException;
+import org.apache.archiva.repository.ManagedRepositoryContent;
+import org.apache.archiva.repository.events.RepositoryListener;
+import org.apache.archiva.xml.XMLException;
+
+import java.util.Collection;
+
+/**
+ * @author Olivier Lamy
+ */
+public class MockRepositoryStorage
+ implements RepositoryStorage, RepositoryListener
+{
+ @Override
+ public ProjectMetadata readProjectMetadata( String repoId, String namespace, String projectId )
+ {
+ return null;
+ }
+
+ @Override
+ public ProjectVersionMetadata readProjectVersionMetadata( ReadMetadataRequest readMetadataRequest )
+ throws RepositoryStorageMetadataInvalidException, RepositoryStorageMetadataNotFoundException,
+ RepositoryStorageRuntimeException
+ {
+ return null;
+ }
+
+ @Override
+ public Collection<String> listRootNamespaces( String repoId, Filter<String> filter )
+ throws RepositoryStorageRuntimeException
+ {
+ return null;
+ }
+
+ @Override
+ public Collection<String> listNamespaces( String repoId, String namespace, Filter<String> filter )
+ throws RepositoryStorageRuntimeException
+ {
+ return null;
+ }
+
+ @Override
+ public Collection<String> listProjects( String repoId, String namespace, Filter<String> filter )
+ throws RepositoryStorageRuntimeException
+ {
+ return null;
+ }
+
+ @Override
+ public Collection<String> listProjectVersions( String repoId, String namespace, String projectId,
+ Filter<String> filter )
+ throws RepositoryStorageRuntimeException
+ {
+ return null;
+ }
+
+ @Override
+ public Collection<ArtifactMetadata> readArtifactsMetadata( ReadMetadataRequest readMetadataRequest )
+ throws RepositoryStorageRuntimeException
+ {
+ return null;
+ }
+
+ @Override
+ public ArtifactMetadata readArtifactMetadataFromPath( String repoId, String path )
+ throws RepositoryStorageRuntimeException
+ {
+ return null;
+ }
+
+ @Override
+ public void applyServerSideRelocation( ManagedRepositoryContent managedRepository, ArtifactReference artifact )
+ throws ProxyDownloadException
+ {
+
+ }
+
+ @Override
+ public String getFilePath( String requestPath, ManagedRepository managedRepository )
+ {
+ return null;
+ }
+
+ @Override
+ public String getFilePathWithVersion( String requestPath, ManagedRepositoryContent managedRepositoryContent )
+ throws RelocationException, XMLException
+ {
+ return null;
+ }
+
+ @Override
+ public void deleteArtifact( MetadataRepository metadataRepository, String repositoryId, String namespace,
+ String project, String version, String id )
+ {
+
+ }
+
+ @Override
+ public void addArtifact( RepositorySession session, String repoId, String namespace, String projectId,
+ ProjectVersionMetadata metadata )
+ {
+
+ }
+
+ @Override
+ public void addArtifactProblem( RepositorySession session, String repoId, String namespace, String projectId,
+ String projectVersion, RepositoryStorageMetadataException exception )
+ {
+
+ }
+}
diff --git a/archiva-modules/plugins/metadata-store-file/pom.xml b/archiva-modules/plugins/metadata-store-file/pom.xml
index a908d60dd..e7906dae0 100644
--- a/archiva-modules/plugins/metadata-store-file/pom.xml
+++ b/archiva-modules/plugins/metadata-store-file/pom.xml
@@ -113,6 +113,15 @@
</instructions>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemPropertyVariables>
+ <archiva.repositorySessionFactory.id>file</archiva.repositorySessionFactory.id>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
</plugins>
</build>
</project>