diff options
Diffstat (limited to 'archiva-converter/src/test')
83 files changed, 2136 insertions, 0 deletions
diff --git a/archiva-converter/src/test/expected-files/converted-artifact-one.pom b/archiva-converter/src/test/expected-files/converted-artifact-one.pom new file mode 100644 index 000000000..cd3862d35 --- /dev/null +++ b/archiva-converter/src/test/expected-files/converted-artifact-one.pom @@ -0,0 +1,6 @@ +<project> + <modelVersion>4.0.0</modelVersion> + <groupId>test</groupId> + <artifactId>artifact-one</artifactId> + <version>1.0.0</version> +</project> diff --git a/archiva-converter/src/test/expected-files/converted-artifact-three.pom b/archiva-converter/src/test/expected-files/converted-artifact-three.pom new file mode 100644 index 000000000..343291037 --- /dev/null +++ b/archiva-converter/src/test/expected-files/converted-artifact-three.pom @@ -0,0 +1,6 @@ +<project> + <modelVersion>4.0.0</modelVersion> + <groupId>test</groupId> + <artifactId>artifact-three</artifactId> + <version>1.0.0</version> +</project> diff --git a/archiva-converter/src/test/expected-files/converted-artifact-two.pom b/archiva-converter/src/test/expected-files/converted-artifact-two.pom new file mode 100644 index 000000000..227470167 --- /dev/null +++ b/archiva-converter/src/test/expected-files/converted-artifact-two.pom @@ -0,0 +1,6 @@ +<project> + <modelVersion>4.0.0</modelVersion> + <groupId>test</groupId> + <artifactId>artifact-two</artifactId> + <version>1.0.0</version> +</project> diff --git a/archiva-converter/src/test/expected-files/converted-v3-snapshot.pom b/archiva-converter/src/test/expected-files/converted-v3-snapshot.pom new file mode 100644 index 000000000..9134c3cdf --- /dev/null +++ b/archiva-converter/src/test/expected-files/converted-v3-snapshot.pom @@ -0,0 +1,22 @@ +<project> + <modelVersion>4.0.0</modelVersion> + <groupId>test</groupId> + <artifactId>v3artifact</artifactId> + <version>1.0.0-SNAPSHOT</version> + <scm> + <connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection> + </scm> + <dependencies> + <dependency> + <groupId>groupId</groupId> + <artifactId>artifactId</artifactId> + <version>version</version> + </dependency> + <dependency> + <groupId>groupId</groupId> + <artifactId>test-artifactId</artifactId> + <version>version</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/archiva-converter/src/test/expected-files/converted-v3-timestamped-snapshot.pom b/archiva-converter/src/test/expected-files/converted-v3-timestamped-snapshot.pom new file mode 100644 index 000000000..46eacaf2e --- /dev/null +++ b/archiva-converter/src/test/expected-files/converted-v3-timestamped-snapshot.pom @@ -0,0 +1,22 @@ +<project> + <modelVersion>4.0.0</modelVersion> + <groupId>test</groupId> + <artifactId>v3artifact</artifactId> + <version>1.0.0-20060105.130101-3</version> + <scm> + <connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection> + </scm> + <dependencies> + <dependency> + <groupId>groupId</groupId> + <artifactId>artifactId</artifactId> + <version>version</version> + </dependency> + <dependency> + <groupId>groupId</groupId> + <artifactId>test-artifactId</artifactId> + <version>version</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/archiva-converter/src/test/expected-files/converted-v3-warnings.pom b/archiva-converter/src/test/expected-files/converted-v3-warnings.pom new file mode 100644 index 000000000..e07664932 --- /dev/null +++ b/archiva-converter/src/test/expected-files/converted-v3-warnings.pom @@ -0,0 +1,22 @@ +<project> + <modelVersion>4.0.0</modelVersion> + <groupId>test</groupId> + <artifactId>v3-warnings-artifact</artifactId> + <version>1.0.0</version> + <scm> + <connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection> + </scm> + <dependencies> + <dependency> + <groupId>groupId</groupId> + <artifactId>artifactId</artifactId> + <version>version</version> + </dependency> + <dependency> + <groupId>groupId</groupId> + <artifactId>test-artifactId</artifactId> + <version>version</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/archiva-converter/src/test/expected-files/converted-v3.pom b/archiva-converter/src/test/expected-files/converted-v3.pom new file mode 100644 index 000000000..29ba92771 --- /dev/null +++ b/archiva-converter/src/test/expected-files/converted-v3.pom @@ -0,0 +1,22 @@ +<project> + <modelVersion>4.0.0</modelVersion> + <groupId>test</groupId> + <artifactId>v3artifact</artifactId> + <version>1.0.0</version> + <scm> + <connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection> + </scm> + <dependencies> + <dependency> + <groupId>groupId</groupId> + <artifactId>artifactId</artifactId> + <version>version</version> + </dependency> + <dependency> + <groupId>groupId</groupId> + <artifactId>test-artifactId</artifactId> + <version>version</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/archiva-converter/src/test/expected-files/newversion-artifact-metadata.xml b/archiva-converter/src/test/expected-files/newversion-artifact-metadata.xml new file mode 100644 index 000000000..ecc7f09a0 --- /dev/null +++ b/archiva-converter/src/test/expected-files/newversion-artifact-metadata.xml @@ -0,0 +1,10 @@ +<metadata> + <groupId>test</groupId> + <artifactId>newversion-artifact</artifactId> + <versioning> + <versions> + <version>1.0.0</version> + <version>1.0.1</version> + </versions> + </versioning> +</metadata> diff --git a/archiva-converter/src/test/expected-files/relocated-test/relocated-v3artifact/1.0.0/maven-metadata.xml b/archiva-converter/src/test/expected-files/relocated-test/relocated-v3artifact/1.0.0/maven-metadata.xml new file mode 100644 index 000000000..ebd9be970 --- /dev/null +++ b/archiva-converter/src/test/expected-files/relocated-test/relocated-v3artifact/1.0.0/maven-metadata.xml @@ -0,0 +1,6 @@ +<metadata> + <groupId>relocated-test</groupId> + <artifactId>relocated-v3artifact</artifactId> + <version>1.0.0</version> + <versioning /> +</metadata>
\ No newline at end of file diff --git a/archiva-converter/src/test/expected-files/relocated-test/relocated-v3artifact/1.0.0/relocated-v3artifact-1.0.0.jar b/archiva-converter/src/test/expected-files/relocated-test/relocated-v3artifact/1.0.0/relocated-v3artifact-1.0.0.jar new file mode 100644 index 000000000..29ef827e8 --- /dev/null +++ b/archiva-converter/src/test/expected-files/relocated-test/relocated-v3artifact/1.0.0/relocated-v3artifact-1.0.0.jar @@ -0,0 +1 @@ +v3 diff --git a/archiva-converter/src/test/expected-files/relocated-test/relocated-v3artifact/1.0.0/relocated-v3artifact-1.0.0.pom b/archiva-converter/src/test/expected-files/relocated-test/relocated-v3artifact/1.0.0/relocated-v3artifact-1.0.0.pom new file mode 100644 index 000000000..253ef3466 --- /dev/null +++ b/archiva-converter/src/test/expected-files/relocated-test/relocated-v3artifact/1.0.0/relocated-v3artifact-1.0.0.pom @@ -0,0 +1,22 @@ +<project> + <modelVersion>4.0.0</modelVersion> + <groupId>relocated-test</groupId> + <artifactId>relocated-v3artifact</artifactId> + <version>1.0.0</version> + <scm> + <connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection> + </scm> + <dependencies> + <dependency> + <groupId>groupId</groupId> + <artifactId>artifactId</artifactId> + <version>version</version> + </dependency> + <dependency> + <groupId>groupId</groupId> + <artifactId>test-artifactId</artifactId> + <version>version</version> + <scope>test</scope> + </dependency> + </dependencies> +</project>
\ No newline at end of file diff --git a/archiva-converter/src/test/expected-files/relocated-test/relocated-v3artifact/maven-metadata.xml b/archiva-converter/src/test/expected-files/relocated-test/relocated-v3artifact/maven-metadata.xml new file mode 100644 index 000000000..b4b1a864a --- /dev/null +++ b/archiva-converter/src/test/expected-files/relocated-test/relocated-v3artifact/maven-metadata.xml @@ -0,0 +1,9 @@ +<metadata> + <groupId>relocated-test</groupId> + <artifactId>relocated-v3artifact</artifactId> + <versioning> + <versions> + <version>1.0.0</version> + </versions> + </versioning> +</metadata>
\ No newline at end of file diff --git a/archiva-converter/src/test/expected-files/test/relocated-v3artifact/1.0.0/relocated-v3artifact-1.0.0.pom b/archiva-converter/src/test/expected-files/test/relocated-v3artifact/1.0.0/relocated-v3artifact-1.0.0.pom new file mode 100644 index 000000000..b20f62f9e --- /dev/null +++ b/archiva-converter/src/test/expected-files/test/relocated-v3artifact/1.0.0/relocated-v3artifact-1.0.0.pom @@ -0,0 +1,12 @@ +<project> + <groupId>test</groupId> + <artifactId>relocated-v3artifact</artifactId> + <version>1.0.0</version> + <distributionManagement> + <relocation> + <groupId>relocated-test</groupId> + <artifactId>relocated-v3artifact</artifactId> + <version>1.0.0</version> + </relocation> + </distributionManagement> +</project>
\ No newline at end of file diff --git a/archiva-converter/src/test/expected-files/v3-artifact-metadata.xml b/archiva-converter/src/test/expected-files/v3-artifact-metadata.xml new file mode 100644 index 000000000..a8a7f3748 --- /dev/null +++ b/archiva-converter/src/test/expected-files/v3-artifact-metadata.xml @@ -0,0 +1,9 @@ +<metadata> + <groupId>test</groupId> + <artifactId>v3artifact</artifactId> + <versioning> + <versions> + <version>1.0.0</version> + </versions> + </versioning> +</metadata> diff --git a/archiva-converter/src/test/expected-files/v3-snapshot-artifact-metadata.xml b/archiva-converter/src/test/expected-files/v3-snapshot-artifact-metadata.xml new file mode 100644 index 000000000..24d25a0e0 --- /dev/null +++ b/archiva-converter/src/test/expected-files/v3-snapshot-artifact-metadata.xml @@ -0,0 +1,9 @@ +<metadata> + <groupId>test</groupId> + <artifactId>v3artifact</artifactId> + <versioning> + <versions> + <version>1.0.0-SNAPSHOT</version> + </versions> + </versioning> +</metadata> diff --git a/archiva-converter/src/test/expected-files/v3-snapshot-metadata.xml b/archiva-converter/src/test/expected-files/v3-snapshot-metadata.xml new file mode 100644 index 000000000..b19c537b5 --- /dev/null +++ b/archiva-converter/src/test/expected-files/v3-snapshot-metadata.xml @@ -0,0 +1,6 @@ +<metadata> + <groupId>test</groupId> + <artifactId>v3artifact</artifactId> + <version>1.0.0-SNAPSHOT</version> + <versioning /> +</metadata> diff --git a/archiva-converter/src/test/expected-files/v3-timestamped-snapshot-metadata.xml b/archiva-converter/src/test/expected-files/v3-timestamped-snapshot-metadata.xml new file mode 100644 index 000000000..602c38ec8 --- /dev/null +++ b/archiva-converter/src/test/expected-files/v3-timestamped-snapshot-metadata.xml @@ -0,0 +1,11 @@ +<metadata> + <groupId>test</groupId> + <artifactId>v3artifact</artifactId> + <version>1.0.0-SNAPSHOT</version> + <versioning> + <snapshot> + <timestamp>20060105.130101</timestamp> + <buildNumber>3</buildNumber> + </snapshot> + </versioning> +</metadata> diff --git a/archiva-converter/src/test/expected-files/v3-version-metadata.xml b/archiva-converter/src/test/expected-files/v3-version-metadata.xml new file mode 100644 index 000000000..3c8938984 --- /dev/null +++ b/archiva-converter/src/test/expected-files/v3-version-metadata.xml @@ -0,0 +1,6 @@ +<metadata> + <groupId>test</groupId> + <artifactId>v3artifact</artifactId> + <version>1.0.0</version> + <versioning /> +</metadata> diff --git a/archiva-converter/src/test/expected-files/v4-artifact-metadata.xml b/archiva-converter/src/test/expected-files/v4-artifact-metadata.xml new file mode 100644 index 000000000..c0cdbfdb4 --- /dev/null +++ b/archiva-converter/src/test/expected-files/v4-artifact-metadata.xml @@ -0,0 +1,9 @@ +<metadata> + <groupId>test</groupId> + <artifactId>v4artifact</artifactId> + <versioning> + <versions> + <version>1.0.0</version> + </versions> + </versioning> +</metadata> diff --git a/archiva-converter/src/test/expected-files/v4-snapshot-artifact-metadata.xml b/archiva-converter/src/test/expected-files/v4-snapshot-artifact-metadata.xml new file mode 100644 index 000000000..f8072b0df --- /dev/null +++ b/archiva-converter/src/test/expected-files/v4-snapshot-artifact-metadata.xml @@ -0,0 +1,9 @@ +<metadata> + <groupId>test</groupId> + <artifactId>v4artifact</artifactId> + <versioning> + <versions> + <version>1.0.0-SNAPSHOT</version> + </versions> + </versioning> +</metadata> diff --git a/archiva-converter/src/test/expected-files/v4-snapshot-metadata.xml b/archiva-converter/src/test/expected-files/v4-snapshot-metadata.xml new file mode 100644 index 000000000..d5ecb7d47 --- /dev/null +++ b/archiva-converter/src/test/expected-files/v4-snapshot-metadata.xml @@ -0,0 +1,6 @@ +<metadata> + <groupId>test</groupId> + <artifactId>v4artifact</artifactId> + <version>1.0.0-SNAPSHOT</version> + <versioning /> +</metadata> diff --git a/archiva-converter/src/test/expected-files/v4-timestamped-snapshot-metadata.xml b/archiva-converter/src/test/expected-files/v4-timestamped-snapshot-metadata.xml new file mode 100644 index 000000000..060a79cdd --- /dev/null +++ b/archiva-converter/src/test/expected-files/v4-timestamped-snapshot-metadata.xml @@ -0,0 +1,11 @@ +<metadata> + <groupId>test</groupId> + <artifactId>v4artifact</artifactId> + <version>1.0.0-SNAPSHOT</version> + <versioning> + <snapshot> + <timestamp>20060111.120115</timestamp> + <buildNumber>1</buildNumber> + </snapshot> + </versioning> +</metadata> diff --git a/archiva-converter/src/test/expected-files/v4-version-metadata.xml b/archiva-converter/src/test/expected-files/v4-version-metadata.xml new file mode 100644 index 000000000..7cbd8ad3d --- /dev/null +++ b/archiva-converter/src/test/expected-files/v4-version-metadata.xml @@ -0,0 +1,6 @@ +<metadata> + <groupId>test</groupId> + <artifactId>v4artifact</artifactId> + <version>1.0.0</version> + <versioning /> +</metadata> diff --git a/archiva-converter/src/test/java/org/apache/maven/repository/converter/RepositoryConverterTest.java b/archiva-converter/src/test/java/org/apache/maven/repository/converter/RepositoryConverterTest.java new file mode 100644 index 000000000..d7b83cf7e --- /dev/null +++ b/archiva-converter/src/test/java/org/apache/maven/repository/converter/RepositoryConverterTest.java @@ -0,0 +1,947 @@ +package org.apache.maven.repository.converter; + +/* + * 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. + */ + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.factory.ArtifactFactory; +import org.apache.maven.artifact.metadata.ArtifactMetadata; +import org.apache.maven.artifact.repository.ArtifactRepository; +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; +import java.io.IOException; +import java.net.MalformedURLException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.regex.Matcher; + +/** + * Test the repository converter. + * + * @author <a href="mailto:brett@apache.org">Brett Porter</a> + * @todo what about deletions from the source repository? + * @todo use artifact-test instead + * @todo should reject if dependencies are missing - rely on reporting? + * @todo group metadata + */ +public class RepositoryConverterTest + extends PlexusTestCase +{ + private ArtifactRepository sourceRepository; + + private ArtifactRepository targetRepository; + + private RepositoryConverter repositoryConverter; + + private ArtifactFactory artifactFactory; + + private ArtifactReporter reporter; + + private static final int SLEEP_MILLIS = 100; + + private I18N i18n; + + protected void setUp() + throws Exception + { + super.setUp(); + + ArtifactRepositoryFactory factory = (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE ); + + ArtifactRepositoryLayout layout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "legacy" ); + + File sourceBase = getTestFile( "src/test/source-repository" ); + sourceRepository = + factory.createArtifactRepository( "source", sourceBase.toURL().toString(), layout, null, null ); + + layout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" ); + + File targetBase = getTestFile( "target/test-target-repository" ); + copyDirectoryStructure( getTestFile( "src/test/target-repository" ), targetBase ); + + targetRepository = + factory.createArtifactRepository( "target", targetBase.toURL().toString(), layout, null, null ); + + repositoryConverter = (RepositoryConverter) lookup( RepositoryConverter.ROLE, "default" ); + + artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE ); + + i18n = (I18N) lookup( I18N.ROLE ); + + reporter = new DefaultArtifactReporter(); + } + + private void copyDirectoryStructure( File sourceDirectory, File destinationDirectory ) + throws IOException + { + if ( !sourceDirectory.exists() ) + { + throw new IOException( "Source directory doesn't exists (" + sourceDirectory.getAbsolutePath() + ")." ); + } + + File[] files = sourceDirectory.listFiles(); + + String sourcePath = sourceDirectory.getAbsolutePath(); + + for ( int i = 0; i < files.length; i++ ) + { + File file = files[i]; + + String dest = file.getAbsolutePath(); + + dest = dest.substring( sourcePath.length() + 1 ); + + File destination = new File( destinationDirectory, dest ); + + if ( file.isFile() ) + { + destination = destination.getParentFile(); + + FileUtils.copyFileToDirectory( file, destination ); + } + else if ( file.isDirectory() ) + { + if ( !".svn".equals( file.getName() ) ) + { + if ( !destination.exists() && !destination.mkdirs() ) + { + throw new IOException( + "Could not create destination directory '" + destination.getAbsolutePath() + "'." ); + } + copyDirectoryStructure( file, destination ); + } + } + else + { + throw new IOException( "Unknown file type: " + file.getAbsolutePath() ); + } + } + } + + public void testV4PomConvert() + throws IOException, RepositoryConversionException + { + // test that it is copied as is + + Artifact artifact = createArtifact( "test", "v4artifact", "1.0.0" ); + ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact ); + File artifactMetadataFile = new File( targetRepository.getBasedir(), + targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) ); + artifactMetadataFile.delete(); + + ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact ); + File versionMetadataFile = new File( targetRepository.getBasedir(), + targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) ); + versionMetadataFile.delete(); + + File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + artifactFile.delete(); + + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkSuccess(); + + assertTrue( "Check artifact created", artifactFile.exists() ); + assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) ); + + artifact = createPomArtifact( artifact ); + File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) ); + assertTrue( "Check POM created", pomFile.exists() ); + + compareFiles( sourcePomFile, pomFile ); + + assertTrue( "Check artifact metadata created", artifactMetadataFile.exists() ); + + File expectedMetadataFile = getTestFile( "src/test/expected-files/v4-artifact-metadata.xml" ); + + compareFiles( expectedMetadataFile, artifactMetadataFile ); + + assertTrue( "Check snapshot metadata created", versionMetadataFile.exists() ); + + expectedMetadataFile = getTestFile( "src/test/expected-files/v4-version-metadata.xml" ); + + compareFiles( expectedMetadataFile, versionMetadataFile ); + } + + public void testV3PomConvert() + throws IOException, RepositoryConversionException + { + // test that the pom is coverted + + Artifact artifact = createArtifact( "test", "v3artifact", "1.0.0" ); + ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact ); + File artifactMetadataFile = new File( targetRepository.getBasedir(), + targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) ); + artifactMetadataFile.delete(); + + ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact ); + File versionMetadataFile = new File( targetRepository.getBasedir(), + targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) ); + versionMetadataFile.delete(); + + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkSuccess(); + + File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + assertTrue( "Check artifact created", artifactFile.exists() ); + assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) ); + + artifact = createPomArtifact( artifact ); + File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + File expectedPomFile = getTestFile( "src/test/expected-files/converted-v3.pom" ); + assertTrue( "Check POM created", pomFile.exists() ); + + compareFiles( expectedPomFile, pomFile ); + + assertTrue( "Check artifact metadata created", artifactMetadataFile.exists() ); + + File expectedMetadataFile = getTestFile( "src/test/expected-files/v3-artifact-metadata.xml" ); + + compareFiles( expectedMetadataFile, artifactMetadataFile ); + + assertTrue( "Check snapshot metadata created", versionMetadataFile.exists() ); + + expectedMetadataFile = getTestFile( "src/test/expected-files/v3-version-metadata.xml" ); + + compareFiles( expectedMetadataFile, versionMetadataFile ); + } + + public void testV3PomConvertWithRelocation() + throws RepositoryConversionException, IOException + { + Artifact artifact = createArtifact( "test", "relocated-v3artifact", "1.0.0" ); + ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact ); + File artifactMetadataFile = new File( targetRepository.getBasedir(), + targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) ); + artifactMetadataFile.delete(); + + ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact ); + File versionMetadataFile = new File( targetRepository.getBasedir(), + targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) ); + versionMetadataFile.delete(); + + repositoryConverter.convert( artifact, targetRepository, reporter ); + //checkSuccess(); --> commented until MNG-2100 is fixed + + File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + assertTrue( "Check if relocated artifact created", artifactFile.exists() ); + assertTrue( "Check if relocated artifact matches", + FileUtils.contentEquals( artifactFile, artifact.getFile() ) ); + Artifact pomArtifact = createArtifact( "relocated-test", "relocated-v3artifact", "1.0.0", "1.0.0", "pom" ); + File pomFile = getTestFile( "src/test/expected-files/" + targetRepository.pathOf( pomArtifact ) ); + File testFile = getTestFile( "target/test-target-repository/" + targetRepository.pathOf( pomArtifact ) ); + compareFiles( pomFile, testFile ); + + Artifact orig = createArtifact( "test", "relocated-v3artifact", "1.0.0", "1.0.0", "pom" ); + artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( orig ) ); + assertTrue( "Check if relocation artifact pom is created", artifactFile.exists() ); + testFile = getTestFile( "src/test/expected-files/" + targetRepository.pathOf( orig ) ); + compareFiles( artifactFile, testFile ); + } + + public void testV3PomWarningsOnConvert() + throws RepositoryConversionException, IOException + { + // test that the pom is converted but that warnings are reported + + Artifact artifact = createArtifact( "test", "v3-warnings-artifact", "1.0.0" ); + ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact ); + File artifactMetadataFile = new File( targetRepository.getBasedir(), + targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) ); + artifactMetadataFile.delete(); + + ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact ); + File versionMetadataFile = new File( targetRepository.getBasedir(), + targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) ); + versionMetadataFile.delete(); + + 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() ); + assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) ); + + artifact = createPomArtifact( artifact ); + File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + File expectedPomFile = getTestFile( "src/test/expected-files/converted-v3-warnings.pom" ); + assertTrue( "Check POM created", pomFile.exists() ); + + compareFiles( expectedPomFile, pomFile ); + + // TODO: check 2 warnings (extend and versions) matched on i18n key + } + + private void doTestV4SnapshotPomConvert( String version, String expectedMetadataFileName ) + throws RepositoryConversionException, IOException + { + // test that it is copied as is + + Artifact artifact = createArtifact( "test", "v4artifact", version ); + ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact ); + File artifactMetadataFile = new File( targetRepository.getBasedir(), + targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) ); + artifactMetadataFile.delete(); + + ArtifactMetadata snapshotMetadata = new SnapshotArtifactRepositoryMetadata( artifact ); + File snapshotMetadataFile = new File( targetRepository.getBasedir(), + targetRepository.pathOfRemoteRepositoryMetadata( snapshotMetadata ) ); + snapshotMetadataFile.delete(); + + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkSuccess(); + + File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + assertTrue( "Check artifact created", artifactFile.exists() ); + assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) ); + + artifact = createPomArtifact( artifact ); + File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) ); + assertTrue( "Check POM created", pomFile.exists() ); + + compareFiles( sourcePomFile, pomFile ); + + assertTrue( "Check artifact metadata created", artifactMetadataFile.exists() ); + + File expectedMetadataFile = getTestFile( "src/test/expected-files/v4-snapshot-artifact-metadata.xml" ); + + compareFiles( expectedMetadataFile, artifactMetadataFile ); + + assertTrue( "Check snapshot metadata created", snapshotMetadataFile.exists() ); + + expectedMetadataFile = getTestFile( expectedMetadataFileName ); + + compareFiles( expectedMetadataFile, snapshotMetadataFile ); + } + + public void testV3SnapshotPomConvert() + throws IOException, RepositoryConversionException + { + // test that the pom is coverted + + Artifact artifact = createArtifact( "test", "v3artifact", "1.0.0-SNAPSHOT" ); + ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact ); + File artifactMetadataFile = new File( targetRepository.getBasedir(), + targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) ); + artifactMetadataFile.delete(); + + ArtifactMetadata snapshotMetadata = new SnapshotArtifactRepositoryMetadata( artifact ); + File snapshotMetadataFile = new File( targetRepository.getBasedir(), + targetRepository.pathOfRemoteRepositoryMetadata( snapshotMetadata ) ); + snapshotMetadataFile.delete(); + + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkSuccess(); + + File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + assertTrue( "Check artifact created", artifactFile.exists() ); + assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) ); + + artifact = createPomArtifact( artifact ); + File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + File expectedPomFile = getTestFile( "src/test/expected-files/converted-v3-snapshot.pom" ); + assertTrue( "Check POM created", pomFile.exists() ); + + compareFiles( expectedPomFile, pomFile ); + + assertTrue( "Check artifact metadata created", artifactMetadataFile.exists() ); + + File expectedMetadataFile = getTestFile( "src/test/expected-files/v3-snapshot-artifact-metadata.xml" ); + + compareFiles( expectedMetadataFile, artifactMetadataFile ); + + assertTrue( "Check snapshot metadata created", snapshotMetadataFile.exists() ); + + expectedMetadataFile = getTestFile( "src/test/expected-files/v3-snapshot-metadata.xml" ); + + compareFiles( expectedMetadataFile, snapshotMetadataFile ); + } + + public void testV4SnapshotPomConvert() + throws IOException, RepositoryConversionException + { + doTestV4SnapshotPomConvert( "1.0.0-SNAPSHOT", "src/test/expected-files/v4-snapshot-metadata.xml" ); + + assertTrue( true ); + } + + public void testV4TimestampedSnapshotPomConvert() + throws IOException, RepositoryConversionException + { + doTestV4SnapshotPomConvert( "1.0.0-20060111.120115-1", + "src/test/expected-files/v4-timestamped-snapshot-metadata.xml" ); + + assertTrue( true ); + } + + public void testV3TimestampedSnapshotPomConvert() + throws IOException, RepositoryConversionException + { + // test that the pom is coverted + + Artifact artifact = createArtifact( "test", "v3artifact", "1.0.0-20060105.130101-3" ); + ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact ); + File artifactMetadataFile = new File( targetRepository.getBasedir(), + targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) ); + artifactMetadataFile.delete(); + + ArtifactMetadata snapshotMetadata = new SnapshotArtifactRepositoryMetadata( artifact ); + File snapshotMetadataFile = new File( targetRepository.getBasedir(), + targetRepository.pathOfRemoteRepositoryMetadata( snapshotMetadata ) ); + snapshotMetadataFile.delete(); + + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkSuccess(); + + File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + assertTrue( "Check artifact created", artifactFile.exists() ); + assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) ); + + artifact = createPomArtifact( artifact ); + File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + File expectedPomFile = getTestFile( "src/test/expected-files/converted-v3-timestamped-snapshot.pom" ); + assertTrue( "Check POM created", pomFile.exists() ); + + compareFiles( expectedPomFile, pomFile ); + + assertTrue( "Check artifact snapshotMetadata created", artifactMetadataFile.exists() ); + + File expectedMetadataFile = getTestFile( "src/test/expected-files/v3-snapshot-artifact-metadata.xml" ); + + compareFiles( expectedMetadataFile, artifactMetadataFile ); + + assertTrue( "Check snapshot snapshotMetadata created", snapshotMetadataFile.exists() ); + + expectedMetadataFile = getTestFile( "src/test/expected-files/v3-timestamped-snapshot-metadata.xml" ); + + compareFiles( expectedMetadataFile, snapshotMetadataFile ); + } + + public void testNoPomConvert() + throws IOException, RepositoryConversionException + { + // test that a POM is not created when there was none at the source + + Artifact artifact = createArtifact( "test", "noPomArtifact", "1.0.0" ); + repositoryConverter.convert( artifact, targetRepository, reporter ); + assertEquals( "check no errors", 0, reporter.getFailures() ); + assertEquals( "check no warnings", 1, reporter.getWarnings() ); + assertEquals( "check success", 1, reporter.getSuccesses() ); + assertEquals( "check warning message", getI18nString( "warning.missing.pom" ), getWarning().getReason() ); + + File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + assertTrue( "Check artifact created", artifactFile.exists() ); + assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) ); + + artifact = createPomArtifact( artifact ); + File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) ); + + assertFalse( "Check no POM created", pomFile.exists() ); + assertFalse( "No source POM", sourcePomFile.exists() ); + } + + public void testIncorrectSourceChecksumMd5() + throws RepositoryConversionException + { + // test that it fails when the source md5 is wrong + + Artifact artifact = createArtifact( "test", "incorrectMd5Artifact", "1.0.0" ); + File file = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + file.delete(); + + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkFailure(); + assertEquals( "check failure message", getI18nString( "failure.incorrect.md5" ), getFailure().getReason() ); + + assertFalse( "Check artifact not created", file.exists() ); + + ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact ); + File metadataFile = + new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) ); + assertFalse( "Check metadata not created", metadataFile.exists() ); + } + + public void testIncorrectSourceChecksumSha1() + throws RepositoryConversionException + { + // test that it fails when the source sha1 is wrong + + 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(); + assertEquals( "check failure message", getI18nString( "failure.incorrect.sha1" ), getFailure().getReason() ); + + assertFalse( "Check artifact not created", file.exists() ); + + ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact ); + File metadataFile = + new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) ); + assertFalse( "Check metadata not created", metadataFile.exists() ); + } + + public void testUnmodifiedArtifact() + throws RepositoryConversionException, IOException, InterruptedException + { + // test the unmodified artifact is untouched + + Artifact artifact = createArtifact( "test", "unmodified-artifact", "1.0.0" ); + Artifact pomArtifact = createPomArtifact( artifact ); + + File sourceFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) ); + File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( pomArtifact ) ); + File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + File targetPomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) ); + + assertTrue( "Check target file exists", targetFile.exists() ); + assertTrue( "Check target POM exists", targetPomFile.exists() ); + + sourceFile.setLastModified( System.currentTimeMillis() ); + sourcePomFile.setLastModified( System.currentTimeMillis() ); + + long origTime = targetFile.lastModified(); + long origPomTime = targetPomFile.lastModified(); + + // Need to guarantee last modified is not equal + Thread.sleep( SLEEP_MILLIS ); + + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkSuccess(); + + compareFiles( sourceFile, targetFile ); + compareFiles( sourcePomFile, targetPomFile ); + + assertEquals( "Check unmodified", origTime, targetFile.lastModified() ); + assertEquals( "Check unmodified", origPomTime, targetPomFile.lastModified() ); + } + + public void testModifedArtifactFails() + throws InterruptedException, RepositoryConversionException, IOException + { + // test that it fails when the source artifact has changed and is different to the existing artifact in the + // target repository + + Artifact artifact = createArtifact( "test", "modified-artifact", "1.0.0" ); + Artifact pomArtifact = createPomArtifact( artifact ); + + File sourceFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) ); + File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( pomArtifact ) ); + File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + File targetPomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) ); + + assertTrue( "Check target file exists", targetFile.exists() ); + assertTrue( "Check target POM exists", targetPomFile.exists() ); + + sourceFile.setLastModified( System.currentTimeMillis() ); + sourcePomFile.setLastModified( System.currentTimeMillis() ); + + long origTime = targetFile.lastModified(); + long origPomTime = targetPomFile.lastModified(); + + // Need to guarantee last modified is not equal + Thread.sleep( SLEEP_MILLIS ); + + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkFailure(); + assertEquals( "Check failure message", getI18nString( "failure.target.already.exists" ), + getFailure().getReason() ); + + assertEquals( "Check unmodified", origTime, targetFile.lastModified() ); + assertEquals( "Check unmodified", origPomTime, targetPomFile.lastModified() ); + + ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact ); + File metadataFile = + new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) ); + assertFalse( "Check metadata not created", metadataFile.exists() ); + } + + public void testForcedUnmodifiedArtifact() + throws Exception, IOException + { + // test unmodified artifact is still converted when set to force + + repositoryConverter = (RepositoryConverter) lookup( RepositoryConverter.ROLE, "force-repository-converter" ); + + Artifact artifact = createArtifact( "test", "unmodified-artifact", "1.0.0" ); + Artifact pomArtifact = createPomArtifact( artifact ); + + File sourceFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) ); + File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( pomArtifact ) ); + File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + File targetPomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) ); + + SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd", Locale.getDefault() ); + long origTime = dateFormat.parse( "2006-03-03" ).getTime(); + targetFile.setLastModified( origTime ); + targetPomFile.setLastModified( origTime ); + + sourceFile.setLastModified( dateFormat.parse( "2006-01-01" ).getTime() ); + sourcePomFile.setLastModified( dateFormat.parse( "2006-02-02" ).getTime() ); + + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkSuccess(); + + compareFiles( sourceFile, targetFile ); + compareFiles( sourcePomFile, targetPomFile ); + + assertFalse( "Check modified", origTime == targetFile.lastModified() ); + assertFalse( "Check modified", origTime == targetPomFile.lastModified() ); + + ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact ); + File metadataFile = + new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) ); + assertTrue( "Check metadata created", metadataFile.exists() ); + } + + public void testDryRunSuccess() + throws Exception + { + // test dry run does nothing on a run that will be successful, and returns success + + repositoryConverter = (RepositoryConverter) lookup( RepositoryConverter.ROLE, "dryrun-repository-converter" ); + + Artifact artifact = createArtifact( "test", "dryrun-artifact", "1.0.0" ); + Artifact pomArtifact = createPomArtifact( artifact ); + + File sourceFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) ); + File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( pomArtifact ) ); + File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + File targetPomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) ); + + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkSuccess(); + + assertTrue( "Check source file exists", sourceFile.exists() ); + assertTrue( "Check source POM exists", sourcePomFile.exists() ); + + assertFalse( "Check target file doesn't exist", targetFile.exists() ); + assertFalse( "Check target POM doesn't exist", targetPomFile.exists() ); + + ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact ); + File metadataFile = + new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) ); + assertFalse( "Check metadata not created", metadataFile.exists() ); + } + + public void testDryRunFailure() + throws Exception + { + // test dry run does nothing on a run that will fail, and returns failure + + repositoryConverter = (RepositoryConverter) lookup( RepositoryConverter.ROLE, "dryrun-repository-converter" ); + + Artifact artifact = createArtifact( "test", "modified-artifact", "1.0.0" ); + Artifact pomArtifact = createPomArtifact( artifact ); + + File sourceFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) ); + File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( pomArtifact ) ); + File targetFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + File targetPomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) ); + + assertTrue( "Check target file exists", targetFile.exists() ); + assertTrue( "Check target POM exists", targetPomFile.exists() ); + + sourceFile.setLastModified( System.currentTimeMillis() ); + sourcePomFile.setLastModified( System.currentTimeMillis() ); + + long origTime = targetFile.lastModified(); + long origPomTime = targetPomFile.lastModified(); + + // Need to guarantee last modified is not equal + Thread.sleep( SLEEP_MILLIS ); + + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkFailure(); + assertEquals( "Check failure message", getI18nString( "failure.target.already.exists" ), + getFailure().getReason() ); + + assertEquals( "Check unmodified", origTime, targetFile.lastModified() ); + assertEquals( "Check unmodified", origPomTime, targetPomFile.lastModified() ); + + ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact ); + File metadataFile = + new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) ); + assertFalse( "Check metadata not created", metadataFile.exists() ); + } + + public void testRollbackArtifactCreated() + throws RepositoryConversionException, IOException + { + // test rollback can remove a created artifact, including checksums + + Artifact artifact = createArtifact( "test", "rollback-created-artifact", "1.0.0" ); + ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact ); + File artifactMetadataFile = new File( targetRepository.getBasedir(), + targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) ); + FileUtils.deleteDirectory( artifactMetadataFile.getParentFile() ); + + ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact ); + File versionMetadataFile = new File( targetRepository.getBasedir(), + targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) ); + + File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkFailure(); + String pattern = "^" + getI18nString( "failure.invalid.source.pom" ).replaceFirst( "\\{0\\}", ".*" ) + "$"; + assertTrue( "Check failure message", getFailure().getReason().matches( pattern ) ); + + assertFalse( "check artifact rolled back", artifactFile.exists() ); + assertFalse( "check metadata rolled back", artifactMetadataFile.exists() ); + assertFalse( "check metadata rolled back", versionMetadataFile.exists() ); + } + + public void testMultipleArtifacts() + throws RepositoryConversionException, IOException + { + // test multiple artifacts are converted + + List artifacts = new ArrayList(); + 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, 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(); ) + { + Artifact artifact = (Artifact) i.next(); + + File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + assertTrue( "Check artifact created", artifactFile.exists() ); + assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) ); + + artifact = createPomArtifact( artifact ); + File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + File expectedPomFile = + getTestFile( "src/test/expected-files/converted-" + artifact.getArtifactId() + ".pom" ); + assertTrue( "Check POM created", pomFile.exists() ); + + compareFiles( expectedPomFile, pomFile ); + } + } + + public void testInvalidSourceArtifactMetadata() + throws Exception + { + // test artifact is not converted when source metadata is invalid, and returns failure + + createModernSourceRepository(); + + Artifact artifact = createArtifact( "test", "incorrectArtifactMetadata", "1.0.0" ); + File file = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + file.delete(); + + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkFailure(); + assertEquals( "check failure message", getI18nString( "failure.incorrect.artifactMetadata.versions" ), + getFailure().getReason() ); + + assertFalse( "Check artifact not created", file.exists() ); + + ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact ); + File metadataFile = + new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) ); + assertFalse( "Check metadata not created", metadataFile.exists() ); + } + + public void testInvalidSourceSnapshotMetadata() + throws Exception, MalformedURLException + { + // test artifact is not converted when source snapshot metadata is invalid and returns failure + + createModernSourceRepository(); + + Artifact artifact = createArtifact( "test", "incorrectSnapshotMetadata", "1.0.0-20060102.030405-6" ); + File file = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + file.delete(); + + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkFailure(); + assertEquals( "check failure message", getI18nString( "failure.incorrect.snapshotMetadata.snapshot" ), + getFailure().getReason() ); + + assertFalse( "Check artifact not created", file.exists() ); + + ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact ); + File metadataFile = + new File( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) ); + assertFalse( "Check metadata not created", metadataFile.exists() ); + } + + public void testMergeArtifactMetadata() + throws RepositoryConversionException, IOException + { + // test artifact level metadata is merged when it already exists on successful conversion + + Artifact artifact = createArtifact( "test", "newversion-artifact", "1.0.1" ); + + repositoryConverter.convert( artifact, targetRepository, reporter ); + checkSuccess(); + + File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + assertTrue( "Check artifact created", artifactFile.exists() ); + assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) ); + + artifact = createPomArtifact( artifact ); + File pomFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) ); + File sourcePomFile = new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) ); + assertTrue( "Check POM created", pomFile.exists() ); + + compareFiles( sourcePomFile, pomFile ); + + ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact ); + File artifactMetadataFile = new File( targetRepository.getBasedir(), + targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) ); + assertTrue( "Check artifact metadata created", artifactMetadataFile.exists() ); + + File expectedMetadataFile = getTestFile( "src/test/expected-files/newversion-artifact-metadata.xml" ); + + compareFiles( expectedMetadataFile, artifactMetadataFile ); + } + + public void testSourceAndTargetRepositoriesMatch() + throws Exception + { + // test that it fails if the same + + ArtifactRepositoryFactory factory = (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE ); + + sourceRepository = factory.createArtifactRepository( "source", targetRepository.getUrl(), + targetRepository.getLayout(), null, null ); + + Artifact artifact = createArtifact( "test", "repository-artifact", "1.0" ); + + try + { + repositoryConverter.convert( artifact, targetRepository, reporter ); + fail( "Should have failed trying to convert within the same repository" ); + } + catch ( RepositoryConversionException e ) + { + // expected + assertEquals( "check message", getI18nString( "exception.repositories.match" ), e.getMessage() ); + assertNull( "Check no additional cause", e.getCause() ); + } + } + + private Artifact createArtifact( String groupId, String artifactId, String version ) + { + Matcher matcher = Artifact.VERSION_FILE_PATTERN.matcher( version ); + String baseVersion; + if ( matcher.matches() ) + { + baseVersion = matcher.group( 1 ) + "-SNAPSHOT"; + } + else + { + baseVersion = version; + } + return createArtifact( groupId, artifactId, baseVersion, version, "jar" ); + } + + private Artifact createArtifact( String groupId, String artifactId, String baseVersion, String version, + String type ) + { + Artifact artifact = artifactFactory.createArtifact( groupId, artifactId, version, null, type ); + artifact.setBaseVersion( baseVersion ); + artifact.setRepository( sourceRepository ); + artifact.setFile( new File( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) ) ); + return artifact; + } + + private Artifact createPomArtifact( Artifact artifact ) + { + return createArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getBaseVersion(), + artifact.getVersion(), "pom" ); + } + + private static void compareFiles( File expectedPomFile, File pomFile ) + throws IOException + { + String expectedContent = normalizeString( FileUtils.fileRead( expectedPomFile ) ); + String targetContent = normalizeString( FileUtils.fileRead( pomFile ) ); + assertEquals( "Check file match between " + expectedPomFile + " and " + pomFile, expectedContent, + targetContent ); + } + + private static String normalizeString( String path ) + { + return path.trim().replaceAll( "\r\n", "\n" ).replace( '\r', '\n' ).replaceAll( "<\\?xml .+\\?>", "" ); + } + + 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 ); + } + + private ArtifactResult getFailure() + { + return (ArtifactResult) reporter.getArtifactFailureIterator().next(); + } + + private ArtifactResult getWarning() + { + return (ArtifactResult) reporter.getArtifactWarningIterator().next(); + } + + private void createModernSourceRepository() + throws Exception + { + ArtifactRepositoryFactory factory = (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE ); + + ArtifactRepositoryLayout layout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" ); + + File sourceBase = getTestFile( "src/test/source-modern-repository" ); + sourceRepository = + factory.createArtifactRepository( "source", sourceBase.toURL().toString(), layout, null, null ); + } +} diff --git a/archiva-converter/src/test/java/org/apache/maven/repository/converter/transaction/CopyFileEventTest.java b/archiva-converter/src/test/java/org/apache/maven/repository/converter/transaction/CopyFileEventTest.java new file mode 100644 index 000000000..627c32cde --- /dev/null +++ b/archiva-converter/src/test/java/org/apache/maven/repository/converter/transaction/CopyFileEventTest.java @@ -0,0 +1,138 @@ +package org.apache.maven.repository.converter.transaction; + +/* + * 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. + */ + +import org.codehaus.plexus.PlexusTestCase; +import org.codehaus.plexus.util.FileUtils; + +import java.io.File; + +/** + * @author Edwin Punzalan + */ +public class CopyFileEventTest + extends PlexusTestCase +{ + private File testDir = new File( PlexusTestCase.getBasedir(), "target/transaction-tests/copy-file" ); + + private File testDest = new File( testDir, "test-file.txt" ); + + private File testSource = new File( PlexusTestCase.getBasedir(), "target/transaction-tests/test-file.txt" ); + + public void setUp() + throws Exception + { + super.setUp(); + + testSource.getParentFile().mkdirs(); + + testSource.createNewFile(); + + FileUtils.fileWrite( testSource.getAbsolutePath(), "source contents" ); + } + + public void testCopyCommitRollback() + throws Exception + { + assertTrue( "Test if the source exists", testSource.exists() ); + + String source = FileUtils.fileRead( testSource.getAbsolutePath() ); + + CopyFileEvent event = new CopyFileEvent( testSource, testDest ); + + assertFalse( "Test that the destination is not yet created", testDest.exists() ); + + event.commit(); + + assertTrue( "Test that the destination is created", testDest.exists() ); + + String target = FileUtils.fileRead( testDest.getAbsolutePath() ); + + assertTrue( "Test that the destination contents are copied correctly", source.equals( target ) ); + + event.rollback(); + + assertFalse( "Test that the destination file has been deleted", testDest.exists() ); + } + + public void testCopyCommitRollbackWithBackup() + throws Exception + { + assertTrue( "Test if the source exists", testSource.exists() ); + + String source = FileUtils.fileRead( testSource.getAbsolutePath() ); + + testDest.getParentFile().mkdirs(); + + testDest.createNewFile(); + + FileUtils.fileWrite( testDest.getAbsolutePath(), "overwritten contents" ); + + assertTrue( "Test that the destination exists", testDest.exists() ); + + CopyFileEvent event = new CopyFileEvent( testSource, testDest ); + + String target = FileUtils.fileRead( testDest.getAbsolutePath() ); + + assertTrue( "Test that the destination contents have not changed", target.equals( "overwritten contents" ) ); + + event.commit(); + + target = FileUtils.fileRead( testDest.getAbsolutePath() ); + + assertTrue( "Test that the destination contents are copied correctly", source.equals( target ) ); + + event.rollback(); + + target = FileUtils.fileRead( testDest.getAbsolutePath() ); + + assertTrue( "Test the destination file contents have been restored", target.equals( "overwritten contents" ) ); + } + + public void testCreateRollbackCommit() + throws Exception + { + assertTrue( "Test if the source exists", testSource.exists() ); + + String source = FileUtils.fileRead( testSource.getAbsolutePath() ); + + CopyFileEvent event = new CopyFileEvent( testSource, testDest ); + + assertFalse( "Test that the destination is not yet created", testDest.exists() ); + + event.rollback(); + + assertFalse( "Test that the destination file is not yet created", testDest.exists() ); + + event.commit(); + + assertTrue( "Test that the destination is created", testDest.exists() ); + + String target = FileUtils.fileRead( testDest.getAbsolutePath() ); + + assertTrue( "Test that the destination contents are copied correctly", source.equals( target ) ); + } + + protected void tearDown() + throws Exception + { + super.tearDown(); + + FileUtils.deleteDirectory( new File( PlexusTestCase.getBasedir(), + "target/transaction-tests" ).getAbsolutePath() ); + } +} diff --git a/archiva-converter/src/test/java/org/apache/maven/repository/converter/transaction/CreateFileEventTest.java b/archiva-converter/src/test/java/org/apache/maven/repository/converter/transaction/CreateFileEventTest.java new file mode 100644 index 000000000..2018e89a2 --- /dev/null +++ b/archiva-converter/src/test/java/org/apache/maven/repository/converter/transaction/CreateFileEventTest.java @@ -0,0 +1,108 @@ +package org.apache.maven.repository.converter.transaction; + +/* + * 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. + */ + +import org.codehaus.plexus.PlexusTestCase; +import org.codehaus.plexus.util.FileUtils; + +import java.io.File; + +/** + * @author Edwin Punzalan + */ +public class CreateFileEventTest + extends PlexusTestCase +{ + private File testDir = new File( PlexusTestCase.getBasedir(), "target/transaction-tests/create-file" ); + + public void testCreateCommitRollback() + throws Exception + { + File testFile = new File( testDir, "test-file.txt" ); + + CreateFileEvent event = new CreateFileEvent( "file contents", testFile ); + + assertFalse( "Test file is not yet created", testFile.exists() ); + + event.commit(); + + assertTrue( "Test file is not yet created", testFile.exists() ); + + event.rollback(); + + assertFalse( "Test file is has been deleted after rollback", testFile.exists() ); + assertFalse( "Test file parent directories has been rolledback too", testDir.exists() ); + assertTrue( "target directory still exists", new File( PlexusTestCase.getBasedir(), "target" ).exists() ); + } + + public void testCreateCommitRollbackWithBackup() + throws Exception + { + File testFile = new File( testDir, "test-file.txt" ); + + testFile.getParentFile().mkdirs(); + + testFile.createNewFile(); + + FileUtils.fileWrite( testFile.getAbsolutePath(), "original contents" ); + + CreateFileEvent event = new CreateFileEvent( "modified contents", testFile ); + + String contents = FileUtils.fileRead( testFile.getAbsolutePath() ); + + assertEquals( "Test contents have not changed", "original contents", contents ); + + event.commit(); + + contents = FileUtils.fileRead( testFile.getAbsolutePath() ); + + assertEquals( "Test contents have not changed", "modified contents", contents ); + + event.rollback(); + + contents = FileUtils.fileRead( testFile.getAbsolutePath() ); + + assertEquals( "Test contents have not changed", "original contents", contents ); + } + + public void testCreateRollbackCommit() + throws Exception + { + File testFile = new File( testDir, "test-file.txt" ); + + CreateFileEvent event = new CreateFileEvent( "file contents", testFile ); + + assertFalse( "Test file is not yet created", testFile.exists() ); + + event.rollback(); + + assertFalse( "Test file is not yet created", testFile.exists() ); + + event.commit(); + + assertTrue( "Test file is not yet created", testFile.exists() ); + } + + protected void tearDown() + throws Exception + { + super.tearDown(); + + FileUtils.deleteDirectory( new File( PlexusTestCase.getBasedir(), + "target/transaction-tests" ).getAbsolutePath() ); + } +} diff --git a/archiva-converter/src/test/resources/org/apache/maven/repository/converter/RepositoryConverterTest.xml b/archiva-converter/src/test/resources/org/apache/maven/repository/converter/RepositoryConverterTest.xml new file mode 100644 index 000000000..f2caaffca --- /dev/null +++ b/archiva-converter/src/test/resources/org/apache/maven/repository/converter/RepositoryConverterTest.xml @@ -0,0 +1,84 @@ +<!-- + ~ 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. + --> + +<component-set> + <components> + <component> + <role>org.apache.maven.repository.converter.RepositoryConverter</role> + <implementation>org.apache.maven.repository.converter.DefaultRepositoryConverter</implementation> + <role-hint>force-repository-converter</role-hint> + <configuration> + <force>true</force> + </configuration> + <requirements> + <requirement> + <role>org.apache.maven.repository.digest.Digester</role> + <role-hint>sha1</role-hint> + <field-name>sha1Digester</field-name> + </requirement> + <requirement> + <role>org.apache.maven.repository.digest.Digester</role> + <role-hint>md5</role-hint> + <field-name>md5Digester</field-name> + </requirement> + <requirement> + <role>org.apache.maven.artifact.factory.ArtifactFactory</role> + <field-name>artifactFactory</field-name> + </requirement> + <requirement> + <role>org.apache.maven.model.converter.ArtifactPomRewriter</role> + <field-name>rewriter</field-name> + </requirement> + <requirement> + <role>org.codehaus.plexus.i18n.I18N</role> + <field-name>i18n</field-name> + </requirement> + </requirements> + </component> + <component> + <role>org.apache.maven.repository.converter.RepositoryConverter</role> + <implementation>org.apache.maven.repository.converter.DefaultRepositoryConverter</implementation> + <role-hint>dryrun-repository-converter</role-hint> + <configuration> + <dryrun>true</dryrun> + </configuration> + <requirements> + <requirement> + <role>org.apache.maven.repository.digest.Digester</role> + <role-hint>sha1</role-hint> + <field-name>sha1Digester</field-name> + </requirement> + <requirement> + <role>org.apache.maven.repository.digest.Digester</role> + <role-hint>md5</role-hint> + <field-name>md5Digester</field-name> + </requirement> + <requirement> + <role>org.apache.maven.artifact.factory.ArtifactFactory</role> + <field-name>artifactFactory</field-name> + </requirement> + <requirement> + <role>org.apache.maven.model.converter.ArtifactPomRewriter</role> + <field-name>rewriter</field-name> + </requirement> + <requirement> + <role>org.codehaus.plexus.i18n.I18N</role> + <field-name>i18n</field-name> + </requirement> + </requirements> + </component> + </components> +</component-set>
\ No newline at end of file diff --git a/archiva-converter/src/test/source-modern-repository/test/incorrectArtifactMetadata/1.0.0/incorrectArtifactMetadata-1.0.0.jar b/archiva-converter/src/test/source-modern-repository/test/incorrectArtifactMetadata/1.0.0/incorrectArtifactMetadata-1.0.0.jar new file mode 100644 index 000000000..72af4bc10 --- /dev/null +++ b/archiva-converter/src/test/source-modern-repository/test/incorrectArtifactMetadata/1.0.0/incorrectArtifactMetadata-1.0.0.jar @@ -0,0 +1 @@ +incorrectMd5 diff --git a/archiva-converter/src/test/source-modern-repository/test/incorrectArtifactMetadata/1.0.0/incorrectArtifactMetadata-1.0.0.pom b/archiva-converter/src/test/source-modern-repository/test/incorrectArtifactMetadata/1.0.0/incorrectArtifactMetadata-1.0.0.pom new file mode 100644 index 000000000..e9ec6a15c --- /dev/null +++ b/archiva-converter/src/test/source-modern-repository/test/incorrectArtifactMetadata/1.0.0/incorrectArtifactMetadata-1.0.0.pom @@ -0,0 +1,22 @@ +<!-- + ~ 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>incorrectArtifactMetadata</artifactId> + <groupId>test</groupId> + <currentVersion>1.0.0</currentVersion> +</project> diff --git a/archiva-converter/src/test/source-modern-repository/test/incorrectArtifactMetadata/maven-metadata.xml b/archiva-converter/src/test/source-modern-repository/test/incorrectArtifactMetadata/maven-metadata.xml new file mode 100644 index 000000000..5ed142599 --- /dev/null +++ b/archiva-converter/src/test/source-modern-repository/test/incorrectArtifactMetadata/maven-metadata.xml @@ -0,0 +1,25 @@ +<!-- + ~ 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. + --> + +<metadata> + <groupId>test</groupId> + <artifactId>incorrectArtifactMetadata</artifactId> + <versioning> + <versions> + <version>0.9</version> + </versions> + </versioning> +</metadata>
\ No newline at end of file diff --git a/archiva-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/1.0.0-SNAPSHOT/incorrectSnapshotMetadata-1.0.0-20060102.030405-6.jar b/archiva-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/1.0.0-SNAPSHOT/incorrectSnapshotMetadata-1.0.0-20060102.030405-6.jar new file mode 100644 index 000000000..72af4bc10 --- /dev/null +++ b/archiva-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/1.0.0-SNAPSHOT/incorrectSnapshotMetadata-1.0.0-20060102.030405-6.jar @@ -0,0 +1 @@ +incorrectMd5 diff --git a/archiva-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/1.0.0-SNAPSHOT/incorrectSnapshotMetadata-1.0.0-20060102.030405-6.pom b/archiva-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/1.0.0-SNAPSHOT/incorrectSnapshotMetadata-1.0.0-20060102.030405-6.pom new file mode 100644 index 000000000..70118f64a --- /dev/null +++ b/archiva-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/1.0.0-SNAPSHOT/incorrectSnapshotMetadata-1.0.0-20060102.030405-6.pom @@ -0,0 +1,22 @@ +<!-- + ~ 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>incorrectSnapshotMetadata</artifactId> + <groupId>test</groupId> + <currentVersion>1.0.0-20060102.030405-6</currentVersion> +</project> diff --git a/archiva-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/1.0.0-SNAPSHOT/maven-metadata.xml b/archiva-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/1.0.0-SNAPSHOT/maven-metadata.xml new file mode 100644 index 000000000..031fb19b6 --- /dev/null +++ b/archiva-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/1.0.0-SNAPSHOT/maven-metadata.xml @@ -0,0 +1,27 @@ +<!-- + ~ 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. + --> + +<metadata> + <groupId>test</groupId> + <artifactId>incorrectSnapshotMetadata</artifactId> + <version>1.0.0-SNAPSHOT</version> + <versioning> + <snapshot> + <buildNumber>10</buildNumber> + <timestamp>20060102.040506</timestamp> + </snapshot> + </versioning> +</metadata>
\ No newline at end of file diff --git a/archiva-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/maven-metadata.xml b/archiva-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/maven-metadata.xml new file mode 100644 index 000000000..db6ce9a7f --- /dev/null +++ b/archiva-converter/src/test/source-modern-repository/test/incorrectSnapshotMetadata/maven-metadata.xml @@ -0,0 +1,25 @@ +<!-- + ~ 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. + --> + +<metadata> + <groupId>test</groupId> + <artifactId>incorrectSnapshotMetadata</artifactId> + <versioning> + <versions> + <version>1.0.0-SNAPSHOT</version> + </versions> + </versioning> +</metadata>
\ No newline at end of file diff --git a/archiva-converter/src/test/source-repository/test/jars/artifact-one-1.0.0.jar b/archiva-converter/src/test/source-repository/test/jars/artifact-one-1.0.0.jar new file mode 100644 index 000000000..5626abf0f --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/jars/artifact-one-1.0.0.jar @@ -0,0 +1 @@ +one diff --git a/archiva-converter/src/test/source-repository/test/jars/artifact-three-1.0.0.jar b/archiva-converter/src/test/source-repository/test/jars/artifact-three-1.0.0.jar new file mode 100644 index 000000000..2bdf67abb --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/jars/artifact-three-1.0.0.jar @@ -0,0 +1 @@ +three diff --git a/archiva-converter/src/test/source-repository/test/jars/artifact-two-1.0.0.jar b/archiva-converter/src/test/source-repository/test/jars/artifact-two-1.0.0.jar new file mode 100644 index 000000000..f719efd43 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/jars/artifact-two-1.0.0.jar @@ -0,0 +1 @@ +two diff --git a/archiva-converter/src/test/source-repository/test/jars/dryrun-artifact-1.0.0.jar b/archiva-converter/src/test/source-repository/test/jars/dryrun-artifact-1.0.0.jar new file mode 100644 index 000000000..cbaf024e5 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/jars/dryrun-artifact-1.0.0.jar @@ -0,0 +1 @@ +existing diff --git a/archiva-converter/src/test/source-repository/test/jars/existing-artifact-1.0.0.jar b/archiva-converter/src/test/source-repository/test/jars/existing-artifact-1.0.0.jar new file mode 100644 index 000000000..cbaf024e5 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/jars/existing-artifact-1.0.0.jar @@ -0,0 +1 @@ +existing diff --git a/archiva-converter/src/test/source-repository/test/jars/incorrectMd5Artifact-1.0.0.jar b/archiva-converter/src/test/source-repository/test/jars/incorrectMd5Artifact-1.0.0.jar new file mode 100644 index 000000000..72af4bc10 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/jars/incorrectMd5Artifact-1.0.0.jar @@ -0,0 +1 @@ +incorrectMd5 diff --git a/archiva-converter/src/test/source-repository/test/jars/incorrectMd5Artifact-1.0.0.jar.md5 b/archiva-converter/src/test/source-repository/test/jars/incorrectMd5Artifact-1.0.0.jar.md5 new file mode 100644 index 000000000..316d9a4eb --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/jars/incorrectMd5Artifact-1.0.0.jar.md5 @@ -0,0 +1 @@ +379dcfcd1e6312cc859111f696047eb4 diff --git a/archiva-converter/src/test/source-repository/test/jars/incorrectSha1Artifact-1.0.0.jar b/archiva-converter/src/test/source-repository/test/jars/incorrectSha1Artifact-1.0.0.jar new file mode 100644 index 000000000..f5812f3e5 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/jars/incorrectSha1Artifact-1.0.0.jar @@ -0,0 +1 @@ +incorrectSha1 diff --git a/archiva-converter/src/test/source-repository/test/jars/incorrectSha1Artifact-1.0.0.jar.sha1 b/archiva-converter/src/test/source-repository/test/jars/incorrectSha1Artifact-1.0.0.jar.sha1 new file mode 100644 index 000000000..cce322eb2 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/jars/incorrectSha1Artifact-1.0.0.jar.sha1 @@ -0,0 +1 @@ +52e07b82d944741f66bba5896d4cd74e9879e289 diff --git a/archiva-converter/src/test/source-repository/test/jars/modified-artifact-1.0.0.jar b/archiva-converter/src/test/source-repository/test/jars/modified-artifact-1.0.0.jar new file mode 100644 index 000000000..2e0996000 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/jars/modified-artifact-1.0.0.jar @@ -0,0 +1 @@ +modified diff --git a/archiva-converter/src/test/source-repository/test/jars/newversion-artifact-1.0.1.jar b/archiva-converter/src/test/source-repository/test/jars/newversion-artifact-1.0.1.jar new file mode 100644 index 000000000..c694117fd --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/jars/newversion-artifact-1.0.1.jar @@ -0,0 +1 @@ +v4 diff --git a/archiva-converter/src/test/source-repository/test/jars/noPomArtifact-1.0.0.jar b/archiva-converter/src/test/source-repository/test/jars/noPomArtifact-1.0.0.jar new file mode 100644 index 000000000..3d27acdcc --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/jars/noPomArtifact-1.0.0.jar @@ -0,0 +1 @@ +noPom diff --git a/archiva-converter/src/test/source-repository/test/jars/relocated-v3artifact-1.0.0.jar b/archiva-converter/src/test/source-repository/test/jars/relocated-v3artifact-1.0.0.jar new file mode 100644 index 000000000..29ef827e8 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/jars/relocated-v3artifact-1.0.0.jar @@ -0,0 +1 @@ +v3 diff --git a/archiva-converter/src/test/source-repository/test/jars/rollback-created-artifact-1.0.0.jar b/archiva-converter/src/test/source-repository/test/jars/rollback-created-artifact-1.0.0.jar new file mode 100644 index 000000000..29ef827e8 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/jars/rollback-created-artifact-1.0.0.jar @@ -0,0 +1 @@ +v3 diff --git a/archiva-converter/src/test/source-repository/test/jars/unmodified-artifact-1.0.0.jar b/archiva-converter/src/test/source-repository/test/jars/unmodified-artifact-1.0.0.jar new file mode 100644 index 000000000..27597bc21 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/jars/unmodified-artifact-1.0.0.jar @@ -0,0 +1 @@ +unmodified diff --git a/archiva-converter/src/test/source-repository/test/jars/v3-warnings-artifact-1.0.0.jar b/archiva-converter/src/test/source-repository/test/jars/v3-warnings-artifact-1.0.0.jar new file mode 100644 index 000000000..29ef827e8 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/jars/v3-warnings-artifact-1.0.0.jar @@ -0,0 +1 @@ +v3 diff --git a/archiva-converter/src/test/source-repository/test/jars/v3artifact-1.0.0-20060105.130101-3.jar b/archiva-converter/src/test/source-repository/test/jars/v3artifact-1.0.0-20060105.130101-3.jar new file mode 100644 index 000000000..29ef827e8 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/jars/v3artifact-1.0.0-20060105.130101-3.jar @@ -0,0 +1 @@ +v3 diff --git a/archiva-converter/src/test/source-repository/test/jars/v3artifact-1.0.0-SNAPSHOT.jar b/archiva-converter/src/test/source-repository/test/jars/v3artifact-1.0.0-SNAPSHOT.jar new file mode 100644 index 000000000..29ef827e8 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/jars/v3artifact-1.0.0-SNAPSHOT.jar @@ -0,0 +1 @@ +v3 diff --git a/archiva-converter/src/test/source-repository/test/jars/v3artifact-1.0.0.jar b/archiva-converter/src/test/source-repository/test/jars/v3artifact-1.0.0.jar new file mode 100644 index 000000000..29ef827e8 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/jars/v3artifact-1.0.0.jar @@ -0,0 +1 @@ +v3 diff --git a/archiva-converter/src/test/source-repository/test/jars/v4artifact-1.0.0-20060111.120115-1.jar b/archiva-converter/src/test/source-repository/test/jars/v4artifact-1.0.0-20060111.120115-1.jar new file mode 100644 index 000000000..29ef827e8 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/jars/v4artifact-1.0.0-20060111.120115-1.jar @@ -0,0 +1 @@ +v3 diff --git a/archiva-converter/src/test/source-repository/test/jars/v4artifact-1.0.0-SNAPSHOT.jar b/archiva-converter/src/test/source-repository/test/jars/v4artifact-1.0.0-SNAPSHOT.jar new file mode 100644 index 000000000..29ef827e8 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/jars/v4artifact-1.0.0-SNAPSHOT.jar @@ -0,0 +1 @@ +v3 diff --git a/archiva-converter/src/test/source-repository/test/jars/v4artifact-1.0.0.jar b/archiva-converter/src/test/source-repository/test/jars/v4artifact-1.0.0.jar new file mode 100644 index 000000000..c694117fd --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/jars/v4artifact-1.0.0.jar @@ -0,0 +1 @@ +v4 diff --git a/archiva-converter/src/test/source-repository/test/jars/v4artifact-1.0.0.jar.md5 b/archiva-converter/src/test/source-repository/test/jars/v4artifact-1.0.0.jar.md5 new file mode 100644 index 000000000..1930bc6d3 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/jars/v4artifact-1.0.0.jar.md5 @@ -0,0 +1 @@ +4289bbdd6fba75013b317b2f9a540736 *v4artifact-1.0.0.jar diff --git a/archiva-converter/src/test/source-repository/test/jars/v4artifact-1.0.0.jar.sha1 b/archiva-converter/src/test/source-repository/test/jars/v4artifact-1.0.0.jar.sha1 new file mode 100644 index 000000000..466f209a7 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/jars/v4artifact-1.0.0.jar.sha1 @@ -0,0 +1 @@ +e3e4159da65a4257f0bffb7cac8e3e78241a4dca *v4artifact-1.0.0.jar diff --git a/archiva-converter/src/test/source-repository/test/poms/artifact-one-1.0.0.pom b/archiva-converter/src/test/source-repository/test/poms/artifact-one-1.0.0.pom new file mode 100644 index 000000000..cd3862d35 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/poms/artifact-one-1.0.0.pom @@ -0,0 +1,6 @@ +<project> + <modelVersion>4.0.0</modelVersion> + <groupId>test</groupId> + <artifactId>artifact-one</artifactId> + <version>1.0.0</version> +</project> diff --git a/archiva-converter/src/test/source-repository/test/poms/artifact-three-1.0.0.pom b/archiva-converter/src/test/source-repository/test/poms/artifact-three-1.0.0.pom new file mode 100644 index 000000000..343291037 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/poms/artifact-three-1.0.0.pom @@ -0,0 +1,6 @@ +<project> + <modelVersion>4.0.0</modelVersion> + <groupId>test</groupId> + <artifactId>artifact-three</artifactId> + <version>1.0.0</version> +</project> diff --git a/archiva-converter/src/test/source-repository/test/poms/artifact-two-1.0.0.pom b/archiva-converter/src/test/source-repository/test/poms/artifact-two-1.0.0.pom new file mode 100644 index 000000000..227470167 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/poms/artifact-two-1.0.0.pom @@ -0,0 +1,6 @@ +<project> + <modelVersion>4.0.0</modelVersion> + <groupId>test</groupId> + <artifactId>artifact-two</artifactId> + <version>1.0.0</version> +</project> diff --git a/archiva-converter/src/test/source-repository/test/poms/dryrun-artifact-1.0.0.pom b/archiva-converter/src/test/source-repository/test/poms/dryrun-artifact-1.0.0.pom new file mode 100644 index 000000000..1953c5523 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/poms/dryrun-artifact-1.0.0.pom @@ -0,0 +1,22 @@ +<!-- + ~ 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> + <modelVersion>4.0.0</modelVersion> + <artifactId>dryrun-artifact</artifactId> + <groupId>test</groupId> + <currentVersion>1.0.0</currentVersion> +</project> diff --git a/archiva-converter/src/test/source-repository/test/poms/incorrectMd5Artifact-1.0.0.pom b/archiva-converter/src/test/source-repository/test/poms/incorrectMd5Artifact-1.0.0.pom new file mode 100644 index 000000000..74d5e12b4 --- /dev/null +++ b/archiva-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/archiva-converter/src/test/source-repository/test/poms/incorrectSha1Artifact-1.0.0.pom b/archiva-converter/src/test/source-repository/test/poms/incorrectSha1Artifact-1.0.0.pom new file mode 100644 index 000000000..fe3c7fd91 --- /dev/null +++ b/archiva-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/archiva-converter/src/test/source-repository/test/poms/modified-artifact-1.0.0.pom b/archiva-converter/src/test/source-repository/test/poms/modified-artifact-1.0.0.pom new file mode 100644 index 000000000..fcfdaacb4 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/poms/modified-artifact-1.0.0.pom @@ -0,0 +1,22 @@ +<!-- + ~ 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> + <modelVersion>4.0.0</modelVersion> + <artifactId>modified-artifact</artifactId> + <groupId>test</groupId> + <currentVersion>1.0.0</currentVersion> +</project> diff --git a/archiva-converter/src/test/source-repository/test/poms/newversion-artifact-1.0.1.pom b/archiva-converter/src/test/source-repository/test/poms/newversion-artifact-1.0.1.pom new file mode 100644 index 000000000..f441c9a46 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/poms/newversion-artifact-1.0.1.pom @@ -0,0 +1,22 @@ +<!-- + ~ 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> + <modelVersion>4.0.0</modelVersion> + <groupId>test</groupId> + <artifactId>newversoin-artifact</artifactId> + <version>1.0.1</version> +</project> diff --git a/archiva-converter/src/test/source-repository/test/poms/relocated-v3artifact-1.0.0.pom b/archiva-converter/src/test/source-repository/test/poms/relocated-v3artifact-1.0.0.pom new file mode 100644 index 000000000..10823fe89 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/poms/relocated-v3artifact-1.0.0.pom @@ -0,0 +1,27 @@ +<project>
+ <pomVersion>3</pomVersion>
+ <artifactId>relocated-v3artifact</artifactId>
+ <groupId>test</groupId>
+ <currentVersion>1.0.0</currentVersion>
+ <dependencies>
+ <dependency>
+ <groupId>groupId</groupId>
+ <artifactId>artifactId</artifactId>
+ <version>version</version>
+ </dependency>
+ <dependency>
+ <groupId>groupId</groupId>
+ <artifactId>test-artifactId</artifactId>
+ <version>version</version>
+ <properties>
+ <scope>test</scope>
+ </properties>
+ </dependency>
+ </dependencies>
+ <repository>
+ <connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection>
+ </repository>
+ <properties>
+ <relocated.groupId>relocated-test</relocated.groupId>
+ </properties>
+</project>
\ No newline at end of file diff --git a/archiva-converter/src/test/source-repository/test/poms/rollback-created-artifact-1.0.0.pom b/archiva-converter/src/test/source-repository/test/poms/rollback-created-artifact-1.0.0.pom new file mode 100644 index 000000000..00692be72 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/poms/rollback-created-artifact-1.0.0.pom @@ -0,0 +1,39 @@ +<!-- + ~ 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>v3artifact</artifactId> + <groupId>test</groupId> + <currentVersion>1.0.0</currentVersion> + <dependencies> + <dependency> + <groupId>groupId</groupId> + <artifactId>artifactId</artifactId> + <version>version</version> + </dependency> + <dependency> + <groupId>groupId</groupId> + <artifactId>test-artifactId</artifactId> + <version>version</version> + <properties> + <scope>test</scope> + </properties> + </dependency> + </dependencies> + <!-- deliberate parse error --> + <repository> +</project> diff --git a/archiva-converter/src/test/source-repository/test/poms/unmodified-artifact-1.0.0.pom b/archiva-converter/src/test/source-repository/test/poms/unmodified-artifact-1.0.0.pom new file mode 100644 index 000000000..c570979f4 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/poms/unmodified-artifact-1.0.0.pom @@ -0,0 +1,22 @@ +<!-- + ~ 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> + <modelVersion>4.0.0</modelVersion> + <artifactId>unmodified-artifact</artifactId> + <groupId>test</groupId> + <currentVersion>1.0.0</currentVersion> +</project> diff --git a/archiva-converter/src/test/source-repository/test/poms/v3-warnings-artifact-1.0.0.pom b/archiva-converter/src/test/source-repository/test/poms/v3-warnings-artifact-1.0.0.pom new file mode 100644 index 000000000..5f347f371 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/poms/v3-warnings-artifact-1.0.0.pom @@ -0,0 +1,48 @@ +<!-- + ~ 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> + <extend>../project.xml</extend> + <artifactId>v3-warnings-artifact</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> + <artifactId>artifactId</artifactId> + <version>version</version> + </dependency> + <dependency> + <groupId>groupId</groupId> + <artifactId>test-artifactId</artifactId> + <version>version</version> + <properties> + <scope>test</scope> + </properties> + </dependency> + </dependencies> + <repository> + <connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection> + </repository> +</project> diff --git a/archiva-converter/src/test/source-repository/test/poms/v3artifact-1.0.0-20060105.130101-3.pom b/archiva-converter/src/test/source-repository/test/poms/v3artifact-1.0.0-20060105.130101-3.pom new file mode 100644 index 000000000..d7ae8953b --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/poms/v3artifact-1.0.0-20060105.130101-3.pom @@ -0,0 +1,40 @@ +<!-- + ~ 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>v3artifact</artifactId> + <groupId>test</groupId> + <currentVersion>1.0.0-20060105.130101-3</currentVersion> + <dependencies> + <dependency> + <groupId>groupId</groupId> + <artifactId>artifactId</artifactId> + <version>version</version> + </dependency> + <dependency> + <groupId>groupId</groupId> + <artifactId>test-artifactId</artifactId> + <version>version</version> + <properties> + <scope>test</scope> + </properties> + </dependency> + </dependencies> + <repository> + <connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection> + </repository> +</project> diff --git a/archiva-converter/src/test/source-repository/test/poms/v3artifact-1.0.0-SNAPSHOT.pom b/archiva-converter/src/test/source-repository/test/poms/v3artifact-1.0.0-SNAPSHOT.pom new file mode 100644 index 000000000..3958a3358 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/poms/v3artifact-1.0.0-SNAPSHOT.pom @@ -0,0 +1,40 @@ +<!-- + ~ 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>v3artifact</artifactId> + <groupId>test</groupId> + <currentVersion>1.0.0-SNAPSHOT</currentVersion> + <dependencies> + <dependency> + <groupId>groupId</groupId> + <artifactId>artifactId</artifactId> + <version>version</version> + </dependency> + <dependency> + <groupId>groupId</groupId> + <artifactId>test-artifactId</artifactId> + <version>version</version> + <properties> + <scope>test</scope> + </properties> + </dependency> + </dependencies> + <repository> + <connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection> + </repository> +</project> diff --git a/archiva-converter/src/test/source-repository/test/poms/v3artifact-1.0.0.pom b/archiva-converter/src/test/source-repository/test/poms/v3artifact-1.0.0.pom new file mode 100644 index 000000000..5aed3437a --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/poms/v3artifact-1.0.0.pom @@ -0,0 +1,24 @@ +<project> + <pomVersion>3</pomVersion> + <artifactId>v3artifact</artifactId> + <groupId>test</groupId> + <currentVersion>1.0.0</currentVersion> + <dependencies> + <dependency> + <groupId>groupId</groupId> + <artifactId>artifactId</artifactId> + <version>version</version> + </dependency> + <dependency> + <groupId>groupId</groupId> + <artifactId>test-artifactId</artifactId> + <version>version</version> + <properties> + <scope>test</scope> + </properties> + </dependency> + </dependencies> + <repository> + <connection>scm:cvs:ext:${maven.username}@localhost:/home/cvs</connection> + </repository> +</project> diff --git a/archiva-converter/src/test/source-repository/test/poms/v4artifact-1.0.0-20060111.120115-1.pom b/archiva-converter/src/test/source-repository/test/poms/v4artifact-1.0.0-20060111.120115-1.pom new file mode 100644 index 000000000..e4f36566a --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/poms/v4artifact-1.0.0-20060111.120115-1.pom @@ -0,0 +1,22 @@ +<!-- + ~ 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> + <modelVersion>4.0.0</modelVersion> + <groupId>test</groupId> + <artifactId>v4artifact</artifactId> + <version>1.0.0-20060111.120115-1</version> +</project> diff --git a/archiva-converter/src/test/source-repository/test/poms/v4artifact-1.0.0-SNAPSHOT.pom b/archiva-converter/src/test/source-repository/test/poms/v4artifact-1.0.0-SNAPSHOT.pom new file mode 100644 index 000000000..be5b8b7e2 --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/poms/v4artifact-1.0.0-SNAPSHOT.pom @@ -0,0 +1,22 @@ +<!-- + ~ 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> + <modelVersion>4.0.0</modelVersion> + <groupId>test</groupId> + <artifactId>v4artifact</artifactId> + <version>1.0.0-SNAPSHOT</version> +</project> diff --git a/archiva-converter/src/test/source-repository/test/poms/v4artifact-1.0.0.pom b/archiva-converter/src/test/source-repository/test/poms/v4artifact-1.0.0.pom new file mode 100644 index 000000000..fa6e82b1e --- /dev/null +++ b/archiva-converter/src/test/source-repository/test/poms/v4artifact-1.0.0.pom @@ -0,0 +1,6 @@ +<project> + <modelVersion>4.0.0</modelVersion> + <groupId>test</groupId> + <artifactId>v4artifact</artifactId> + <version>1.0.0</version> +</project> diff --git a/archiva-converter/src/test/target-repository/test/modified-artifact/1.0.0/modified-artifact-1.0.0.jar b/archiva-converter/src/test/target-repository/test/modified-artifact/1.0.0/modified-artifact-1.0.0.jar new file mode 100644 index 000000000..27597bc21 --- /dev/null +++ b/archiva-converter/src/test/target-repository/test/modified-artifact/1.0.0/modified-artifact-1.0.0.jar @@ -0,0 +1 @@ +unmodified diff --git a/archiva-converter/src/test/target-repository/test/modified-artifact/1.0.0/modified-artifact-1.0.0.pom b/archiva-converter/src/test/target-repository/test/modified-artifact/1.0.0/modified-artifact-1.0.0.pom new file mode 100644 index 000000000..fcfdaacb4 --- /dev/null +++ b/archiva-converter/src/test/target-repository/test/modified-artifact/1.0.0/modified-artifact-1.0.0.pom @@ -0,0 +1,22 @@ +<!-- + ~ 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> + <modelVersion>4.0.0</modelVersion> + <artifactId>modified-artifact</artifactId> + <groupId>test</groupId> + <currentVersion>1.0.0</currentVersion> +</project> diff --git a/archiva-converter/src/test/target-repository/test/newversion-artifact/1.0.0/newversion-artifact-1.0.0.jar b/archiva-converter/src/test/target-repository/test/newversion-artifact/1.0.0/newversion-artifact-1.0.0.jar new file mode 100644 index 000000000..27597bc21 --- /dev/null +++ b/archiva-converter/src/test/target-repository/test/newversion-artifact/1.0.0/newversion-artifact-1.0.0.jar @@ -0,0 +1 @@ +unmodified diff --git a/archiva-converter/src/test/target-repository/test/newversion-artifact/1.0.0/newversion-artifact-1.0.0.pom b/archiva-converter/src/test/target-repository/test/newversion-artifact/1.0.0/newversion-artifact-1.0.0.pom new file mode 100644 index 000000000..836cc236b --- /dev/null +++ b/archiva-converter/src/test/target-repository/test/newversion-artifact/1.0.0/newversion-artifact-1.0.0.pom @@ -0,0 +1,22 @@ +<!-- + ~ 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> + <modelVersion>4.0.0</modelVersion> + <artifactId>newversion-artifact</artifactId> + <groupId>test</groupId> + <currentVersion>1.0.0</currentVersion> +</project> diff --git a/archiva-converter/src/test/target-repository/test/newversion-artifact/maven-metadata.xml b/archiva-converter/src/test/target-repository/test/newversion-artifact/maven-metadata.xml new file mode 100644 index 000000000..f4d211741 --- /dev/null +++ b/archiva-converter/src/test/target-repository/test/newversion-artifact/maven-metadata.xml @@ -0,0 +1,9 @@ +<metadata> + <groupId>test</groupId> + <artifactId>newversion-artifact</artifactId> + <versioning> + <versions> + <version>1.0.0</version> + </versions> + </versioning> +</metadata>
\ No newline at end of file diff --git a/archiva-converter/src/test/target-repository/test/unmodified-artifact/1.0.0/unmodified-artifact-1.0.0.jar b/archiva-converter/src/test/target-repository/test/unmodified-artifact/1.0.0/unmodified-artifact-1.0.0.jar new file mode 100644 index 000000000..27597bc21 --- /dev/null +++ b/archiva-converter/src/test/target-repository/test/unmodified-artifact/1.0.0/unmodified-artifact-1.0.0.jar @@ -0,0 +1 @@ +unmodified diff --git a/archiva-converter/src/test/target-repository/test/unmodified-artifact/1.0.0/unmodified-artifact-1.0.0.pom b/archiva-converter/src/test/target-repository/test/unmodified-artifact/1.0.0/unmodified-artifact-1.0.0.pom new file mode 100644 index 000000000..c570979f4 --- /dev/null +++ b/archiva-converter/src/test/target-repository/test/unmodified-artifact/1.0.0/unmodified-artifact-1.0.0.pom @@ -0,0 +1,22 @@ +<!-- + ~ 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> + <modelVersion>4.0.0</modelVersion> + <artifactId>unmodified-artifact</artifactId> + <groupId>test</groupId> + <currentVersion>1.0.0</currentVersion> +</project> |