diff options
author | Brett Porter <brett@apache.org> | 2006-01-27 04:35:37 +0000 |
---|---|---|
committer | Brett Porter <brett@apache.org> | 2006-01-27 04:35:37 +0000 |
commit | 00ea26352a50a95b2f9ae661c3992053e7642f98 (patch) | |
tree | 7b11c79800d741a6b339779655a5f6ba9c90d653 /maven-repository-converter | |
parent | ae38360d9c7d2b29e03ff2b7f0d8051122807d87 (diff) | |
download | archiva-00ea26352a50a95b2f9ae661c3992053e7642f98.tar.gz archiva-00ea26352a50a95b2f9ae661c3992053e7642f98.zip |
[MRM-9] checksum tests
git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@372727 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'maven-repository-converter')
17 files changed, 237 insertions, 122 deletions
diff --git a/maven-repository-converter/pom.xml b/maven-repository-converter/pom.xml index fcb90db1c..d19b9d9c8 100644 --- a/maven-repository-converter/pom.xml +++ b/maven-repository-converter/pom.xml @@ -37,5 +37,10 @@ <groupId>org.apache.maven.repository</groupId> <artifactId>maven-repository-reports-standard</artifactId> </dependency> + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-i18n</artifactId> + <version>1.0-beta-6</version> + </dependency> </dependencies> </project> diff --git a/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/DefaultRepositoryConverter.java b/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/DefaultRepositoryConverter.java index ce62db609..0158c9ce2 100644 --- a/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/DefaultRepositoryConverter.java +++ b/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/DefaultRepositoryConverter.java @@ -28,6 +28,9 @@ import org.apache.maven.artifact.repository.metadata.Versioning; import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader; import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Writer; import org.apache.maven.model.converter.ArtifactPomRewriter; +import org.apache.maven.repository.digest.Digester; +import org.apache.maven.repository.reporting.ArtifactReporter; +import org.codehaus.plexus.i18n.I18N; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; @@ -38,9 +41,10 @@ import java.io.FileWriter; import java.io.IOException; import java.io.StringReader; import java.io.Writer; -import java.util.ArrayList; +import java.security.NoSuchAlgorithmException; import java.util.Iterator; import java.util.List; +import java.util.Locale; import java.util.regex.Matcher; /** @@ -55,6 +59,11 @@ public class DefaultRepositoryConverter /** * @plexus.requirement */ + private Digester digester; + + /** + * @plexus.requirement + */ private ArtifactFactory artifactFactory; /** @@ -63,46 +72,52 @@ public class DefaultRepositoryConverter private ArtifactPomRewriter rewriter; /** - * @plexus.configuration + * @plexus.configuration default-value="false" */ private boolean force; /** - * @plexus.configuration + * @plexus.configuration default-value="false" */ private boolean dryrun; - public List convert( Artifact artifact, ArtifactRepository targetRepository ) + /** + * @plexus.requirement + */ + private I18N i18n; + + public void convert( Artifact artifact, ArtifactRepository targetRepository, ArtifactReporter reporter ) throws RepositoryConversionException { - copyArtifact( artifact, targetRepository ); - - List warnings = copyPom( artifact, targetRepository ); + if ( copyArtifact( artifact, targetRepository, reporter ) ) + { + copyPom( artifact, targetRepository, reporter ); - Metadata metadata = createBaseMetadata( artifact ); - Versioning versioning = new Versioning(); - versioning.addVersion( artifact.getBaseVersion() ); - metadata.setVersioning( versioning ); - updateMetadata( new ArtifactRepositoryMetadata( artifact ), targetRepository, metadata ); + Metadata metadata = createBaseMetadata( artifact ); + Versioning versioning = new Versioning(); + versioning.addVersion( artifact.getBaseVersion() ); + metadata.setVersioning( versioning ); + updateMetadata( new ArtifactRepositoryMetadata( artifact ), targetRepository, metadata ); - metadata = createBaseMetadata( artifact ); - metadata.setVersion( artifact.getBaseVersion() ); - versioning = new Versioning(); + metadata = createBaseMetadata( artifact ); + metadata.setVersion( artifact.getBaseVersion() ); + versioning = new Versioning(); - Matcher matcher = Artifact.VERSION_FILE_PATTERN.matcher( artifact.getVersion() ); - if ( matcher.matches() ) - { - Snapshot snapshot = new Snapshot(); - snapshot.setBuildNumber( Integer.valueOf( matcher.group( 3 ) ).intValue() ); - snapshot.setTimestamp( matcher.group( 2 ) ); - versioning.setSnapshot( snapshot ); - } + Matcher matcher = Artifact.VERSION_FILE_PATTERN.matcher( artifact.getVersion() ); + if ( matcher.matches() ) + { + Snapshot snapshot = new Snapshot(); + snapshot.setBuildNumber( Integer.valueOf( matcher.group( 3 ) ).intValue() ); + snapshot.setTimestamp( matcher.group( 2 ) ); + versioning.setSnapshot( snapshot ); + } - // TODO: merge latest/release/snapshot from source instead - metadata.setVersioning( versioning ); - updateMetadata( new SnapshotArtifactRepositoryMetadata( artifact ), targetRepository, metadata ); + // TODO: merge latest/release/snapshot from source instead + metadata.setVersioning( versioning ); + updateMetadata( new SnapshotArtifactRepositoryMetadata( artifact ), targetRepository, metadata ); - return warnings; + reporter.addSuccess( artifact ); + } } private static Metadata createBaseMetadata( Artifact artifact ) @@ -175,11 +190,9 @@ public class DefaultRepositoryConverter } } - private List copyPom( Artifact artifact, ArtifactRepository targetRepository ) + private void copyPom( Artifact artifact, ArtifactRepository targetRepository, ArtifactReporter reporter ) throws RepositoryConversionException { - List warnings = new ArrayList(); - Artifact pom = artifactFactory.createProjectArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion() ); pom.setBaseVersion( artifact.getBaseVersion() ); @@ -191,17 +204,22 @@ public class DefaultRepositoryConverter // TODO: utility methods in the model converter File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pom ) ); - String contents; + String contents = null; + boolean checksumsValid = false; try { - contents = FileUtils.fileRead( file ); + if ( testChecksums( artifact, file, reporter ) ) + { + checksumsValid = true; + contents = FileUtils.fileRead( file ); + } } catch ( IOException e ) { throw new RepositoryConversionException( "Unable to read source POM: " + e.getMessage(), e ); } - if ( contents.indexOf( "modelVersion" ) >= 0 ) + if ( checksumsValid && contents.indexOf( "modelVersion" ) >= 0 ) { // v4 POM try @@ -239,7 +257,13 @@ public class DefaultRepositoryConverter rewriter.rewrite( stringReader, fileWriter, false, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType() ); - warnings = rewriter.getWarnings(); + List warnings = rewriter.getWarnings(); + + for ( Iterator i = warnings.iterator(); i.hasNext(); ) + { + String message = (String) i.next(); + reporter.addWarning( artifact, message ); + } IOUtil.close( fileWriter ); } @@ -254,16 +278,54 @@ public class DefaultRepositoryConverter } } } - return warnings; } - private void copyArtifact( Artifact artifact, ArtifactRepository targetRepository ) + private boolean testChecksums( Artifact artifact, File file, ArtifactReporter reporter ) + throws IOException, RepositoryConversionException + { + boolean result = true; + + try + { + File md5 = new File( file.getParentFile(), file.getName() + ".md5" ); + if ( md5.exists() ) + { + String checksum = FileUtils.fileRead( md5 ); + if ( !digester.verifyChecksum( file, checksum, Digester.MD5 ) ) + { + reporter.addFailure( artifact, i18n.getString( getClass().getName(), Locale.getDefault(), + "failure.incorrect.md5" ) ); + result = false; + } + } + + File sha1 = new File( file.getParentFile(), file.getName() + ".sha1" ); + if ( sha1.exists() ) + { + String checksum = FileUtils.fileRead( sha1 ); + if ( !digester.verifyChecksum( file, checksum, Digester.SHA1 ) ) + { + reporter.addFailure( artifact, i18n.getString( getClass().getName(), Locale.getDefault(), + "failure.incorrect.sha1" ) ); + result = false; + } + } + } + catch ( NoSuchAlgorithmException e ) + { + throw new RepositoryConversionException( "Error copying artifact: " + e.getMessage(), e ); + } + return result; + } + + private boolean copyArtifact( Artifact artifact, ArtifactRepository targetRepository, ArtifactReporter reporter ) throws RepositoryConversionException { File sourceFile = artifact.getFile(); File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + boolean result = true; try { boolean matching = false; @@ -273,9 +335,16 @@ public class DefaultRepositoryConverter } if ( force || !matching ) { - if ( !dryrun ) + if ( testChecksums( artifact, sourceFile, reporter ) ) + { + if ( !dryrun ) + { + FileUtils.copyFile( sourceFile, targetFile ); + } + } + else { - FileUtils.copyFile( sourceFile, targetFile ); + result = false; } } } @@ -283,15 +352,16 @@ public class DefaultRepositoryConverter { throw new RepositoryConversionException( "Error copying artifact", e ); } + return result; } - public void convert( List artifacts, ArtifactRepository targetRepository ) + public void convert( List artifacts, ArtifactRepository targetRepository, ArtifactReporter reporter ) throws RepositoryConversionException { for ( Iterator i = artifacts.iterator(); i.hasNext(); ) { Artifact artifact = (Artifact) i.next(); - convert( artifact, targetRepository ); + convert( artifact, targetRepository, reporter ); } } } diff --git a/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/RepositoryConverter.java b/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/RepositoryConverter.java index 1fbb38cb3..06214e8b4 100644 --- a/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/RepositoryConverter.java +++ b/maven-repository-converter/src/main/java/org/apache/maven/repository/converter/RepositoryConverter.java @@ -18,6 +18,7 @@ package org.apache.maven.repository.converter; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.repository.reporting.ArtifactReporter; import java.util.List; @@ -35,9 +36,9 @@ public interface RepositoryConverter * * @param artifact the artifact to convert * @param targetRepository the target repository - * @return a list of warnings occuring during the conversion + * @param reporter reporter to track the results of the conversion */ - List convert( Artifact artifact, ArtifactRepository targetRepository ) + void convert( Artifact artifact, ArtifactRepository targetRepository, ArtifactReporter reporter ) throws RepositoryConversionException; /** @@ -45,7 +46,8 @@ public interface RepositoryConverter * * @param artifacts the set of artifacts to convert * @param targetRepository the target repository + * @param reporter reporter to track the results of the conversions */ - void convert( List artifacts, ArtifactRepository targetRepository ) + void convert( List artifacts, ArtifactRepository targetRepository, ArtifactReporter reporter ) throws RepositoryConversionException; } diff --git a/maven-repository-converter/src/main/resources/org/apache/maven/repository/converter/DefaultRepositoryConverter.properties b/maven-repository-converter/src/main/resources/org/apache/maven/repository/converter/DefaultRepositoryConverter.properties new file mode 100644 index 000000000..324beff41 --- /dev/null +++ b/maven-repository-converter/src/main/resources/org/apache/maven/repository/converter/DefaultRepositoryConverter.properties @@ -0,0 +1,18 @@ +# +# Copyright 2005-2006 The Apache Software Foundation. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +failure.incorrect.md5=The MD5 checksum value was incorrect. +failure.incorrect.sha1=The SHA1 checksum value was incorrect.
\ No newline at end of file diff --git a/maven-repository-converter/src/test/java/org/apache/maven/repository/converter/RepositoryConverterTest.java b/maven-repository-converter/src/test/java/org/apache/maven/repository/converter/RepositoryConverterTest.java index f75fe3103..ce2f2a768 100644 --- a/maven-repository-converter/src/test/java/org/apache/maven/repository/converter/RepositoryConverterTest.java +++ b/maven-repository-converter/src/test/java/org/apache/maven/repository/converter/RepositoryConverterTest.java @@ -24,7 +24,11 @@ import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata; import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata; +import org.apache.maven.repository.reporting.ArtifactReporter; +import org.apache.maven.repository.reporting.ArtifactResult; +import org.apache.maven.repository.reporting.DefaultArtifactReporter; import org.codehaus.plexus.PlexusTestCase; +import org.codehaus.plexus.i18n.I18N; import org.codehaus.plexus.util.FileUtils; import java.io.File; @@ -32,6 +36,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Locale; import java.util.regex.Matcher; /** @@ -54,8 +59,12 @@ public class RepositoryConverterTest private ArtifactFactory artifactFactory; + private ArtifactReporter reporter; + private static final int SLEEP_MILLIS = 100; + private I18N i18n; + protected void setUp() throws Exception { @@ -80,6 +89,10 @@ public class RepositoryConverterTest repositoryConverter = (RepositoryConverter) lookup( RepositoryConverter.ROLE, "default" ); artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE ); + + i18n = (I18N) lookup( I18N.ROLE ); + + reporter = new DefaultArtifactReporter(); } public void testV4PomConvert() @@ -98,7 +111,8 @@ public class RepositoryConverterTest targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) ); versionMetadataFile.delete(); - repositoryConverter.convert( artifact, targetRepository ); + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkSuccess(); File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); assertTrue( "Check artifact created", artifactFile.exists() ); @@ -140,7 +154,8 @@ public class RepositoryConverterTest targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) ); versionMetadataFile.delete(); - repositoryConverter.convert( artifact, targetRepository ); + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkSuccess(); File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); assertTrue( "Check artifact created", artifactFile.exists() ); @@ -182,7 +197,10 @@ public class RepositoryConverterTest targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) ); versionMetadataFile.delete(); - List warnings = repositoryConverter.convert( artifact, targetRepository ); + repositoryConverter.convert( artifact, targetRepository, reporter ); + assertEquals( "check no errors", 0, reporter.getFailures() ); + assertEquals( "check number of warnings", 2, reporter.getWarnings() ); + assertEquals( "check success", 1, reporter.getSuccesses() ); File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); assertTrue( "Check artifact created", artifactFile.exists() ); @@ -195,8 +213,6 @@ public class RepositoryConverterTest compareFiles( expectedPomFile, pomFile ); - assertEquals( "check number of warnings", 2, warnings.size() ); - // TODO: check 2 warnings (extend and versions) matched on i18n key } @@ -216,7 +232,8 @@ public class RepositoryConverterTest targetRepository.pathOfRemoteRepositoryMetadata( snapshotMetadata ) ); snapshotMetadataFile.delete(); - repositoryConverter.convert( artifact, targetRepository ); + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkSuccess(); File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); assertTrue( "Check artifact created", artifactFile.exists() ); @@ -258,7 +275,8 @@ public class RepositoryConverterTest targetRepository.pathOfRemoteRepositoryMetadata( snapshotMetadata ) ); snapshotMetadataFile.delete(); - repositoryConverter.convert( artifact, targetRepository ); + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkSuccess(); File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); assertTrue( "Check artifact created", artifactFile.exists() ); @@ -300,7 +318,8 @@ public class RepositoryConverterTest targetRepository.pathOfRemoteRepositoryMetadata( snapshotMetadata ) ); snapshotMetadataFile.delete(); - repositoryConverter.convert( artifact, targetRepository ); + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkSuccess(); File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); assertTrue( "Check artifact created", artifactFile.exists() ); @@ -342,7 +361,8 @@ public class RepositoryConverterTest targetRepository.pathOfRemoteRepositoryMetadata( snapshotMetadata ) ); snapshotMetadataFile.delete(); - repositoryConverter.convert( artifact, targetRepository ); + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkSuccess(); File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); assertTrue( "Check artifact created", artifactFile.exists() ); @@ -374,7 +394,8 @@ public class RepositoryConverterTest // test that a POM is created when there was none at the source Artifact artifact = createArtifact( "test", "noPomArtifact", "1.0.0" ); - repositoryConverter.convert( artifact, targetRepository ); + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkSuccess(); File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); assertTrue( "Check artifact created", artifactFile.exists() ); @@ -388,36 +409,38 @@ public class RepositoryConverterTest assertFalse( "No source POM", sourcePomFile.exists() ); } - public void testInvalidSourceChecksumMd5() + public void testIncorrectSourceChecksumMd5() throws RepositoryConversionException { - // test that it fails when the source md5 is not a valid md5 - - Artifact artifact = createArtifact( "test", "invalidMd5Artifact", "1.0.0" ); - repositoryConverter.convert( artifact, targetRepository ); - - // TODO: check for failure - } - - public void testInvalidSourceChecksumSha1() - { - // test that it fails when the source sha1 is not a valid sha1 + // test that it fails when the source md5 is wrong - // TODO: using exceptions at this level, or passing in reporter? - } + Artifact artifact = createArtifact( "test", "incorrectMd5Artifact", "1.0.0" ); + File file = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + file.delete(); - public void testIncorrectSourceChecksumMd5() - { - // test that it fails when the source md5 is wrong + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkFailure(); + ArtifactResult failure = (ArtifactResult) reporter.getArtifactFailureIterator().next(); + assertEquals( "check failure message", getI18nString( "failure.incorrect.md5" ), failure.getReason() ); - // TODO: using exceptions at this level, or passing in reporter? + assertFalse( "Check artifact not created", file.exists() ); } public void testIncorrectSourceChecksumSha1() + throws RepositoryConversionException { // test that it fails when the source sha1 is wrong - // TODO: using exceptions at this level, or passing in reporter? + Artifact artifact = createArtifact( "test", "incorrectSha1Artifact", "1.0.0" ); + File file = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + file.delete(); + + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkFailure(); + ArtifactResult failure = (ArtifactResult) reporter.getArtifactFailureIterator().next(); + assertEquals( "check failure message", getI18nString( "failure.incorrect.sha1" ), failure.getReason() ); + + assertFalse( "Check artifact not created", file.exists() ); } public void testUnmodifiedArtifact() @@ -445,7 +468,8 @@ public class RepositoryConverterTest // Need to guarantee last modified is not equal Thread.sleep( SLEEP_MILLIS ); - repositoryConverter.convert( artifact, targetRepository ); + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkSuccess(); compareFiles( sourceFile, targetFile ); compareFiles( sourcePomFile, targetPomFile ); @@ -486,7 +510,8 @@ public class RepositoryConverterTest // Need to guarantee last modified is not equal Thread.sleep( SLEEP_MILLIS ); - repositoryConverter.convert( artifact, targetRepository ); + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkSuccess(); compareFiles( sourceFile, targetFile ); compareFiles( sourcePomFile, targetPomFile ); @@ -510,7 +535,8 @@ public class RepositoryConverterTest File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); File targetPomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) ); - repositoryConverter.convert( artifact, targetRepository ); + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkSuccess(); assertTrue( "Check source file exists", sourceFile.exists() ); assertTrue( "Check source POM exists", sourcePomFile.exists() ); @@ -563,7 +589,10 @@ public class RepositoryConverterTest artifacts.add( createArtifact( "test", "artifact-one", "1.0.0" ) ); artifacts.add( createArtifact( "test", "artifact-two", "1.0.0" ) ); artifacts.add( createArtifact( "test", "artifact-three", "1.0.0" ) ); - repositoryConverter.convert( artifacts, targetRepository ); + repositoryConverter.convert( artifacts, targetRepository, reporter ); + assertEquals( "check no errors", 0, reporter.getFailures() ); + assertEquals( "check no warnings", 0, reporter.getWarnings() ); + assertEquals( "check successes", 3, reporter.getSuccesses() ); for ( Iterator i = artifacts.iterator(); i.hasNext(); ) { @@ -604,7 +633,8 @@ public class RepositoryConverterTest Artifact artifact = createArtifact( "test", "newversion-artifact", "1.0.1" ); - repositoryConverter.convert( artifact, targetRepository ); + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkSuccess(); File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); assertTrue( "Check artifact created", artifactFile.exists() ); @@ -678,4 +708,23 @@ public class RepositoryConverterTest return path.trim().replaceAll( "\r\n", "\n" ).replace( '\r', '\n' ); } + private void checkSuccess() + { + assertEquals( "check no errors", 0, reporter.getFailures() ); + assertEquals( "check no warnings", 0, reporter.getWarnings() ); + assertEquals( "check success", 1, reporter.getSuccesses() ); + } + + private void checkFailure() + { + assertEquals( "check num errors", 1, reporter.getFailures() ); + assertEquals( "check no warnings", 0, reporter.getWarnings() ); + assertEquals( "check no success", 0, reporter.getSuccesses() ); + } + + private String getI18nString( String key ) + { + return i18n.getString( repositoryConverter.getClass().getName(), Locale.getDefault(), key ); + } + } diff --git a/maven-repository-converter/src/test/source-repository/test/jars/incorrectMd5Artifact-1.0.0.jar b/maven-repository-converter/src/test/source-repository/test/jars/incorrectMd5Artifact-1.0.0.jar new file mode 100644 index 000000000..72af4bc10 --- /dev/null +++ b/maven-repository-converter/src/test/source-repository/test/jars/incorrectMd5Artifact-1.0.0.jar @@ -0,0 +1 @@ +incorrectMd5 diff --git a/maven-repository-converter/src/test/source-repository/test/jars/incorrectMd5Artifact-1.0.0.jar.md5 b/maven-repository-converter/src/test/source-repository/test/jars/incorrectMd5Artifact-1.0.0.jar.md5 new file mode 100644 index 000000000..316d9a4eb --- /dev/null +++ b/maven-repository-converter/src/test/source-repository/test/jars/incorrectMd5Artifact-1.0.0.jar.md5 @@ -0,0 +1 @@ +379dcfcd1e6312cc859111f696047eb4 diff --git a/maven-repository-converter/src/test/source-repository/test/jars/incorrectSha1Artifact-1.0.0.jar b/maven-repository-converter/src/test/source-repository/test/jars/incorrectSha1Artifact-1.0.0.jar new file mode 100644 index 000000000..f5812f3e5 --- /dev/null +++ b/maven-repository-converter/src/test/source-repository/test/jars/incorrectSha1Artifact-1.0.0.jar @@ -0,0 +1 @@ +incorrectSha1 diff --git a/maven-repository-converter/src/test/source-repository/test/jars/incorrectSha1Artifact-1.0.0.jar.sha1 b/maven-repository-converter/src/test/source-repository/test/jars/incorrectSha1Artifact-1.0.0.jar.sha1 new file mode 100644 index 000000000..cce322eb2 --- /dev/null +++ b/maven-repository-converter/src/test/source-repository/test/jars/incorrectSha1Artifact-1.0.0.jar.sha1 @@ -0,0 +1 @@ +52e07b82d944741f66bba5896d4cd74e9879e289 diff --git a/maven-repository-converter/src/test/source-repository/test/jars/invalidMd5Artifact-1.0.0.jar b/maven-repository-converter/src/test/source-repository/test/jars/invalidMd5Artifact-1.0.0.jar deleted file mode 100644 index 4694cadf5..000000000 --- a/maven-repository-converter/src/test/source-repository/test/jars/invalidMd5Artifact-1.0.0.jar +++ /dev/null @@ -1 +0,0 @@ -invalidMd5 diff --git a/maven-repository-converter/src/test/source-repository/test/jars/invalidMd5Artifact-1.0.0.jar.md5 b/maven-repository-converter/src/test/source-repository/test/jars/invalidMd5Artifact-1.0.0.jar.md5 deleted file mode 100644 index 29f1ec27a..000000000 --- a/maven-repository-converter/src/test/source-repository/test/jars/invalidMd5Artifact-1.0.0.jar.md5 +++ /dev/null @@ -1 +0,0 @@ -md5
\ No newline at end of file diff --git a/maven-repository-converter/src/test/source-repository/test/poms/incorrectMd5Artifact-1.0.0.pom b/maven-repository-converter/src/test/source-repository/test/poms/incorrectMd5Artifact-1.0.0.pom new file mode 100644 index 000000000..74d5e12b4 --- /dev/null +++ b/maven-repository-converter/src/test/source-repository/test/poms/incorrectMd5Artifact-1.0.0.pom @@ -0,0 +1,6 @@ +<project> + <pomVersion>3</pomVersion> + <artifactId>incorrectMd5Artifact</artifactId> + <groupId>test</groupId> + <currentVersion>1.0.0</currentVersion> +</project> diff --git a/maven-repository-converter/src/test/source-repository/test/poms/incorrectSha1Artifact-1.0.0.pom b/maven-repository-converter/src/test/source-repository/test/poms/incorrectSha1Artifact-1.0.0.pom new file mode 100644 index 000000000..fe3c7fd91 --- /dev/null +++ b/maven-repository-converter/src/test/source-repository/test/poms/incorrectSha1Artifact-1.0.0.pom @@ -0,0 +1,6 @@ +<project> + <pomVersion>3</pomVersion> + <artifactId>incorrectSha1Artifact</artifactId> + <groupId>test</groupId> + <currentVersion>1.0.0</currentVersion> +</project> diff --git a/maven-repository-converter/src/test/source-repository/test/poms/invalidMd5Artifact-1.0.0.pom b/maven-repository-converter/src/test/source-repository/test/poms/invalidMd5Artifact-1.0.0.pom deleted file mode 100644 index 1a7012ee4..000000000 --- a/maven-repository-converter/src/test/source-repository/test/poms/invalidMd5Artifact-1.0.0.pom +++ /dev/null @@ -1,22 +0,0 @@ -<!-- - ~ Copyright 2005-2006 The Apache Software Foundation. - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - -<project> - <pomVersion>3</pomVersion> - <artifactId>invalidMd5Artifact</artifactId> - <groupId>test</groupId> - <currentVersion>1.0.0</currentVersion> -</project> diff --git a/maven-repository-converter/src/test/source-repository/test/poms/v3artifact-1.0.0-20060105.130101-3.pom b/maven-repository-converter/src/test/source-repository/test/poms/v3artifact-1.0.0-20060105.130101-3.pom index 4d550c7dd..d7ae8953b 100644 --- a/maven-repository-converter/src/test/source-repository/test/poms/v3artifact-1.0.0-20060105.130101-3.pom +++ b/maven-repository-converter/src/test/source-repository/test/poms/v3artifact-1.0.0-20060105.130101-3.pom @@ -19,13 +19,6 @@ <artifactId>v3artifact</artifactId> <groupId>test</groupId> <currentVersion>1.0.0-20060105.130101-3</currentVersion> - <versions> - <version> - <id>1.0</id> - <name>1.0</name> - <tag>1_0</tag> - </version> - </versions> <dependencies> <dependency> <groupId>groupId</groupId> diff --git a/maven-repository-converter/src/test/source-repository/test/poms/v3artifact-1.0.0-SNAPSHOT.pom b/maven-repository-converter/src/test/source-repository/test/poms/v3artifact-1.0.0-SNAPSHOT.pom index 966d1a509..3958a3358 100644 --- a/maven-repository-converter/src/test/source-repository/test/poms/v3artifact-1.0.0-SNAPSHOT.pom +++ b/maven-repository-converter/src/test/source-repository/test/poms/v3artifact-1.0.0-SNAPSHOT.pom @@ -19,13 +19,6 @@ <artifactId>v3artifact</artifactId> <groupId>test</groupId> <currentVersion>1.0.0-SNAPSHOT</currentVersion> - <versions> - <version> - <id>1.0</id> - <name>1.0</name> - <tag>1_0</tag> - </version> - </versions> <dependencies> <dependency> <groupId>groupId</groupId> diff --git a/maven-repository-converter/src/test/source-repository/test/poms/v3artifact-1.0.0.pom b/maven-repository-converter/src/test/source-repository/test/poms/v3artifact-1.0.0.pom index 310b01278..5aed3437a 100644 --- a/maven-repository-converter/src/test/source-repository/test/poms/v3artifact-1.0.0.pom +++ b/maven-repository-converter/src/test/source-repository/test/poms/v3artifact-1.0.0.pom @@ -3,13 +3,6 @@ <artifactId>v3artifact</artifactId> <groupId>test</groupId> <currentVersion>1.0.0</currentVersion> - <versions> - <version> - <id>1.0</id> - <name>1.0</name> - <tag>1_0</tag> - </version> - </versions> <dependencies> <dependency> <groupId>groupId</groupId> |