aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-maven
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2020-06-07 11:12:29 +0200
committerMartin Stockhammer <martin_s@apache.org>2020-06-07 11:12:29 +0200
commitdda90e3302715b65f0d0908e1997e7aaf32b6242 (patch)
tree94c34e7a1928a48b8d75188dc5c1534f1862bb85 /archiva-modules/archiva-maven
parent311fe09dd61c4ac09789ed052006395e5df02785 (diff)
downloadarchiva-dda90e3302715b65f0d0908e1997e7aaf32b6242.tar.gz
archiva-dda90e3302715b65f0d0908e1997e7aaf32b6242.zip
Moving proxy to new repository API
Diffstat (limited to 'archiva-modules/archiva-maven')
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/CacheFailuresTransferTest.java6
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java14
-rw-r--r--archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/content/ManagedDefaultRepositoryContent.java13
3 files changed, 17 insertions, 16 deletions
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/CacheFailuresTransferTest.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/CacheFailuresTransferTest.java
index 5afb561e3..4f6019336 100644
--- a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/CacheFailuresTransferTest.java
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/CacheFailuresTransferTest.java
@@ -27,6 +27,7 @@ import org.apache.archiva.policies.ReleasesPolicy;
import org.apache.archiva.policies.SnapshotsPolicy;
import org.apache.archiva.policies.urlcache.UrlFailureCache;
import org.apache.archiva.repository.BaseRepositoryContentLayout;
+import org.apache.archiva.repository.content.Artifact;
import org.apache.archiva.repository.storage.StorageAsset;
import org.apache.maven.wagon.ResourceDoesNotExistException;
import org.easymock.EasyMock;
@@ -64,7 +65,8 @@ public class CacheFailuresTransferTest
assertNotExistsInManagedDefaultRepo( expectedFile );
BaseRepositoryContentLayout layout = managedDefaultRepository.getLayout( BaseRepositoryContentLayout.class );
- ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+ Artifact artifact = layout.getArtifact( path );
+ // ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
// Configure Repository (usually done within archiva.xml configuration)
saveRemoteRepositoryConfig( "badproxied1", "Bad Proxied 1", "http://bad.machine.com/repo/", "default" );
@@ -109,7 +111,7 @@ public class CacheFailuresTransferTest
assertNotExistsInManagedDefaultRepo( expectedFile );
BaseRepositoryContentLayout layout = managedDefaultRepository.getLayout( BaseRepositoryContentLayout.class );
- ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path );
+ Artifact artifact = layout.getArtifact( path );
// Configure Repository (usually done within archiva.xml configuration)
saveRemoteRepositoryConfig( "badproxied1", "Bad Proxied 1", "http://bad.machine.com/repo/", "default" );
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java
index c59bfad45..7048470d8 100644
--- a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java
+++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/repository/mock/ManagedRepositoryContentMock.java
@@ -174,7 +174,19 @@ public class ManagedRepositoryContentMock implements BaseRepositoryContentLayout
@Override
public Artifact getArtifact( String path ) throws LayoutException, ContentAccessException
{
- return null;
+ StorageAsset asset = fsStorage.getAsset( path.toString( ) );
+ String artifactId = asset.getName( );
+ StorageAsset namespacePath = asset.getParent( ).getParent( ).getParent( );
+ String namespaceId = namespacePath.getPath( ).replace( "/", "." );
+ StorageAsset projectPath = asset.getParent( ).getParent( );
+ String projectId = projectPath.getName( );
+ StorageAsset versionPath = asset.getParent( );
+ String versionId = versionPath.getName( );
+ ArchivaNamespace ns = ArchivaNamespace.withRepository( repository.getContent( ) ).withAsset( namespacePath ).withNamespace( namespaceId ).build( );
+ ArchivaProject project = ArchivaProject.withRepository( repository.getContent( ) ).withAsset( projectPath ).withNamespace( ns ).withId( projectId ).build( );
+ ArchivaVersion version = ArchivaVersion.withRepository( repository.getContent( ) ).withAsset( versionPath ).withProject( project ).withVersion( versionId ).build( );
+ ArchivaArtifact artifact = ArchivaArtifact.withAsset( asset ).withVersion( version ).withId( projectId ).withArtifactVersion( versionId ).build( );
+ return artifact;
}
@Override
diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/content/ManagedDefaultRepositoryContent.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/content/ManagedDefaultRepositoryContent.java
index 319eaa700..eedd3663f 100644
--- a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/content/ManagedDefaultRepositoryContent.java
+++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/maven/content/ManagedDefaultRepositoryContent.java
@@ -1627,19 +1627,6 @@ public class ManagedDefaultRepositoryContent
}
- // The variant with runtime exception for stream usage
- private ArtifactReference toArtifactRef( String path )
- {
- try
- {
- return toArtifactReference( path );
- }
- catch ( LayoutException e )
- {
- throw new RuntimeException( e );
- }
- }
-
public void setFiletypes( FileTypes filetypes )
{
this.filetypes = filetypes;