1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.test;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.springframework.core.io.DefaultResourceLoader;
20
21 import java.io.BufferedReader;
22 import java.io.InputStreamReader;
23
24
25
26
27
28
29
30 public abstract class RiceInternalSuiteDataTestCase extends RiceTestCase {
31 private static final String HASH_PREFIX = "#";
32 private static final String SLASH_PREFIX = "//";
33
34
35
36
37 @Override
38 protected void loadSuiteTestData() throws Exception {
39 new SQLDataLoader(getKRADDefaultSuiteTestData(), "/").runSql();
40
41
42 DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
43
44
45 BufferedReader reader = new BufferedReader(new InputStreamReader(resourceLoader.getResource(getKIMDataLoadOrderFile()).getInputStream()));
46 String line = null;
47 while ((line = reader.readLine()) != null) {
48 if (!StringUtils.isBlank(line) && !line.startsWith(HASH_PREFIX) && !line.startsWith(SLASH_PREFIX)) {
49 new SQLDataLoader(getKIMSqlFileBaseLocation() + "/" + line, "/").runSql();
50 }
51 }
52 }
53
54 protected String getKRADDefaultSuiteTestData() {
55
56 return "classpath:/config/data/DefaultSuiteTestDataKRAD.sql";
57 }
58
59 protected String getKIMDataLoadOrderFile() {
60 return "classpath:/config/data/KIMDataLoadOrder.txt";
61 }
62
63 protected String getKIMSqlFileBaseLocation() {
64 return "classpath:/config/data";
65 }
66 }