1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.test;
18
19 import org.kuali.rice.core.api.lifecycle.Lifecycle;
20 import org.kuali.rice.core.api.lifecycle.Lifecycle;
21 import org.kuali.rice.core.impl.resourceloader.SpringResourceLoader;
22 import org.kuali.rice.core.impl.resourceloader.SpringResourceLoader;
23 import org.kuali.rice.test.BaselineTestCase;
24 import org.kuali.rice.test.SQLDataLoader;
25 import org.kuali.rice.test.lifecycles.KEWXmlDataLoaderLifecycle;
26
27 import javax.xml.namespace.QName;
28 import java.util.List;
29
30
31
32
33
34
35
36 @BaselineTestCase.BaselineMode(BaselineTestCase.Mode.ROLLBACK_CLEAR_DB)
37 public abstract class KRADTestCase extends BaselineTestCase {
38
39 private static final String SQL_FILE = "classpath:org/kuali/rice/krad/test/DefaultSuiteTestData.sql";
40 private static final String XML_FILE = "classpath:org/kuali/rice/krad/test/DefaultSuiteTestData.xml";
41 private static final String KRAD_MODULE_NAME = "krad";
42
43 public KRADTestCase() {
44 super(KRAD_MODULE_NAME);
45 }
46
47 @Override
48 protected List<Lifecycle> getSuiteLifecycles() {
49 List<Lifecycle> suiteLifecycles = super.getSuiteLifecycles();
50 suiteLifecycles.add(new KEWXmlDataLoaderLifecycle(XML_FILE));
51 return suiteLifecycles;
52 }
53
54 @Override
55 protected void loadSuiteTestData() throws Exception {
56 super.loadSuiteTestData();
57 new SQLDataLoader(SQL_FILE, ";").runSql();
58 }
59
60 @Override
61 protected Lifecycle getLoadApplicationLifecycle() {
62 SpringResourceLoader springResourceLoader = new SpringResourceLoader(new QName("KRADTestResourceLoader"), "classpath:KradTestSpringBeans.xml", null);
63 springResourceLoader.setParentSpringResourceLoader(getTestHarnessSpringResourceLoader());
64 return springResourceLoader;
65 }
66 }