@ -307,6 +307,26 @@ public abstract class LocalDiskRepositoryTestCase {
toClose . add ( r ) ;
toClose . add ( r ) ;
}
}
private String createUniqueTestFolderPrefix ( ) {
return "test" + ( System . currentTimeMillis ( ) + "_" + ( testCount + + ) ) ;
}
/ * *
* Creates a unique directory for a test
*
* @param name
* a subdirectory
* @return a unique directory for a test
* @throws IOException
* /
protected File createTempDirectory ( String name ) throws IOException {
String gitdirName = createUniqueTestFolderPrefix ( ) ;
File parent = new File ( trash , gitdirName ) ;
File directory = new File ( parent , name ) ;
FileUtils . mkdirs ( directory ) ;
return directory . getCanonicalFile ( ) ;
}
/ * *
/ * *
* Creates a new unique directory for a test repository
* Creates a new unique directory for a test repository
*
*
@ -317,11 +337,12 @@ public abstract class LocalDiskRepositoryTestCase {
* @throws IOException
* @throws IOException
* /
* /
protected File createUniqueTestGitDir ( boolean bare ) throws IOException {
protected File createUniqueTestGitDir ( boolean bare ) throws IOException {
String uniqueId = System . currentTimeMillis ( ) + "_" + ( testCount + + ) ;
String gitdirName = createUniqueTestFolderPrefix ( ) ;
String gitdirName = "test" + uniqueId + ( bare ? "" : "/" )
if ( ! bare )
+ Constants . DOT_GIT ;
gitdirName + = "/" ;
File gitdir = new File ( trash , gitdirName ) . getCanonicalFile ( ) ;
gitdirName + = Constants . DOT_GIT ;
return gitdir ;
File gitdir = new File ( trash , gitdirName ) ;
return gitdir . getCanonicalFile ( ) ;
}
}
protected File createTempFile ( ) throws IOException {
protected File createTempFile ( ) throws IOException {
@ -453,4 +474,5 @@ public abstract class LocalDiskRepositoryTestCase {
private String testId ( ) {
private String testId ( ) {
return getClass ( ) . getName ( ) + "." + testCount ;
return getClass ( ) . getName ( ) + "." + testCount ;
}
}
}
}