KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hammurapi > util > TestCaseVerifier


1 /*
2  * Hammurapi
3  * Automated Java code review system.
4  * Copyright (C) 2004 Hammurapi Group
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  * URL: http://www.hammurapi.org
21  * e-Mail: support@hammurapi.biz
22  */

23
24 package org.hammurapi.util;
25
26 import java.util.HashMap JavaDoc;
27 import java.util.HashSet JavaDoc;
28 import java.util.Iterator JavaDoc;
29 import java.util.Map JavaDoc;
30 import java.util.Set JavaDoc;
31
32 import org.hammurapi.HammurapiException;
33 import org.hammurapi.Inspector;
34 import org.hammurapi.InspectorSet;
35 import org.hammurapi.Listener;
36 import org.hammurapi.results.CompositeResults;
37 import org.hammurapi.results.ReviewResults;
38
39 import com.pavelvlasov.config.ConfigurationException;
40 import com.pavelvlasov.config.Parameterizable;
41
42 /**
43  * @author Pavel Vlasov
44  * @version $Revision: 1.2 $
45  */

46 public class TestCaseVerifier implements Listener, Parameterizable {
47     private Map JavaDoc validationResults=new HashMap JavaDoc();
48     private Set JavaDoc excludedInspectors=new HashSet JavaDoc();
49     private String JavaDoc violationTestCaseFormat="{1}.testcases.violations.{2}ViolationTestCase.java";
50     private String JavaDoc fixTestCaseFormat="{1}.testcases.fixes.{2}FixTestCase.java";
51     
52     private class VerifyEntry {
53         Class JavaDoc inspectorClass;
54         boolean violationTestCaseExists=false;
55         boolean fixTestCaseExists=false;
56         boolean violationTestCasePassed=false;
57         boolean fixTestCasePassed=false;
58         /**
59          * @param inspectorClass
60          */

61         protected VerifyEntry(Class JavaDoc inspectorClass) {
62             super();
63             this.inspectorClass = inspectorClass;
64         }
65     }
66
67     public void onReview(ReviewResults reviewResult) throws HammurapiException {
68         // TODO Auto-generated method stub
69

70     }
71
72     public void onPackage(CompositeResults packageResults) throws HammurapiException {
73         // TODO Auto-generated method stub
74

75     }
76
77     public void onSummary(CompositeResults summary, InspectorSet inspectorSet) throws HammurapiException {
78         // TODO Auto-generated method stub
79

80     }
81
82     public void onBegin(InspectorSet inspectorSet) {
83         try {
84             Iterator JavaDoc it=inspectorSet.getInspectors().iterator();
85             while (it.hasNext()) {
86                 Inspector inspector=(Inspector) it.next();
87                 validationResults.put(inspector.getContext().getDescriptor().getName(), new VerifyEntry(inspector.getClass()));
88             }
89         } catch (HammurapiException e) {
90             e.printStackTrace();
91         } catch (ConfigurationException e) {
92             e.printStackTrace();
93         }
94     }
95
96     public boolean setParameter(String JavaDoc name, Object JavaDoc parameter) throws ConfigurationException {
97         // TODO Auto-generated method stub
98
return true;
99         
100     }
101 }
102
Popular Tags