1 23 24 package org.hammurapi.util; 25 26 import java.util.HashMap ; 27 import java.util.HashSet ; 28 import java.util.Iterator ; 29 import java.util.Map ; 30 import java.util.Set ; 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 46 public class TestCaseVerifier implements Listener, Parameterizable { 47 private Map validationResults=new HashMap (); 48 private Set excludedInspectors=new HashSet (); 49 private String violationTestCaseFormat="{1}.testcases.violations.{2}ViolationTestCase.java"; 50 private String fixTestCaseFormat="{1}.testcases.fixes.{2}FixTestCase.java"; 51 52 private class VerifyEntry { 53 Class inspectorClass; 54 boolean violationTestCaseExists=false; 55 boolean fixTestCaseExists=false; 56 boolean violationTestCasePassed=false; 57 boolean fixTestCasePassed=false; 58 61 protected VerifyEntry(Class inspectorClass) { 62 super(); 63 this.inspectorClass = inspectorClass; 64 } 65 } 66 67 public void onReview(ReviewResults reviewResult) throws HammurapiException { 68 70 } 71 72 public void onPackage(CompositeResults packageResults) throws HammurapiException { 73 75 } 76 77 public void onSummary(CompositeResults summary, InspectorSet inspectorSet) throws HammurapiException { 78 80 } 81 82 public void onBegin(InspectorSet inspectorSet) { 83 try { 84 Iterator 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 name, Object parameter) throws ConfigurationException { 97 return true; 99 100 } 101 } 102 | Popular Tags |