mirror of
https://github.com/apache/archiva.git
synced 2025-02-08 02:59:43 +00:00
[MRM-9] remove issues on windows
git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@369274 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
080a93a597
commit
254f0293c6
@ -49,6 +49,8 @@ public class RepositoryConverterTest
|
|||||||
|
|
||||||
private ArtifactFactory artifactFactory;
|
private ArtifactFactory artifactFactory;
|
||||||
|
|
||||||
|
private static final int SLEEP_MILLIS = 100;
|
||||||
|
|
||||||
protected void setUp()
|
protected void setUp()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
@ -114,13 +116,24 @@ public void testV3PomConvert()
|
|||||||
File expectedPomFile = getTestFile( "src/test/expected-files/converted-v3.pom" );
|
File expectedPomFile = getTestFile( "src/test/expected-files/converted-v3.pom" );
|
||||||
assertTrue( "Check POM created", pomFile.exists() );
|
assertTrue( "Check POM created", pomFile.exists() );
|
||||||
|
|
||||||
String expectedContent = FileUtils.fileRead( expectedPomFile ).trim();
|
compareFiles( expectedPomFile, pomFile );
|
||||||
String targetContent = FileUtils.fileRead( pomFile ).trim();
|
|
||||||
assertEquals( "Check POM was converted", expectedContent, targetContent );
|
|
||||||
|
|
||||||
// TODO: test warnings (separate test?)
|
// TODO: test warnings (separate test?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void compareFiles( File expectedPomFile, File pomFile )
|
||||||
|
throws IOException
|
||||||
|
{
|
||||||
|
String expectedContent = normalizeString( FileUtils.fileRead( expectedPomFile ) );
|
||||||
|
String targetContent = normalizeString( FileUtils.fileRead( pomFile ) );
|
||||||
|
assertEquals( "Check POM was converted", expectedContent, targetContent );
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String normalizeString( String path )
|
||||||
|
{
|
||||||
|
return path.trim().replace( "\r\n", "\n" ).replace( '\r', '\n' );
|
||||||
|
}
|
||||||
|
|
||||||
public void testNoPomConvert()
|
public void testNoPomConvert()
|
||||||
throws IOException, RepositoryConversionException
|
throws IOException, RepositoryConversionException
|
||||||
{
|
{
|
||||||
@ -174,7 +187,7 @@ public void testIncorrectSourceChecksumSha1()
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testUnmodifiedArtifact()
|
public void testUnmodifiedArtifact()
|
||||||
throws RepositoryConversionException, IOException
|
throws RepositoryConversionException, IOException, InterruptedException
|
||||||
{
|
{
|
||||||
// test the unmodified artifact is untouched
|
// test the unmodified artifact is untouched
|
||||||
|
|
||||||
@ -195,6 +208,9 @@ public void testUnmodifiedArtifact()
|
|||||||
long origTime = targetFile.lastModified();
|
long origTime = targetFile.lastModified();
|
||||||
long origPomTime = targetPomFile.lastModified();
|
long origPomTime = targetPomFile.lastModified();
|
||||||
|
|
||||||
|
// Need to guarantee last modified is not equal
|
||||||
|
Thread.sleep( SLEEP_MILLIS );
|
||||||
|
|
||||||
repositoryConverter.convert( artifact, targetRepository );
|
repositoryConverter.convert( artifact, targetRepository );
|
||||||
|
|
||||||
String expectedContent = FileUtils.fileRead( sourceFile ).trim();
|
String expectedContent = FileUtils.fileRead( sourceFile ).trim();
|
||||||
@ -238,6 +254,9 @@ public void testForcedUnmodifiedArtifact()
|
|||||||
sourceFile.setLastModified( System.currentTimeMillis() );
|
sourceFile.setLastModified( System.currentTimeMillis() );
|
||||||
sourcePomFile.setLastModified( System.currentTimeMillis() );
|
sourcePomFile.setLastModified( System.currentTimeMillis() );
|
||||||
|
|
||||||
|
// Need to guarantee last modified is not equal
|
||||||
|
Thread.sleep( SLEEP_MILLIS );
|
||||||
|
|
||||||
repositoryConverter.convert( artifact, targetRepository );
|
repositoryConverter.convert( artifact, targetRepository );
|
||||||
|
|
||||||
String expectedContent = FileUtils.fileRead( sourceFile ).trim();
|
String expectedContent = FileUtils.fileRead( sourceFile ).trim();
|
||||||
@ -336,9 +355,7 @@ public void testMultipleArtifacts()
|
|||||||
getTestFile( "src/test/expected-files/converted-" + artifact.getArtifactId() + ".pom" );
|
getTestFile( "src/test/expected-files/converted-" + artifact.getArtifactId() + ".pom" );
|
||||||
assertTrue( "Check POM created", pomFile.exists() );
|
assertTrue( "Check POM created", pomFile.exists() );
|
||||||
|
|
||||||
String expectedContent = FileUtils.fileRead( expectedPomFile ).trim();
|
compareFiles( expectedPomFile, pomFile );
|
||||||
String targetContent = FileUtils.fileRead( pomFile ).trim();
|
|
||||||
assertEquals( "Check POM was converted", expectedContent, targetContent );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user