System.currentTimeMillis() does not have the granularity necessary to guarantee uniqueness. We keep it to make sure we have unique names between different runs, but add a counter to make it unique within the execution of a test suite. Signed-off-by: Robin Rosenberg <robin.rosenberg@xxxxxxxxxx> --- .../org/spearce/jgit/lib/RepositoryTestCase.java | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java index 3b08fa5..6ea9b45 100644 --- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java @@ -150,11 +150,13 @@ protected static void checkFile(File f, final String checkData) protected Repository db; + private static int testcount; + public void setUp() throws Exception { super.setUp(); configure(); recursiveDelete(trashParent); - trash = new File(trashParent,"trash"+System.currentTimeMillis()); + trash = new File(trashParent,"trash"+System.currentTimeMillis()+"."+(testcount++)); trash_git = new File(trash, ".git"); Runtime.getRuntime().addShutdownHook(new Thread() { @@ -200,7 +202,7 @@ protected void tearDown() throws Exception { * @throws IOException */ protected Repository createNewEmptyRepo() throws IOException { - File newTestRepo = new File(trashParent, "new"+System.currentTimeMillis()+"/.git"); + File newTestRepo = new File(trashParent, "new"+System.currentTimeMillis()+"."+(testcount++)+"/.git"); assertFalse(newTestRepo.exists()); final Repository newRepo = new Repository(newTestRepo); newRepo.create(); -- 1.6.0.3.640.g6331a -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html