mirror of https://github.com/apache/archiva.git
[MRM-9] dry run tests
git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@372763 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9ecb2cca17
commit
a4f75db365
|
@ -167,7 +167,7 @@ public class DefaultRepositoryConverter
|
|||
metadata = newMetadata;
|
||||
}
|
||||
|
||||
if ( changed )
|
||||
if ( changed && !dryrun )
|
||||
{
|
||||
Writer writer = null;
|
||||
try
|
||||
|
|
|
@ -583,13 +583,52 @@ public class RepositoryConverterTest
|
|||
|
||||
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
|
||||
|
||||
// TODO
|
||||
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()
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
<force>true</force>
|
||||
</configuration>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.apache.maven.repository.digest.Digester</role>
|
||||
<field-name>digester</field-name>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
|
||||
<field-name>artifactFactory</field-name>
|
||||
|
@ -32,6 +36,10 @@
|
|||
<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>
|
||||
|
@ -42,6 +50,10 @@
|
|||
<dryrun>true</dryrun>
|
||||
</configuration>
|
||||
<requirements>
|
||||
<requirement>
|
||||
<role>org.apache.maven.repository.digest.Digester</role>
|
||||
<field-name>digester</field-name>
|
||||
</requirement>
|
||||
<requirement>
|
||||
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
|
||||
<field-name>artifactFactory</field-name>
|
||||
|
@ -50,6 +62,10 @@
|
|||
<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>
|
||||
|
|
Loading…
Reference in New Issue