1 /*******************************************************************************
2 * Copyright (C) 2007, Robin Rosenberg <robin.rosenberg@dewire.com>
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * See LICENSE for the full license text, also available.
7 *******************************************************************************/
8 package org
.eclipse
.egit
.core
.test
;
11 import java
.io
.IOException
;
13 import junit
.framework
.TestCase
;
15 public abstract class GitTestCase
extends TestCase
{
17 protected TestProject project
;
19 protected File gitDir
;
21 protected void setUp() throws Exception
{
23 project
= new TestProject();
24 gitDir
= new File(project
.getProject().getWorkspace().getRoot()
25 .getRawLocation().toFile(), ".git");
29 protected void tearDown() throws Exception
{
35 private void rmrf(File d
) throws IOException
{
39 File
[] files
= d
.listFiles();
41 for (int i
= 0; i
< files
.length
; ++i
) {
42 if (files
[i
].isDirectory())
44 else if (!files
[i
].delete())
45 throw new IOException(files
[i
] + " in use or undeletable");
49 throw new IOException(d
+ " in use or undeletable");