模拟svn实例以测试svnkit测试 [英] Mock svn instance for testing svnkit tests
本文介绍了模拟svn实例以测试svnkit测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用的项目使用svnkit与Subversion进行了大量交互.
A project I'm working on interacts heavily with Subversion, using svnkit.
是否有运行模拟内存中的svn实例的示例,以帮助进行测试等?
Are there any examples on running a mock in-memory svn instance, to help facilitate testing etc?
欢呼
马蒂
推荐答案
在文件系统上创建一个临时SVN存储库以在测试期间使用非常简单,您可以在测试结束时立即将其删除.您将使用file://协议来访问它.
It's quite straightforward to create a temporary SVN repository on the filesystem to use during the test which you can delete immediately at the end of the test. You would use file:// protocol to access it.
import static org.junit.Assert.*;
import java.io.*;
import org.apache.commons.io.FileUtils;
import org.junit.*;
import org.tmatesoft.svn.core.*;
public class SVNTest {
private static final String path = "/tmp/testrepo";
SVNURL tgtURL;
@Before
public void setUp() throws Exception {
SVNRepositoryFactoryImpl.setup();
tgtURL = SVNRepositoryFactory.createLocalRepository( new File( path ), true , false );
}
@After
public void tearDown() throws IOException {
FileUtils.deleteDirectory(new File(path));
}
@Test
public void test() {
fail("Not yet implemented");
}
}
这篇关于模拟svn实例以测试svnkit测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文