Skip to content

Commit 47f0baa

Browse files
harrisricvladak
authored andcommitted
Corrections to other tests affected by use of full githash
1 parent ffb82b4 commit 47f0baa

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

opengrok-web/src/test/java/org/opengrok/web/PageConfigTest.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@
7070
* Unit tests for the {@code PageConfig} class.
7171
*/
7272
public class PageConfigTest {
73+
private static final String HASH_BB74B7E8 = "bb74b7e849170c31dc1b1b5801c83bf0094a3b10";
74+
private static final String HASH_AA35C258 = "aa35c25882b9a60a97758e0ceb276a3f8cb4ae3a";
7375
private static TestRepository repository = new TestRepository();
7476

7577
@BeforeAll
@@ -317,7 +319,7 @@ public String getPathInfo() {
317319
PageConfig cfg = PageConfig.get(req1);
318320
String rev = getLatestRevision(cfg.getResourceFile());
319321

320-
assertEquals("aa35c258", rev);
322+
assertEquals(HASH_AA35C258, rev);
321323
}
322324

323325
@Test
@@ -352,7 +354,7 @@ public String getPathInfo() {
352354
PageConfig cfg = PageConfig.get(req1);
353355
String rev = LatestRevisionUtil.getLastRevFromIndex(new File(repository.getSourceRoot(), filePath));
354356
assertNotNull(rev);
355-
assertEquals("aa35c258", rev);
357+
assertEquals(HASH_AA35C258, rev);
356358
}
357359

358360
@Test
@@ -378,7 +380,7 @@ public String getQueryString() {
378380

379381
String location = cfg.getRevisionLocation(getLatestRevision(cfg.getResourceFile()));
380382
assertNotNull(location);
381-
assertEquals("source/xref/git/main.c?r=aa35c258&a=true", location);
383+
assertEquals("source/xref/git/main.c?r=" + HASH_AA35C258 + "&a=true", location);
382384
}
383385

384386
@Test
@@ -404,7 +406,7 @@ public String getQueryString() {
404406

405407
String location = cfg.getRevisionLocation(getLatestRevision(cfg.getResourceFile()));
406408
assertNotNull(location);
407-
assertEquals("source/xref/git/main.c?r=aa35c258", location);
409+
assertEquals("source/xref/git/main.c?r=" + HASH_AA35C258, location);
408410
}
409411

410412
@Test
@@ -449,7 +451,7 @@ public String getParameter(String name) {
449451

450452
@Test
451453
void testGetAnnotation() {
452-
final String[] revisions = {"aa35c258", "bb74b7e8"};
454+
final String[] revisions = {HASH_AA35C258, HASH_BB74B7E8};
453455

454456
for (int i = 0; i < revisions.length; i++) {
455457
final int index = i;

opengrok-web/src/test/java/org/opengrok/web/api/v1/controller/AnnotationControllerTest.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@
5252

5353
public class AnnotationControllerTest extends OGKJerseyTest {
5454

55+
private static final String HASH_BB74B7E8 = "bb74b7e849170c31dc1b1b5801c83bf0094a3b10";
56+
private static final String HASH_AA35C258 = "aa35c25882b9a60a97758e0ceb276a3f8cb4ae3a";
57+
5558
private final RuntimeEnvironment env = RuntimeEnvironment.getInstance();
5659

5760
private TestRepository repository;
@@ -121,8 +124,8 @@ public void testAnnotationAPI() throws IOException {
121124
List<String> ids = annotations.stream().
122125
map(AnnotationController.AnnotationDTO::getRevision).
123126
collect(Collectors.toList());
124-
assertEquals(Arrays.asList("bb74b7e8", "bb74b7e8", "bb74b7e8", "bb74b7e8", "bb74b7e8",
125-
"bb74b7e8", "bb74b7e8", "bb74b7e8", "aa35c258", "aa35c258", "aa35c258"), ids);
127+
assertEquals(Arrays.asList(HASH_BB74B7E8, HASH_BB74B7E8, HASH_BB74B7E8, HASH_BB74B7E8, HASH_BB74B7E8,
128+
HASH_BB74B7E8, HASH_BB74B7E8, HASH_BB74B7E8, HASH_AA35C258, HASH_AA35C258, HASH_AA35C258), ids);
126129
List<String> versions = annotations.stream().
127130
map(AnnotationController.AnnotationDTO::getVersion).
128131
collect(Collectors.toList());
@@ -136,7 +139,7 @@ public void testAnnotationAPIWithRevision() {
136139
final String path = "git/Makefile";
137140
List<AnnotationController.AnnotationDTO> annotations = target("annotation")
138141
.queryParam("path", path)
139-
.queryParam("revision", "bb74b7e8")
142+
.queryParam("revision", HASH_BB74B7E8)
140143
.request()
141144
.get(new GenericType<>() {
142145
});
@@ -150,6 +153,6 @@ public void testAnnotationAPIWithRevision() {
150153
collect(Collectors.toList());
151154
assertEquals(Arrays.asList("1/1", "1/1", "1/1", "1/1", "1/1", "1/1", "1/1", "1/1"),
152155
versions);
153-
assertEquals(Collections.singleton("bb74b7e8"), ids);
156+
assertEquals(Collections.singleton(HASH_BB74B7E8), ids);
154157
}
155158
}

0 commit comments

Comments
 (0)