Moving methods to content helper and adding unit tests

This commit is contained in:
Martin Stockhammer 2020-03-06 18:41:57 +01:00
parent 939d127869
commit cffd5477a9
7 changed files with 378 additions and 155 deletions

View File

@ -28,10 +28,8 @@ import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
import org.apache.archiva.metadata.repository.storage.maven2.ArtifactMappingProvider;
import org.apache.archiva.metadata.repository.storage.maven2.DefaultArtifactMappingProvider;
import org.apache.archiva.model.ArchivaArtifact;
import org.apache.archiva.model.ArchivaRepositoryMetadata;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.model.ProjectReference;
import org.apache.archiva.model.SnapshotVersion;
import org.apache.archiva.model.VersionedReference;
import org.apache.archiva.repository.ContentAccessException;
import org.apache.archiva.repository.ContentNotFoundException;
@ -50,7 +48,6 @@ import org.apache.archiva.repository.content.base.ArchivaNamespace;
import org.apache.archiva.repository.content.base.ArchivaProject;
import org.apache.archiva.repository.content.base.ArchivaVersion;
import org.apache.archiva.repository.content.base.builder.ArtifactOptBuilder;
import org.apache.archiva.repository.metadata.RepositoryMetadataException;
import org.apache.archiva.repository.storage.RepositoryStorage;
import org.apache.archiva.repository.storage.StorageAsset;
import org.apache.archiva.repository.storage.util.StorageUtil;
@ -60,13 +57,11 @@ import org.apache.commons.lang3.StringUtils;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.IOException;
import java.net.Socket;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
@ -104,6 +99,10 @@ public class ManagedDefaultRepositoryContent
@Named( "metadataReader#maven" )
MavenMetadataReader metadataReader;
@Inject
@Named( "MavenContentHelper" )
MavenContentHelper mavenContentHelper;
public static final String SNAPSHOT = "SNAPSHOT";
public static final Pattern UNIQUE_SNAPSHOT_PATTERN = Pattern.compile( "^(SNAPSHOT|[0-9]{8}\\.[0-9]{6}-[0-9]+)(.*)" );
@ -123,6 +122,10 @@ public class ManagedDefaultRepositoryContent
private ReferenceMap<StorageAsset, Version> versionMap = new ReferenceMap<>( );
private ReferenceMap<StorageAsset, Artifact> artifactMap = new ReferenceMap<>( );
public ManagedDefaultRepositoryContent() {
super(Collections.singletonList( new DefaultArtifactMappingProvider() ));
}
public ManagedDefaultRepositoryContent(ManagedRepository repository, FileTypes fileTypes, FileLockManager lockManager) {
super(Collections.singletonList( new DefaultArtifactMappingProvider() ));
setFileTypes( fileTypes );
@ -203,12 +206,16 @@ public class ManagedDefaultRepositoryContent
}
}
private StorageAsset getAssetByPath(String assetPath) {
return getStorage( ).getAsset( assetPath );
}
private StorageAsset getAsset(String namespace) {
String namespacePath = formatAsDirectory( namespace.trim() );
if (StringUtils.isEmpty( namespacePath )) {
namespacePath = "";
}
return getAsset(namespacePath);
return getAssetByPath(namespacePath);
}
private StorageAsset getAsset(String namespace, String project) {
@ -270,141 +277,14 @@ public class ManagedDefaultRepositoryContent
}
/*
*/
private String getArtifactFileName(ItemSelector selector, String artifactVersion,
String classifier, String extension) {
StringBuilder fileName = new StringBuilder( selector.getArtifactId() ).append( "-" );
fileName.append( artifactVersion );
if ( !StringUtils.isEmpty( classifier ) )
{
fileName.append( "-" ).append( classifier );
}
fileName.append( "." ).append( extension );
return fileName.toString( );
}
private String getClassifier(ItemSelector selector) {
if (selector.hasClassifier()) {
return selector.getClassifier();
} else if (selector.hasType()) {
return getClassifierFromType( selector.getType( ) );
} else {
return "";
}
}
private String getClassifierFromType(final String type) {
if ("pom".equalsIgnoreCase(type) || "jar".equalsIgnoreCase( type )
|| "maven-plugin".equalsIgnoreCase( type )
|| "ejb".equalsIgnoreCase( type )
|| "ear".equalsIgnoreCase( type )
|| "war".equalsIgnoreCase( type )
|| "rar".equalsIgnoreCase( type )
) return "";
if ("test-jar".equalsIgnoreCase( type )) {
return "tests";
} else if ("ejb-client".equalsIgnoreCase( type )) {
return "client";
} else if ("java-source".equalsIgnoreCase( type )) {
return "sources";
} else if ("javadoc".equalsIgnoreCase( type )) {
return "javadoc";
} else {
return "";
}
}
private String getTypeFromClassifierAndExtension(String classifierArg, String extensionArg) {
String extension = extensionArg.toLowerCase( ).trim( );
String classifier = classifierArg.toLowerCase( ).trim( );
if (StringUtils.isEmpty( extension )) {
return "";
} else if (StringUtils.isEmpty( classifier ) ) {
return extension;
} else if (classifier.equals("tests") && extension.equals("jar")) {
return "test-jar";
} else if (classifier.equals("client") && extension.equals( "jar" )) {
return "ejb-client";
} else if (classifier.equals("source") && extension.equals("jar")) {
return "java-source";
} else if (classifier.equals("javadoc") && extension.equals( "jar" )) {
return "javadoc";
} else {
return extension;
}
}
private String getArtifactExtension(ItemSelector selector) {
if (selector.hasExtension()) {
return selector.getExtension( );
} else if (selector.hasType()) {
String type = selector.getType( ).toLowerCase( );
if ("test-jar".equals( type )) {
return "jar";
} else if ("ejb-client".equals( type )) {
return "jar";
} else if ("java-source".equals( type )) {
return "jar";
} else if ("javadoc".equals( type )) {
return "jar";
} else {
return "jar";
}
} else {
return "jar";
}
}
/*
TBD
*/
private String getArtifactVersion(StorageAsset artifactDir, ItemSelector selector) {
if (selector.hasArtifactVersion()) {
return selector.getArtifactVersion();
} else if (selector.hasVersion()) {
if ( VersionUtil.isGenericSnapshot( selector.getVersion() ) ) {
return getArtifactSnapshotVersion( artifactDir, selector.getVersion( ) );
} else {
return selector.getVersion( );
}
} else {
throw new IllegalArgumentException( "No version set on the selector " );
}
}
private String getArtifactSnapshotVersion(StorageAsset artifactDir, String snapshotVersion) {
final StorageAsset metadataFile = artifactDir.resolve( METADATA_FILENAME );
StringBuilder version = new StringBuilder( );
try
{
ArchivaRepositoryMetadata metadata = metadataReader.read( metadataFile );
// re-adjust to timestamp if present, otherwise retain the original -SNAPSHOT filename
SnapshotVersion metadataVersion = metadata.getSnapshotVersion( );
if ( metadataVersion != null )
{
version.append( snapshotVersion, 0, snapshotVersion.length( ) - 8 ); // remove SNAPSHOT from end
version.append( metadataVersion.getTimestamp( )).append("-").append( metadataVersion.getBuildNumber( ) );
}
return version.toString( );
}
catch ( RepositoryMetadataException e )
{
// unable to parse metadata - LOGGER it, and continue with the version as the original SNAPSHOT version
log.warn( "Invalid metadata: {} - {}", metadataFile, e.getMessage( ) );
return snapshotVersion;
}
}
private Artifact createArtifact(final StorageAsset artifactPath, final ItemSelector selector,
public Artifact createArtifact(final StorageAsset artifactPath, final ItemSelector selector,
final String classifier, final String extension) {
Version version = getVersion(selector);
ArtifactOptBuilder builder = org.apache.archiva.repository.content.base.ArchivaArtifact.withAsset( artifactPath )
.withVersion( version )
.withId( selector.getArtifactId( ) )
.withArtifactVersion( getArtifactVersion( artifactPath, selector ) )
.withArtifactVersion( mavenContentHelper.getArtifactVersion( artifactPath, selector ) )
.withClassifier( classifier );
if (selector.hasType()) {
builder.withType( selector.getType( ) );
@ -412,18 +292,9 @@ public class ManagedDefaultRepositoryContent
return builder.build( );
}
private String getNamespaceFromNamespacePath(final StorageAsset namespacePath) {
LinkedList<String> names = new LinkedList<>( );
StorageAsset current = namespacePath;
while (current.hasParent()) {
names.addFirst( current.getName() );
}
return String.join( ".", names );
}
private Namespace getNamespaceFromArtifactPath( final StorageAsset artifactPath) {
public Namespace getNamespaceFromArtifactPath( final StorageAsset artifactPath) {
final StorageAsset namespacePath = artifactPath.getParent( ).getParent( ).getParent( );
final String namespace = getNamespaceFromNamespacePath( namespacePath );
final String namespace = MavenContentHelper.getNamespaceFromNamespacePath( namespacePath );
return namespaceMap.computeIfAbsent( namespace,
myNamespace -> ArchivaNamespace.withRepository( this )
.withAsset( namespacePath )
@ -474,7 +345,7 @@ public class ManagedDefaultRepositoryContent
if (projectMap.containsKey( itemPath )) {
return projectMap.get( itemPath );
}
String ns = getNamespaceFromNamespacePath( itemPath );
String ns = MavenContentHelper.getNamespaceFromNamespacePath( itemPath );
if (namespaceMap.containsKey( ns )) {
return namespaceMap.get( ns );
}
@ -603,7 +474,7 @@ public class ManagedDefaultRepositoryContent
}
}
info.extension = StringUtils.substringAfterLast( fileName, "." );
info.type = getTypeFromClassifierAndExtension( info.classifier, info.extension );
info.type = MavenContentHelper.getTypeFromClassifierAndExtension( info.classifier, info.extension );
try {
info.contentType = Files.probeContentType( path.getFilePath( ) );
} catch (IOException e) {
@ -628,10 +499,10 @@ public class ManagedDefaultRepositoryContent
}
final StorageAsset artifactDir = getAsset(selector.getNamespace(), selector.getProjectId(),
selector.getVersion());
final String artifactVersion = getArtifactVersion( artifactDir, selector );
final String classifier = getClassifier( selector );
final String extension = getArtifactExtension( selector );
final String fileName = getArtifactFileName( selector, artifactVersion, classifier, extension );
final String artifactVersion = mavenContentHelper.getArtifactVersion( artifactDir, selector );
final String classifier = MavenContentHelper.getClassifier( selector );
final String extension = MavenContentHelper.getArtifactExtension( selector );
final String fileName = MavenContentHelper.getArtifactFileName( selector, artifactVersion, classifier, extension );
final StorageAsset path = getAsset( selector.getNamespace( ), selector.getProjectId( ),
selector.getVersion( ), fileName );
return artifactMap.computeIfAbsent( path, artifactPath -> createArtifact( path, selector, classifier, extension ) );
@ -668,14 +539,14 @@ public class ManagedDefaultRepositoryContent
final String pattern = "."+selector.getExtension( );
p = p.and( a -> StringUtils.endsWithIgnoreCase( a.getName( ), pattern ) );
} else if (selector.hasType()) {
final String pattern = "."+getArtifactExtension( selector );
final String pattern = "."+ MavenContentHelper.getArtifactExtension( selector );
p = p.and( a -> StringUtils.endsWithIgnoreCase( a.getName( ), pattern ) );
}
if (selector.hasClassifier()) {
final String pattern = "-" + selector.getClassifier( ) + ".";
p = p.and( a -> StringUtils.containsIgnoreCase( a.getName( ), pattern ) );
} else if (selector.hasType()) {
final String pattern = "-" + getClassifierFromType( selector.getType( ) ) + ".";
final String pattern = "-" + MavenContentHelper.getClassifierFromType( selector.getType( ) ) + ".";
p = p.and( a -> StringUtils.containsIgnoreCase( a.getName( ).toLowerCase( ), pattern ) );
}
return p;
@ -1335,5 +1206,9 @@ public class ManagedDefaultRepositoryContent
this.filetypes = filetypes;
}
public void setMavenContentHelper( MavenContentHelper contentHelper) {
this.mavenContentHelper = contentHelper;
}
}

