Return-Path: Delivered-To: apmail-archiva-commits-archive@www.apache.org Received: (qmail 68773 invoked from network); 2 May 2010 06:14:09 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 2 May 2010 06:14:09 -0000 Received: (qmail 15404 invoked by uid 500); 2 May 2010 06:14:09 -0000 Delivered-To: apmail-archiva-commits-archive@archiva.apache.org Received: (qmail 15345 invoked by uid 500); 2 May 2010 06:14:07 -0000 Mailing-List: contact commits-help@archiva.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@archiva.apache.org Delivered-To: mailing list commits@archiva.apache.org Received: (qmail 15338 invoked by uid 99); 2 May 2010 06:14:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 May 2010 06:14:06 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 May 2010 06:14:01 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 0DFD323889B8; Sun, 2 May 2010 06:13:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r940163 - in /archiva/trunk/archiva-modules/archiva-web: archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/ archiva-webapp/src/main/java/org/apache/maven/... Date: Sun, 02 May 2010 06:13:08 -0000 To: commits@archiva.apache.org From: oching@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100502061309.0DFD323889B8@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: oching Date: Sun May 2 06:13:08 2010 New Revision: 940163 URL: http://svn.apache.org/viewvc?rev=940163&view=rev Log: [MRM-1353] Build number is always 1 for SNAPSHOT artifacts uploaded via web upload form merge -c 930528 from 1.3.x branch with some tweaks in the unit and selenium tests Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/UploadActionTest.java Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java?rev=940163&r1=940162&r2=940163&view=diff ============================================================================== --- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java (original) +++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java Sun May 2 06:13:08 2010 @@ -22,6 +22,7 @@ package org.apache.archiva.web.test; import java.io.File; import org.apache.archiva.web.test.parent.AbstractBrowseTest; +import org.testng.Assert; import org.testng.annotations.Test; @Test( groups = { "browse" }, dependsOnMethods = { "testAddArtifactNullValues" } ) @@ -86,6 +87,44 @@ public class BrowseTest assertArtifactInfoPage( "1.0-SNAPSHOT/", snapshotsRepo, "continuum", "continuum-core", "1.0-SNAPSHOT", "jar" ); } + // MRM-1353 + @Test( groups = { "requiresUpload" } ) + public void testBuildNumberOfSnapshotArtifact() + { + String snapshotsRepo = getProperty( "SNAPSHOTS_REPOSITORY" ); + + String path = + "src/test/resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar"; + // TODO: do this differently as uploading doesn't work on browsers other than *chrome (below as well) + // upload a snapshot artifact to repository 'releases' + addArtifact( "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT", "jar", path, snapshotsRepo ); + assertTextPresent( "Artifact 'archiva:archiva-multiple-artifacts:1.0-SNAPSHOT' was successfully deployed to repository '" + + snapshotsRepo + "'" ); + + goToBrowsePage(); + assertBrowsePage(); + assertGroupsPage( "archiva/" ); + assertArtifactsPage( "archiva-multiple-artifacts/" ); + assertArtifactInfoPage( "1.0-SNAPSHOT/", snapshotsRepo, "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT", "jar" ); + + + addArtifact( "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT", "jar", path, snapshotsRepo ); + assertTextPresent( "Artifact 'archiva:archiva-multiple-artifacts:1.0-SNAPSHOT' was successfully deployed to repository '" + + snapshotsRepo + "'" ); + + goToBrowsePage(); + assertBrowsePage(); + assertGroupsPage( "archiva/" ); + assertArtifactsPage( "archiva-multiple-artifacts/" ); + assertArtifactInfoPage( "1.0-SNAPSHOT/", snapshotsRepo, "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT", "jar" ); + + String firstSnapshotVersion = getText( "//div[@id='download']/div[@id='accordion']/p[2]/a/" ); + Assert.assertTrue( firstSnapshotVersion.endsWith( "-1" ) ); + + String secondSnapshotVersion = getText( "//div[@id='download']/div[@id='accordion']/p[1]/a/" ); + Assert.assertTrue( secondSnapshotVersion.endsWith( "-2" ) ); + } + private void assertArtifactInfoPage( String version, String artifactInfoRepositoryId, String artifactInfoGroupId, String artifactInfoArtifactId, String artifactInfoVersion, String artifactInfoPackaging ) Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java?rev=940163&r1=940162&r2=940163&view=diff ============================================================================== --- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java (original) +++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java Sun May 2 06:13:08 2010 @@ -153,6 +153,11 @@ public abstract class AbstractSeleniumTe return getSelenium().getHtmlSource(); } + public String getText( String locator ) + { + return getSelenium().getText( locator ); + } + public void assertTextPresent( String text ) { Assert.assertTrue( getSelenium().isTextPresent( text ), "'" + text + "' isn't present." ); Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java?rev=940163&r1=940162&r2=940163&view=diff ============================================================================== --- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java (original) +++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java Sun May 2 06:13:08 2010 @@ -74,6 +74,7 @@ import java.util.TimeZone; * * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="uploadAction" instantiation-strategy="per-lookup" */ +@SuppressWarnings( "serial" ) public class UploadAction extends PlexusActionSupport implements Validateable, Preparable, Auditable @@ -312,8 +313,8 @@ public class UploadAction int newBuildNumber = -1; String timestamp = null; - File metadataFile = getMetadata( targetPath.getAbsolutePath() ); - ArchivaRepositoryMetadata metadata = getMetadata( metadataFile ); + File versionMetadataFile = getMetadata( targetPath.getAbsolutePath() ); + ArchivaRepositoryMetadata versionMetadata = getMetadata( versionMetadataFile ); if ( VersionUtil.isSnapshot( version ) ) { @@ -321,13 +322,12 @@ public class UploadAction DateFormat fmt = new SimpleDateFormat( "yyyyMMdd.HHmmss" ); fmt.setTimeZone( timezone ); timestamp = fmt.format( lastUpdatedTimestamp ); - if ( metadata.getSnapshotVersion() != null ) + if ( versionMetadata.getSnapshotVersion() != null ) { - newBuildNumber = metadata.getSnapshotVersion().getBuildNumber() + 1; + newBuildNumber = versionMetadata.getSnapshotVersion().getBuildNumber() + 1; } else { - metadata.setSnapshotVersion( new SnapshotVersion() ); newBuildNumber = 1; } } @@ -410,10 +410,17 @@ public class UploadAction } - // explicitly update only if metadata-updater consumer is not enabled! - if ( !config.getRepositoryScanning().getKnownContentConsumers().contains( "metadata-updater" ) ) + // explicitly update only if versionMetadata-updater consumer is not enabled! + if ( !config.getRepositoryScanning().getKnownContentConsumers().contains( "versionMetadata-updater" ) ) { - updateMetadata( metadata, metadataFile, lastUpdatedTimestamp, timestamp, newBuildNumber, fixChecksums ); + updateProjectMetadata( targetPath.getAbsolutePath(), lastUpdatedTimestamp, timestamp, newBuildNumber, + fixChecksums ); + + if ( VersionUtil.isSnapshot( version ) ) + { + updateVersionMetadata( versionMetadata, versionMetadataFile, lastUpdatedTimestamp, timestamp, + newBuildNumber, fixChecksums ); + } } String msg = "Artifact \'" + groupId + ":" + artifactId + ":" + version + @@ -496,9 +503,7 @@ public class UploadAction private File getMetadata( String targetPath ) { - String artifactPath = targetPath.substring( 0, targetPath.lastIndexOf( File.separatorChar ) ); - - return new File( artifactPath, MetadataTools.MAVEN_METADATA ); + return new File( targetPath, MetadataTools.MAVEN_METADATA ); } private ArchivaRepositoryMetadata getMetadata( File metadataFile ) @@ -511,21 +516,58 @@ public class UploadAction } return metadata; } + + + /** + * Update version level metadata for snapshot artifacts. If it does not exist, create the metadata and fix checksums + * if necessary. + */ + private void updateVersionMetadata( ArchivaRepositoryMetadata metadata, File metadataFile, + Date lastUpdatedTimestamp, String timestamp, int buildNumber, + boolean fixChecksums ) + throws RepositoryMetadataException + { + if ( !metadataFile.exists() ) + { + metadata.setGroupId( groupId ); + metadata.setArtifactId( artifactId ); + metadata.setVersion( version ); + } + + if ( metadata.getSnapshotVersion() == null ) + { + metadata.setSnapshotVersion( new SnapshotVersion() ); + } + + metadata.getSnapshotVersion().setBuildNumber( buildNumber ); + metadata.getSnapshotVersion().setTimestamp( timestamp ); + metadata.setLastUpdatedTimestamp( lastUpdatedTimestamp ); + + RepositoryMetadataWriter.write( metadata, metadataFile ); + + if ( fixChecksums ) + { + fixChecksums( metadataFile ); + } + } /** - * Update artifact level metadata. If it does not exist, create the metadata and - * fix checksums if necessary. + * Update artifact level metadata. If it does not exist, create the metadata and fix checksums if necessary. */ - private void updateMetadata( ArchivaRepositoryMetadata metadata, File metadataFile, Date lastUpdatedTimestamp, - String timestamp, int buildNumber, boolean fixChecksums ) + private void updateProjectMetadata( String targetPath, Date lastUpdatedTimestamp, String timestamp, + int buildNumber, boolean fixChecksums ) throws RepositoryMetadataException { List availableVersions = new ArrayList(); String latestVersion = version; - if ( metadataFile.exists() ) + String projectPath = targetPath.substring( 0, targetPath.lastIndexOf( File.separatorChar ) ); + File projectMetadataFile = getMetadata( projectPath ); + ArchivaRepositoryMetadata projectMetadata = getMetadata( projectMetadataFile ); + + if ( projectMetadataFile.exists() ) { - availableVersions = metadata.getAvailableVersions(); + availableVersions = projectMetadata.getAvailableVersions(); Collections.sort( availableVersions, VersionComparator.getInstance() ); @@ -540,39 +582,34 @@ public class UploadAction { availableVersions.add( version ); - metadata.setGroupId( groupId ); - metadata.setArtifactId( artifactId ); + projectMetadata.setGroupId( groupId ); + projectMetadata.setArtifactId( artifactId ); } - if ( metadata.getGroupId() == null ) + if ( projectMetadata.getGroupId() == null ) { - metadata.setGroupId( groupId ); + projectMetadata.setGroupId( groupId ); } - if ( metadata.getArtifactId() == null ) + + if ( projectMetadata.getArtifactId() == null ) { - metadata.setArtifactId( artifactId ); + projectMetadata.setArtifactId( artifactId ); } - metadata.setLatestVersion( latestVersion ); - metadata.setLastUpdatedTimestamp( lastUpdatedTimestamp ); - metadata.setAvailableVersions( availableVersions ); + projectMetadata.setLatestVersion( latestVersion ); + projectMetadata.setLastUpdatedTimestamp( lastUpdatedTimestamp ); + projectMetadata.setAvailableVersions( availableVersions ); if ( !VersionUtil.isSnapshot( version ) ) { - metadata.setReleasedVersion( latestVersion ); + projectMetadata.setReleasedVersion( latestVersion ); } - else - { - metadata.getSnapshotVersion().setBuildNumber( buildNumber ); - metadata.getSnapshotVersion().setTimestamp( timestamp ); - } - - RepositoryMetadataWriter.write( metadata, metadataFile ); + RepositoryMetadataWriter.write( projectMetadata, projectMetadataFile ); if ( fixChecksums ) { - fixChecksums( metadataFile ); + fixChecksums( projectMetadataFile ); } } Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/UploadActionTest.java URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/UploadActionTest.java?rev=940163&r1=940162&r2=940163&view=diff ============================================================================== --- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/UploadActionTest.java (original) +++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/UploadActionTest.java Sun May 2 06:13:08 2010 @@ -31,11 +31,14 @@ import org.apache.maven.archiva.configur import org.apache.maven.archiva.configuration.Configuration; import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration; +import org.apache.maven.archiva.model.ArchivaRepositoryMetadata; +import org.apache.maven.archiva.model.SnapshotVersion; import org.apache.maven.archiva.repository.ManagedRepositoryContent; import org.apache.maven.archiva.repository.RepositoryContentFactory; import org.apache.maven.archiva.repository.RepositoryNotFoundException; import org.apache.maven.archiva.repository.content.ManagedDefaultRepositoryContent; import org.apache.maven.archiva.repository.metadata.MetadataTools; +import org.apache.maven.archiva.repository.metadata.RepositoryMetadataReader; import org.codehaus.plexus.spring.PlexusInSpringTestCase; import org.easymock.MockControl; import org.easymock.classextension.MockClassControl; @@ -134,109 +137,131 @@ public class UploadActionTest uploadAction.setGeneratePom( generatePom ); } - private void assertAllArtifactsIncludingSupportArtifactsArePresent( String repoLocation ) + private void assertAllArtifactsIncludingSupportArtifactsArePresent( String repoLocation, String artifact, + String version ) { - assertTrue( - new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.jar" ).exists() ); - assertTrue( - new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.jar.sha1" ).exists() ); - assertTrue( - new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.jar.md5" ).exists() ); - - assertTrue( - new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom" ).exists() ); - assertTrue( - new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom.sha1" ).exists() ); - assertTrue( - new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom.md5" ).exists() ); - - assertTrue( - new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA ).exists() ); - assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA + - ".sha1" ).exists() ); - assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA + - ".md5" ).exists() ); + assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + artifact + ".jar" ).exists() ); + assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + artifact + + ".jar.sha1" ).exists() ); + assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + artifact + + ".jar.md5" ).exists() ); + + assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + artifact + ".pom" ).exists() ); + assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + artifact + + ".pom.sha1" ).exists() ); + assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + artifact + + ".pom.md5" ).exists() ); + + assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA ).exists() ); + assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA + + ".sha1" ).exists() ); + assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA + + ".md5" ).exists() ); } - private void verifyChecksums( String repoLocation ) + private void verifyVersionMetadataChecksums( String repoLocation, String version ) throws IOException { - // verify checksums of jar file - ChecksummedFile checksum = new ChecksummedFile( - new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.jar" ) ); + ChecksummedFile checksum = + new ChecksummedFile( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + + MetadataTools.MAVEN_METADATA ) ); String sha1 = checksum.calculateChecksum( ChecksumAlgorithm.SHA1 ); String md5 = checksum.calculateChecksum( ChecksumAlgorithm.MD5 ); - String contents = FileUtils.readFileToString( - new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.jar.sha1" ) ); + String contents = + FileUtils.readFileToString( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + + MetadataTools.MAVEN_METADATA + ".sha1" ) ); assertTrue( StringUtils.contains( contents, sha1 ) ); - contents = FileUtils.readFileToString( - new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.jar.md5" ) ); + contents = + FileUtils.readFileToString( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + + MetadataTools.MAVEN_METADATA + ".md5" ) ); assertTrue( StringUtils.contains( contents, md5 ) ); + } - // verify checksums of pom file - checksum = new ChecksummedFile( - new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom" ) ); - sha1 = checksum.calculateChecksum( ChecksumAlgorithm.SHA1 ); - md5 = checksum.calculateChecksum( ChecksumAlgorithm.MD5 ); + private void verifyProjectMetadataChecksums( String repoLocation ) + throws IOException + { + ChecksummedFile checksum = + new ChecksummedFile( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + + MetadataTools.MAVEN_METADATA ) ); + String sha1 = checksum.calculateChecksum( ChecksumAlgorithm.SHA1 ); + String md5 = checksum.calculateChecksum( ChecksumAlgorithm.MD5 ); - contents = FileUtils.readFileToString( - new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom.sha1" ) ); + String contents = + FileUtils.readFileToString( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + + MetadataTools.MAVEN_METADATA + ".sha1" ) ); assertTrue( StringUtils.contains( contents, sha1 ) ); - contents = FileUtils.readFileToString( - new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom.md5" ) ); + contents = + FileUtils.readFileToString( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + + MetadataTools.MAVEN_METADATA + ".md5" ) ); assertTrue( StringUtils.contains( contents, md5 ) ); + } - // verify checksums of metadata file - checksum = new ChecksummedFile( - new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA ) ); + private void verifyPomChecksums( String repoLocation, String artifact, String version ) + throws IOException + { + ChecksummedFile checksum; + String sha1; + String md5; + String contents; + checksum = + new ChecksummedFile( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + + artifact + ".pom" ) ); sha1 = checksum.calculateChecksum( ChecksumAlgorithm.SHA1 ); md5 = checksum.calculateChecksum( ChecksumAlgorithm.MD5 ); - contents = FileUtils.readFileToString( - new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA + ".sha1" ) ); + contents = + FileUtils.readFileToString( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + + artifact + ".pom.sha1" ) ); assertTrue( StringUtils.contains( contents, sha1 ) ); - contents = FileUtils.readFileToString( - new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA + ".md5" ) ); + contents = + FileUtils.readFileToString( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + + artifact + ".pom.md5" ) ); assertTrue( StringUtils.contains( contents, md5 ) ); } - public void testArtifactUploadWithPomSuccessful() - throws Exception + private void verifyArtifactChecksums( String repoLocation, String artifact, String version ) + throws IOException { - setUploadParameters( "1.0", null, new File( getBasedir(), - "target/test-classes/upload-artifact-test/artifact-to-be-uploaded.jar" ), - new File( getBasedir(), "target/test-classes/upload-artifact-test/pom.xml" ), false ); - - ManagedRepositoryContent content = new ManagedDefaultRepositoryContent(); - content.setRepository( config.findManagedRepositoryById( REPOSITORY_ID ) ); - - archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config ); - repoFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( REPOSITORY_ID ), content ); - - archivaConfigControl.replay(); - repoFactoryControl.replay(); + ChecksummedFile checksum = + new ChecksummedFile( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + + artifact + ".jar" ) ); + String sha1 = checksum.calculateChecksum( ChecksumAlgorithm.SHA1 ); + String md5 = checksum.calculateChecksum( ChecksumAlgorithm.MD5 ); - MockControl control = mockAuditLogs( - Arrays.asList( "org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.jar", - "org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom" ) ); + String contents = + FileUtils.readFileToString( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + + artifact + ".jar.sha1" ) ); + assertTrue( StringUtils.contains( contents, sha1 ) ); - String returnString = uploadAction.doUpload(); - assertEquals( Action.SUCCESS, returnString ); + contents = + FileUtils.readFileToString( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + version + "/" + + artifact + ".jar.md5" ) ); + assertTrue( StringUtils.contains( contents, md5 ) ); + } - archivaConfigControl.verify(); - repoFactoryControl.verify(); - control.verify(); + private String getTimestamp( String[] artifactsList, int startIndex, int index ) + { + int endIndex = -1; + String timestamp; - String repoLocation = config.findManagedRepositoryById( REPOSITORY_ID ).getLocation(); - assertAllArtifactsIncludingSupportArtifactsArePresent( repoLocation ); + if ( artifactsList[index].contains( "jar" ) ) + { + endIndex = artifactsList[index].indexOf( ".jar" ); + } + else + { + endIndex = artifactsList[index].indexOf( ".pom" ); + } + + timestamp = artifactsList[index].substring( startIndex, endIndex ); - verifyChecksums( repoLocation ); + return timestamp; } - + private MockControl mockAuditLogs( List resources ) { return mockAuditLogs( AuditEvent.UPLOAD_FILE, resources ); @@ -261,12 +286,12 @@ public class UploadActionTest uploadAction.setAuditListeners( Collections.singletonList( listener ) ); return control; } - - public void testArtifactUploadWithClassifier() + + public void testArtifactUploadWithPomSuccessful() throws Exception { - setUploadParameters( "1.0", "tests", new File( getBasedir(), - "target/test-classes/upload-artifact-test/artifact-to-be-uploaded.jar" ), + setUploadParameters( "1.0", null, new File( getBasedir(), + "target/test-classes/upload-artifact-test/artifact-to-be-uploaded.jar" ), new File( getBasedir(), "target/test-classes/upload-artifact-test/pom.xml" ), false ); ManagedRepositoryContent content = new ManagedDefaultRepositoryContent(); @@ -279,7 +304,7 @@ public class UploadActionTest repoFactoryControl.replay(); MockControl control = mockAuditLogs( - Arrays.asList( "org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0-tests.jar", + Arrays.asList( "org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.jar", "org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom" ) ); String returnString = uploadAction.doUpload(); @@ -290,68 +315,58 @@ public class UploadActionTest control.verify(); String repoLocation = config.findManagedRepositoryById( REPOSITORY_ID ).getLocation(); - assertTrue( new File( repoLocation, - "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0-tests.jar" ).exists() ); - assertTrue( new File( repoLocation, - "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0-tests.jar.sha1" ).exists() ); - assertTrue( new File( repoLocation, - "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0-tests.jar.md5" ).exists() ); + assertAllArtifactsIncludingSupportArtifactsArePresent( repoLocation, "artifact-upload-1.0", "1.0" ); - assertTrue( - new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom" ).exists() ); - assertTrue( - new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom.sha1" ).exists() ); - assertTrue( - new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom.md5" ).exists() ); + verifyArtifactChecksums( repoLocation, "artifact-upload-1.0", "1.0" ); + verifyPomChecksums( repoLocation, "artifact-upload-1.0", "1.0" ); + verifyProjectMetadataChecksums( repoLocation ); + } - assertTrue( - new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA ).exists() ); - assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA + - ".sha1" ).exists() ); - assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA + - ".md5" ).exists() ); + public void testArtifactUploadWithClassifier() + throws Exception + { + setUploadParameters( "1.0", "tests", new File( getBasedir(), + "target/test-classes/upload-artifact-test/artifact-to-be-uploaded.jar" ), + new File( getBasedir(), "target/test-classes/upload-artifact-test/pom.xml" ), false ); - // verify checksums of jar file - ChecksummedFile checksum = new ChecksummedFile( - new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0-tests.jar" ) ); - String sha1 = checksum.calculateChecksum( ChecksumAlgorithm.SHA1 ); - String md5 = checksum.calculateChecksum( ChecksumAlgorithm.MD5 ); + ManagedRepositoryContent content = new ManagedDefaultRepositoryContent(); + content.setRepository( config.findManagedRepositoryById( REPOSITORY_ID ) ); - String contents = FileUtils.readFileToString( - new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0-tests.jar.sha1" ) ); - assertTrue( StringUtils.contains( contents, sha1 ) ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config ); + repoFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( REPOSITORY_ID ), content ); - contents = FileUtils.readFileToString( - new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0-tests.jar.md5" ) ); - assertTrue( StringUtils.contains( contents, md5 ) ); + archivaConfigControl.replay(); + repoFactoryControl.replay(); - // verify checksums of jar file - checksum = new ChecksummedFile( - new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom" ) ); - sha1 = checksum.calculateChecksum( ChecksumAlgorithm.SHA1 ); - md5 = checksum.calculateChecksum( ChecksumAlgorithm.MD5 ); + MockControl control = mockAuditLogs( + Arrays.asList( "org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0-tests.jar", + "org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom" ) ); - contents = FileUtils.readFileToString( - new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom.sha1" ) ); - assertTrue( StringUtils.contains( contents, sha1 ) ); + String returnString = uploadAction.doUpload(); + assertEquals( Action.SUCCESS, returnString ); - contents = FileUtils.readFileToString( - new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom.md5" ) ); - assertTrue( StringUtils.contains( contents, md5 ) ); + archivaConfigControl.verify(); + repoFactoryControl.verify(); + control.verify(); - // verify checksums of metadata file - checksum = new ChecksummedFile( - new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA ) ); - sha1 = checksum.calculateChecksum( ChecksumAlgorithm.SHA1 ); - md5 = checksum.calculateChecksum( ChecksumAlgorithm.MD5 ); + String repoLocation = config.findManagedRepositoryById( REPOSITORY_ID ).getLocation(); + assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0-tests.jar" ).exists() ); + assertTrue( new File( repoLocation, + "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0-tests.jar.sha1" ).exists() ); + assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0-tests.jar.md5" ).exists() ); - contents = FileUtils.readFileToString( - new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA + ".sha1" ) ); - assertTrue( StringUtils.contains( contents, sha1 ) ); + assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom" ).exists() ); + assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom.sha1" ).exists() ); + assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom.md5" ).exists() ); + + assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA ).exists() ); + assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA + + ".sha1" ).exists() ); + assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA + + ".md5" ).exists() ); - contents = FileUtils.readFileToString( - new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA + ".md5" ) ); - assertTrue( StringUtils.contains( contents, md5 ) ); + verifyArtifactChecksums( repoLocation, "artifact-upload-1.0-tests", "1.0" ); + verifyProjectMetadataChecksums( repoLocation ); } public void testArtifactUploadGeneratePomSuccessful() @@ -382,9 +397,11 @@ public class UploadActionTest control.verify(); String repoLocation = config.findManagedRepositoryById( REPOSITORY_ID ).getLocation(); - assertAllArtifactsIncludingSupportArtifactsArePresent( repoLocation ); + assertAllArtifactsIncludingSupportArtifactsArePresent( repoLocation, "artifact-upload-1.0", "1.0" ); - verifyChecksums( repoLocation ); + verifyArtifactChecksums( repoLocation, "artifact-upload-1.0", "1.0" ); + verifyPomChecksums( repoLocation, "artifact-upload-1.0", "1.0" ); + verifyProjectMetadataChecksums( repoLocation ); } public void testArtifactUploadNoPomSuccessful() @@ -485,14 +502,11 @@ public class UploadActionTest repoFactoryControl.verify(); String repoLocation = config.findManagedRepositoryById( REPOSITORY_ID ).getLocation(); - assertFalse( - new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.jar" ).exists() ); + assertFalse( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.jar" ).exists() ); - assertFalse( - new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom" ).exists() ); + assertFalse( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0/artifact-upload-1.0.pom" ).exists() ); - assertFalse( - new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA ).exists() ); + assertFalse( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA ).exists() ); } public void testArtifactUploadSnapshots() @@ -527,88 +541,101 @@ public class UploadActionTest String repoLocation = config.findManagedRepositoryById( REPOSITORY_ID ).getLocation(); String[] artifactsList = new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/" ).list(); - - assertEquals( 6, artifactsList.length ); + Arrays.sort( artifactsList ); - assertTrue( - new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA ).exists() ); - assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA + - ".sha1" ).exists() ); - assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + MetadataTools.MAVEN_METADATA + - ".md5" ).exists() ); - - int startIndex = "artifact-upload-1.0-".length(); - int endIndex = -1; + assertEquals( 9, artifactsList.length ); + assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/" + + MetadataTools.MAVEN_METADATA ).exists() ); + assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/" + + MetadataTools.MAVEN_METADATA + ".sha1" ).exists() ); + assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/" + + MetadataTools.MAVEN_METADATA + ".md5" ).exists() ); - if ( artifactsList[0].contains( "jar" ) ) - { - endIndex = artifactsList[0].indexOf( ".jar" ); - } - else - { - endIndex = artifactsList[0].indexOf( ".pom" ); - } + int startIndex = "artifact-upload-1.0-".length(); + String timestampPath = getTimestamp( artifactsList, startIndex, 0 ); - String actualTimestamp = artifactsList[0].substring( startIndex, endIndex ); + assertAllArtifactsIncludingSupportArtifactsArePresent( repoLocation, "artifact-upload-1.0-" + timestampPath, + "1.0-SNAPSHOT" ); + verifyArtifactChecksums( repoLocation, "artifact-upload-1.0-" + timestampPath, "1.0-SNAPSHOT" ); + verifyPomChecksums( repoLocation, "artifact-upload-1.0-" + timestampPath, "1.0-SNAPSHOT" ); + verifyProjectMetadataChecksums( repoLocation ); + verifyVersionMetadataChecksums( repoLocation, "1.0-SNAPSHOT" ); + + // verify build number + File metadataFile = + new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/" + MetadataTools.MAVEN_METADATA ); + ArchivaRepositoryMetadata artifactMetadata = RepositoryMetadataReader.read( metadataFile ); - assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/artifact-upload-1.0-" + actualTimestamp + ".jar" ).exists() ); - assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/artifact-upload-1.0-" + actualTimestamp + ".jar.md5" ).exists() ); - assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/artifact-upload-1.0-" + actualTimestamp + ".jar.sha1" ).exists() ); - assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/artifact-upload-1.0-" + actualTimestamp + ".pom" ).exists() ); - assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/artifact-upload-1.0-" + actualTimestamp + ".pom.md5" ).exists() ); - assertTrue( new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/artifact-upload-1.0-" + actualTimestamp + ".pom.sha1" ).exists() ); + SnapshotVersion snapshotVersion = artifactMetadata.getSnapshotVersion(); + assertEquals( "Incorrect build number set in artifact metadata.", 1, snapshotVersion.getBuildNumber() ); - // verify checksums of jar file - ChecksummedFile checksum = - new ChecksummedFile( new File( repoLocation, - "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/artifact-upload-1.0-" + actualTimestamp + ".jar" ) ); - String sha1 = checksum.calculateChecksum( ChecksumAlgorithm.SHA1 ); - String md5 = checksum.calculateChecksum( ChecksumAlgorithm.MD5 ); + String timestampPart = StringUtils.substringBeforeLast( timestampPath, "-" ); + assertEquals( "Incorrect timestamp set in artifact metadata.", timestampPart, snapshotVersion.getTimestamp() ); - String contents = - FileUtils.readFileToString( new File( repoLocation, - "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/artifact-upload-1.0-" + actualTimestamp + ".jar.sha1" ) ); - assertTrue( StringUtils.contains( contents, sha1 ) ); + String buildnumber = StringUtils.substringAfterLast( timestampPath, "-" ); + assertEquals( "Incorrect build number in filename.", "1", buildnumber ); - contents = - FileUtils.readFileToString( new File( repoLocation, - "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/artifact-upload-1.0-" + actualTimestamp + ".jar.md5" ) ); - assertTrue( StringUtils.contains( contents, md5 ) ); + archivaConfigControl.reset(); + repoFactoryControl.reset(); + control.reset(); - // verify checksums of pom file - checksum = - new ChecksummedFile( new File( repoLocation, - "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/artifact-upload-1.0-" + actualTimestamp + ".pom" ) ); - sha1 = checksum.calculateChecksum( ChecksumAlgorithm.SHA1 ); - md5 = checksum.calculateChecksum( ChecksumAlgorithm.MD5 ); + control.setDefaultMatcher( MockControl.ALWAYS_MATCHER ); - contents = - FileUtils.readFileToString( new File( repoLocation, - "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/artifact-upload-1.0-" + actualTimestamp + ".pom.sha1" ) ); - assertTrue( StringUtils.contains( contents, sha1 ) ); + // MRM-1353 + // upload snapshot artifact again and check if build number was incremented + setUploadParameters( "1.0-SNAPSHOT", null, + new File( getBasedir(), + "target/test-classes/upload-artifact-test/artifact-to-be-uploaded.jar" ), null, + true ); - contents = - FileUtils.readFileToString( new File( repoLocation, - "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/artifact-upload-1.0-" + actualTimestamp + ".pom.md5" ) ); - assertTrue( StringUtils.contains( contents, md5 ) ); + archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config ); + repoFactoryControl.expectAndReturn( repoFactory.getManagedRepositoryContent( REPOSITORY_ID ), content ); + + archivaConfigControl.replay(); + repoFactoryControl.replay(); + + fmt = new SimpleDateFormat( "yyyyMMdd.HHmmss" ); + fmt.setTimeZone( TimeZone.getTimeZone( "UTC" ) ); + timestamp = fmt.format( new Date() ); + + control = mockAuditLogs( Arrays.asList( + "org/apache/archiva/artifact-upload/1.0-SNAPSHOT/artifact-upload-1.0-" + timestamp + "-2.jar", + "org/apache/archiva/artifact-upload/1.0-SNAPSHOT/artifact-upload-1.0-" + timestamp + "-2.pom" ) ); + + returnString = uploadAction.doUpload(); + assertEquals( Action.SUCCESS, returnString ); + archivaConfigControl.verify(); + repoFactoryControl.verify(); + control.verify(); - // verify checksums of metadata file - checksum = - new ChecksummedFile( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + - MetadataTools.MAVEN_METADATA ) ); - sha1 = checksum.calculateChecksum( ChecksumAlgorithm.SHA1 ); - md5 = checksum.calculateChecksum( ChecksumAlgorithm.MD5 ); + artifactsList = new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/" ).list(); + Arrays.sort( artifactsList ); + + assertEquals( 15, artifactsList.length ); - contents = - FileUtils.readFileToString( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + - MetadataTools.MAVEN_METADATA + ".sha1" ) ); - assertTrue( StringUtils.contains( contents, sha1 ) ); + timestampPath = getTimestamp( artifactsList, startIndex, 6 ); - contents = - FileUtils.readFileToString( new File( repoLocation, "/org/apache/archiva/artifact-upload/" + - MetadataTools.MAVEN_METADATA + ".md5" ) ); - assertTrue( StringUtils.contains( contents, md5 ) ); + assertAllArtifactsIncludingSupportArtifactsArePresent( repoLocation, "artifact-upload-1.0-" + timestampPath, + "1.0-SNAPSHOT" ); + verifyArtifactChecksums( repoLocation, "artifact-upload-1.0-" + timestampPath, "1.0-SNAPSHOT" ); + verifyPomChecksums( repoLocation, "artifact-upload-1.0-" + timestampPath, "1.0-SNAPSHOT" ); + verifyProjectMetadataChecksums( repoLocation ); + verifyVersionMetadataChecksums( repoLocation, "1.0-SNAPSHOT" ); + + // verify build number set in metadata and in filename + metadataFile = + new File( repoLocation, "/org/apache/archiva/artifact-upload/1.0-SNAPSHOT/" + MetadataTools.MAVEN_METADATA ); + artifactMetadata = RepositoryMetadataReader.read( metadataFile ); + + snapshotVersion = artifactMetadata.getSnapshotVersion(); + assertEquals( "Incorrect build number set in artifact metadata.", 2, snapshotVersion.getBuildNumber() ); + + timestampPart = StringUtils.substringBeforeLast( timestampPath, "-" ); + assertEquals( "Incorrect timestamp set in artifact metadata.", timestampPart, snapshotVersion.getTimestamp() ); + + buildnumber = StringUtils.substringAfterLast( timestampPath, "-" ); + assertEquals( "Incorrect build number in filename.", "2", buildnumber ); } public void testChecksumIsCorrectWhenArtifactIsReUploaded() @@ -639,9 +666,11 @@ public class UploadActionTest repoFactoryControl.reset(); String repoLocation = config.findManagedRepositoryById( REPOSITORY_ID ).getLocation(); - assertAllArtifactsIncludingSupportArtifactsArePresent( repoLocation ); + assertAllArtifactsIncludingSupportArtifactsArePresent( repoLocation, "artifact-upload-1.0", "1.0" ); - verifyChecksums( repoLocation ); + verifyArtifactChecksums( repoLocation, "artifact-upload-1.0", "1.0" ); + verifyPomChecksums( repoLocation, "artifact-upload-1.0", "1.0" ); + verifyProjectMetadataChecksums( repoLocation ); // RE-upload artifact setUploadParameters( "1.0", null, new File( getBasedir(), @@ -668,9 +697,11 @@ public class UploadActionTest control.verify(); repoLocation = config.findManagedRepositoryById( REPOSITORY_ID ).getLocation(); - assertAllArtifactsIncludingSupportArtifactsArePresent( repoLocation ); + assertAllArtifactsIncludingSupportArtifactsArePresent( repoLocation, "artifact-upload-1.0", "1.0" ); - verifyChecksums( repoLocation ); + verifyArtifactChecksums( repoLocation, "artifact-upload-1.0", "1.0" ); + verifyPomChecksums( repoLocation, "artifact-upload-1.0", "1.0" ); + verifyProjectMetadataChecksums( repoLocation ); } public void testUploadArtifactAlreadyExistingRedeploymentsBlocked() @@ -706,9 +737,11 @@ public class UploadActionTest control.verify(); String repoLocation = config.findManagedRepositoryById( REPOSITORY_ID ).getLocation(); - assertAllArtifactsIncludingSupportArtifactsArePresent( repoLocation ); + assertAllArtifactsIncludingSupportArtifactsArePresent( repoLocation, "artifact-upload-1.0", "1.0" ); - verifyChecksums( repoLocation ); + verifyArtifactChecksums( repoLocation, "artifact-upload-1.0", "1.0" ); + verifyPomChecksums( repoLocation, "artifact-upload-1.0", "1.0" ); + verifyProjectMetadataChecksums( repoLocation ); } public void testUploadArtifactAlreadyExistingRedeploymentsAllowed() @@ -750,9 +783,10 @@ public class UploadActionTest control.verify(); String repoLocation = config.findManagedRepositoryById( REPOSITORY_ID ).getLocation(); - assertAllArtifactsIncludingSupportArtifactsArePresent( repoLocation ); + assertAllArtifactsIncludingSupportArtifactsArePresent( repoLocation, "artifact-upload-1.0", "1.0" ); - verifyChecksums( repoLocation ); + verifyArtifactChecksums( repoLocation, "artifact-upload-1.0", "1.0" ); + verifyPomChecksums( repoLocation, "artifact-upload-1.0", "1.0" ); + verifyProjectMetadataChecksums( repoLocation ); } - }