annotate mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/BaseMercurialTestCase.java @ 44:1490e2981799

labeling/tagging support
author Pavel.Sher
date Fri, 05 Sep 2008 01:15:29 +0400
parents 0052d368c90c
children 99e757f2527b
rev   line source
34
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
1 package jetbrains.buildServer.buildTriggers.vcs.mercurial;
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
2
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
3 import jetbrains.buildServer.MockSupport;
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
4 import jetbrains.buildServer.TempFiles;
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
5 import jetbrains.buildServer.vcs.impl.VcsRootImpl;
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
6 import jetbrains.buildServer.vcs.patches.PatchTestCase;
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
7 import org.testng.annotations.AfterMethod;
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
8 import org.testng.annotations.BeforeMethod;
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
9
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
10 import java.io.File;
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
11 import java.io.IOException;
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
12
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
13 /**
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
14 * @author Pavel.Sher
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
15 * Date: 31.07.2008
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
16 */
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
17 public abstract class BaseMercurialTestCase extends PatchTestCase {
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
18 protected TempFiles myTempFiles;
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
19 protected MockSupport myMockSupport;
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
20
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
21 @Override
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
22 @BeforeMethod
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
23 protected void setUp() throws Exception {
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
24 super.setUp();
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
25
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
26 myMockSupport = new MockSupport();
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
27 myMockSupport.setUpMocks();
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
28 myTempFiles = new TempFiles();
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
29 }
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
30
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
31 @AfterMethod
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
32 protected void tearDown() throws Exception {
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
33 myMockSupport.tearDownMocks();
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
34 myTempFiles.cleanup();
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
35 }
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
36
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
37 protected VcsRootImpl createVcsRoot() throws IOException {
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
38 VcsRootImpl vcsRoot = new VcsRootImpl(1, Constants.VCS_NAME);
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
39 vcsRoot.addProperty(Constants.HG_COMMAND_PATH_PROP, new File("mercurial-tests/testData/bin/hg.exe").getAbsolutePath());
44
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 34
diff changeset
40 String repPath = getRepositoryPath();
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 34
diff changeset
41 File repository = LocalRepositoryUtil.prepareRepository(repPath);
34
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
42 vcsRoot.addProperty(Constants.REPOSITORY_PROP, repository.getAbsolutePath());
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
43 return vcsRoot;
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
44 }
44
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 34
diff changeset
45
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 34
diff changeset
46 private String getRepositoryPath() {
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 34
diff changeset
47 return new File("mercurial-tests/testData/rep1").getAbsolutePath();
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 34
diff changeset
48 }
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 34
diff changeset
49
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 34
diff changeset
50 protected void cleanRepositoryAfterTest() {
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 34
diff changeset
51 LocalRepositoryUtil.forgetRepository(getRepositoryPath());
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 34
diff changeset
52 }
34
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
53 }