01: package salomeTMF_plug.simpleJunit;
02:
03: import java.lang.annotation.Annotation;
04: import java.lang.reflect.Method;
05: import java.util.Hashtable;
06:
07: import junit.textui.ResultPrinter;
08:
09: import org.objectweb.salome_tmf.api.Util;
10: import org.objectweb.salome_tmf.data.ExecutionResult;
11:
12: public class JunitAnalyser {
13:
14: Hashtable cacheClass = new Hashtable();
15: String currentExecRes = null;
16: String strLog = "";
17:
18: JunitAnalyser() {
19:
20: }
21:
22: protected void setExceutionResult(ExecutionResult pExecutionResult) {
23: if (pExecutionResult == null) {
24: cacheClass.clear();
25: }
26: if (currentExecRes == null) {
27: initExecution(pExecutionResult);
28: } else if (!currentExecRes.equals(pExecutionResult
29: .getNameFromModel())) {
30: initExecution(pExecutionResult);
31: }
32: }
33:
34: protected void initExecution(ExecutionResult pExecutionResult) {
35: if (pExecutionResult != null) {
36: Util.log("[SimpleJunitPlugin:initExceution] for "
37: + pExecutionResult);
38: currentExecRes = pExecutionResult.getNameFromModel();
39: cacheClass.clear();
40: }
41: }
42:
43: Method findStrMedtode(String meth, Class pTestClass) {
44: Method pMethod = null;
45: Method[] pMethods = pTestClass.getDeclaredMethods();
46: for (int i = 0; i < pMethods.length; i++) {
47: pMethod = pMethods[i];
48: String methName = pMethod.getName();
49: if (meth.equals(methName)) {
50: return pMethod;
51: }
52: }
53: return null;
54: }
55: }
|