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