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
32
33
34
35 @Override
36 protected void loadSuiteTestData() throws Exception {
37 new SQLDataLoader(getKRADDefaultSuiteTestData(), "/").runSql();
38
39
40 DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
41
42
43 BufferedReader reader = new BufferedReader(new InputStreamReader(resourceLoader.getResource(getKIMDataLoadOrderFile()).getInputStream()));
44 String line = null;
45 while ((line = reader.readLine()) != null) {
46 if (!StringUtils.isBlank(line)) {
47 new SQLDataLoader(getKIMSqlFileBaseLocation() + "/" + line, "/").runSql();
48 }
49 }
50 }
51
52 protected String getKRADDefaultSuiteTestData() {
53
54 return "classpath:/config/data/DefaultSuiteTestDataKRAD.sql";
55 }
56
57 protected String getKIMDataLoadOrderFile() {
58 return "classpath:/config/data/KIMDataLoadOrder.txt";
59 }
60
61 protected String getKIMSqlFileBaseLocation() {
62 return "classpath:/config/data";
63 }
64 }