String expectedTime, int expectedBuildnumber )
throws RepositoryMetadataException, Exception
{
// Build expected metadata XML
StringWriter expectedMetadataXml = new StringWriter();
ArchivaRepositoryMetadata m = new ArchivaRepositoryMetadata();
m.setGroupId( actualMetadata.getGroupId() );
m.setArtifactId( actualMetadata.getArtifactId() );
m.setVersion( VersionUtil.getBaseVersion( actualMetadata.getVersion() ) );
m.setSnapshotVersion( new SnapshotVersion() );
if ( StringUtils.isNotBlank( expectedDate ) && StringUtils.isNotBlank( expectedTime ) )
{
m.getSnapshotVersion().setTimestamp( expectedDate + "." + expectedTime );
}
m.getSnapshotVersion().setBuildNumber( expectedBuildnumber );
m.setLastUpdated( expectedDate + expectedTime );
RepositoryMetadataWriter.write( m, expectedMetadataXml );
// Compare the file to the actual contents.
assertMetadataEquals( expectedMetadataXml.toString(), actualFile );