annotate mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/BaseMercurialTestCase.java @ 57:99e757f2527b

branches support
author Pavel.Sher
date Sun, 26 Oct 2008 16:23:50 +0300
parents 1490e2981799
children 5d9c34cb543a
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;
57
99e757f2527b branches support
Pavel.Sher
parents: 44
diff changeset
7 import org.jetbrains.annotations.NotNull;
34
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
8 import org.testng.annotations.AfterMethod;
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
9 import org.testng.annotations.BeforeMethod;
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
10
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
11 import java.io.File;
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
12 import java.io.IOException;
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 /**
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
15 * @author Pavel.Sher
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
16 * Date: 31.07.2008
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
17 */
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
18 public abstract class BaseMercurialTestCase extends PatchTestCase {
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
19 protected TempFiles myTempFiles;
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
20 protected MockSupport myMockSupport;
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
21
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
22 @Override
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
23 @BeforeMethod
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
24 protected void setUp() throws Exception {
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
25 super.setUp();
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
26
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
27 myMockSupport = new MockSupport();
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
28 myMockSupport.setUpMocks();
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
29 myTempFiles = new TempFiles();
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
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
32 @AfterMethod
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
33 protected void tearDown() throws Exception {
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
34 myMockSupport.tearDownMocks();
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
35 myTempFiles.cleanup();
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
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
38 protected VcsRootImpl createVcsRoot() throws IOException {
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
39 VcsRootImpl vcsRoot = new VcsRootImpl(1, Constants.VCS_NAME);
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
40 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
41 String repPath = getRepositoryPath();
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 34
diff changeset
42 File repository = LocalRepositoryUtil.prepareRepository(repPath);
34
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
43 vcsRoot.addProperty(Constants.REPOSITORY_PROP, repository.getAbsolutePath());
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
44 return vcsRoot;
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
45 }
44
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 34
diff changeset
46
57
99e757f2527b branches support
Pavel.Sher
parents: 44
diff changeset
47 protected VcsRootImpl createVcsRoot(@NotNull String branchName) throws IOException {
99e757f2527b branches support
Pavel.Sher
parents: 44
diff changeset
48 VcsRootImpl vcsRoot = createVcsRoot();
99e757f2527b branches support
Pavel.Sher
parents: 44
diff changeset
49 vcsRoot.addProperty(Constants.BRANCH_NAME_PROP, branchName);
99e757f2527b branches support
Pavel.Sher
parents: 44
diff changeset
50 return vcsRoot;
99e757f2527b branches support
Pavel.Sher
parents: 44
diff changeset
51 }
99e757f2527b branches support
Pavel.Sher
parents: 44
diff changeset
52
44
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 34
diff changeset
53 private String getRepositoryPath() {
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 34
diff changeset
54 return new File("mercurial-tests/testData/rep1").getAbsolutePath();
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 34
diff changeset
55 }
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 34
diff changeset
56
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 34
diff changeset
57 protected void cleanRepositoryAfterTest() {
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 34
diff changeset
58 LocalRepositoryUtil.forgetRepository(getRepositoryPath());
1490e2981799 labeling/tagging support
Pavel.Sher
parents: 34
diff changeset
59 }
34
0052d368c90c initial working version of agent side checkout + some tests
Pavel.Sher
parents:
diff changeset
60 }