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