1 package org.kuali.student.common.test;
2
3 import org.kuali.rice.core.api.config.property.Config;
4 import org.kuali.rice.core.api.config.property.ConfigContext;
5 import org.kuali.rice.core.impl.config.property.JAXBConfigImpl;
6
7 import java.io.IOException;
8 import java.util.List;
9
10
11
12
13
14
15
16
17
18
19
20
21 public class KSTestConfigContextLoader {
22
23 List<String> configLocations = null;
24
25 public KSTestConfigContextLoader() {
26
27 Config config = getTestHarnessConfig();
28 ConfigContext.init(config);
29 }
30
31 public KSTestConfigContextLoader(List<String> configLocations) {
32 this.configLocations = configLocations;
33
34 Config config = getTestHarnessConfig();
35 ConfigContext.init(config);
36 }
37
38 protected Config getTestHarnessConfig() {
39 Config config = new JAXBConfigImpl(getConfigLocations(), System.getProperties());
40 try {
41 config.parseConfig();
42 } catch (IOException ex) {
43 throw new RuntimeException(ex);
44 }
45 return config;
46 }
47
48
49
50
51
52
53
54 protected List<String> getConfigLocations() {
55
56
57 return configLocations;
58 }
59
60 public void setConfigLocations(List<String> configLocations){
61 this.configLocations = configLocations;
62 }
63 }
64
65