ReadWypluwkaBenchmarkTest.java
1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package ipipan.clarin.tei.impl.io;
import ipipan.clarin.tei.api.exceptions.TEIException;
import ipipan.clarin.tei.api.io.TEI_IO;
import java.io.File;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
/**
*
* @author lennyn
*/
public class ReadWypluwkaBenchmarkTest {
// private final static File wypluwkaRoot = new
// File("/home/mlenart/storage/NKJP_1M_roboczy");
private final static File wypluwkaRoot = new File(
"src/test/resources/nkjp1m_test");
private final static TEI_IO teiIO = TEI_IO.getInstance();
private List<File> getLeaves(File root) {
List<File> res = new LinkedList<File>();
for (File f : root.listFiles()) {
if (f.isDirectory()) {
res.addAll(getLeaves(f));
} else if (f.isFile()
&& Arrays.asList("header.xml").contains(f.getName())) {
res.add(root);
}
}
return res;
}
public ReadWypluwkaBenchmarkTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
BasicConfigurator.configure();
Logger.getRootLogger().setLevel(Level.ALL);
}
@AfterClass
public static void tearDownClass() throws Exception {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
@Test
public void doTest() throws TEIException {
for (File d : getLeaves(wypluwkaRoot)) {
System.out.println(d.getPath());
teiIO.readFromNKJPDirectory(d);
}
}
}