diff options
author | Martin Stockhammer <martin_s@apache.org> | 2020-06-02 22:53:18 +0200 |
---|---|---|
committer | Martin Stockhammer <martin_s@apache.org> | 2020-06-02 22:53:18 +0200 |
commit | 873753536bbc1cd1639016ae845625f631f3cff1 (patch) | |
tree | 0345e0a67b08ceae743a8a8fb8e7db5772a9dceb /archiva-modules/archiva-maven/archiva-maven-proxy/src | |
parent | 22a8cbfd22c8cfb33a8d4e3e82cf22a7c03df68b (diff) | |
download | archiva-873753536bbc1cd1639016ae845625f631f3cff1.tar.gz archiva-873753536bbc1cd1639016ae845625f631f3cff1.zip |
Switching to new repository layout
Diffstat (limited to 'archiva-modules/archiva-maven/archiva-maven-proxy/src')
2 files changed, 15 insertions, 3 deletions
diff --git a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/SnapshotTransferTest.java b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/SnapshotTransferTest.java index e15bbfb1d..291e0a914 100644 --- a/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/SnapshotTransferTest.java +++ b/archiva-modules/archiva-maven/archiva-maven-proxy/src/test/java/org/apache/archiva/proxy/SnapshotTransferTest.java @@ -34,8 +34,7 @@ import java.nio.file.Paths; import java.nio.file.attribute.FileTime; import java.util.concurrent.TimeUnit; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; /** * SnapshotTransferTest @@ -314,6 +313,7 @@ public class SnapshotTransferTest StorageAsset downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository.getRepository(), artifact ); Path proxiedFile = Paths.get(REPOPATH_PROXIED1, path); + assertNotNull( downloadedFile ); assertFileEquals( expectedFile, downloadedFile.getFilePath(), proxiedFile ); assertNoTempFiles( expectedFile ); } @@ -333,6 +333,7 @@ public class SnapshotTransferTest BaseRepositoryContentLayout layout = managedDefaultRepository.getLayout( BaseRepositoryContentLayout.class ); ArtifactReference artifact = managedDefaultRepository.toArtifactReference( path ); + artifact.setProjectVersion( "1.0-SNAPSHOT" ); assertTrue( Files.exists(expectedFile) ); @@ -344,6 +345,7 @@ public class SnapshotTransferTest StorageAsset downloadedFile = proxyHandler.fetchFromProxies( managedDefaultRepository.getRepository(), artifact ); Path proxiedFile = Paths.get(REPOPATH_PROXIED1, path); + assertNotNull( downloadedFile ); assertFileEquals( expectedFile, downloadedFile.getFilePath(), proxiedFile ); assertNoTempFiles( expectedFile ); } 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 e49c913c7..970645139 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 @@ -36,6 +36,7 @@ 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.ArchivaArtifact; import org.apache.archiva.repository.content.base.ArchivaContentItem; import org.apache.archiva.repository.content.base.ArchivaDataItem; import org.apache.archiva.repository.content.base.ArchivaNamespace; @@ -173,7 +174,15 @@ public class ManagedRepositoryContentMock implements BaseRepositoryContentLayout @Override public Artifact getArtifact( ItemSelector selector ) throws ContentAccessException { - return null; + StringBuilder path = new StringBuilder(selector.getNamespace( ).replace( ".", "/" )); + path.append( "/" ).append( selector.getProjectId( ) ).append( "/" ).append( selector.getVersion( ) ); + path.append( "/" ).append( selector.getArtifactId( ) ).append( "-" ).append( selector.getArtifactVersion( ) ).append( "." ).append( selector.getType( ) ); + StorageAsset asset = fsStorage.getAsset( path.toString( ) ); + ArchivaNamespace ns = ArchivaNamespace.withRepository( repository.getContent( ) ).withAsset( asset.getParent( ).getParent( ).getParent( ) ).withNamespace( selector.getNamespace( ) ).build( ); + ArchivaProject project = ArchivaProject.withRepository( repository.getContent( ) ).withAsset( asset.getParent( ).getParent( ) ).withNamespace( ns ).withId( selector.getProjectId( ) ).build( ); + ArchivaVersion version = ArchivaVersion.withRepository( repository.getContent( ) ).withAsset( asset.getParent( ) ).withProject( project ).withVersion( selector.getVersion( ) ).build( ); + ArchivaArtifact artifact = ArchivaArtifact.withAsset( asset ).withVersion( version ).withId( selector.getArtifactId( ) ).withArtifactVersion( selector.getArtifactVersion( ) ).withType( selector.getType( ) ).build( ); + return artifact; } @Override @@ -424,6 +433,7 @@ public class ManagedRepositoryContentMock implements BaseRepositoryContentLayout artifact.setGroupId( metadata.getNamespace() ); artifact.setArtifactId( metadata.getProject() ); artifact.setVersion( metadata.getVersion() ); + artifact.setProjectVersion( metadata.getProjectVersion( ) ); MavenArtifactFacet facet = (MavenArtifactFacet) metadata.getFacet( MavenArtifactFacet.FACET_ID ); if ( facet != null ) { |