Mercurial > hg4j
comparison test/org/tmatesoft/hg/test/Configuration.java @ 203:66fd2c73c56f
Basic test for HgOutgoingCommand. Handle cases with no outgoing changes in RepositoryComparator
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Tue, 26 Apr 2011 15:52:33 +0200 |
parents | 706bcc7cfee4 |
children | 883f1efbcf27 |
comparison
equal
deleted
inserted
replaced
202:706bcc7cfee4 | 203:66fd2c73c56f |
---|---|
34 * @author TMate Software Ltd. | 34 * @author TMate Software Ltd. |
35 */ | 35 */ |
36 public class Configuration { | 36 public class Configuration { |
37 | 37 |
38 private static Configuration inst; | 38 private static Configuration inst; |
39 private final File root; | 39 private File root; |
40 private final HgLookup lookup; | 40 private final HgLookup lookup; |
41 private File tempDir; | 41 private File tempDir; |
42 private List<String> remoteServers; | 42 private List<String> remoteServers; |
43 | 43 |
44 private Configuration(File reposRoot) { | 44 private Configuration() { |
45 root = reposRoot; | |
46 lookup = new HgLookup(); | 45 lookup = new HgLookup(); |
46 } | |
47 | |
48 private File getRoot() { | |
49 if (root == null) { | |
50 String repo2 = System.getProperty("hg4j.tests.repos"); | |
51 assertNotNull("System property hg4j.tests.repos is undefined", repo2); | |
52 root = new File(repo2); | |
53 assertTrue(root.exists()); | |
54 } | |
55 return root; | |
47 } | 56 } |
48 | 57 |
49 public static Configuration get() { | 58 public static Configuration get() { |
50 if (inst == null) { | 59 if (inst == null) { |
51 String repo2 = System.getProperty("hg4j.tests.repos"); | 60 inst = new Configuration(); |
52 assertNotNull(repo2); | |
53 File rr = new File(repo2); | |
54 assertTrue(rr.exists()); | |
55 inst = new Configuration(rr); | |
56 } | 61 } |
57 return inst; | 62 return inst; |
58 } | 63 } |
59 | 64 |
60 public HgRepository own() throws Exception { | 65 public HgRepository own() throws Exception { |
61 return lookup.detectFromWorkingDir(); | 66 return lookup.detectFromWorkingDir(); |
62 } | 67 } |
63 | 68 |
64 // fails if repo not found | 69 // fails if repo not found |
65 public HgRepository find(String key) throws Exception { | 70 public HgRepository find(String key) throws Exception { |
66 HgRepository rv = lookup.detect(new File(root, key)); | 71 HgRepository rv = lookup.detect(new File(getRoot(), key)); |
67 assertNotNull(rv); | 72 assertNotNull(rv); |
68 assertFalse(rv.isInvalid()); | 73 assertFalse(rv.isInvalid()); |
69 return rv; | 74 return rv; |
70 } | 75 } |
71 | 76 |