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