1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
package org.kuali.rice.student; |
20 |
|
|
21 |
|
import java.io.BufferedReader; |
22 |
|
import java.io.FileReader; |
23 |
|
import java.util.List; |
24 |
|
|
25 |
|
import javax.xml.namespace.QName; |
26 |
|
|
27 |
|
import org.apache.commons.lang.StringUtils; |
28 |
|
import org.kuali.rice.core.lifecycle.BaseLifecycle; |
29 |
|
import org.kuali.rice.core.lifecycle.Lifecycle; |
30 |
|
import org.kuali.rice.core.resourceloader.SpringResourceLoader; |
31 |
|
import org.kuali.rice.kew.batch.KEWXmlDataLoader; |
32 |
|
import org.kuali.rice.kew.exception.WorkflowRuntimeException; |
33 |
|
import org.kuali.rice.kim.service.KIMServiceLocator; |
34 |
|
import org.kuali.rice.test.BaselineTestCase; |
35 |
|
import org.kuali.rice.test.SQLDataLoader; |
36 |
|
|
37 |
|
|
38 |
|
@author |
39 |
|
|
40 |
|
|
|
|
| 0% |
Uncovered Elements: 36 (36) |
Complexity: 13 |
Complexity Density: 0.57 |
|
41 |
|
public class StudentStandaloneTestBase extends BaselineTestCase { |
42 |
|
|
43 |
|
private static final String MODULE_NAME = "standalone"; |
44 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
45 |
0
|
public StudentStandaloneTestBase() {... |
46 |
0
|
super(MODULE_NAME); |
47 |
|
} |
48 |
|
|
49 |
|
|
50 |
|
@see |
51 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
52 |
0
|
@Override... |
53 |
|
protected Lifecycle getLoadApplicationLifecycle() { |
54 |
0
|
SpringResourceLoader springResourceLoader = new SpringResourceLoader(new QName("StudentStandaloneTestResourceLoader"), "classpath:StandaloneTestSpringBeans.xml"); |
55 |
0
|
springResourceLoader.setParentSpringResourceLoader(getTestHarnessSpringResourceLoader()); |
56 |
0
|
return springResourceLoader; |
57 |
|
} |
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
@see |
62 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
63 |
0
|
@Override... |
64 |
|
protected List<Lifecycle> getPerTestLifecycles() { |
65 |
0
|
List<Lifecycle> lifecycles = super.getPerTestLifecycles(); |
66 |
|
|
67 |
|
|
68 |
0
|
lifecycles.add(new ClearCacheLifecycle()); |
69 |
0
|
return lifecycles; |
70 |
|
} |
71 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.33 |
|
72 |
|
public class ClearCacheLifecycle extends BaseLifecycle { |
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
73 |
0
|
public void stop() throws Exception {... |
74 |
0
|
KIMServiceLocator.getIdentityManagementService().flushAllCaches(); |
75 |
0
|
KIMServiceLocator.getRoleManagementService().flushRoleCaches(); |
76 |
0
|
super.stop(); |
77 |
|
} |
78 |
|
} |
79 |
|
|
80 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
81 |
0
|
@Override... |
82 |
|
protected void loadSuiteTestData() throws Exception { |
83 |
0
|
new SQLDataLoader(getKNSDefaultSuiteTestData(), "/").runSql(); |
84 |
0
|
BufferedReader reader = new BufferedReader(new FileReader(getKIMDataLoadOrderFile())); |
85 |
0
|
String line = null; |
86 |
0
|
while ((line = reader.readLine()) != null) { |
87 |
0
|
if (!StringUtils.isBlank(line)) { |
88 |
0
|
new SQLDataLoader(getKIMSqlFileBaseLocation() + "/" + line, "/").runSql(); |
89 |
|
} |
90 |
|
} |
91 |
0
|
new SQLDataLoader("file:" + getBaseDir() + "/../src/main/config/sql/kim.sql", ";").runSql(); |
92 |
|
} |
93 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
94 |
0
|
protected String getKNSDefaultSuiteTestData() {... |
95 |
0
|
return "file:" + getBaseDir() + "/../src/test/config/data/DefaultSuiteTestDataKNS.sql"; |
96 |
|
} |
97 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
98 |
0
|
protected String getKIMDataLoadOrderFile() {... |
99 |
0
|
return getBaseDir() + "/../src/test/config/data/KIMDataLoadOrder.txt"; |
100 |
|
} |
101 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
102 |
0
|
protected String getKIMSqlFileBaseLocation() {... |
103 |
0
|
return "file:" + getBaseDir() + "/../src/test/config/data"; |
104 |
|
} |
105 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
106 |
0
|
protected void loadXmlFile(String fileName) {... |
107 |
0
|
try { |
108 |
0
|
KEWXmlDataLoader.loadXmlClassLoaderResource(getClass(), fileName); |
109 |
|
} catch (Exception e) { |
110 |
0
|
throw new WorkflowRuntimeException(e); |
111 |
|
} |
112 |
|
} |
113 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
114 |
0
|
protected void loadXmlFileFromFileSystem(String fileName) {... |
115 |
0
|
try { |
116 |
0
|
KEWXmlDataLoader.loadXmlFile(fileName); |
117 |
|
} catch (Exception e) { |
118 |
0
|
throw new WorkflowRuntimeException(e); |
119 |
|
} |
120 |
|
} |
121 |
|
|
122 |
|
} |