View File

@ -0,0 +1,287 @@
package org.apache.archiva.repository.content.maven2;
/*
* 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.common.utils.VersionUtil;
import org.apache.archiva.maven2.metadata.MavenMetadataReader;
import org.apache.archiva.model.ArchivaRepositoryMetadata;
import org.apache.archiva.model.SnapshotVersion;
import org.apache.archiva.repository.content.ItemSelector;
import org.apache.archiva.repository.metadata.RepositoryMetadataException;
import org.apache.archiva.repository.storage.StorageAsset;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.LinkedList;
/**
* Helper class that contains certain maven specific methods
*/
@Service( "MavenContentHelper" )
public class MavenContentHelper
{
private static final Logger log = LoggerFactory.getLogger( MavenContentHelper.class );
@Inject
@Named( "metadataReader#maven" )
MavenMetadataReader metadataReader;
public static final String METADATA_FILENAME = "maven-metadata.xml";
public MavenContentHelper() {
}
/**
* Returns the namespace string for a given path in the repository
*
* @param namespacePath the path to the namespace in the directory
* @return the namespace string that matches the given path.
*/
public static String getNamespaceFromNamespacePath( final StorageAsset namespacePath) {
LinkedList<String> names = new LinkedList<>( );
StorageAsset current = namespacePath;
while (current.hasParent()) {
names.addFirst( current.getName() );
}
return String.join( ".", names );
}
/**
* Returns the artifact version for the given artifact directory and the item selector
*/
public String getArtifactVersion( StorageAsset artifactDir, ItemSelector selector) {
if (selector.hasArtifactVersion()) {
return selector.getArtifactVersion();
} else if (selector.hasVersion()) {
if ( VersionUtil.isGenericSnapshot( selector.getVersion() ) ) {
return getLatestArtifactSnapshotVersion( artifactDir, selector.getVersion( ) );
} else {
return selector.getVersion( );
}
} else {
throw new IllegalArgumentException( "No version set on the selector " );
}
}
/**
*
* Returns the latest snapshot version that is referenced by the metadata file.
*
* @param artifactDir the directory of the artifact
* @param snapshotVersion the generic snapshot version (must end with '-SNAPSHOT')
* @return the real version from the metadata
*/
public String getLatestArtifactSnapshotVersion( StorageAsset artifactDir, String snapshotVersion) {
final StorageAsset metadataFile = artifactDir.resolve( METADATA_FILENAME );
StringBuilder version = new StringBuilder( );
try
{
ArchivaRepositoryMetadata metadata = metadataReader.read( metadataFile );
// re-adjust to timestamp if present, otherwise retain the original -SNAPSHOT filename
SnapshotVersion metadataVersion = metadata.getSnapshotVersion( );
if ( metadataVersion != null )
{
version.append( snapshotVersion, 0, snapshotVersion.length( ) - 8 ); // remove SNAPSHOT from end
version.append( metadataVersion.getTimestamp( )).append("-").append( metadataVersion.getBuildNumber( ) );
}
return version.toString( );
}
catch ( RepositoryMetadataException e )
{
// unable to parse metadata - LOGGER it, and continue with the version as the original SNAPSHOT version
log.warn( "Invalid metadata: {} - {}", metadataFile, e.getMessage( ) );
return snapshotVersion;
}
}
/**
* Returns a artifact filename that corresponds to the given data.
* @param selector the selector data
* @param artifactVersion the artifactVersion
* @param classifier the artifact classifier
* @param extension the file extension
*/
static String getArtifactFileName( ItemSelector selector, String artifactVersion,
String classifier, String extension )
{
StringBuilder fileName = new StringBuilder( selector.getArtifactId( ) ).append( "-" );
fileName.append( artifactVersion );
if ( !StringUtils.isEmpty( classifier ) )
{
fileName.append( "-" ).append( classifier );
}
fileName.append( "." ).append( extension );
return fileName.toString( );
}
/**
* Returns the classifier for a given selector. If the selector has no classifier, but
* a type set. The classifier is generated from the type.
*
* @param selector the artifact selector
* @return the classifier or empty string if no classifier was found
*/
static String getClassifier( ItemSelector selector )
{
if ( selector.hasClassifier( ) )
{
return selector.getClassifier( );
}
else if ( selector.hasType( ) )
{
return getClassifierFromType( selector.getType( ) );
}
else
{
return "";
}
}
/**
* Returns a classifier for a given type. It returns only classifier for the maven default types
* that are known.
*
* @param type the type of the artifact
* @return the classifier if one was found, otherwise a empty string
*/
static String getClassifierFromType( final String type )
{
if ( "pom".equalsIgnoreCase( type ) || "jar".equalsIgnoreCase( type )
|| "maven-plugin".equalsIgnoreCase( type )
|| "ejb".equalsIgnoreCase( type )
|| "ear".equalsIgnoreCase( type )
|| "war".equalsIgnoreCase( type )
|| "rar".equalsIgnoreCase( type )
) return "";
if ( "test-jar".equalsIgnoreCase( type ) )
{
return "tests";
}
else if ( "ejb-client".equalsIgnoreCase( type ) )
{
return "client";
}
else if ( "java-source".equalsIgnoreCase( type ) )
{
return "sources";
}
else if ( "javadoc".equalsIgnoreCase( type ) )
{
return "javadoc";
}
else
{
return "";
}
}
/**
* Returns the type that matches the given classifier and extension
*
* @param classifierArg the classifier
* @param extensionArg the extension
* @return the type that matches the combination of classifier and extension
*/
static String getTypeFromClassifierAndExtension( String classifierArg, String extensionArg )
{
String extension = extensionArg.toLowerCase( ).trim( );
String classifier = classifierArg.toLowerCase( ).trim( );
if ( StringUtils.isEmpty( extension ) )
{
return "";
}
else if ( StringUtils.isEmpty( classifier ) )
{
return extension;
}
else if ( classifier.equals( "tests" ) && extension.equals( "jar" ) )
{
return "test-jar";
}
else if ( classifier.equals( "client" ) && extension.equals( "jar" ) )
{
return "ejb-client";
}
else if ( classifier.equals( "source" ) && extension.equals( "jar" ) )
{
return "java-source";
}
else if ( classifier.equals( "javadoc" ) && extension.equals( "jar" ) )
{
return "javadoc";
}
else
{
return extension;
}
}
/**
* If the selector defines a type and no extension, the extension can be derived from
* the type.
*
* @param selector the item selector
* @return the extension that matches the type or the default extension "jar" if the type is not known
*/
static String getArtifactExtension( ItemSelector selector )
{
if ( selector.hasExtension( ) )
{
return selector.getExtension( );
}
else if ( selector.hasType( ) )
{
String type = selector.getType( ).toLowerCase( );
if ( "test-jar".equals( type ) )
{
return "jar";
}
else if ( "ejb-client".equals( type ) )
{
return "jar";
}
else if ( "java-source".equals( type ) )
{
return "jar";
}
else if ( "javadoc".equals( type ) )
{
return "jar";
}
else
{
return "jar";
}
}
else
{
return "jar";
}
}
}

