Line | |
---|
1 | package eu.clarin.cmdi.vlo.importer; |
---|
2 | |
---|
3 | import eu.clarin.cmdi.vlo.config.VloConfig; |
---|
4 | import java.io.File; |
---|
5 | import java.io.IOException; |
---|
6 | import org.apache.commons.io.FileUtils; |
---|
7 | import org.junit.AfterClass; |
---|
8 | import org.junit.BeforeClass; |
---|
9 | |
---|
10 | public abstract class ImporterTestcase { |
---|
11 | private static File testDir; |
---|
12 | |
---|
13 | protected File createCmdiFile(String name, String content) throws IOException { |
---|
14 | File file = File.createTempFile(name, ".cmdi", testDir); |
---|
15 | FileUtils.writeStringToFile(file, content, "UTF-8"); |
---|
16 | return file; |
---|
17 | } |
---|
18 | |
---|
19 | @AfterClass |
---|
20 | public static void cleanup() { |
---|
21 | FileUtils.deleteQuietly(testDir); |
---|
22 | } |
---|
23 | |
---|
24 | @BeforeClass |
---|
25 | public static void setup() { |
---|
26 | final String baseTempPath = System.getProperty("java.io.tmpdir"); |
---|
27 | testDir = new File(baseTempPath + File.separator + "testRegistry_" + System.currentTimeMillis()); |
---|
28 | testDir.mkdir(); |
---|
29 | testDir.deleteOnExit(); |
---|
30 | |
---|
31 | // read the configuration defined in the packaged configuration file |
---|
32 | VloConfig.readPackagedConfig(); |
---|
33 | |
---|
34 | // optionally, modify the configuration here |
---|
35 | |
---|
36 | VloConfig.setComponentRegistryRESTURL("http://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/profiles/"); |
---|
37 | } |
---|
38 | |
---|
39 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.