From 9ebf8c88809bbe9c689a0a4ac5628f92f49f152e Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sat, 3 Aug 2019 16:02:09 +0200 Subject: [PATCH] Fixing Unit Tests --- .../services/AbstractArchivaRestTest.java | 77 ++++++++++++------- .../rest/services/BrowseServiceTest.java | 2 +- .../ManagedRepositoriesServiceTest.java | 5 +- .../MergeRepositoriesServiceTest.java | 23 ++++-- .../services/RepositoriesServiceTest.java | 26 +++---- .../rest/services/SearchServiceTest.java | 4 +- .../webdav/ArchivaDavResourceFactory.java | 2 +- 7 files changed, 84 insertions(+), 55 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java index 2d1754cae..f13336582 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java @@ -21,7 +21,6 @@ package org.apache.archiva.rest.services; import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider; import org.apache.archiva.admin.model.beans.ManagedRepository; -import org.apache.archiva.common.utils.PathUtil; import org.apache.archiva.redback.rest.api.services.RedbackServiceException; import org.apache.archiva.redback.rest.services.AbstractRestServicesTest; import org.apache.archiva.rest.api.services.ArchivaAdministrationService; @@ -54,11 +53,11 @@ import org.junit.runner.RunWith; import org.slf4j.LoggerFactory; import javax.ws.rs.core.MediaType; -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.time.LocalTime; import java.util.Collections; import java.util.Date; import java.util.Locale; @@ -71,7 +70,10 @@ import java.util.concurrent.atomic.AtomicReference; public abstract class AbstractArchivaRestTest extends AbstractRestServicesTest { - private AtomicReference buildDir = new AtomicReference<>(); + private AtomicReference projectDir = new AtomicReference<>(); + private AtomicReference appServerBase = new AtomicReference<>( ); + private AtomicReference basePath = new AtomicReference<>( ); + private boolean reuseServer = true; @@ -96,13 +98,24 @@ public abstract class AbstractArchivaRestTest // END SNIPPET: authz-header + Path getAppserverBase() { + if (appServerBase.get()==null) { + String basePath = System.getProperty( "appserver.base" ); + final Path appserverPath; + if (StringUtils.isNotEmpty( basePath )) { + appserverPath = Paths.get( basePath ).toAbsolutePath( ); + } else { + appserverPath = getBasedir( ).resolve( "target" ).resolve( "appserver-base-" + LocalTime.now( ).toSecondOfDay( ) ); + } + appServerBase.compareAndSet( null, appserverPath ); + } + return appServerBase.get(); + } @BeforeClass public static void checkRepo() { - Assume.assumeTrue( !System.getProperty( "appserver.base" ).contains( " " ) ); - LoggerFactory.getLogger( AbstractArchivaRestTest.class.getName() ). - error( "Rest services unit test must be run in a folder with no space" ); + Assume.assumeFalse("Test is ignored, because path to appserver contains whitespace characters!", System.getProperty( "appserver.base" ).contains( " " ) ); // skygo: was not possible to fix path in this particular module // Skip test if not in proper folder , otherwise test are not fair coz repository // cannot have space in their name. @@ -115,7 +128,7 @@ public abstract class AbstractArchivaRestTest { if ( (!isReuseServer()) || (isReuseServer() && !isServerRunning())) { log.info("Starting new server reuse={}, running={}, instance={}, server={}", isReuseServer(), isServerRunning(), this.hashCode(), getServer()==null ? "" : getServer().hashCode()); - Path appServerBase = Paths.get(System.getProperty("appserver.base")); + Path appServerBase = getAppserverBase( ); removeAppsubFolder(appServerBase, "jcr"); removeAppsubFolder(appServerBase, "conf"); @@ -370,7 +383,7 @@ public abstract class AbstractArchivaRestTest protected ManagedRepository getTestManagedRepository() { - String location = getBasedir().resolve( "target/repositories/test-repo" ).toAbsolutePath().toString(); + String location = getAppserverBase().resolve( "data/repositories/test-repo" ).toAbsolutePath().toString(); return new ManagedRepository( Locale.getDefault(), "TEST", "test", location, "default", true, true, false, "2 * * * * ?", null, false, 2, 3, true, false, "my nice repo", false ); @@ -382,8 +395,8 @@ public abstract class AbstractArchivaRestTest return StringUtils.isBlank( baseUrlSysProps ) ? "http://localhost:" + getServerPort() : baseUrlSysProps; } - protected Path getBuildDirectory() { - if (buildDir.get()==null) { + protected Path getProjectDirectory() { + if ( projectDir.get()==null) { String propVal = System.getProperty("mvn.project.base.dir"); Path newVal; if (StringUtils.isEmpty(propVal)) { @@ -391,9 +404,9 @@ public abstract class AbstractArchivaRestTest } else { newVal = Paths.get(propVal).toAbsolutePath(); } - buildDir.compareAndSet(null, newVal); + projectDir.compareAndSet(null, newVal); } - return buildDir.get(); + return projectDir.get(); } //----------------------------------------------------- @@ -407,7 +420,7 @@ public abstract class AbstractArchivaRestTest protected void initSourceTargetRepo() throws Exception { - Path targetRepo = Paths.get( "target/repositories/test-repo-copy" ); + Path targetRepo = getAppserverBase().resolve("data/repositories/test-repo-copy" ); if ( Files.exists(targetRepo) ) { org.apache.archiva.common.utils.FileUtils.deleteDirectory( targetRepo ); @@ -427,13 +440,13 @@ public abstract class AbstractArchivaRestTest getManagedRepositoriesService( authorizationHeader ).addManagedRepository( managedRepository ); assertNotNull( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( TARGET_REPO_ID ) ); - Path originRepo = Paths.get( "target/repositories/test-origin-repo" ); + Path originRepo = getAppserverBase().resolve( "data/repositories/test-origin-repo" ); if ( Files.exists(originRepo) ) { org.apache.archiva.common.utils.FileUtils.deleteDirectory( originRepo ); } assertFalse( Files.exists(originRepo) ); - FileUtils.copyDirectory( getBuildDirectory().resolve("src/test/repo-with-osgi" ).toAbsolutePath().toFile(), originRepo.toAbsolutePath().toFile() ); + FileUtils.copyDirectory( getProjectDirectory().resolve("src/test/repo-with-osgi" ).toAbsolutePath().toFile(), originRepo.toAbsolutePath().toFile() ); if ( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( SOURCE_REPO_ID ) != null ) { @@ -486,7 +499,7 @@ public abstract class AbstractArchivaRestTest } - protected void createAndIndexRepo( String testRepoId, String srcRepoPath, boolean stageNeeded ) + protected void createAndIndexRepo( String testRepoId, Path srcRepoPath, boolean stageNeeded ) throws ArchivaRestServiceException, IOException, RedbackServiceException { if ( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( testRepoId ) != null ) @@ -498,23 +511,23 @@ public abstract class AbstractArchivaRestTest managedRepository.setId( testRepoId ); managedRepository.setName( "test repo" ); - Path badContent = Paths.get( srcRepoPath, "target" ); + Path badContent = srcRepoPath.resolve( "target" ); if ( Files.exists(badContent) ) { org.apache.archiva.common.utils.FileUtils.deleteDirectory( badContent ); } - Path repoPath = getBasedir().resolve( "target" ).resolve( "repositories" ).resolve( testRepoId); + Path repoPath = getAppserverBase().resolve( "data" ).resolve( "repositories" ).resolve( testRepoId); FileUtils.deleteQuietly(repoPath.toFile()); - FileUtils.copyDirectory(Paths.get(srcRepoPath).toFile(), repoPath.toFile()); + FileUtils.copyDirectory(srcRepoPath.toFile(), repoPath.toFile()); managedRepository.setLocation( repoPath.toAbsolutePath().toString() ); String suffix = Long.toString( new Date().getTime() ); - String baseDir = System.getProperty("java.io.tmpdir"); + Path baseDir = Files.createTempDirectory( "archiva-test-index" ).toAbsolutePath(); managedRepository.setIndexDirectory( - baseDir + "/.indexer-" + suffix ); - managedRepository.setPackedIndexDirectory(baseDir + "/.index-" + suffix); + baseDir.resolve( ".indexer-" + suffix ).toString()); + managedRepository.setPackedIndexDirectory(baseDir.resolve(".index-" + suffix).toString()); managedRepository.setStageRepoNeeded( stageNeeded ); managedRepository.setSnapshots( true ); @@ -537,17 +550,17 @@ public abstract class AbstractArchivaRestTest getRepositoriesService( authorizationHeader ).scanRepositoryNow( testRepoId, true ); } - protected void createAndIndexRepo( String testRepoId, String repoPath ) + protected void createAndIndexRepo( String testRepoId, Path srcRepoPath ) throws Exception { - createAndIndexRepo( testRepoId, repoPath, false ); + createAndIndexRepo( testRepoId, srcRepoPath, false ); scanRepo( testRepoId ); } - protected void createStagedNeededRepo( String testRepoId, String repoPath, boolean scan ) + protected void createStagedNeededRepo( String testRepoId, Path srcRepoPath, boolean scan ) throws Exception { - createAndIndexRepo( testRepoId, repoPath, true ); + createAndIndexRepo( testRepoId, srcRepoPath, true ); if ( scan ) { scanRepo( testRepoId ); @@ -574,7 +587,17 @@ public abstract class AbstractArchivaRestTest public Path getBasedir() { - return Paths.get(System.getProperty( "basedir" )); + if (basePath.get()==null) { + String baseDir = System.getProperty( "basedir" ); + final Path baseDirPath; + if (StringUtils.isNotEmpty( baseDir )) { + baseDirPath = Paths.get( baseDir ); + } else { + baseDirPath = getProjectDirectory( ); + } + basePath.compareAndSet( null, baseDirPath ); + } + return basePath.get( ); } protected void waitForScanToComplete( String repoId ) diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/BrowseServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/BrowseServiceTest.java index f7f8c5152..448405e7a 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/BrowseServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/BrowseServiceTest.java @@ -494,7 +494,7 @@ public class BrowseServiceTest assertNotNull( getUserService( authorizationHeader ).createGuestUser() ); } - createAndIndexRepo( TEST_REPO_ID, getBasedir().resolve( "src/test/repo-with-osgi" ).toAbsolutePath().toString(), + createAndIndexRepo( TEST_REPO_ID, getProjectDirectory().resolve( "src/test/repo-with-osgi" ), false ); waitForScanToComplete( TEST_REPO_ID ); diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ManagedRepositoriesServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ManagedRepositoriesServiceTest.java index 2b67382a7..41296cb2b 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ManagedRepositoriesServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/ManagedRepositoriesServiceTest.java @@ -19,7 +19,6 @@ package org.apache.archiva.rest.services; * under the License. */ -import org.apache.archiva.admin.model.beans.FileType; import org.apache.archiva.admin.model.beans.ManagedRepository; import org.apache.archiva.rest.api.model.ArchivaRepositoryStatistics; import org.apache.archiva.rest.api.services.ManagedRepositoriesService; @@ -121,7 +120,7 @@ public class ManagedRepositoriesServiceTest throws Exception { ManagedRepositoriesService service = getManagedRepositoriesService( authorizationHeader ); - Path target = Paths.get( "target" ); + Path target = getProjectDirectory().resolve( "target" ); assertTrue( service.fileLocationExists( target.toAbsolutePath().toString() ) ); @@ -147,7 +146,7 @@ public class ManagedRepositoriesServiceTest RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader ); createAndIndexRepo( testRepoId, - Paths.get( System.getProperty( "basedir" ), "src/test/repo-with-osgi" ).toAbsolutePath().toString() ); + getProjectDirectory().resolve("src/test/repo-with-osgi" ) ); repositoriesService.scanRepositoryDirectoriesNow( testRepoId ); diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/MergeRepositoriesServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/MergeRepositoriesServiceTest.java index a440271c8..7497642ea 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/MergeRepositoriesServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/MergeRepositoriesServiceTest.java @@ -40,10 +40,11 @@ public class MergeRepositoriesServiceTest { private static final String TEST_REPOSITORY = "test-repository"; + private static final String TEST_REPOSITORY_STAGE = TEST_REPOSITORY + "-stage"; - private Path repo = Paths.get( System.getProperty( "basedir" ),"target","repositories-merge", "test-repository" ); + private Path repo = getAppserverBase().resolve("data/repositories").resolve( "test-repository" ); - private Path repoStage = Paths.get( System.getProperty( "basedir" ),"target","repositories-merge", "test-repository-stage" ); + private Path repoStage = getAppserverBase().resolve("data/repositories").resolve( "test-repository-stage" ); @Test public void getMergeConflictedArtifacts() @@ -51,7 +52,11 @@ public class MergeRepositoriesServiceTest { MergeRepositoriesService service = getMergeRepositoriesService( authorizationHeader ); - List artifactMetadatas = service.getMergeConflictedArtifacts( TEST_REPOSITORY + "-stage", + waitForScanToComplete( TEST_REPOSITORY ); + waitForScanToComplete( TEST_REPOSITORY_STAGE ); + + + List artifactMetadatas = service.getMergeConflictedArtifacts( TEST_REPOSITORY_STAGE, TEST_REPOSITORY ); log.info( "conflicts: {}", artifactMetadatas ); @@ -71,9 +76,12 @@ public class MergeRepositoriesServiceTest assertTrue( Files.exists(repoStage.resolve(mergedArtifactPath)) ); assertTrue( Files.exists(repoStage.resolve(mergedArtifactPomPath)) ); + waitForScanToComplete( TEST_REPOSITORY ); + waitForScanToComplete( TEST_REPOSITORY_STAGE ); + MergeRepositoriesService service = getMergeRepositoriesService( authorizationHeader ); - service.mergeRepositories( TEST_REPOSITORY + "-stage", TEST_REPOSITORY, true ); + service.mergeRepositories( TEST_REPOSITORY_STAGE, TEST_REPOSITORY, true ); assertTrue( Files.exists(repo.resolve(mergedArtifactPath)) ); assertTrue( Files.exists(repo.resolve(mergedArtifactPomPath)) ); @@ -84,6 +92,7 @@ public class MergeRepositoriesServiceTest throws Exception { waitForScanToComplete( TEST_REPOSITORY ); + waitForScanToComplete( TEST_REPOSITORY_STAGE ); deleteTestRepo( TEST_REPOSITORY ); @@ -97,9 +106,9 @@ public class MergeRepositoriesServiceTest { // FileUtils.copyDirectory( Paths.get( System.getProperty( "basedir" ), "src/test/repo-with-osgi" ).toFile(), repo.toFile() ); - Path srcRepo = Paths.get( System.getProperty( "basedir" ), "src/test/repo-with-osgi" ); - createStagedNeededRepo( TEST_REPOSITORY, srcRepo.toAbsolutePath().toString(), true ); - FileUtils.copyDirectory( getBasedir().resolve("src/test/repo-with-osgi-stage" ).toFile(), + Path srcRepo = getProjectDirectory().resolve( "src/test/repo-with-osgi" ); + createStagedNeededRepo( TEST_REPOSITORY, srcRepo , true ); + FileUtils.copyDirectory( getProjectDirectory().resolve("src/test/repo-with-osgi-stage" ).toFile(), repoStage.toFile() ); } } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java index b9107b38b..482e26d6d 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoriesServiceTest.java @@ -165,8 +165,8 @@ public class RepositoriesServiceTest try { - Path artifactFile = getBasedir().resolve( - "target/repositories/test-origin-repo/org/apache/karaf/features/org.apache.karaf.features.core/2.2.2/org.apache.karaf.features.core-2.2.2.jar" ); + Path artifactFile = getAppserverBase().resolve( + "data/repositories/test-origin-repo/org/apache/karaf/features/org.apache.karaf.features.core/2.2.2/org.apache.karaf.features.core-2.2.2.jar" ); assertTrue( "artifact not exists:" + artifactFile, Files.exists(artifactFile) ); @@ -226,8 +226,8 @@ public class RepositoriesServiceTest try { - Path artifactFile = getBasedir().resolve( - "target/repositories/test-origin-repo/org/apache/karaf/features/org.apache.karaf.features.core/2.2.2/org.apache.karaf.features.core-2.2.2.jar" ); + Path artifactFile = getAppserverBase().resolve( + "data/repositories/test-origin-repo/org/apache/karaf/features/org.apache.karaf.features.core/2.2.2/org.apache.karaf.features.core-2.2.2.jar" ); assertTrue( "artifact not exists:" + artifactFile.toString(), Files.exists(artifactFile) ); @@ -283,14 +283,12 @@ public class RepositoriesServiceTest try { - Path artifactFile = getBasedir().resolve( - "target/repositories/test-origin-repo/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1-javadoc.jar" ); + Path artifactFile = getAppserverBase().resolve( + "data/repositories/test-origin-repo/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1-javadoc.jar" ); - Path artifactFilemd5 = getBasedir().resolve( - "target/repositories/test-origin-repo/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1-javadoc.jar.md5" ); + Path artifactFilemd5 = getAppserverBase().resolve("data/repositories/test-origin-repo/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1-javadoc.jar.md5" ); - Path artifactFilesha1 = getBasedir().resolve( - "target/repositories/test-origin-repo/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1-javadoc.jar.sha1" ); + Path artifactFilesha1 = getAppserverBase().resolve("data/repositories/test-origin-repo/commons-logging/commons-logging/1.0.1/commons-logging-1.0.1-javadoc.jar.sha1" ); assertTrue( "artifact not exists:" + artifactFile, Files.exists(artifactFile) ); @@ -354,7 +352,7 @@ public class RepositoriesServiceTest new BrowseResultEntry( "org.apache.karaf.features.org.apache.karaf.features.core", true ) ); Path directory = - getBasedir().resolve( "target/repositories/test-origin-repo/org/apache/karaf/features/org.apache.karaf.features.command" ); + getAppserverBase().resolve("data/repositories/test-origin-repo/org/apache/karaf/features/org.apache.karaf.features.command" ); assertTrue( "directory not exists", Files.exists(directory) ); @@ -497,14 +495,14 @@ public class RepositoriesServiceTest protected Path initSnapshotRepo() throws Exception { - Path targetRepo = getBasedir().resolve( "target/repositories/repo-with-snapshots" ); + Path targetRepo = getAppserverBase().resolve("data/repositories/repo-with-snapshots" ); if ( Files.exists(targetRepo) ) { org.apache.archiva.common.utils.FileUtils.deleteDirectory( targetRepo ); } assertFalse( Files.exists(targetRepo) ); - FileUtils.copyDirectoryToDirectory( getBasedir().resolve( "src/test/repo-with-snapshots" ).toFile(), + FileUtils.copyDirectoryToDirectory( getProjectDirectory().resolve( "src/test/repo-with-snapshots" ).toFile(), targetRepo.getParent().toFile() ); if ( getManagedRepositoriesService( authorizationHeader ).getManagedRepository( SNAPSHOT_REPO_ID ) != null ) @@ -544,7 +542,7 @@ public class RepositoriesServiceTest protected ManagedRepository getTestManagedRepository( String id, String path ) { - String location = getBasedir().resolve("target/repositories/" + path ).toAbsolutePath().toString(); + String location = getAppserverBase().resolve("data/repositories/" + path ).toAbsolutePath().toString(); return new ManagedRepository( Locale.getDefault(), id, id, location, "default", true, true, true, "2 * * * * ?", null, false, 80, 80, true, false ); } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/SearchServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/SearchServiceTest.java index 7e8d027f4..26d2c369d 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/SearchServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/SearchServiceTest.java @@ -262,7 +262,7 @@ public class SearchServiceTest assertNotNull( getUserService( authorizationHeader ).createGuestUser() ); } - createAndIndexRepo( TEST_REPO, "src/test/repo-with-classifier-only" ); + createAndIndexRepo( TEST_REPO, getProjectDirectory().resolve("src/test/repo-with-classifier-only") ); SearchService searchService = getSearchService( authorizationHeader ); @@ -317,7 +317,7 @@ public class SearchServiceTest assertNotNull( getUserService( authorizationHeader ).createGuestUser() ); } - createAndIndexRepo( TEST_REPO, "src/test/repo-with-osgi" ); + createAndIndexRepo( TEST_REPO, getProjectDirectory( ).resolve( "src/test/repo-with-osgi" ) ); waitForScanToComplete( TEST_REPO ); } diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java index 4a0a548c9..ad0bb388e 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java @@ -430,7 +430,7 @@ public class ArchivaDavResourceFactory String requestedFileName = StringUtils.substringAfterLast( pathInfo, "/" ); StorageAsset temporaryIndexDirectory = buildMergedIndexDirectory( activePrincipal, request, repoGroup ); - StorageAsset asset = temporaryIndexDirectory.getStorage().getAsset(requestedFileName); + StorageAsset asset = temporaryIndexDirectory.resolve(requestedFileName); try { resource = new ArchivaDavResource( asset, requestedFileName, repoGroup, -- 2.39.5