| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
package org.kuali.rice.test; |
| 14 |
|
|
| 15 |
|
import java.lang.reflect.Method; |
| 16 |
|
import java.util.HashMap; |
| 17 |
|
import java.util.Iterator; |
| 18 |
|
import java.util.Map; |
| 19 |
|
|
| 20 |
|
import org.apache.log4j.Level; |
| 21 |
|
import org.apache.log4j.Logger; |
| 22 |
|
import org.junit.After; |
| 23 |
|
import org.junit.Assert; |
| 24 |
|
import org.junit.Before; |
| 25 |
|
import org.junit.runner.RunWith; |
| 26 |
|
import org.kuali.rice.test.lifecycles.PerTestDataLoaderLifecycle; |
| 27 |
|
import org.kuali.rice.test.runners.RiceUnitTestClassRunner; |
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
|
@link |
| 35 |
|
|
| 36 |
|
|
| 37 |
|
@author |
| 38 |
|
@since |
| 39 |
|
|
| 40 |
|
@RunWith(RiceUnitTestClassRunner.class) |
|
|
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 11 |
Complexity Density: 0.61 |
|
| 41 |
|
public abstract class BaseRiceTestCase extends Assert implements MethodAware { |
| 42 |
|
|
| 43 |
|
protected final Logger log = Logger.getLogger(getClass()); |
| 44 |
|
|
| 45 |
|
private static final Map<String, Level> changedLogLevels = new HashMap<String, Level>(); |
| 46 |
|
|
| 47 |
|
private String name; |
| 48 |
|
private PerTestDataLoaderLifecycle perTestDataLoaderLifecycle; |
| 49 |
|
protected Method method; |
| 50 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 51 |
0
|
public BaseRiceTestCase() {... |
| 52 |
0
|
super(); |
| 53 |
|
} |
| 54 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 55 |
0
|
public String getName() {... |
| 56 |
0
|
return this.name; |
| 57 |
|
} |
| 58 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 59 |
0
|
public void setName(String name) {... |
| 60 |
0
|
this.name = name; |
| 61 |
|
} |
| 62 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 63 |
0
|
@Before... |
| 64 |
|
public void setUp() throws Exception { |
| 65 |
|
} |
| 66 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 67 |
0
|
@After... |
| 68 |
|
public void tearDown() throws Exception { |
| 69 |
0
|
resetLogLevels(); |
| 70 |
|
} |
| 71 |
|
|
| 72 |
|
|
| 73 |
|
|
| 74 |
|
|
| 75 |
|
|
| 76 |
|
|
| 77 |
|
@param |
| 78 |
|
|
| 79 |
|
@param |
| 80 |
|
|
| 81 |
|
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 82 |
0
|
protected void setLogLevel(String loggerName, Level newLevel) {... |
| 83 |
0
|
Logger logger = Logger.getLogger(loggerName); |
| 84 |
|
|
| 85 |
0
|
if (!changedLogLevels.containsKey(loggerName)) { |
| 86 |
0
|
Level originalLevel = logger.getLevel(); |
| 87 |
0
|
changedLogLevels.put(loggerName, originalLevel); |
| 88 |
|
} |
| 89 |
|
|
| 90 |
0
|
logger.setLevel(newLevel); |
| 91 |
|
} |
| 92 |
|
|
| 93 |
|
|
| 94 |
|
|
| 95 |
|
|
| 96 |
|
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
| 97 |
0
|
protected void resetLogLevels() {... |
| 98 |
0
|
for (Iterator i = changedLogLevels.entrySet().iterator(); i.hasNext();) { |
| 99 |
0
|
Map.Entry e = (Map.Entry) i.next(); |
| 100 |
|
|
| 101 |
0
|
String loggerName = (String) e.getKey(); |
| 102 |
0
|
Level originalLevel = (Level) e.getValue(); |
| 103 |
|
|
| 104 |
0
|
Logger.getLogger(loggerName).setLevel(originalLevel); |
| 105 |
|
} |
| 106 |
0
|
changedLogLevels.clear(); |
| 107 |
|
} |
| 108 |
|
|
| 109 |
|
|
| 110 |
|
@see |
| 111 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 112 |
0
|
public void setTestMethod(Method testMethod) {... |
| 113 |
0
|
this.method = testMethod; |
| 114 |
|
|
| 115 |
0
|
perTestDataLoaderLifecycle = new PerTestDataLoaderLifecycle(method); |
| 116 |
|
} |
| 117 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 118 |
0
|
protected PerTestDataLoaderLifecycle getPerTestDataLoaderLifecycle() {... |
| 119 |
0
|
return this.perTestDataLoaderLifecycle; |
| 120 |
|
} |
| 121 |
|
} |