Skip to content

Commit 2bcacab

Browse files
ahornaceVladimir Kotal
authored andcommitted
Move testdata sources to maven's test resources
1 parent 4ed11dc commit 2bcacab

File tree

81 files changed

+131
-108
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+131
-108
lines changed

opengrok-indexer/build.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ Portions Copyright (c) 2020, Chris Fraire <[email protected]>.
6161
<fileset dir="${test.bzr}/bzr"/>
6262
</copy>
6363

64-
<zip destfile="${build.test.classes.dir}/org/opengrok/indexer/index/source.zip"
65-
basedir="${test.sources}"
66-
update="false"
67-
defaultexcludes="no"/>
6864
<zip destfile="${build.test.classes.dir}/org/opengrok/indexer/history/repositories.zip"
6965
basedir="${test.repositories}"
7066
excludes="mercurial/hg/**, mercurial/hgignore, git/git/**, bitkeeper/bk/**, bazaar/bzr/**"

opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/CtagsTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ public static void setUpClass() throws Exception {
4747
ctags = new Ctags();
4848

4949
repository = new TestRepository();
50-
repository.create(CtagsTest.class.getResourceAsStream(
51-
"/org/opengrok/indexer/index/source.zip"));
50+
repository.create(CtagsTest.class.getClassLoader().getResource("sources"));
5251

5352
/*
5453
* This setting is only needed for bug19195 but it does not seem
@@ -84,7 +83,7 @@ private static Definitions getDefs(String fileName) throws Exception {
8483
* Test of doCtags method, of class Ctags.
8584
*/
8685
@Test
87-
public void testDoCtags() throws Exception {
86+
void testDoCtags() throws Exception {
8887
Definitions result = getDefs("bug16070/arguments.c");
8988
assertEquals(13, result.numberOfSymbols());
9089
}
@@ -94,7 +93,7 @@ public void testDoCtags() throws Exception {
9493
* definitions for Java files. Bug #14924.
9594
*/
9695
@Test
97-
public void bug14924() throws Exception {
96+
void bug14924() throws Exception {
9897
// Expected method names found in the file
9998
String[] names = {"ts", "classNameOnly", "format"};
10099
// Expected line numbers for the methods
@@ -118,7 +117,7 @@ public void bug14924() throws Exception {
118117
* for assembler source code. Bug #19195.
119118
*/
120119
@Test
121-
public void bug19195() throws Exception {
120+
void bug19195() throws Exception {
122121
// Expected method names found in the file
123122
String[] names = {"foo", "bar", "_fce", "__fce"};
124123
// Expected line numbers for the methods

opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/JFlexXrefTest.java

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ public class JFlexXrefTest {
8181
public static void setUpClass() throws Exception {
8282
ctags = new Ctags();
8383
repository = new TestRepository();
84-
repository.create(JFlexXrefTest.class.getResourceAsStream(
85-
"/org/opengrok/indexer/index/source.zip"));
84+
repository.create(JFlexXrefTest.class.getClassLoader().getResource("sources"));
8685
}
8786

8887
@AfterAll
@@ -98,7 +97,7 @@ public static void tearDownClass() {
9897
* to cause trouble.
9998
*/
10099
@Test
101-
public void testBug15890LineCount() throws Exception {
100+
void testBug15890LineCount() throws Exception {
102101
String fileContents =
103102
"line 1\n" +
104103
"line 2\n" +
@@ -159,7 +158,7 @@ private void bug15890LineCount(JFlexNonXref xref) throws Exception {
159158
* used to cause trouble.
160159
*/
161160
@Test
162-
public void testBug15890Anchor() throws Exception {
161+
void testBug15890Anchor() throws Exception {
163162
bug15890Anchor(CXref.class, "c/bug15890.c");
164163
bug15890Anchor(CxxXref.class, "c/bug15890.c");
165164
bug15890Anchor(HaskellXref.class, "haskell/bug15890.hs");
@@ -196,7 +195,7 @@ private void bug15890Anchor(Class<? extends JFlexSymbolMatcher> klass, String pa
196195
* highlighting in ShXref.
197196
*/
198197
@Test
199-
public void testBug14663() throws Exception {
198+
void testBug14663() throws Exception {
200199
// \" should not start a new string literal
201200
assertXrefLine(ShXref.class, "echo \\\"", "<b>echo</b> \\&quot;");
202201
// \" should not terminate a string literal
@@ -242,7 +241,7 @@ private void assertXrefLine(Class<? extends JFlexSymbolMatcher> xrefClass,
242241
* is properly reset now.
243242
*/
244243
@Test
245-
public void bug16883() throws Exception {
244+
void bug16883() throws Exception {
246245
final String ECHO_QUOT_XYZ = "echo \"xyz";
247246
// Analyze a script with broken syntax (unterminated string literal)
248247
JFlexXref xref = new JFlexXref(new ShXref(
@@ -285,12 +284,12 @@ public void bug16883() throws Exception {
285284
* </ul>
286285
*/
287286
@Test
288-
public void testCXrefInclude() throws Exception {
287+
void testCXrefInclude() throws Exception {
289288
testCXrefInclude(CXref.class);
290289
}
291290

292291
@Test
293-
public void testCxxXrefInclude() throws Exception {
292+
void testCxxXrefInclude() throws Exception {
294293
testCXrefInclude(CxxXref.class);
295294
}
296295

@@ -320,7 +319,7 @@ private void testCXrefInclude(Class<? extends JFlexSymbolMatcher> klass) throws
320319
* filenames.
321320
*/
322321
@Test
323-
public void testCxxXrefTemplateParameters() throws Exception {
322+
void testCxxXrefTemplateParameters() throws Exception {
324323
StringReader in = new StringReader("#include <vector>\nclass MyClass;\nstd::vector<MyClass> *v;");
325324
StringWriter out = new StringWriter();
326325
JFlexXref xref = new JFlexXref(new CxxXref(in));
@@ -333,7 +332,7 @@ public void testCxxXrefTemplateParameters() throws Exception {
333332
* Verify that ShXref handles here-documents. Bug #18198.
334333
*/
335334
@Test
336-
public void testShXrefHeredoc() throws IOException {
335+
void testShXrefHeredoc() throws IOException {
337336
final String SH_HERE_DOC = "cat<<EOF\n" +
338337
"This shouldn't cause any problem.\n" +
339338
"EOF\n" +
@@ -359,7 +358,7 @@ public void testShXrefHeredoc() throws IOException {
359358
* Test that JavaXref handles empty Java comments. Bug #17885.
360359
*/
361360
@Test
362-
public void testEmptyJavaComment() throws IOException {
361+
void testEmptyJavaComment() throws IOException {
363362
StringReader in = new StringReader("/**/\nclass xyz { }\n");
364363
JFlexXref xref = new JFlexXref(new JavaXref(in));
365364
StringWriter out = new StringWriter();
@@ -369,7 +368,7 @@ public void testEmptyJavaComment() throws IOException {
369368
}
370369

371370
@Test
372-
public void bug18586() throws IOException, InterruptedException {
371+
void bug18586() throws IOException, InterruptedException {
373372
String filename = repository.getSourceRoot() + "/sql/bug18586.sql";
374373
try (Reader in = new InputStreamReader(new FileInputStream(filename), StandardCharsets.UTF_8)) {
375374
JFlexXref xref = new JFlexXref(new SQLXref(in));
@@ -384,7 +383,7 @@ public void bug18586() throws IOException, InterruptedException {
384383
* This originally became a problem after upgrade to JFlex 1.5.0.
385384
*/
386385
@Test
387-
public void unterminatedHeredoc() throws IOException {
386+
void unterminatedHeredoc() throws IOException {
388387
JFlexXref xref = new JFlexXref(new ShXref(new StringReader(
389388
"cat << EOF\nunterminated heredoc")));
390389

@@ -406,7 +405,7 @@ public void unterminatedHeredoc() throws IOException {
406405
* they work now.
407406
*/
408407
@Test
409-
public void truncatedUuencodedFile() throws IOException {
408+
void truncatedUuencodedFile() throws IOException {
410409
JFlexXref xref = new JFlexXref(new UuencodeXref(
411410
new StringReader("begin 644 test.txt\n")));
412411

@@ -427,7 +426,7 @@ public void truncatedUuencodedFile() throws IOException {
427426
* Test that CSharpXref correctly handles verbatim strings that end with backslash.
428427
*/
429428
@Test
430-
public void testCsharpXrefVerbatimString() throws IOException {
429+
void testCsharpXrefVerbatimString() throws IOException {
431430
StringReader in = new StringReader("test(@\"\\some_windows_path_in_a_string\\\");");
432431
JFlexXref xref = new JFlexXref(new CSharpXref(in));
433432
StringWriter out = new StringWriter();
@@ -439,7 +438,7 @@ public void testCsharpXrefVerbatimString() throws IOException {
439438
* Test that special characters in URLs are escaped in the xref.
440439
*/
441440
@Test
442-
public void testEscapeLink() throws IOException {
441+
void testEscapeLink() throws IOException {
443442
StringReader in = new StringReader("http://www.example.com/?a=b&c=d");
444443
JFlexXref xref = new JFlexXref(new PlainXref(in));
445444
StringWriter out = new StringWriter();
@@ -454,7 +453,7 @@ public void testEscapeLink() throws IOException {
454453
* to be produced.
455454
*/
456455
@Test
457-
public void testJFlexRule() throws Exception {
456+
void testJFlexRule() throws Exception {
458457
StringReader in = new StringReader("\\\" { yybegin(STRING); }");
459458
// JFlex files are usually analyzed with CAnalyzer.
460459
JFlexXref xref = new JFlexXref(new CXref(in));
@@ -473,7 +472,7 @@ public void testJFlexRule() throws Exception {
473472
* longer so.
474473
*/
475474
@Test
476-
public void testUnterminatedElements() throws Exception {
475+
void testUnterminatedElements() throws Exception {
477476
for (String str : Arrays.asList("#define STR \"abc\n",
478477
"void f(); /* unterminated comment\n",
479478
"const char c = 'x\n")) {
@@ -491,7 +490,7 @@ public void testUnterminatedElements() throws Exception {
491490
* Test that JavaClassAnalyzer produces well-formed output.
492491
*/
493492
@Test
494-
public void testJavaClassAnalyzer() throws Exception {
493+
void testJavaClassAnalyzer() throws Exception {
495494
StreamSource src = new StreamSource() {
496495
@Override public InputStream getStream() throws IOException {
497496
final String path = "/" +
@@ -513,7 +512,7 @@ public void testJavaClassAnalyzer() throws Exception {
513512
* Test that special characters in Fortran files are escaped.
514513
*/
515514
@Test
516-
public void testFortranSpecialCharacters() throws Exception {
515+
void testFortranSpecialCharacters() throws Exception {
517516
JFlexXref xref = new JFlexXref(new FortranXref(
518517
new StringReader("<?php?>")));
519518
StringWriter out = new StringWriter();

opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/c/CAnalyzerFactoryTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ public static void setUpClass() throws Exception {
7474
ctags = new Ctags();
7575

7676
repository = new TestRepository();
77-
repository.create(CAnalyzerFactoryTest.class.getResourceAsStream(
78-
"/org/opengrok/indexer/index/source.zip"));
77+
repository.create(CAnalyzerFactoryTest.class.getClassLoader().getResource("sources"));
7978

8079
CAnalyzerFactory analFact = new CAnalyzerFactory();
8180
analyzer = analFact.getAnalyzer();
@@ -97,7 +96,7 @@ public static void tearDownClass() {
9796
* @throws java.lang.Exception exception
9897
*/
9998
@Test
100-
public void testScopeAnalyzer() throws Exception {
99+
void testScopeAnalyzer() throws Exception {
101100
String path = repository.getSourceRoot() + "/c/sample.c";
102101
File f = new File(path);
103102
assertTrue(f.canRead() && f.isFile(), "c testfile " + f + " not found");

opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/c/CxxAnalyzerFactoryTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ public static void setUpClass() throws Exception {
7474
ctags = new Ctags();
7575

7676
repository = new TestRepository();
77-
repository.create(CxxAnalyzerFactoryTest.class.getResourceAsStream(
78-
"/org/opengrok/indexer/index/source.zip"));
77+
repository.create(CxxAnalyzerFactoryTest.class.getClassLoader().getResource("sources"));
7978

8079
CxxAnalyzerFactory analFact = new CxxAnalyzerFactory();
8180
analyzer = analFact.getAnalyzer();
@@ -96,7 +95,7 @@ public static void tearDownClass() {
9695
* @throws Exception exception
9796
*/
9897
@Test
99-
public void testScopeAnalyzer() throws Exception {
98+
void testScopeAnalyzer() throws Exception {
10099
String path = repository.getSourceRoot() + "/c/sample.cxx";
101100
File f = new File(path);
102101
assertTrue(f.canRead() && f.isFile(), "cxx testfile " + f + " not found");

opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/clojure/ClojureAnalyzerFactoryTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ public static void setUpClass() throws Exception {
7070
ctags = new Ctags();
7171

7272
repository = new TestRepository();
73-
repository.create(ClojureAnalyzerFactoryTest.class.getResourceAsStream(
74-
"/org/opengrok/indexer/index/source.zip"));
73+
repository.create(ClojureAnalyzerFactoryTest.class.getClassLoader().getResource("sources"));
7574

7675
ClojureAnalyzerFactory analFact = new ClojureAnalyzerFactory();
7776
analyzer = analFact.getAnalyzer();
@@ -93,7 +92,7 @@ public static void tearDownClass() {
9392
* @throws java.lang.Exception throw in case of analyzer or deserialize ctags error
9493
*/
9594
@Test
96-
public void testScopeAnalyzer() throws Exception {
95+
void testScopeAnalyzer() throws Exception {
9796
String path = repository.getSourceRoot() + "/clojure/sample.clj";
9897
File f = new File(path);
9998
assertTrue(f.canRead() && f.isFile(), "clojure testfile " + f + " not found");

opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/csharp/CSharpAnalyzerFactoryTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ public static void setUpClass() throws Exception {
7474
ctags = new Ctags();
7575

7676
repository = new TestRepository();
77-
repository.create(CSharpAnalyzerFactoryTest.class.getResourceAsStream(
78-
"/org/opengrok/indexer/index/source.zip"));
77+
repository.create(CSharpAnalyzerFactoryTest.class.getClassLoader().getResource("sources"));
7978

8079
CSharpAnalyzerFactory analFact = new CSharpAnalyzerFactory();
8180
analyzer = analFact.getAnalyzer();
@@ -96,7 +95,7 @@ public static void tearDownClass() {
9695
* @throws Exception exception
9796
*/
9897
@Test
99-
public void testScopeAnalyzer() throws Exception {
98+
void testScopeAnalyzer() throws Exception {
10099
String path = repository.getSourceRoot() + "/csharp/Sample.cs";
101100
File f = new File(path);
102101
assertTrue(f.canRead() && f.isFile(), "csharp testfile " + f + " not found");

opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/document/TroffAnalyzerTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ public static void setUpBeforeClass() throws Exception {
6565
analyzer = new TroffAnalyzer(factory);
6666
assertNotNull(analyzer);
6767
repository = new TestRepository();
68-
repository.create(TroffAnalyzerTest.class.getResourceAsStream(
69-
"/org/opengrok/indexer/index/source.zip"));
68+
repository.create(TroffAnalyzerTest.class.getClassLoader().getResource("sources"));
7069

7170
String file = System.getProperty("opengrok.test.troff.doc",
7271
repository.getSourceRoot() + "/document/foobar.1");
@@ -97,7 +96,7 @@ public static void tearDownAfterClass() throws Exception {
9796
* @throws IOException I/O exception
9897
*/
9998
@Test
100-
public void testAnalyze() throws IOException {
99+
void testAnalyze() throws IOException {
101100
Document doc = new Document();
102101
StringWriter xrefOut = new StringWriter();
103102
analyzer.analyze(doc, new StreamSource() {

opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/java/JavaAnalyzerFactoryTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ public static void setUpClass() throws Exception {
7474
ctags = new Ctags();
7575

7676
repository = new TestRepository();
77-
repository.create(JavaAnalyzerFactoryTest.class.getResourceAsStream(
78-
"/org/opengrok/indexer/index/source.zip"));
77+
repository.create(JavaAnalyzerFactoryTest.class.getClassLoader().getResource("sources"));
7978

8079
JavaAnalyzerFactory analFact = new JavaAnalyzerFactory();
8180
analyzer = analFact.getAnalyzer();
@@ -95,7 +94,7 @@ public static void tearDownClass() {
9594
* Test of writeXref method, of class CAnalyzerFactory.
9695
*/
9796
@Test
98-
public void testScopeAnalyzer() throws Exception {
97+
void testScopeAnalyzer() throws Exception {
9998
String path = repository.getSourceRoot() + "/java/Sample.java";
10099
File f = new File(path);
101100
assertTrue(f.canRead() && f.isFile(), "java testfile " + f + " not found");

opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/pascal/PascalAnalyzerFactoryTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ public static void setUpClass() throws Exception {
7272
ctags = new Ctags();
7373

7474
repository = new TestRepository();
75-
repository.create(PascalAnalyzerFactoryTest.class.getResourceAsStream(
76-
"/org/opengrok/indexer/index/source.zip"));
75+
repository.create(PascalAnalyzerFactoryTest.class.getClassLoader().getResource("sources"));
7776

7877
PascalAnalyzerFactory analyzerFactory = new PascalAnalyzerFactory();
7978
analyzer = analyzerFactory.getAnalyzer();
@@ -95,7 +94,7 @@ public static void tearDownClass() {
9594
* @throws java.lang.Exception exception
9695
*/
9796
@Test
98-
public void testAnalyzer() throws Exception {
97+
void testAnalyzer() throws Exception {
9998
String path = repository.getSourceRoot() + "/pascal/Sample.pas";
10099
File f = new File(path);
101100
assertTrue(f.canRead() && f.isFile(), "pascal testfile " + f + " not found");

0 commit comments

Comments
 (0)