1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krms.test;
17
18 import org.junit.Before;
19 import org.kuali.rice.core.api.lifecycle.Lifecycle;
20 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
21 import org.kuali.rice.core.framework.resourceloader.SpringResourceLoader;
22 import org.kuali.rice.core.impl.cache.DistributedCacheManagerDecorator;
23 import org.kuali.rice.krms.api.KrmsConstants;
24 import org.kuali.rice.test.BaselineTestCase;
25 import org.kuali.rice.test.BaselineTestCase.BaselineMode;
26 import org.kuali.rice.test.BaselineTestCase.Mode;
27
28 import javax.xml.namespace.QName;
29 import java.util.ArrayList;
30 import java.util.List;
31
32
33
34
35
36
37 @BaselineMode(Mode.ROLLBACK_CLEAR_DB)
38 public abstract class KRMSTestCase extends BaselineTestCase {
39
40 private static final String KRMS_MODULE_NAME = "krms";
41
42 private SpringResourceLoader krmsTestResourceLoader;
43
44 public KRMSTestCase() {
45 super(KRMS_MODULE_NAME);
46 }
47
48 @Override
49 protected List<Lifecycle> getSuiteLifecycles() {
50 List<Lifecycle> suiteLifecycles = super.getSuiteLifecycles();
51 return suiteLifecycles;
52 }
53
54 @Override
55 protected void loadSuiteTestData() throws Exception {
56 super.loadSuiteTestData();
57 }
58
59
60
61 @Override
62 protected Lifecycle getLoadApplicationLifecycle() {
63 if (krmsTestResourceLoader == null) {
64 krmsTestResourceLoader = new SpringResourceLoader(new QName("KRMSTestHarnessApplicationResourceLoader"), "classpath:KRMSTestHarnessSpringBeans.xml", null);
65 krmsTestResourceLoader.setParentSpringResourceLoader(getTestHarnessSpringResourceLoader());
66 getTestHarnessSpringResourceLoader().addResourceLoader(krmsTestResourceLoader);
67 }
68 return krmsTestResourceLoader;
69 }
70
71
72 protected List<String> getPerTestTablesNotToClear() {
73 List<String> tablesNotToClear = new ArrayList<String>();
74
75 tablesNotToClear.addAll(super.getPerTestTablesNotToClear());
76 tablesNotToClear.add("KRIM_.*");
77 tablesNotToClear.add("KRNS_.*");
78 tablesNotToClear.add("KREW_.*");
79 tablesNotToClear.add("KREN_.*");
80 tablesNotToClear.add("KRCR_.*");
81
82 return tablesNotToClear;
83 }
84
85 protected List<String> getPerTestTablesToClear() {
86 List<String> tablesToClear = new ArrayList<String>();
87
88 tablesToClear.addAll(super.getPerTestTablesToClear());
89 tablesToClear.add("KRMS_.*");
90
91 return tablesToClear;
92 }
93
94
95
96
97 @Override
98 protected String getModuleName() {
99 return KRMS_MODULE_NAME;
100 }
101 }