View File

@ -99,4 +99,5 @@ public class RemoteDefaultRepositoryContent
String url = repository.getLocation( ) + toPath( reference );
return new RepositoryURL( url );
}
}

View File

@ -22,7 +22,12 @@ package org.apache.archiva.metadata.repository.storage.maven2;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.repository.AbstractRepositoryLayerTestCase;
import org.apache.archiva.repository.LayoutException;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.content.Artifact;
import org.apache.archiva.repository.content.ItemSelector;
import org.apache.archiva.repository.content.Namespace;
import org.apache.archiva.repository.content.Project;
import org.apache.archiva.repository.content.Version;
import org.apache.archiva.repository.content.base.ArchivaItemSelector;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
@ -542,6 +547,38 @@ public abstract class AbstractDefaultRepositoryContentTestCase
// And back again, using test Reference from previous step.
assertEquals( "Artifact <" + expectedArtifact + "> to path:", path, toPath( testReference ) );
if (getManaged()!=null)
{
Namespace ns = null;
Project pr = null;
Version ver = null;
if ( StringUtils.isNotEmpty( groupId ) )
{
ns = getManaged( ).getNamespace( expectedArtifact );
assertNotNull( ns );
assertEquals( groupId, ns.getNamespace( ) );
}
if ( StringUtils.isNotEmpty( artifactId ) )
{
pr = getManaged( ).getProject( expectedArtifact );
assertNotNull( pr );
assertEquals( artifactId, pr.getId( ) );
assertEquals( ns, pr.getNamespace( ) );
}
if ( StringUtils.isNotEmpty( version ) )
{
ver = getManaged( ).getVersion( expectedArtifact );
assertNotNull( ver );
assertEquals( version, ver.getVersion( ) );
assertEquals( pr, ver.getProject( ) );
}
Artifact artifact = getManaged( ).getArtifact( expectedArtifact );
assertNotNull( artifact );
assertEquals( artifactId, artifact.getId( ) );
assertEquals( ver, artifact.getVersion( ) );
}
}
protected ArtifactReference createArtifact( String groupId, String artifactId, String version, String classifier,
@ -560,6 +597,7 @@ public abstract class AbstractDefaultRepositoryContentTestCase
protected ItemSelector createItemSelector(String groupId, String artifactId, String version, String classifier,
String type) {
return ArchivaItemSelector.builder( ).withNamespace( groupId )
.withProjectId( artifactId )
.withArtifactId( artifactId )
.withVersion( version )
.withClassifier( classifier )
@ -577,4 +615,6 @@ public abstract class AbstractDefaultRepositoryContentTestCase
protected abstract String toPath( ItemSelector selector );
protected abstract ItemSelector toItemSelector(String path) throws LayoutException;
protected abstract ManagedRepositoryContent getManaged();
}

View File

@ -29,8 +29,10 @@ import org.apache.archiva.model.ProjectReference;
import org.apache.archiva.model.VersionedReference;
import org.apache.archiva.repository.EditableManagedRepository;
import org.apache.archiva.repository.LayoutException;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.content.ItemSelector;
import org.apache.archiva.repository.content.maven2.ManagedDefaultRepositoryContent;
import org.apache.archiva.repository.content.maven2.MavenContentHelper;
import org.apache.archiva.repository.maven2.MavenManagedRepository;
import org.apache.commons.io.FileUtils;
import org.junit.Before;
@ -69,6 +71,9 @@ public class ManagedDefaultRepositoryContentTest
@Inject
List<? extends ArtifactMappingProvider> artifactMappingProviders;
@Inject
MavenContentHelper contentHelper;
@Inject
FileLockManager fileLockManager;
@ -98,6 +103,8 @@ public class ManagedDefaultRepositoryContentTest
fileTypes.afterConfigurationChange( null, "fileType", null );
repoContent = new ManagedDefaultRepositoryContent(repository, artifactMappingProviders, fileTypes, fileLockManager);
repoContent.setMavenContentHelper( contentHelper );
//repoContent = (ManagedRepositoryContent) lookup( ManagedRepositoryContent.class, "default" );
}
@ -271,6 +278,12 @@ public class ManagedDefaultRepositoryContentTest
return repoContent.toPath( selector );
}
@Override
protected ManagedRepositoryContent getManaged( )
{
return repoContent;
}
private Path setupRepoCopy( String source, String target) throws IOException
{
Path defaultRepo = getRepositoryPath( source );

View File

@ -21,6 +21,7 @@ package org.apache.archiva.metadata.repository.storage.maven2;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.repository.LayoutException;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.RemoteRepository;
import org.apache.archiva.repository.RemoteRepositoryContent;
import org.apache.archiva.repository.content.ItemSelector;
@ -67,6 +68,12 @@ public class RemoteDefaultRepositoryContentTest
return repoContent.toItemSelector( path );
}
@Override
protected ManagedRepositoryContent getManaged( )
{
return null;
}
@Override
protected String toPath( ArtifactReference reference )
{

View File

@ -27,7 +27,7 @@
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:annotation-config/>
<context:component-scan base-package="org.apache.archiva.metadata.repository.storage.maven2.conf,org.apache.archiva.repository.content.maven2,org.apache.archiva.repository.maven2.util"/>
<context:component-scan base-package="org.apache.archiva.metadata.repository.storage.maven2.conf,org.apache.archiva.repository.content.maven2,org.apache.archiva.repository.maven2"/>