close repository after each unit test

This commit is contained in:
Sebastian Sdorra
2012-07-04 09:10:10 +02:00
parent d2b93ded12
commit d53449945e
4 changed files with 30 additions and 12 deletions

View File

@@ -30,10 +30,12 @@
*/
package sonia.scm.repository.spi;
//~--- non-JDK imports --------------------------------------------------------
import org.junit.After;
import org.junit.Assume;
import org.junit.Before;
@@ -58,6 +60,21 @@ import java.io.IOException;
public class AbstractHgCommandTestBase extends ZippedRepositoryTestBase
{
/**
* Method description
*
*
* @throws IOException
*/
@After
public void close() throws IOException
{
if (cmdContext != null)
{
cmdContext.close();
}
}
/**
* Method description
*
@@ -85,6 +102,8 @@ public class AbstractHgCommandTestBase extends ZippedRepositoryTestBase
System.out.println("WARNING could not find hg, skipping test");
Assume.assumeTrue(false);
}
cmdContext = new HgCommandContext(handler.getConfig(), repositoryDirectory);
}
//~--- get methods ----------------------------------------------------------
@@ -115,6 +134,9 @@ public class AbstractHgCommandTestBase extends ZippedRepositoryTestBase
//~--- fields ---------------------------------------------------------------
/** Field description */
protected HgCommandContext cmdContext;
/** Field description */
protected HgRepositoryHandler handler;
}

View File

@@ -39,7 +39,6 @@ import org.junit.Test;
import sonia.scm.repository.BlameLine;
import sonia.scm.repository.BlameResult;
import sonia.scm.repository.HgContext;
import sonia.scm.repository.RepositoryException;
import static org.junit.Assert.*;
@@ -139,7 +138,6 @@ public class HgBlameCommandTest extends AbstractHgCommandTestBase
*/
private BlameCommand createCommand()
{
return new HgBlameCommand(new HgCommandContext(handler.getConfig(),
repositoryDirectory), repository);
return new HgBlameCommand(cmdContext, repository);
}
}

View File

@@ -106,8 +106,7 @@ public class HgCatCommandTest extends AbstractHgCommandTestBase
try
{
new HgCatCommand(new HgCommandContext(handler.getConfig(),
repositoryDirectory), repository).getCatResult(request, baos);
new HgCatCommand(cmdContext, repository).getCatResult(request, baos);
}
finally
{

View File

@@ -235,7 +235,6 @@ public class HgLogCommandTest extends AbstractHgCommandTestBase
*/
private HgLogCommand createComamnd()
{
return new HgLogCommand(new HgCommandContext(handler.getConfig(),
repositoryDirectory), repository);
return new HgLogCommand(cmdContext, repository);
}
}