From: <mwl...@us...> - 2007-09-20 21:42:56
|
Revision: 536 http://cishell.svn.sourceforge.net/cishell/?rev=536&view=rev Author: mwlinnem Date: 2007-09-20 14:42:54 -0700 (Thu, 20 Sep 2007) Log Message: ----------- Improved UI for path filters. Removed System.out.printlns. Modified Paths: -------------- trunk/testing/org.cishell.testing.convertertester.algorithm/src/org/cishell/testing/convertertester/algorithm/ConverterTesterAlgorithm.java trunk/testing/org.cishell.testing.convertertester.algorithm/src/org/cishell/testing/convertertester/algorithm/ConverterTesterAlgorithmFactory.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/ConverterTester2.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/DefaultTestRunner.java Added Paths: ----------- trunk/testing/org.cishell.testing.convertertester.algorithm/src/org/cishell/testing/convertertester/algorithm/pathfilter/HopFilter.java Modified: trunk/testing/org.cishell.testing.convertertester.algorithm/src/org/cishell/testing/convertertester/algorithm/ConverterTesterAlgorithm.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.algorithm/src/org/cishell/testing/convertertester/algorithm/ConverterTesterAlgorithm.java 2007-09-20 21:26:54 UTC (rev 535) +++ trunk/testing/org.cishell.testing.convertertester.algorithm/src/org/cishell/testing/convertertester/algorithm/ConverterTesterAlgorithm.java 2007-09-20 21:42:54 UTC (rev 536) @@ -6,12 +6,12 @@ import org.cishell.framework.CIShellContext; import org.cishell.framework.algorithm.Algorithm; -import org.cishell.framework.algorithm.AlgorithmFactory; import org.cishell.framework.algorithm.AlgorithmProperty; import org.cishell.framework.data.BasicData; import org.cishell.framework.data.Data; import org.cishell.framework.data.DataProperty; import org.cishell.testing.convertertester.algorithm.pathfilter.ConvAndHopFilter; +import org.cishell.testing.convertertester.algorithm.pathfilter.HopFilter; import org.cishell.testing.convertertester.core.tester2.ConverterTester2; import org.cishell.testing.convertertester.core.tester2.reportgen.ReportGenerator; import org.cishell.testing.convertertester.core.tester2.reportgen.allconvs.AllConvsReportGenerator; @@ -31,7 +31,6 @@ import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; import org.osgi.framework.BundleContext; -import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.ServiceReference; import org.osgi.service.log.LogService; @@ -158,7 +157,8 @@ new ReportGenerator[] {allGen, allConvGen, allErrGen, graphGen, origGraphGen, readmeGen}, - cContext, bContext); + cContext, bContext, + new HopFilter(numHops)); } else { ct.execute(convRefs, new ReportGenerator[] Modified: trunk/testing/org.cishell.testing.convertertester.algorithm/src/org/cishell/testing/convertertester/algorithm/ConverterTesterAlgorithmFactory.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.algorithm/src/org/cishell/testing/convertertester/algorithm/ConverterTesterAlgorithmFactory.java 2007-09-20 21:26:54 UTC (rev 535) +++ trunk/testing/org.cishell.testing.convertertester.algorithm/src/org/cishell/testing/convertertester/algorithm/ConverterTesterAlgorithmFactory.java 2007-09-20 21:42:54 UTC (rev 536) @@ -72,18 +72,21 @@ AttributeDefinition.STRING, converterNames, converterNames)); + + definition.addAttributeDefinition(ObjectClassDefinition.REQUIRED, + new BasicAttributeDefinition(TEST_ALL_CONVS_PARAM_ID, + "Test All Converters?", + "Should we test all the converters or just the one selected?", + AttributeDefinition.BOOLEAN)); definition.addAttributeDefinition(ObjectClassDefinition.REQUIRED, new BasicAttributeDefinition(NUM_HOPS_PARAM_ID, "Max Test Path Length", "What is the maximum length a test path should have to be included", - AttributeDefinition.INTEGER)); + AttributeDefinition.INTEGER, + "6")); - definition.addAttributeDefinition(ObjectClassDefinition.REQUIRED, - new BasicAttributeDefinition(TEST_ALL_CONVS_PARAM_ID, - "Test All Converters?", - "Should we test all the converters or just the one selected?", - AttributeDefinition.BOOLEAN)); + MetaTypeProvider provider = new BasicMetaTypeProvider(definition); return provider; Added: trunk/testing/org.cishell.testing.convertertester.algorithm/src/org/cishell/testing/convertertester/algorithm/pathfilter/HopFilter.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.algorithm/src/org/cishell/testing/convertertester/algorithm/pathfilter/HopFilter.java (rev 0) +++ trunk/testing/org.cishell.testing.convertertester.algorithm/src/org/cishell/testing/convertertester/algorithm/pathfilter/HopFilter.java 2007-09-20 21:42:54 UTC (rev 536) @@ -0,0 +1,36 @@ +package org.cishell.testing.convertertester.algorithm.pathfilter; + +import java.util.ArrayList; +import java.util.List; + +import org.cishell.testing.convertertester.core.converter.graph.ConverterPath; +import org.cishell.testing.convertertester.core.tester2.pathfilter.PathFilter; + +public class HopFilter implements PathFilter { + + private int maxNumHops; + + public HopFilter(int maxNumHops) { + this.maxNumHops = maxNumHops; + } + + public ConverterPath[] filter(ConverterPath[] testPaths) { + if (testPaths != null) { + List filteredTestPaths = new ArrayList(); + for (int ii = 0; ii < testPaths.length; ii++) { + ConverterPath testPath = testPaths[ii]; + + if (testPath.size() <= this.maxNumHops) { + filteredTestPaths.add(testPath); + } + } + + return (ConverterPath[]) + filteredTestPaths.toArray(new ConverterPath[0]); + + } else { + return new ConverterPath[0]; + } + } + +} Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java 2007-09-20 21:26:54 UTC (rev 535) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java 2007-09-20 21:42:54 UTC (rev 536) @@ -48,13 +48,9 @@ fileExtensionCompareConverters = new ConcurrentHashMap();//<String, ConverterPath>(); - System.out.println("Deriving data formats..."); deriveDataFormats(this.converters, this.dataFormats); - System.out.println("Associating Converters..."); associateConverters(this.converters, this.inDataToConverters, this.outDataToConverters); - System.out.println("Creating converter paths..."); createConverterPaths(this.inDataToConverters, this.fileExtensionTestConverters, this.fileExtensionCompareConverters); - System.out.println("Done creating converter paths..."); } private Converter[] createConverters(ServiceReference[] convRefs) { @@ -105,7 +101,6 @@ String inDataFormat = inDataFormats[i]; if(inDataFormat.startsWith("file-ext")){ - System.out.println("Creating paths for format: " + inDataFormat); ConverterPath test = new ConverterPath(this.bContext, this.log); test.setInData(inDataFormat); @@ -126,20 +121,12 @@ if(currentPath.getInData().equals(currentPath.getOutData())){ //base case addTestCycle(currentPath); - System.out.println("**--Path Completed--**"); List path = currentPath.getPath(); - System.out.println("Path is..."); - for (int ii = 0; ii < path.size(); ii++) { - Converter c = (Converter) path.get(ii); - System.out.println(" " + c.getShortName()); - } - System.out.println("(End Path)"); return; } while(!nextConvs.isEmpty()){ ConverterPath newPath = new ConverterPath(currentPath, this.bContext); Converter nextConv = (Converter) nextConvs.get(0); - System.out.println("Adding " + nextConv.getShortName()); newPath.add(nextConv); nextConvs.remove(0); createPaths((List)this.inDataToConverters.get(newPath.getOutData()), newPath); @@ -161,7 +148,6 @@ if(cp.getOutData() != null){ if(cp.getOutData().equals(ConverterGraph.testOutData)){ String key = cp.getInData() + " " + ((Converter) cp.getPath().get(0)).getOutData(); - //System.out.println(key); if(this.fileExtensionCompareConverters.get(key) == null){ @@ -188,20 +174,9 @@ } else { cs = new ArrayList(); } - System.out.println("Current path is...."); - for (int ii = 0; ii < currentPath.size(); ii++) { - System.out.println(currentPath.get(ii).getShortName()); - } - System.out.println("^^^^ cs prior to removing loop causing convs"); - for (int ii = 0; ii < cs.size(); ii++) { - System.out.println(((Converter) cs.get(ii)).getShortName()); - } cs.removeAll(currentPath.getPath()); - System.out.println("^^^^ cs after removing loop causing convs"); - for (int ii = 0; ii < cs.size(); ii++) { - System.out.println(((Converter) cs.get(ii)).getShortName()); - } + //do we really want to be removing these? List forbidden = new ArrayList(); for(int i = 0; i < cs.size(); i++){ @@ -269,7 +244,6 @@ keySet = (String[])this.fileExtensionCompareConverters.keySet().toArray(keySet); for(int i = 0; i < keySet.length; i++){ String s = keySet[i]; - //System.out.println(s); sb.append(printComparisonConverterPath(s)); } sb.trimToSize(); Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java 2007-09-20 21:26:54 UTC (rev 535) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java 2007-09-20 21:42:54 UTC (rev 536) @@ -127,7 +127,6 @@ Converter c = (Converter) this.path.get(i); if (c.isLossy()) { - System.out.println("FOUND A LOSSY CONVERTER!"); lossiness = LOSSY; } } Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/ConverterTester2.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/ConverterTester2.java 2007-09-20 21:26:54 UTC (rev 535) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/ConverterTester2.java 2007-09-20 21:42:54 UTC (rev 536) @@ -80,14 +80,12 @@ PathFilter testPathFilter) { //generate all the converter paths - - System.out.println("Generating converter graph paths etc..."); + ConverterGraph converterGraph = new ConverterGraph(converterRefs, bContext, this.log); //run the tests - - System.out.println("Running actual tests..."); + TestResult[] rawResults = runAllTests(converterGraph, testPathFilter, cContext, bContext); @@ -97,7 +95,6 @@ Converter[] allConverters = converterGraph.getAllConverters(); - System.out.println("Running conv result maker..."); ChanceAtFaultHeuristic faultHeuristic = new ErrorProximityHeuristic(); AllConvsResult allConvertersResult = Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/DefaultTestRunner.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/DefaultTestRunner.java 2007-09-20 21:26:54 UTC (rev 535) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/DefaultTestRunner.java 2007-09-20 21:42:54 UTC (rev 536) @@ -132,7 +132,6 @@ Converter currentConverter = null; try { for (int ii = 0; ii < converters.size(); ii++) { - //System.out.println("Going into converter " + ii); currentConverter = converters.get(ii); //no parameters used This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |