From 6f322f77cea289961aa1891266faf136dd482026 Mon Sep 17 00:00:00 2001 From: "Maria Odea B. Ching" Date: Thu, 10 Jul 2008 14:50:18 +0000 Subject: [PATCH] [MRM-872] -added test case for repo group merged metadata request git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@675602 13f79535-47bb-0310-9956-ffa450edef68 --- .../webdav/ArchivaDavResourceFactory.java | 3 ++ .../RepositoryServletRepositoryGroupTest.java | 39 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java index 0d52a68a0..544f62b3c 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResourceFactory.java @@ -261,6 +261,9 @@ public class ArchivaDavResourceFactory if ( request.getRequestURI().endsWith( "metadata.xml" ) ) { // TODO MRM-872 : must merge all available metadatas + // use RepositoryMetadataMerge for the merging of the versions + // + // Deng: I'll continue this tomorrow, everything is getting blurry now } DavResource resource = availableResources.get( 0 ); diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/RepositoryServletRepositoryGroupTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/RepositoryServletRepositoryGroupTest.java index 57453ea81..f06c73cd1 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/RepositoryServletRepositoryGroupTest.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/maven/archiva/webdav/RepositoryServletRepositoryGroupTest.java @@ -217,6 +217,45 @@ public class RepositoryServletRepositoryGroupTest assertNotNull( "Should have received a response", response ); assertEquals( "Should have been an 401 response code.", HttpServletResponse.SC_UNAUTHORIZED, response.getResponseCode() ); } + + // MRM-872 + public void testGetMergedMetadata() + throws Exception + { + // first metadata file + String resourceName = "dummy/dummy-merged-metadata-resource/maven-metadata.xml"; + + File dummyInternalResourceFile = new File( repoRootFirst, resourceName ); + dummyInternalResourceFile.getParentFile().mkdirs(); + FileUtils.writeStringToFile( dummyInternalResourceFile, "" + + "dummydummy-merged-metadata-resource" + + "1.01.01.0" + + "2.520080708095554", null ); + + //second metadata file + resourceName = "dummy/dummy-merged-metadata-resource/maven-metadata.xml"; + dummyInternalResourceFile = new File( repoRootLast, resourceName ); + dummyInternalResourceFile.getParentFile().mkdirs(); + FileUtils.writeStringToFile( dummyInternalResourceFile, "" + + "dummydummy-merged-metadata-resource" + + "2.02.01.0" + + "1.52.020080709095554" + + "", null ); + + WebRequest request = + new GetMethodWebRequest( "http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/dummy/" + + "dummy-merged-metadata-resource/maven-metadata.xml" ); + WebResponse response = sc.getResource( request ); + + String expectedString = "" + + "dummydummy-merged-metadata-resource" + + "2.51.0" + + "1.52.02.520080709095554" + + ""; + + //assertResponseOK( response ); + //assertEquals( "Expected file contents", expectedString, response.getText() ); + } protected void assertResponseMethodNotAllowed( WebResponse response ) { -- 2.39.5