123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050 |
- package org.apache.archiva.converter.artifact;
-
- /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 junit.framework.TestCase;
- import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
- import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
- import org.apache.commons.io.FileUtils;
- 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.MavenArtifactRepository;
- import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
- import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
- import org.junit.Before;
- import org.junit.Test;
- import org.junit.runner.RunWith;
- import org.springframework.context.ApplicationContext;
- import org.springframework.test.context.ContextConfiguration;
-
- import javax.inject.Inject;
- import java.io.IOException;
- import java.nio.charset.Charset;
- import java.nio.file.Files;
- import java.nio.file.Path;
- import java.nio.file.Paths;
- import java.nio.file.attribute.FileTime;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Locale;
- import java.util.Map;
- import java.util.concurrent.TimeUnit;
- import java.util.regex.Matcher;
-
- /**
- * LegacyToDefaultConverterTest
- */
- @RunWith (ArchivaSpringJUnit4ClassRunner.class)
- @ContextConfiguration (locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" })
- public class LegacyToDefaultConverterTest
- extends TestCase
- {
- private ArtifactRepository sourceRepository;
-
- private ArtifactRepository targetRepository;
-
- private ArtifactConverter artifactConverter;
-
- private ArtifactFactory artifactFactory;
-
- @Inject
- private PlexusSisuBridge plexusSisuBridge;
-
- @Inject
- private ApplicationContext applicationContext;
-
- private static final int SLEEP_MILLIS = 100;
-
- @Before
- public void init()
- throws Exception
- {
- super.setUp();
-
- // ArtifactRepositoryFactory factory = plexusSisuBridge.lookup( ArtifactRepositoryFactory.class );
-
- ArtifactRepositoryLayout layout = new LegacyRepositoryLayout();
-
- Path sourceBase = getTestFile( "src/test/source-repository" );
- sourceRepository =
- new MavenArtifactRepository( "source", sourceBase.toUri().toURL().toString(), layout, null, null );
-
- layout = plexusSisuBridge.lookup( ArtifactRepositoryLayout.class, "default" );
-
- Path targetBase = getTestFile( "target/test-target-repository" );
- copyDirectoryStructure( getTestFile( "src/test/target-repository" ), targetBase );
-
- targetRepository =
- new MavenArtifactRepository( "target", targetBase.toUri().toURL().toString(), layout, null, null );
-
- artifactConverter =
- applicationContext.getBean( "artifactConverter#legacy-to-default", ArtifactConverter.class );
-
- artifactConverter.clearWarnings();
- artifactFactory = (ArtifactFactory) plexusSisuBridge.lookup( ArtifactFactory.class );
- }
-
- public static Path getTestFile( String path )
- {
- return Paths.get( org.apache.archiva.common.utils.FileUtils.getBasedir(), path );
- }
-
- private void copyDirectoryStructure( Path sourceDirectory, Path destinationDirectory )
- throws IOException
- {
- if ( !Files.exists(sourceDirectory) )
- {
- throw new IOException( "Source directory doesn't exists (" + sourceDirectory.toAbsolutePath()+ ")." );
- }
-
- Path[] files = Files.list( sourceDirectory ).toArray( Path[]::new );
-
- String sourcePath = sourceDirectory.toAbsolutePath().toString();
-
- for ( int i = 0; i < files.length; i++ )
- {
- Path file = files[i];
-
- String dest = file.toAbsolutePath().toString();
-
- dest = dest.substring( sourcePath.length() + 1 );
-
- Path destination = destinationDirectory.resolve( dest );
-
- if ( Files.isRegularFile( file ) )
- {
- destination = destination.getParent();
-
- FileUtils.copyFileToDirectory( file.toFile(), destination.toFile() );
- }
- else if ( Files.isDirectory( file ) )
- {
- if ( !".svn".equals( file.getFileName().toString() ) )
- {
- if ( !Files.exists(destination))
- {
- Files.createDirectories( destination );
- }
- copyDirectoryStructure( file, destination );
- }
- }
- else
- {
- throw new IOException( "Unknown file type: " + file.toAbsolutePath() );
- }
- }
- }
-
- @Test
- public void testV4PomConvert()
- throws Exception
- {
- // test that it is copied as is
-
- Artifact artifact = createArtifact( "test", "v4artifact", "1.0.0" );
- ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
- Path artifactMetadataFile = Paths.get( targetRepository.getBasedir(),
- targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
- Files.deleteIfExists( artifactMetadataFile);
-
- ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
- Path versionMetadataFile = Paths.get( targetRepository.getBasedir(),
- targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );
- Files.deleteIfExists(versionMetadataFile);
-
- Path artifactFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- Files.deleteIfExists(artifactFile);
-
- artifactConverter.convert( artifact, targetRepository );
- checkSuccess( artifactConverter );
-
- assertTrue( "Check artifact created", Files.exists(artifactFile) );
- assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile.toFile(), artifact.getFile() ) );
-
- artifact = createPomArtifact( artifact );
- Path pomFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- Path sourcePomFile = Paths.get( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
- assertTrue( "Check POM created", Files.exists(pomFile) );
-
- compareFiles( sourcePomFile, pomFile );
-
- assertTrue( "Check artifact metadata created", Files.exists(artifactMetadataFile) );
-
- Path expectedMetadataFile = getTestFile( "src/test/expected-files/v4-artifact-metadata.xml" );
-
- compareFiles( expectedMetadataFile, artifactMetadataFile );
-
- assertTrue( "Check snapshot metadata created", Files.exists(versionMetadataFile) );
-
- expectedMetadataFile = getTestFile( "src/test/expected-files/v4-version-metadata.xml" );
-
- compareFiles( expectedMetadataFile, versionMetadataFile );
- }
-
- @Test
- public void testV3PomConvert()
- throws Exception
- {
- // test that the pom is coverted
-
- Artifact artifact = createArtifact( "test", "v3artifact", "1.0.0" );
- ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
- Path artifactMetadataFile = Paths.get( targetRepository.getBasedir(),
- targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
- Files.deleteIfExists(artifactMetadataFile);
-
- ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
- Path versionMetadataFile = Paths.get( targetRepository.getBasedir(),
- targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );
- Files.deleteIfExists(versionMetadataFile);
-
- artifactConverter.convert( artifact, targetRepository );
- checkSuccess( artifactConverter );
-
- Path artifactFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- assertTrue( "Check artifact created", Files.exists(artifactFile) );
- assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile.toFile(), artifact.getFile() ) );
-
- artifact = createPomArtifact( artifact );
- Path pomFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- Path expectedPomFile = getTestFile( "src/test/expected-files/converted-v3.pom" );
- assertTrue( "Check POM created", Files.exists(pomFile) );
-
- compareFiles( expectedPomFile, pomFile );
-
- assertTrue( "Check artifact metadata created", Files.exists(artifactMetadataFile) );
-
- Path expectedMetadataFile = getTestFile( "src/test/expected-files/v3-artifact-metadata.xml" );
-
- compareFiles( expectedMetadataFile, artifactMetadataFile );
-
- assertTrue( "Check snapshot metadata created", Files.exists(versionMetadataFile) );
-
- expectedMetadataFile = getTestFile( "src/test/expected-files/v3-version-metadata.xml" );
-
- compareFiles( expectedMetadataFile, versionMetadataFile );
- }
-
- @Test
- public void testV3PomConvertWithRelocation()
- throws Exception
- {
- Artifact artifact = createArtifact( "test", "relocated-v3artifact", "1.0.0" );
- ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
- Path artifactMetadataFile = Paths.get( targetRepository.getBasedir(),
- targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
- Files.deleteIfExists(artifactMetadataFile);
-
- ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
- Path versionMetadataFile = Paths.get( targetRepository.getBasedir(),
- targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );
- Files.deleteIfExists(versionMetadataFile);
-
- artifactConverter.convert( artifact, targetRepository );
- //checkSuccess(); --> commented until MNG-2100 is fixed
-
- Path artifactFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- assertTrue( "Check if relocated artifact created", Files.exists(artifactFile) );
- assertTrue( "Check if relocated artifact matches",
- FileUtils.contentEquals( artifactFile.toFile(), artifact.getFile() ) );
- Artifact pomArtifact = createArtifact( "relocated-test", "relocated-v3artifact", "1.0.0", "1.0.0", "pom" );
- Path pomFile = getTestFile( "src/test/expected-files/" + targetRepository.pathOf( pomArtifact ) );
- Path 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 = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( orig ) );
- assertTrue( "Check if relocation artifact pom is created", Files.exists(artifactFile) );
- testFile = getTestFile( "src/test/expected-files/" + targetRepository.pathOf( orig ) );
- compareFiles( artifactFile, testFile );
- }
-
- @Test
- public void testV3PomWarningsOnConvert()
- throws Exception
- {
- // 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 );
- Path artifactMetadataFile = Paths.get( targetRepository.getBasedir(),
- targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
- Files.deleteIfExists(artifactMetadataFile);
-
- ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
- Path versionMetadataFile = Paths.get( targetRepository.getBasedir(),
- targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );
- Files.deleteIfExists(versionMetadataFile);
-
- artifactConverter.convert( artifact, targetRepository );
- checkWarnings( artifactConverter, 2 );
-
- Path artifactFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- assertTrue( "Check artifact created", Files.exists(artifactFile) );
- assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile.toFile(), artifact.getFile() ) );
-
- artifact = createPomArtifact( artifact );
- Path pomFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- Path expectedPomFile = getTestFile( "src/test/expected-files/converted-v3-warnings.pom" );
- assertTrue( "Check POM created", Files.exists(pomFile) );
-
- compareFiles( expectedPomFile, pomFile );
-
- // TODO: check 2 warnings (extend and versions) matched on i18n key
- }
-
- private void doTestV4SnapshotPomConvert( String version, String expectedMetadataFileName )
- throws Exception
- {
- // test that it is copied as is
-
- Artifact artifact = createArtifact( "test", "v4artifact", version );
- ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
- Path artifactMetadataFile = Paths.get( targetRepository.getBasedir(),
- targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
- Files.deleteIfExists(artifactMetadataFile);
-
- ArtifactMetadata snapshotMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
- Path snapshotMetadataFile = Paths.get( targetRepository.getBasedir(),
- targetRepository.pathOfRemoteRepositoryMetadata( snapshotMetadata ) );
- Files.deleteIfExists(snapshotMetadataFile);
-
- artifactConverter.convert( artifact, targetRepository );
- checkSuccess( artifactConverter );
-
- Path artifactFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- assertTrue( "Check artifact created", Files.exists(artifactFile) );
- assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile.toFile(), artifact.getFile() ) );
-
- artifact = createPomArtifact( artifact );
- Path pomFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- Path sourcePomFile = Paths.get( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
- assertTrue( "Check POM created", Files.exists(pomFile) );
-
- compareFiles( sourcePomFile, pomFile );
-
- assertTrue( "Check artifact metadata created", Files.exists(artifactMetadataFile) );
-
- Path expectedMetadataFile = getTestFile( "src/test/expected-files/v4-snapshot-artifact-metadata.xml" );
-
- compareFiles( expectedMetadataFile, artifactMetadataFile );
-
- assertTrue( "Check snapshot metadata created", Files.exists(snapshotMetadataFile) );
-
- expectedMetadataFile = getTestFile( expectedMetadataFileName );
-
- compareFiles( expectedMetadataFile, snapshotMetadataFile );
- }
-
- @Test
- public void testV3SnapshotPomConvert()
- throws Exception
- {
- // test that the pom is coverted
-
- Artifact artifact = createArtifact( "test", "v3artifact", "1.0.0-SNAPSHOT" );
- ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
- Path artifactMetadataFile = Paths.get( targetRepository.getBasedir(),
- targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
- Files.deleteIfExists(artifactMetadataFile);
-
- ArtifactMetadata snapshotMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
- Path snapshotMetadataFile = Paths.get( targetRepository.getBasedir(),
- targetRepository.pathOfRemoteRepositoryMetadata( snapshotMetadata ) );
- Files.deleteIfExists(snapshotMetadataFile);
-
- artifactConverter.convert( artifact, targetRepository );
- checkSuccess( artifactConverter );
-
- Path artifactFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- assertTrue( "Check artifact created", Files.exists(artifactFile) );
- assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile.toFile(), artifact.getFile() ) );
-
- artifact = createPomArtifact( artifact );
- Path pomFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- Path expectedPomFile = getTestFile( "src/test/expected-files/converted-v3-snapshot.pom" );
- assertTrue( "Check POM created", Files.exists(pomFile) );
-
- compareFiles( expectedPomFile, pomFile );
-
- assertTrue( "Check artifact metadata created", Files.exists(artifactMetadataFile) );
-
- Path expectedMetadataFile = getTestFile( "src/test/expected-files/v3-snapshot-artifact-metadata.xml" );
-
- compareFiles( expectedMetadataFile, artifactMetadataFile );
-
- assertTrue( "Check snapshot metadata created", Files.exists(snapshotMetadataFile) );
-
- expectedMetadataFile = getTestFile( "src/test/expected-files/v3-snapshot-metadata.xml" );
-
- compareFiles( expectedMetadataFile, snapshotMetadataFile );
- }
-
- @Test
- public void testV4SnapshotPomConvert()
- throws Exception
- {
- doTestV4SnapshotPomConvert( "1.0.0-SNAPSHOT", "src/test/expected-files/v4-snapshot-metadata.xml" );
-
- assertTrue( true );
- }
-
- @Test
- public void testV4TimestampedSnapshotPomConvert()
- throws Exception
- {
- doTestV4SnapshotPomConvert( "1.0.0-20060111.120115-1",
- "src/test/expected-files/v4-timestamped-snapshot-metadata.xml" );
-
- assertTrue( true );
- }
-
- @Test
- public void testMavenOnePluginConversion()
- throws Exception
- {
- Artifact artifact =
- createArtifact( "org.apache.maven.plugins", "maven-foo-plugin", "1.0", "1.0", "maven-plugin" );
- artifact.setFile(
- Paths.get( org.apache.archiva.common.utils.FileUtils.getBasedir(), "src/test/source-repository/test/plugins/maven-foo-plugin-1.0.jar" ).toFile() );
- artifactConverter.convert( artifact, targetRepository );
- // There is a warning but I can't figure out how to look at it. Eyeballing the results it appears
- // the plugin is being coverted correctly.
- //checkSuccess();
-
- Path artifactFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- assertTrue( "Check artifact created", Files.exists(artifactFile) );
- assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile.toFile(), artifact.getFile() ) );
-
- /*
- The POM isn't needed for Maven 1.x plugins but the raw conversion for
-
- artifact = createPomArtifact( artifact );
- Path pomFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- File expectedPomFile = getTestFile( "src/test/expected-files/maven-foo-plugin-1.0.pom" );
- assertTrue( "Check POM created", Files.exists(pomFile) );
- compareFiles( expectedPomFile, pomFile );
- */
- }
-
- @Test
- public void testV3TimestampedSnapshotPomConvert()
- throws Exception
- {
- // test that the pom is coverted
-
- Artifact artifact = createArtifact( "test", "v3artifact", "1.0.0-20060105.130101-3" );
- ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
- Path artifactMetadataFile = Paths.get( targetRepository.getBasedir(),
- targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
- Files.deleteIfExists(artifactMetadataFile);
-
- ArtifactMetadata snapshotMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
- Path snapshotMetadataFile = Paths.get( targetRepository.getBasedir(),
- targetRepository.pathOfRemoteRepositoryMetadata( snapshotMetadata ) );
- Files.deleteIfExists(snapshotMetadataFile);
-
- artifactConverter.convert( artifact, targetRepository );
- checkSuccess( artifactConverter );
-
- Path artifactFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- assertTrue( "Check artifact created", Files.exists(artifactFile) );
- assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile.toFile(), artifact.getFile() ) );
-
- artifact = createPomArtifact( artifact );
- Path pomFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- Path expectedPomFile = getTestFile( "src/test/expected-files/converted-v3-timestamped-snapshot.pom" );
- assertTrue( "Check POM created", Files.exists(pomFile) );
-
- compareFiles( expectedPomFile, pomFile );
-
- assertTrue( "Check artifact snapshotMetadata created", Files.exists(artifactMetadataFile) );
-
- Path expectedMetadataFile = getTestFile( "src/test/expected-files/v3-snapshot-artifact-metadata.xml" );
-
- compareFiles( expectedMetadataFile, artifactMetadataFile );
-
- assertTrue( "Check snapshot snapshotMetadata created", Files.exists(snapshotMetadataFile) );
-
- expectedMetadataFile = getTestFile( "src/test/expected-files/v3-timestamped-snapshot-metadata.xml" );
-
- compareFiles( expectedMetadataFile, snapshotMetadataFile );
- }
-
- @Test
- public void testNoPomConvert()
- throws Exception
- {
- // test that a POM is not created when there was none at the source
-
- Artifact artifact = createArtifact( "test", "noPomArtifact", "1.0.0" );
- artifactConverter.convert( artifact, targetRepository );
- checkWarnings( artifactConverter, 1 );
-
- assertHasWarningReason( artifactConverter, Messages.getString( "warning.missing.pom" ) );
-
- Path artifactFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- assertTrue( "Check artifact created", Files.exists(artifactFile) );
- assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile.toFile(), artifact.getFile() ) );
-
- artifact = createPomArtifact( artifact );
- Path pomFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- Path sourcePomFile = Paths.get( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
-
- assertFalse( "Check no POM created", Files.exists(pomFile) );
- assertFalse( "No source POM", Files.exists(sourcePomFile) );
- }
-
- @Test
- public void testIncorrectSourceChecksumMd5()
- throws Exception
- {
- // test that it fails when the source md5 is wrong
-
- Artifact artifact = createArtifact( "test", "incorrectMd5Artifact", "1.0.0" );
- Path file = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- Files.deleteIfExists(file);
-
- artifactConverter.convert( artifact, targetRepository );
- checkWarnings( artifactConverter, 2 );
-
- assertHasWarningReason( artifactConverter, Messages.getString( "failure.incorrect.md5" ) );
-
- assertFalse( "Check artifact not created", Files.exists(file) );
-
- ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
- Path metadataFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
- assertFalse( "Check metadata not created", Files.exists(metadataFile) );
- }
-
- @Test
- public void testIncorrectSourceChecksumSha1()
- throws Exception
- {
- // test that it fails when the source sha1 is wrong
-
- Artifact artifact = createArtifact( "test", "incorrectSha1Artifact", "1.0.0" );
- Path file = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- Files.deleteIfExists(file);
-
- artifactConverter.convert( artifact, targetRepository );
- checkWarnings( artifactConverter, 2 );
-
- assertHasWarningReason( artifactConverter, Messages.getString( "failure.incorrect.sha1" ) );
-
- assertFalse( "Check artifact not created", Files.exists(file) );
-
- ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
- Path metadataFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
- assertFalse( "Check metadata not created", Files.exists(metadataFile) );
- }
-
- @Test
- public void testUnmodifiedArtifact()
- throws Exception, InterruptedException
- {
- // test the unmodified artifact is untouched
-
- Artifact artifact = createArtifact( "test", "unmodified-artifact", "1.0.0" );
- Artifact pomArtifact = createPomArtifact( artifact );
-
- Path sourceFile = Paths.get( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
- Path sourcePomFile = Paths.get( sourceRepository.getBasedir(), sourceRepository.pathOf( pomArtifact ) );
- Path targetFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- Path targetPomFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) );
-
- assertTrue( "Check target file exists", Files.exists(targetFile) );
- assertTrue( "Check target POM exists", Files.exists(targetPomFile) );
-
- Files.setLastModifiedTime( sourceFile, FileTime.from(System.currentTimeMillis(), TimeUnit.MILLISECONDS) );
- Files.setLastModifiedTime( sourcePomFile, FileTime.from(System.currentTimeMillis(), TimeUnit.MILLISECONDS) );
-
- long origTime = Files.getLastModifiedTime( targetFile ).toMillis();
- long origPomTime = Files.getLastModifiedTime( targetPomFile ).toMillis();
-
- // Need to guarantee last modified is not equal
- Thread.sleep( SLEEP_MILLIS );
-
- artifactConverter.convert( artifact, targetRepository );
- checkSuccess( artifactConverter );
-
- compareFiles( sourceFile, targetFile );
- compareFiles( sourcePomFile, targetPomFile );
-
- assertEquals( "Check artifact unmodified", origTime, Files.getLastModifiedTime( targetFile ).toMillis() );
- assertEquals( "Check POM unmodified", origPomTime, Files.getLastModifiedTime( targetPomFile ).toMillis() );
- }
-
- @Test
- public void testModifedArtifactFails()
- throws Exception
- {
- // 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 );
-
- Path sourceFile = Paths.get( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
- Path sourcePomFile = Paths.get( sourceRepository.getBasedir(), sourceRepository.pathOf( pomArtifact ) );
- Path targetFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- Path targetPomFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) );
-
- assertTrue( "Check target file exists", Files.exists(targetFile) );
- assertTrue( "Check target POM exists", Files.exists(targetPomFile) );
-
- Files.setLastModifiedTime(sourceFile, FileTime.from(System.currentTimeMillis() , TimeUnit.MILLISECONDS));
- Files.setLastModifiedTime(sourcePomFile, FileTime.from(System.currentTimeMillis() , TimeUnit.MILLISECONDS));
-
- long origTime = Files.getLastModifiedTime(targetFile).toMillis();
- long origPomTime = Files.getLastModifiedTime(targetPomFile).toMillis();
-
- // Need to guarantee last modified is not equal
- Thread.sleep( SLEEP_MILLIS );
-
- artifactConverter.convert( artifact, targetRepository );
- checkWarnings( artifactConverter, 2 );
-
- assertHasWarningReason( artifactConverter, Messages.getString( "failure.target.already.exists" ) );
-
- assertEquals( "Check unmodified", origTime, Files.getLastModifiedTime(targetFile).toMillis() );
- assertEquals( "Check unmodified", origPomTime, Files.getLastModifiedTime(targetPomFile).toMillis() );
-
- ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
- Path metadataFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
- assertFalse( "Check metadata not created", Files.exists(metadataFile) );
- }
-
- @Test
- public void testForcedUnmodifiedArtifact()
- throws Exception
- {
- // test unmodified artifact is still converted when set to force
-
- artifactConverter =
- applicationContext.getBean( "artifactConverter#force-repository-converter", ArtifactConverter.class );
-
- Artifact artifact = createArtifact( "test", "unmodified-artifact", "1.0.0" );
- Artifact pomArtifact = createPomArtifact( artifact );
-
- Path sourceFile = Paths.get( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
- Path sourcePomFile = Paths.get( sourceRepository.getBasedir(), sourceRepository.pathOf( pomArtifact ) );
- Path targetFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- Path targetPomFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) );
-
- SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd", Locale.getDefault() );
- long origTime = dateFormat.parse( "2006-03-03" ).getTime();
- Files.setLastModifiedTime(targetFile, FileTime.from(origTime , TimeUnit.MILLISECONDS));
- Files.setLastModifiedTime(targetPomFile, FileTime.from(origTime , TimeUnit.MILLISECONDS));
-
- Files.setLastModifiedTime(sourceFile, FileTime.from(dateFormat.parse( "2006-01-01" ).getTime() , TimeUnit.MILLISECONDS));
- Files.setLastModifiedTime(sourcePomFile, FileTime.from(dateFormat.parse( "2006-02-02" ).getTime() , TimeUnit.MILLISECONDS));
-
- artifactConverter.convert( artifact, targetRepository );
- checkSuccess( artifactConverter );
-
- compareFiles( sourceFile, targetFile );
- compareFiles( sourcePomFile, targetPomFile );
-
- assertFalse( "Check modified", origTime == Files.getLastModifiedTime(targetFile).toMillis() );
- assertFalse( "Check modified", origTime == Files.getLastModifiedTime(targetPomFile).toMillis() );
-
- ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
- Path metadataFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
- assertTrue( "Check metadata created", Files.exists(metadataFile) );
- }
-
- @Test
- public void testDryRunSuccess()
- throws Exception
- {
- // test dry run does nothing on a run that will be successful, and returns success
-
- artifactConverter =
- applicationContext.getBean( "artifactConverter#dryrun-repository-converter", ArtifactConverter.class );
-
- Artifact artifact = createArtifact( "test", "dryrun-artifact", "1.0.0" );
- Artifact pomArtifact = createPomArtifact( artifact );
-
- Path sourceFile = Paths.get( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
- Path sourcePomFile = Paths.get( sourceRepository.getBasedir(), sourceRepository.pathOf( pomArtifact ) );
- Path targetFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- Path targetPomFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) );
-
- // clear warning before test related to MRM-1638
- artifactConverter.clearWarnings();
- artifactConverter.convert( artifact, targetRepository );
- checkSuccess( artifactConverter );
-
- assertTrue( "Check source file exists", Files.exists(sourceFile) );
- assertTrue( "Check source POM exists", Files.exists(sourcePomFile) );
-
- assertFalse( "Check target file doesn't exist", Files.exists(targetFile) );
- assertFalse( "Check target POM doesn't exist", Files.exists(targetPomFile) );
-
- ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
- Path metadataFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
- assertFalse( "Check metadata not created", Files.exists(metadataFile) );
- }
-
- @Test
- public void testDryRunFailure()
- throws Exception
- {
- // test dry run does nothing on a run that will fail, and returns failure
-
- artifactConverter =
- applicationContext.getBean( "artifactConverter#dryrun-repository-converter", ArtifactConverter.class );
-
- Artifact artifact = createArtifact( "test", "modified-artifact", "1.0.0" );
- Artifact pomArtifact = createPomArtifact( artifact );
-
- Path sourceFile = Paths.get( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
- Path sourcePomFile = Paths.get( sourceRepository.getBasedir(), sourceRepository.pathOf( pomArtifact ) );
- Path targetFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- Path targetPomFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( pomArtifact ) );
-
- assertTrue( "Check target file exists", Files.exists(targetFile) );
- assertTrue( "Check target POM exists", Files.exists(targetPomFile) );
-
- Files.setLastModifiedTime(sourceFile, FileTime.from(System.currentTimeMillis() , TimeUnit.MILLISECONDS));
- Files.setLastModifiedTime(sourcePomFile, FileTime.from(System.currentTimeMillis() , TimeUnit.MILLISECONDS));
-
- long origTime = Files.getLastModifiedTime(targetFile).toMillis();
- long origPomTime = Files.getLastModifiedTime(targetPomFile).toMillis();
-
- // Need to guarantee last modified is not equal
- Thread.sleep( SLEEP_MILLIS );
-
- // clear warning before test related to MRM-1638
- artifactConverter.clearWarnings();
- artifactConverter.convert( artifact, targetRepository );
- checkWarnings( artifactConverter, 2 );
-
- assertHasWarningReason( artifactConverter, Messages.getString( "failure.target.already.exists" ) );
-
- assertEquals( "Check unmodified", origTime, Files.getLastModifiedTime(targetFile).toMillis() );
- assertEquals( "Check unmodified", origPomTime, Files.getLastModifiedTime(targetPomFile).toMillis() );
-
- ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
- Path metadataFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
- assertFalse( "Check metadata not created", Files.exists(metadataFile) );
- }
-
- @Test
- public void testRollbackArtifactCreated()
- throws Exception
- {
- // test rollback can remove a created artifact, including checksums
-
- Artifact artifact = createArtifact( "test", "rollback-created-artifact", "1.0.0" );
- ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
- Path artifactMetadataFile = Paths.get( targetRepository.getBasedir(),
- targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
- org.apache.archiva.common.utils.FileUtils.deleteDirectory( artifactMetadataFile.getParent() );
-
- ArtifactMetadata versionMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
- Path versionMetadataFile = Paths.get( targetRepository.getBasedir(),
- targetRepository.pathOfRemoteRepositoryMetadata( versionMetadata ) );
-
- Path artifactFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
-
- artifactConverter.convert( artifact, targetRepository );
- checkWarnings( artifactConverter, 2 );
-
- boolean found = false;
- String pattern = "^" + Messages.getString( "invalid.source.pom" ).replaceFirst( "\\{0\\}", ".*" ) + "$";
- for ( List<String> messages : artifactConverter.getWarnings().values() )
- {
- for ( String message : messages )
- {
- if ( message.matches( pattern ) )
- {
- found = true;
- break;
- }
- }
-
- if ( found )
- {
- break;
- }
- }
-
- assertTrue( "Check failure message.", found );
-
- assertFalse( "check artifact rolled back", Files.exists(artifactFile) );
- assertFalse( "check metadata rolled back", Files.exists(artifactMetadataFile) );
- assertFalse( "check metadata rolled back", Files.exists(versionMetadataFile) );
- }
-
- @Test
- public void testMultipleArtifacts()
- throws Exception
- {
- // test multiple artifacts are converted
-
- List<Artifact> 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" ) );
-
- for ( Artifact artifact : artifacts )
- {
- artifactConverter.convert( artifact, targetRepository );
- checkSuccess( artifactConverter );
- }
-
- for ( Artifact artifact : artifacts )
- {
- Path artifactFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- assertTrue( "Check artifact created", Files.exists(artifactFile) );
- assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile.toFile(), artifact.getFile() ) );
-
- artifact = createPomArtifact( artifact );
- Path pomFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- Path expectedPomFile =
- getTestFile( "src/test/expected-files/converted-" + artifact.getArtifactId() + ".pom" );
- assertTrue( "Check POM created", Files.exists(pomFile) );
-
- compareFiles( expectedPomFile, pomFile );
- }
- }
-
- @Test
- 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" );
- Path file = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- Files.deleteIfExists(file);
-
- artifactConverter.convert( artifact, targetRepository );
- checkWarnings( artifactConverter, 2 );
-
- assertHasWarningReason( artifactConverter,
- Messages.getString( "failure.incorrect.artifactMetadata.versions" ) );
-
- assertFalse( "Check artifact not created", Files.exists(file) );
-
- ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
- Path metadataFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
- assertFalse( "Check metadata not created", Files.exists(metadataFile) );
- }
-
- @Test
- public void testInvalidSourceSnapshotMetadata()
- throws Exception
- {
- // 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" );
- Path file = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- Files.deleteIfExists(file);
-
- artifactConverter.convert( artifact, targetRepository );
- checkWarnings( artifactConverter, 2 );
-
- assertHasWarningReason( artifactConverter,
- Messages.getString( "failure.incorrect.snapshotMetadata.snapshot" ) );
-
- assertFalse( "Check artifact not created", Files.exists(file) );
-
- ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( artifact );
- Path metadataFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOfRemoteRepositoryMetadata( metadata ) );
- assertFalse( "Check metadata not created", Files.exists(metadataFile) );
- }
-
- @Test
- public void testMergeArtifactMetadata()
- throws Exception
- {
- // test artifact level metadata is merged when it already exists on successful conversion
-
- Artifact artifact = createArtifact( "test", "newversion-artifact", "1.0.1" );
- artifactConverter.convert( artifact, targetRepository );
- checkSuccess( artifactConverter );
-
- Path artifactFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- assertTrue( "Check artifact created", Files.exists(artifactFile) );
- assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile.toFile(), artifact.getFile() ) );
-
- artifact = createPomArtifact( artifact );
- Path pomFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
- Path sourcePomFile = Paths.get( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) );
- assertTrue( "Check POM created", Files.exists(pomFile) );
-
- compareFiles( sourcePomFile, pomFile );
-
- ArtifactMetadata artifactMetadata = new ArtifactRepositoryMetadata( artifact );
- Path artifactMetadataFile = Paths.get( targetRepository.getBasedir(),
- targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
- assertTrue( "Check artifact metadata created", Files.exists(artifactMetadataFile) );
-
- Path expectedMetadataFile = getTestFile( "src/test/expected-files/newversion-artifact-metadata.xml" );
-
- compareFiles( expectedMetadataFile, artifactMetadataFile );
- }
-
- @Test
- public void testSourceAndTargetRepositoriesMatch()
- throws Exception
- {
- // test that it fails if the same
-
-
- sourceRepository =
- new MavenArtifactRepository( "source", targetRepository.getUrl(), targetRepository.getLayout(), null,
- null );
-
- Artifact artifact = createArtifact( "test", "repository-artifact", "1.0" );
-
- try
- {
- artifactConverter.convert( artifact, targetRepository );
- fail( "Should have failed trying to convert within the same repository" );
- }
- catch ( ArtifactConversionException e )
- {
- // expected
- assertEquals( "check message", Messages.getString( "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( Paths.get( sourceRepository.getBasedir(), sourceRepository.pathOf( artifact ) ).toFile() );
- return artifact;
- }
-
- private Artifact createPomArtifact( Artifact artifact )
- {
- return createArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getBaseVersion(),
- artifact.getVersion(), "pom" );
- }
-
- private static void compareFiles( Path expectedPomFile, Path pomFile )
- throws IOException
- {
- String expectedContent = normalizeString(
- org.apache.archiva.common.utils.FileUtils.readFileToString( expectedPomFile, Charset.defaultCharset() ) );
- String targetContent =
- normalizeString( org.apache.archiva.common.utils.FileUtils.readFileToString( pomFile, Charset.defaultCharset() ) );
- 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 .+\\?>",
- "" ).replaceAll( "^\\s+", "" );
- }
-
- private void checkSuccess( ArtifactConverter converter )
- {
- assertNotNull( "Warnings should never be null.", converter.getWarnings() );
- assertEquals( "Should have no warnings. " + converter.getWarnings(), 0, countWarningMessages( converter ) );
- }
-
- private void checkWarnings( ArtifactConverter converter, int count )
- {
- assertNotNull( "Warnings should never be null.", converter.getWarnings() );
- assertEquals( "Should have some warnings.", count, countWarningMessages( converter ) );
- }
-
- private int countWarningMessages( ArtifactConverter converter )
- {
- int count = 0;
- for ( List<String> values : converter.getWarnings().values() )
- {
- count += values.size();
- }
- return count;
- }
-
- private void assertHasWarningReason( ArtifactConverter converter, String reason )
- {
- assertNotNull( "Warnings should never be null.", converter.getWarnings() );
- assertTrue( "Expecting 1 or more Warnings", countWarningMessages( converter ) > 0 );
-
- for ( List<String> messages : converter.getWarnings().values() )
- {
- if ( messages.contains( reason ) )
- {
- /* No need to check any further */
- return;
- }
- }
-
- /* didn't find it. */
-
- for ( Map.Entry<Artifact, List<String>> entry : converter.getWarnings().entrySet() )
- {
- Artifact artifact = (Artifact) entry.getKey();
- System.out.println(
- "-Artifact: " + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion() );
- List<String> messages = entry.getValue();
- for ( String message : messages )
- {
- System.out.println( " " + message );
- }
- }
- fail( "Unable to find message <" + reason + "> in warnings." );
- }
-
- private void createModernSourceRepository()
- throws Exception
- {
- ArtifactRepositoryLayout layout = plexusSisuBridge.lookup( ArtifactRepositoryLayout.class, "default" );
-
- Path sourceBase = getTestFile( "src/test/source-modern-repository" );
- sourceRepository =
- new MavenArtifactRepository( "source", sourceBase.toUri().toURL().toString(), layout, null, null );
- }
- }
|