From: James William Dumay Date: Wed, 13 Aug 2008 01:47:08 +0000 (+0000) Subject: Fix failing test testGetMergedMetadata(org.apache.maven.archiva.webdav.RepositoryServ... X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c3f87db862d6f05fa37d94191908b216857708ad;p=archiva.git Fix failing test testGetMergedMetadata(org.apache.maven.archiva.webdav.RepositoryServletRepositoryGroupTest) git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/metadata-rejig-1.2@685414 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java index 38f871703..ce29b991d 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java @@ -424,9 +424,8 @@ public class MetadataTools public void updateMetadata( ManagedRepositoryContent managedRepository, String logicalResource) throws RepositoryMetadataException { - ArchivaRepositoryMetadata metadata = null; final File metadataFile = new File(managedRepository.getRepoRoot(), logicalResource); -// final long lastUpdated = getExistingLastUpdated( metadataFile ); + ArchivaRepositoryMetadata metadata = null; //Gather and merge all metadata available List metadatas = getMetadatasForManagedRepository(managedRepository, logicalResource); @@ -448,12 +447,10 @@ public class MetadataTools updateMetadataVersions(availableVersions, metadata); } -// if ( lastUpdated > 0 ) -// { -// metadata.setLastUpdatedTimestamp( toLastUpdatedDate( lastUpdated ) ); -// } - RepositoryMetadataWriter.write(metadata, metadataFile); + + ChecksummedFile checksum = new ChecksummedFile( metadataFile ); + checksum.fixChecksums( algorithms ); } /** diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataMerge.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataMerge.java index 4b265b6e3..bf717d38b 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataMerge.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/RepositoryMetadataMerge.java @@ -19,11 +19,7 @@ package org.apache.maven.archiva.repository.metadata; * under the License. */ -import java.text.ParseException; -import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; import org.apache.maven.archiva.model.ArchivaModelCloner; import org.apache.maven.archiva.model.ArchivaRepositoryMetadata; import org.apache.maven.archiva.model.SnapshotVersion; @@ -31,7 +27,6 @@ import org.apache.maven.archiva.model.SnapshotVersion; import java.util.Iterator; import java.util.List; import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.time.DateUtils; import org.apache.maven.archiva.model.Plugin; /** 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 c78e0b742..7acf05969 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 @@ -77,6 +77,7 @@ public class RepositoryServletRepositoryGroupTest protected static final String REPO_GROUP_WITH_INVALID_REPOS = "group-with-invalid-repos"; + @Override protected void setUp() throws Exception { @@ -119,6 +120,7 @@ public class RepositoryServletRepositoryGroupTest saveConfiguration( archivaConfiguration ); } + @Override protected void tearDown() throws Exception { @@ -275,7 +277,7 @@ public class RepositoryServletRepositoryGroupTest response = sc.getResource( request ); assertResponseOK( response ); - assertEquals( "d2321a573e0488bca571b624f891104009408dd8 maven-metadata-group-with-valid-repos.xml", response.getText() ); + assertEquals( "add113b0d7f8c6adb92a5015a7a3701081edf998 maven-metadata-group-with-valid-repos.xml", response.getText() ); // request the md5 checksum of the metadata request = @@ -284,7 +286,7 @@ public class RepositoryServletRepositoryGroupTest response = sc.getResource( request ); assertResponseOK( response ); - assertEquals( "79d271fbe8bd1d17b23273937750d407 maven-metadata-group-with-valid-repos.xml", response.getText().trim() ); + assertEquals( "5b85ea4aa5f52bb76760041a52f98de8 maven-metadata-group-with-valid-repos.xml", response.getText().trim() ); } protected void assertResponseMethodNotAllowed( WebResponse response )