[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:
Brett Porter 2006-01-15 22:55:09 +00:00
parent 080a93a597
commit 254f0293c6
1 changed files with 24 additions and 7 deletions

View File

@ -49,6 +49,8 @@ public class RepositoryConverterTest
private ArtifactFactory artifactFactory;
private static final int SLEEP_MILLIS = 100;
protected void setUp()
throws Exception
{
@ -114,13 +116,24 @@ public class RepositoryConverterTest
File expectedPomFile = getTestFile( "src/test/expected-files/converted-v3.pom" );
assertTrue( "Check POM created", pomFile.exists() );
String expectedContent = FileUtils.fileRead( expectedPomFile ).trim();
String targetContent = FileUtils.fileRead( pomFile ).trim();
assertEquals( "Check POM was converted", expectedContent, targetContent );
compareFiles( expectedPomFile, pomFile );
// 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()
throws IOException, RepositoryConversionException
{
@ -174,7 +187,7 @@ public class RepositoryConverterTest
}
public void testUnmodifiedArtifact()
throws RepositoryConversionException, IOException
throws RepositoryConversionException, IOException, InterruptedException
{
// test the unmodified artifact is untouched
@ -195,6 +208,9 @@ public class RepositoryConverterTest
long origTime = targetFile.lastModified();
long origPomTime = targetPomFile.lastModified();
// Need to guarantee last modified is not equal
Thread.sleep( SLEEP_MILLIS );
repositoryConverter.convert( artifact, targetRepository );
String expectedContent = FileUtils.fileRead( sourceFile ).trim();
@ -238,6 +254,9 @@ public class RepositoryConverterTest
sourceFile.setLastModified( System.currentTimeMillis() );
sourcePomFile.setLastModified( System.currentTimeMillis() );
// Need to guarantee last modified is not equal
Thread.sleep( SLEEP_MILLIS );
repositoryConverter.convert( artifact, targetRepository );
String expectedContent = FileUtils.fileRead( sourceFile ).trim();
@ -336,9 +355,7 @@ public class RepositoryConverterTest
getTestFile( "src/test/expected-files/converted-" + artifact.getArtifactId() + ".pom" );
assertTrue( "Check POM created", pomFile.exists() );
String expectedContent = FileUtils.fileRead( expectedPomFile ).trim();
String targetContent = FileUtils.fileRead( pomFile ).trim();
assertEquals( "Check POM was converted", expectedContent, targetContent );
compareFiles( expectedPomFile, pomFile );
}
}