From 97f22cd13c13ded508bb957b4fe7e206df6e6728 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 22 Apr 2013 12:46:13 +0000 Subject: [PATCH] fix issues downloading merged index path (thanks to unit tests) and add an other with non default mergedindex path git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1470481 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/archiva/DownloadMergedIndexTest.java | 13 ++++++++++--- .../archiva/webdav/ArchivaDavResourceFactory.java | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/DownloadMergedIndexTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/DownloadMergedIndexTest.java index 68c82de07..10bbc7181 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/DownloadMergedIndexTest.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/DownloadMergedIndexTest.java @@ -123,8 +123,15 @@ public class DownloadMergedIndexTest RepositoryGroupService repositoryGroupService = getRepositoryGroupService(); + String repoGroupId = "test-group"; + + if ( repositoryGroupService.getRepositoryGroup( repoGroupId ) != null ) + { + repositoryGroupService.deleteRepositoryGroup( repoGroupId ); + } + RepositoryGroup repositoryGroup = new RepositoryGroup(); - repositoryGroup.setId( "test-group" ); + repositoryGroup.setId( repoGroupId ); repositoryGroup.setRepositories( Arrays.asList( id ) ); repositoryGroupService.addRepositoryGroup( repositoryGroup ); @@ -134,7 +141,7 @@ public class DownloadMergedIndexTest managedRepository = new ManagedRepository(); managedRepository.setId( id ); managedRepository.setName( "name of " + id ); - managedRepository.setLocation(System.getProperty( "basedir" ) + "/src/test/repositories/test-repo" ); + managedRepository.setLocation( System.getProperty( "basedir" ) + "/src/test/repositories/test-repo" ); managedRepository.setIndexDirectory( System.getProperty( "java.io.tmpdir" ) + "/tmpIndex/" + id ); if ( managedRepositoriesService.getManagedRepository( id ) != null ) @@ -157,7 +164,7 @@ public class DownloadMergedIndexTest ProxyConnectorService proxyConnectorService = getProxyConnectorService(); ProxyConnector proxyConnector = new ProxyConnector(); - proxyConnector.setProxyId( "foo-bar" ); + proxyConnector.setProxyId( "foo-bar1" ); proxyConnector.setSourceRepoId( id ); proxyConnector.setTargetRepoId( "all-merged" ); proxyConnectorService.addProxyConnector( proxyConnector ); 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 79e2d4195..954e8039c 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 @@ -446,7 +446,7 @@ public class ArchivaDavResourceFactory String rootPath = StringUtils.substringBeforeLast( pathInfo, "/" ); - if ( StringUtils.endsWith( rootPath, "/" + repoGroupConfig.getMergedIndexPath() ) ) + if ( StringUtils.endsWith( rootPath, repoGroupConfig.getMergedIndexPath() ) ) { // we are in the case of index file request String requestedFileName = StringUtils.substringAfterLast( pathInfo, "/" ); -- 2.39.5