001: /*
002: * Hammurapi
003: * Automated Java code review system.
004: * Copyright (C) 2004 Hammurapi Group
005: *
006: * This program is free software; you can redistribute it and/or modify
007: * it under the terms of the GNU General Public License as published by
008: * the Free Software Foundation; either version 2 of the License, or
009: * (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019: *
020: * URL: http://www.hammurapi.org
021: * e-Mail: support@hammurapi.biz
022: */
023:
024: package org.hammurapi.util;
025:
026: import java.util.HashMap;
027: import java.util.HashSet;
028: import java.util.Iterator;
029: import java.util.Map;
030: import java.util.Set;
031:
032: import org.hammurapi.HammurapiException;
033: import org.hammurapi.Inspector;
034: import org.hammurapi.InspectorSet;
035: import org.hammurapi.Listener;
036: import org.hammurapi.results.CompositeResults;
037: import org.hammurapi.results.ReviewResults;
038:
039: import com.pavelvlasov.config.ConfigurationException;
040: import com.pavelvlasov.config.Parameterizable;
041:
042: /**
043: * @author Pavel Vlasov
044: * @version $Revision: 1.2 $
045: */
046: public class TestCaseVerifier implements Listener, Parameterizable {
047: private Map validationResults = new HashMap();
048: private Set excludedInspectors = new HashSet();
049: private String violationTestCaseFormat = "{1}.testcases.violations.{2}ViolationTestCase.java";
050: private String fixTestCaseFormat = "{1}.testcases.fixes.{2}FixTestCase.java";
051:
052: private class VerifyEntry {
053: Class inspectorClass;
054: boolean violationTestCaseExists = false;
055: boolean fixTestCaseExists = false;
056: boolean violationTestCasePassed = false;
057: boolean fixTestCasePassed = false;
058:
059: /**
060: * @param inspectorClass
061: */
062: protected VerifyEntry(Class inspectorClass) {
063: super ();
064: this .inspectorClass = inspectorClass;
065: }
066: }
067:
068: public void onReview(ReviewResults reviewResult)
069: throws HammurapiException {
070: // TODO Auto-generated method stub
071:
072: }
073:
074: public void onPackage(CompositeResults packageResults)
075: throws HammurapiException {
076: // TODO Auto-generated method stub
077:
078: }
079:
080: public void onSummary(CompositeResults summary,
081: InspectorSet inspectorSet) throws HammurapiException {
082: // TODO Auto-generated method stub
083:
084: }
085:
086: public void onBegin(InspectorSet inspectorSet) {
087: try {
088: Iterator it = inspectorSet.getInspectors().iterator();
089: while (it.hasNext()) {
090: Inspector inspector = (Inspector) it.next();
091: validationResults.put(inspector.getContext()
092: .getDescriptor().getName(), new VerifyEntry(
093: inspector.getClass()));
094: }
095: } catch (HammurapiException e) {
096: e.printStackTrace();
097: } catch (ConfigurationException e) {
098: e.printStackTrace();
099: }
100: }
101:
102: public boolean setParameter(String name, Object parameter)
103: throws ConfigurationException {
104: // TODO Auto-generated method stub
105: return true;
106:
107: }
108: }
|