|
From: <mwl...@us...> - 2007-08-15 19:55:29
|
Revision: 469
http://cishell.svn.sourceforge.net/cishell/?rev=469&view=rev
Author: mwlinnem
Date: 2007-08-15 12:55:26 -0700 (Wed, 15 Aug 2007)
Log Message:
-----------
Massive update for Converter Tester Phase II.
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/META-INF/MANIFEST.MF
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/ConverterLoaderImpl.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/ConverterTesterImpl.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/test_files/NET Files/TestFile3.net
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile4.net
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile5.net
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile6.net
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile7.net
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile8.net
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile9.net
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/filetypes.conf
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester/ConverterTester.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
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/TestConfigData.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/TestFileKeeper.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/TestRunner.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/ReportGenerator.java
Added Paths:
-----------
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/ConvResultMaker.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/allconvs/
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/allconvs/AllConvsReportGenerator.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/allconvs/ConvReportSubGenerator.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/alltests/
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/alltests/AllTestsReportGenerator.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/alltests/FilePassSubGenerator.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/alltests/TestReportSubGenerator.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/convgraph/
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/convgraph/GraphReportGenerator.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/reports/
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/reports/AllConvsReport.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/reports/AllTestsReport.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/reports/ConvReport.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/reports/FilePassReport.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/reports/Report.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/reports/TestReport.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/AllTestsResult.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/ConvResult.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/FilePassResult.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/TestResult.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/converter/
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/converter/ConvFailureInfo.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/converter/ConvFilePass.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/converter/ConvFilePassFailure.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/converter/ConvFilePassSuccess.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/filepass/
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/filepass/ComparePhaseFailure.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/filepass/ConvertPhaseFailure.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/filepass/FilePassFailure.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/filepass/FilePassSuccess.java
Removed Paths:
-------------
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NWB Files/TestFile9.net
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/TestResult.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/filepassresults/
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/ConvResultGenerator.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/ConverterReportGenerator.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/OverviewReportGenerator.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/SampleResultReportGenerator.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/TestSuiteReportGenerator.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/ConvBasedResult.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/ConvFailureInfo.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/ConvFilePass.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/ConvFilePassFailure.java
trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/reportgen/results/ConvFilePassSuccess.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-08-10 17:32:32 UTC (rev 468)
+++ trunk/testing/org.cishell.testing.convertertester.algorithm/src/org/cishell/testing/convertertester/algorithm/ConverterTesterAlgorithm.java 2007-08-15 19:55:26 UTC (rev 469)
@@ -11,14 +11,18 @@
import org.cishell.framework.data.BasicData;
import org.cishell.framework.data.Data;
import org.cishell.framework.data.DataProperty;
+import org.cishell.testing.convertertester.core.converter.graph.ConverterGraph;
import org.cishell.testing.convertertester.core.tester2.ConverterTester2;
-import org.cishell.testing.convertertester.core.tester2.reportgen.ConverterReportGenerator;
-import org.cishell.testing.convertertester.core.tester2.reportgen.OverviewReportGenerator;
import org.cishell.testing.convertertester.core.tester2.reportgen.ReportGenerator;
-import org.cishell.testing.convertertester.core.tester2.reportgen.SampleResultReportGenerator;
-import org.eclipse.swt.SWT;
+import org.cishell.testing.convertertester.core.tester2.reportgen.allconvs.AllConvsReportGenerator;
+import org.cishell.testing.convertertester.core.tester2.reportgen.alltests.AllTestsReportGenerator;
+import org.cishell.testing.convertertester.core.tester2.reportgen.convgraph.GraphReportGenerator;
+import org.cishell.testing.convertertester.core.tester2.reportgen.reports.AllConvsReport;
+import org.cishell.testing.convertertester.core.tester2.reportgen.reports.AllTestsReport;
+import org.cishell.testing.convertertester.core.tester2.reportgen.reports.ConvReport;
+import org.cishell.testing.convertertester.core.tester2.reportgen.reports.FilePassReport;
+import org.cishell.testing.convertertester.core.tester2.reportgen.reports.TestReport;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.osgi.framework.BundleContext;
@@ -36,7 +40,7 @@
private Dictionary parameters;
private CIShellContext cContext;
private BundleContext bContext;
- private LogService logger;
+ private LogService log;
public ConverterTesterAlgorithm(Data[] data, Dictionary parameters,
CIShellContext cContext, BundleContext bContext ) {
@@ -45,7 +49,7 @@
this.cContext = cContext;
this.bContext = bContext;
- this.logger = (LogService) cContext.getService(
+ this.log = (LogService) cContext.getService(
LogService.class.getName());
}
@@ -59,7 +63,7 @@
}
Display display = PlatformUI.getWorkbench().getDisplay();
- DataUpdater dataUpdater = new DataUpdater (windows[0]);
+ DataUpdater dataUpdater = new DataUpdater (windows[0], this.log);
if (Thread.currentThread() != display.getThread()) {
display.syncExec(dataUpdater);
@@ -95,76 +99,145 @@
boolean loadFileSuccess = false;
IWorkbenchWindow window;
ArrayList returnList = new ArrayList();
+ LogService log;
- DataUpdater (IWorkbenchWindow window){
+ DataUpdater (IWorkbenchWindow window, LogService log){
+ this.log = log;
this.window = window;
}
public void run (){
- FileDialog dialog = new FileDialog(window.getShell(), SWT.OPEN);
- if (currentDir == null) {
- currentDir = new File(System.getProperty("user.dir") + File.separator + "sampledata");
-
- if (!currentDir.exists()) {
- currentDir = new File(System.getProperty("user.home") + File.separator + "anything");
- } else {
- currentDir = new File(System.getProperty("user.dir") + File.separator + "sampledata" + File.separator + "anything");
- }
- }
- dialog.setFilterPath(currentDir.getPath());
- dialog.setText("Select a File: Too bad we aren't using it, haha!");
- String fileName = dialog.open();
- if (fileName == null) {
- return;
- }
+// FileDialog dialog = new FileDialog(window.getShell(), SWT.OPEN);
+// if (currentDir == null) {
+// currentDir = new File(System.getProperty("user.dir") + File.separator + "sampledata");
+//
+// if (!currentDir.exists()) {
+// currentDir = new File(System.getProperty("user.home") + File.separator + "anything");
+// } else {
+// currentDir = new File(System.getProperty("user.dir") + File.separator + "sampledata" + File.separator + "anything");
+// }
+// }
+// dialog.setFilterPath(currentDir.getPath());
+// dialog.setText("Select a File: Too bad we aren't using it, haha!");
+// String fileName = dialog.open();
+// if (fileName == null) {
+// return;
+// }
try {
- ConverterTester2 ct = new ConverterTester2(logger);
+ ConverterTester2 ct = new ConverterTester2(log);
ServiceReference[] refs = getServiceReferences();
- OverviewReportGenerator overviewGen =
- new OverviewReportGenerator();
- SampleResultReportGenerator sampleGen =
- new SampleResultReportGenerator(10, 5);
- ConverterReportGenerator convGen =
- new ConverterReportGenerator();
-
- ct.execute(refs, cContext, bContext, logger,
- new ReportGenerator[] {overviewGen, sampleGen, convGen});
- File overviewReport = overviewGen.getReport();
- BasicData overviewReportData =
- createReportData(overviewReport, "Overview");
- returnList.add(overviewReportData);
+ ConverterGraph converterGraph = new ConverterGraph(refs, bContext, log);
+ File nwbGraph = converterGraph.asNWB();
- File sampleReport = sampleGen.getReport();
- BasicData sampleReportData =
- createReportData(sampleReport, "Sample Test Results");
- returnList.add(sampleReportData);
+ AllTestsReportGenerator allGen = new AllTestsReportGenerator(this.log);
+ AllConvsReportGenerator allConvGen = new AllConvsReportGenerator(this.log);
+ GraphReportGenerator graphGen = new GraphReportGenerator(nwbGraph, this.log);
-
- File convReport = convGen.getReport();
- BasicData convReportData =
- createReportData(convReport, "Basic Converter Results");
- returnList.add(convReportData);
+ ct.execute(converterGraph, new ReportGenerator[] {allGen, allConvGen, graphGen}, cContext, bContext);
+ AllTestsReport allReport = allGen.getAllTestsReport();
+ File allReportFile = allReport.getAllTestsReport();
+ Data allReportData = createReportData(allReportFile,
+ allReport.getName() , null);
+ addReturn(allReportData);
+
+ TestReport[] sTestReports = allReport.getSuccessfulTestReports();
+ addFilePasses(sTestReports, allReportData);
+
+ TestReport[] ppTestReports = allReport.getPartialSuccessTestReports();
+ addFilePasses(ppTestReports, allReportData);
+
+ TestReport[] fTestReports = allReport.getFailedTestReports();
+ addFilePasses(fTestReports, allReportData);
+
+ //all conv report
+
+ AllConvsReport allConvReport = allConvGen.getAllConvsReport();
+ File allConvReportFile = allConvReport.getReport();
+ Data allConvReportData = createReportData(allConvReportFile, allConvReport.getName(),
+ null);
+ addReturn(allConvReportData);
+
+ ConvReport[] convReports = allConvReport.getConverterReports();
+ for (int ii = 0; ii < convReports.length; ii++) {
+ ConvReport convReport = convReports[ii];
+ File convReportFile = convReport.getReport();
+ Data convReportData = createReportData(convReportFile, convReport.getName(), allConvReportData);
+ addReturn(convReportData);
+
+ TestReport[] trs = convReport.getTestReports();
+ addFilePasses(trs, convReportData);
+ }
+
+ File graphReportFile = graphGen.getGraphReport();
+ Data graphReport = createReportData(graphReportFile, "Annotated Graph Report", null,
+ "file:text/nwb", DataProperty.NETWORK_TYPE);
+ addReturn(graphReport);
+
} catch (Exception e) {
System.out.println("Why oh why am I catching type Exception?");
System.out.println(e);
e.printStackTrace();
}
}
- }
-
- private BasicData createReportData(Object report, String label) {
- BasicData reportData = new BasicData(report, "file:text/plain");
+
+ private void addReturn(Data report) {
+ this.returnList.add(report);
+ }
+
+
+ private void addFilePasses(TestReport[] testReports, Data allReportData) {
+ for (int ii = 0; ii < testReports.length; ii++) {
+ TestReport tr = testReports[ii];
+ File testReportFile = tr.getTestReport();
+ System.out.println("In algorithm, file pass name is : " + tr.getName());
+ System.out.println("In algorithm FILE name is : " + testReportFile.getName());
+ Data testReportData = createReportData(testReportFile,
+ tr.getName(), allReportData);
+ addReturn(testReportData);
+
+ FilePassReport[] sFilePassReports = tr.getSuccessfulFilePassReports();
+ for (int kk = 0; kk < sFilePassReports.length; kk++) {
+ FilePassReport fp = sFilePassReports[kk];
+ File fpFile = fp.getFilePassReport();
+ Data fpData = createReportData(fpFile, fp.getName(),
+ testReportData);
+ addReturn(fpData);
+ }
+
+ FilePassReport[] fFilePassReports = tr.getFailedFilePassReports();
+ for (int kk = 0; kk < fFilePassReports.length; kk++) {
+ FilePassReport fp = fFilePassReports[kk];
+ File fpFile = fp.getFilePassReport();
+ Data fpData = createReportData(fpFile, fp.getName(),
+ testReportData);
+ addReturn(fpData);
+ }
+ }
+ }
+
+ private Data createReportData(Object report, String label, Data parent, String format, String type) {
+ Data reportData = new BasicData(report, format);
Dictionary metadata = reportData.getMetaData();
metadata.put(DataProperty.LABEL, label);
- metadata.put(DataProperty.TYPE, DataProperty.TEXT_TYPE);
+ metadata.put(DataProperty.TYPE, type);
+ if (parent != null) {
+ metadata.put(DataProperty.PARENT, parent);
+ }
return reportData;
- }
+ }
+
+ private Data createReportData(Object report, String label, Data parent) {
+ return createReportData(report, label, parent, "file:text/plain", DataProperty.TEXT_TYPE);
+ }
+ }
+
+
private ServiceReference[] getServiceReferences() {
String filter = "(&("+ALGORITHM_TYPE+"="+TYPE_CONVERTER+"))";// +
@@ -179,5 +252,8 @@
return null;
}
}
+
+
+
}
\ No newline at end of file
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-08-10 17:32:32 UTC (rev 468)
+++ trunk/testing/org.cishell.testing.convertertester.algorithm/src/org/cishell/testing/convertertester/algorithm/ConverterTesterAlgorithmFactory.java 2007-08-15 19:55:26 UTC (rev 469)
@@ -32,6 +32,6 @@
return new ConverterTesterAlgorithm(data, parameters, context, bContext);
}
public MetaTypeProvider createParameters(Data[] data) {
- return provider;
+ return null;
}
}
\ No newline at end of file
Modified: trunk/testing/org.cishell.testing.convertertester.core.new/META-INF/MANIFEST.MF
===================================================================
--- trunk/testing/org.cishell.testing.convertertester.core.new/META-INF/MANIFEST.MF 2007-08-10 17:32:32 UTC (rev 468)
+++ trunk/testing/org.cishell.testing.convertertester.core.new/META-INF/MANIFEST.MF 2007-08-15 19:55:26 UTC (rev 469)
@@ -15,7 +15,18 @@
org.osgi.service.metatype;version="1.1.0",
org.osgi.service.prefs;version="1.1.0"
Require-Bundle: org.prefuse.lib
-Export-Package: org.cishell.testing.convertertester.core.tester,
+Export-Package: org.cishell.testing.convertertester.core.converter,
+ org.cishell.testing.convertertester.core.converter.graph,
+ org.cishell.testing.convertertester.core.service,
+ org.cishell.testing.convertertester.core.tester,
+ org.cishell.testing.convertertester.core.tester.graphcomparison,
org.cishell.testing.convertertester.core.tester2,
+ org.cishell.testing.convertertester.core.tester2.graphcomparison,
org.cishell.testing.convertertester.core.tester2.reportgen,
- org.cishell.testing.convertertester.core.tester2.reportgen.results
+ org.cishell.testing.convertertester.core.tester2.reportgen.allconvs,
+ org.cishell.testing.convertertester.core.tester2.reportgen.alltests,
+ org.cishell.testing.convertertester.core.tester2.reportgen.convgraph,
+ org.cishell.testing.convertertester.core.tester2.reportgen.reports,
+ org.cishell.testing.convertertester.core.tester2.reportgen.results,
+ org.cishell.testing.convertertester.core.tester2.reportgen.results.converter,
+ org.cishell.testing.convertertester.core.tester2.reportgen.results.filepass
Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/ConverterLoaderImpl.java
===================================================================
--- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/ConverterLoaderImpl.java 2007-08-10 17:32:32 UTC (rev 468)
+++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/ConverterLoaderImpl.java 2007-08-15 19:55:26 UTC (rev 469)
@@ -15,6 +15,7 @@
import org.osgi.framework.ServiceEvent;
import org.osgi.framework.ServiceListener;
import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogService;
@@ -23,12 +24,14 @@
public final static String SERVICE_LIST = "SERVICE_LIST";
private Map converterList;
private BundleContext bContext;
+ private LogService log;
private CIShellContext ciContext;
- public ConverterLoaderImpl(BundleContext bContext, CIShellContext cContext){
+ public ConverterLoaderImpl(BundleContext bContext, CIShellContext cContext, LogService log){
this.ciContext = cContext;
this.bContext = bContext;
+ this.log = log;
converterList = new Hashtable();
@@ -51,20 +54,8 @@
ServiceReference[] refs = bContext.getServiceReferences(
AlgorithmFactory.class.getName(), filter);
- // ConverterGraph g = new ConverterGraph(refs);
- // System.out.println(g.printComparisonConverterPaths());
- /* System.out.println(g.printComparisonConverterPaths() + "\n" +
- g.getComparePaths().length + "\n" + g.printTestConverterPaths() + "\n");
- int length = 0;
- for(int i = 0; i < g.getTestPaths().length; i++){
- for(int j = 0; j < g.getTestPaths()[i].length; j++){
- length++;
- }
- }
- System.out.println(length + " " + g.getTestPaths().length);
- */
- // System.out.println(g);
-
+ ConverterGraph g = new ConverterGraph(refs, bContext, this.log);
+
if (refs != null) {
for (int i = 0; i < refs.length; ++i) {
Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/ConverterTesterImpl.java
===================================================================
--- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/ConverterTesterImpl.java 2007-08-10 17:32:32 UTC (rev 468)
+++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/ConverterTesterImpl.java 2007-08-15 19:55:26 UTC (rev 469)
@@ -117,7 +117,7 @@
if (factory != null) {
Algorithm alg = factory.createAlgorithm(dm, parameters, context);
- System.out.println("Entering: " + refs[i].getProperty(Constants.SERVICE_PID)+ "-->");
+// System.out.println("Entering: " + refs[i].getProperty(Constants.SERVICE_PID)+ "-->");
dm = alg.execute();
if(dm == null){
throw new RuntimeException("Error after " + refs[i].getProperty(Constants.SERVICE_PID));
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-08-10 17:32:32 UTC (rev 468)
+++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java 2007-08-15 19:55:26 UTC (rev 469)
@@ -6,13 +6,13 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogService;
public class ConverterGraph {
prefuse.data.Graph converterGraph;
@@ -21,11 +21,13 @@
Map fileExtensionCompareConverters;
ServiceReference[] converters;
BundleContext bContext;
+ private LogService log;
private static final String testOutData = "prefuse.data.Graph";
- public ConverterGraph(ServiceReference[] converters, BundleContext bContext){
+ public ConverterGraph(ServiceReference[] converters, BundleContext bContext, LogService log){
this.converters = converters;
this.bContext = bContext;
+ this.log = log;
inDataToAlgorithm = new HashMap();//<String, ArrayList<ServiceReference>>();
fileExtensionTestConverters = new ConcurrentHashMap();//<String, ArrayList<ConverterPath>>();
fileExtensionCompareConverters = new ConcurrentHashMap();//<String, ConverterPath>();
@@ -59,7 +61,7 @@
if(s.startsWith("file-ext")){
- ConverterPath test = new ConverterPath(this.bContext);
+ ConverterPath test = new ConverterPath(this.bContext, this.log);
test.setInData(s);
@@ -93,7 +95,6 @@
String firstOutData, lastInData;
firstOutData = ((ServiceReference)cp.getPath().get(0)).getProperty("out_data").toString();
lastInData = ((ServiceReference)cp.getPath().get(cp.getPath().size()-1)).getProperty("in_data").toString();
- //System.out.println(firstOutData + " " + lastInData);
if(firstOutData.equals(lastInData)){
addTestPath(cp);
}
@@ -255,7 +256,7 @@
return this.fileExtensionTestConverters;
}
- public File asNWB(){
+ public File asNWB() {
File f = getTempFile();
Map nodes = assembleNodesSet();
TreeSet output = assembleEdges(nodes);
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-08-10 17:32:32 UTC (rev 468)
+++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java 2007-08-15 19:55:26 UTC (rev 469)
@@ -7,18 +7,25 @@
import org.cishell.framework.algorithm.AlgorithmProperty;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogService;
public class ConverterPath implements AlgorithmProperty {
- private String in_data;
+
+ private BundleContext bContext;
+ private LogService log;
+ private String in_data = null;
private String out_data = null;
+
private ArrayList path;
- private BundleContext bContext;
- boolean algPathCached = false;
- ArrayList algPath;
+ private boolean algPathCached = false;
+ private ArrayList algPath;
- public ConverterPath(BundleContext bContext){
+
+ public ConverterPath(BundleContext bContext, LogService log){
this.bContext = bContext;
+ this.log = log;
+
path = new ArrayList();
}
@@ -69,6 +76,17 @@
return this.out_data;
}
+ public String getAcceptedFileFormat() {
+ if (size() > 0) {
+ return (String) getRef(0).getProperty(AlgorithmProperty.OUT_DATA);
+ } else {
+ this.log.log(LogService.LOG_ERROR, "Converter Path cannot " +
+ "determine accepted file format if there are no " +
+ "converters inside it. Returning null String.");
+ return "";
+ }
+ }
+
public List getPath(){
return this.path;
@@ -138,7 +156,7 @@
List thisConvPathCopy = new ArrayList(thisConvPath);
thisConvPathCopy.addAll(otherConvPath);
- ConverterPath combinedPath = new ConverterPath(this.bContext);
+ ConverterPath combinedPath = new ConverterPath(this.bContext, this.log);
List combinedConvPath = thisConvPathCopy;
for (int ii = 0; ii < combinedConvPath.size(); ii++) {
@@ -154,6 +172,10 @@
return this.path.size();
}
+
+ public String getConverterName(int index) {
+ return (String) getRef(index).getProperty("service.pid");
+ }
private void cacheAlgPath() {
@@ -173,5 +195,4 @@
this.algPathCached = false;
}
-
}
Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile3.net
===================================================================
--- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile3.net 2007-08-10 17:32:32 UTC (rev 468)
+++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile3.net 2007-08-15 19:55:26 UTC (rev 469)
@@ -11,7 +11,6 @@
550 "ph"
551 "SMO"
552 "ci"
-//I thought I would add a comment here.
553 "CI"
554 "CIA"
555 "CIR"
Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile4.net
===================================================================
--- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile4.net 2007-08-10 17:32:32 UTC (rev 468)
+++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile4.net 2007-08-15 19:55:26 UTC (rev 469)
@@ -11,7 +11,6 @@
550 "ph"
551 "SMO"
552 "ci"
-//I thought I would add a comment here.
553 "CI"
554 "CIA"
555 "CIR"
Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile5.net
===================================================================
--- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile5.net 2007-08-10 17:32:32 UTC (rev 468)
+++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile5.net 2007-08-15 19:55:26 UTC (rev 469)
@@ -11,7 +11,6 @@
550 "ph"
551 "SMO"
552 "ci"
-//I thought I would add a comment here.
553 "CI"
554 "CIA"
555 "CIR"
Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile6.net
===================================================================
--- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile6.net 2007-08-10 17:32:32 UTC (rev 468)
+++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile6.net 2007-08-15 19:55:26 UTC (rev 469)
@@ -1,5 +1,5 @@
*Vertices
-541 "SLP Friend" ellipse 0.987 0.5
+541 "SLP Friend" 0.987 0.5 ellipse
542 "wg"
543 "WG"
544 "en"
@@ -11,7 +11,6 @@
550 "ph"
551 "SMO"
552 "ci"
-//I thought I would add a comment here.
553 "CI"
554 "CIA"
555 "CIR"
Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile7.net
===================================================================
--- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile7.net 2007-08-10 17:32:32 UTC (rev 468)
+++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile7.net 2007-08-15 19:55:26 UTC (rev 469)
@@ -6,12 +6,11 @@
545 "EN"
546 "hh"
547 "HH"
-548 "ptc" 0.987 ellipse 0.5 0.7
+548 "ptc" 0.987 0.5 0.7
549 "PTC"
550 "ph"
551 "SMO"
552 "ci"
-//I thought I would add a comment here.
553 "CI"
554 "CIA"
555 "CIR"
Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile8.net
===================================================================
--- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile8.net 2007-08-10 17:32:32 UTC (rev 468)
+++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile8.net 2007-08-15 19:55:26 UTC (rev 469)
@@ -5,7 +5,7 @@
544 "en"
545 "EN"
546 "hh"
-547 "HH" 0.987 0.5 0.5 box r 3.5 x_fact 7 s_size 1 lc red font "Arial Black" lphi 5 lr 3
+547 "HH" 0.987 0.5 0.5 box r 3.5 x_fact 7 s_size 1 lc red lphi 5 lr 3
549 "PTC"
550 "ph"
551 "SMO"
Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile9.net
===================================================================
--- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile9.net 2007-08-10 17:32:32 UTC (rev 468)
+++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile9.net 2007-08-15 19:55:26 UTC (rev 469)
@@ -5,11 +5,10 @@
544 "en"
545 "EN"
546 "hh"
-547 "HH" 0.987 0.5 0.5 box r 3.5 x_fact 7 s_size 1 lc red font "Arial Black" lphi 5 lr 3
+547 "HH" 0.987 0.5 0.5 box r 3.5 x_fact 7 s_size 1 lc red lphi 5 lr 3
549 "PTC"
550 "ph"
551 "SMO"
-//I thought I would add a comment here.
552 "ci"
553 "CI"
554 "CIA"
@@ -35,7 +34,6 @@
574 "en"
575 "EN"
576 "hh"
-577
578 "ptc"
579 "PTC"
580 "ph"
Deleted: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NWB Files/TestFile9.net
===================================================================
--- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NWB Files/TestFile9.net 2007-08-10 17:32:32 UTC (rev 468)
+++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NWB Files/TestFile9.net 2007-08-15 19:55:26 UTC (rev 469)
@@ -1,11 +0,0 @@
-*Vertices 6
- 1 "Ada" 0.1646 0.2144 0.5000
- 2 "Cora" 0.0481 0.3869 0.5000
- 3 "Louise" 0.3472 0.1913 0.5000
- 4 "Jean" 0.1063 0.5935 0.5000
- 5 "Helen" 0.2892 0.6688 0.5000
- 6 "Martha" 0.4630 0.5179 0.5000
-*Arcs
-1 2
-2 5 2.5
-4 5
Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/filetypes.conf
===================================================================
--- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/filetypes.conf 2007-08-10 17:32:32 UTC (rev 468)
+++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/filetypes.conf 2007-08-15 19:55:26 UTC (rev 469)
@@ -1,6 +1,6 @@
file:text/edge=Edge Files
file:text/graphml+xml=GraphML Files
-file:application/pajek=NET Files
+file:application/pajeknet=NET Files
file:text/nwb=NWB Files
file:text/treeml+xml=TreeML Files
-file:text/xgmml_xml=XGMML Files
+file:text/xgmml+xml=XGMML Files
Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester/ConverterTester.java
===================================================================
--- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester/ConverterTester.java 2007-08-10 17:32:32 UTC (rev 468)
+++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester/ConverterTester.java 2007-08-15 19:55:26 UTC (rev 469)
@@ -18,6 +18,7 @@
import org.cishell.testing.convertertester.core.tester.graphcomparison.DefaultGraphComparer;
import org.cishell.testing.convertertester.core.tester.graphcomparison.GraphComparer;
import org.osgi.framework.BundleContext;
+import org.osgi.service.log.LogService;
import prefuse.data.Graph;
@@ -27,6 +28,7 @@
private ConverterLoaderImpl cli;
private Converter comparisonConverters;
private GraphComparer dgc;
+ private LogService log;
//private Map<String, Exception> fileErrors;
private static final String tempDir = "converterTesterTemp";
private File temporaryStorage;
@@ -34,9 +36,10 @@
//string, comparisonresult
private Map results;
- public ConverterTester(BundleContext b, CIShellContext c){
+ public ConverterTester(BundleContext b, CIShellContext c, LogService log){
this.cContext = c;
- cli = new ConverterLoaderImpl(b, this.cContext);
+ this.log = log;
+ cli = new ConverterLoaderImpl(b, this.cContext, this.log);
cfp = new ConfigurationFileParser();
}
@@ -50,7 +53,7 @@
public ConverterTester(BundleContext b, CIShellContext c, File configFile) throws Exception{
cContext = c;
- cli = new ConverterLoaderImpl(b, cContext);
+ cli = new ConverterLoaderImpl(b, cContext, this.log);
cfp = new ConfigurationFileParser(configFile);
testConverters = cli.getConverter(cfp.getTestConverters());
comparisonConverters = cli.getConverter(cfp.getComparisonConverters());
@@ -60,7 +63,7 @@
public ConverterTester(BundleContext b, CIShellContext c, String configFileName) throws Exception {
cContext = c;
- cli = new ConverterLoaderImpl(b,cContext);
+ cli = new ConverterLoaderImpl(b,cContext, this.log);
cfp = new ConfigurationFileParser(new File(configFileName));
testConverters = cli.getConverter(cfp.getTestConverters());
comparisonConverters = cli.getConverter(cfp.getComparisonConverters());
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-08-10 17:32:32 UTC (rev 468)
+++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/ConverterTester2.java 2007-08-15 19:55:26 UTC (rev 469)
@@ -2,33 +2,31 @@
import java.io.File;
import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
import org.cishell.framework.CIShellContext;
-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.core.converter.graph.ConverterGraph;
import org.cishell.testing.convertertester.core.converter.graph.ConverterPath;
-import org.cishell.testing.convertertester.core.tester2.filepassresults.FilePassResult;
import org.cishell.testing.convertertester.core.tester2.graphcomparison.IdsNotPreservedComparer;
import org.cishell.testing.convertertester.core.tester2.graphcomparison.IdsPreservedComparer;
import org.cishell.testing.convertertester.core.tester2.graphcomparison.LossyComparer;
import org.cishell.testing.convertertester.core.tester2.graphcomparison.NewGraphComparer;
import org.cishell.testing.convertertester.core.tester2.reportgen.ReportGenerator;
+import org.cishell.testing.convertertester.core.tester2.reportgen.results.AllTestsResult;
+import org.cishell.testing.convertertester.core.tester2.reportgen.results.FilePassResult;
+import org.cishell.testing.convertertester.core.tester2.reportgen.results.TestResult;
import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
import org.osgi.service.log.LogService;
/**
- * Test Suites are arrays of test paths, where each test path starts
- * from the same file format.
- *
- * Compare Paths are paths of converters that convert from the original file
- * format to the in-memory comparison format. For each test suite there
- * is a single corresponding compare path.
- *
* @author mwlinnem
*
*/
@@ -39,7 +37,6 @@
private TestFileKeeper testFileKeeper;
private TestRunner testRunner;
-
public ConverterTester2(LogService log) {
this.log = log;
this.testFileKeeper =
@@ -47,71 +44,80 @@
this.testRunner = new DefaultTestRunner(log);
}
-
/**
* Tests the provided converters, and passes the results of those tests to
* the report generators. Report Generators are side-effected, which takes
* the place of a return value.
- *
- * @param converterRefs the converters to be tested
+ * @param reportGenerators process the test results.
* @param cContext the CIShell Context
* @param bContext the Bundle Context
- * @param log The log written to should an error occur (other than the
- * errors resulting from the converters, which are included in the test
- * results)
- * @param reportGenerators process the test results.
*/
- public void execute(ServiceReference[] converterRefs,
+ public void execute(
+ ConverterGraph converterGraph,
+ ReportGenerator[] reportGenerators,
CIShellContext cContext,
- BundleContext bContext,
- LogService log,
- ReportGenerator[] reportGenerators) {
+ BundleContext bContext) {
- this.log = log;
+ //run the tests
- //generate test paths
+ TestResult[] rawResults =
+ runAllTests(converterGraph, cContext, bContext);
+ AllTestsResult allTestsResult = new AllTestsResult(rawResults);
- ConverterGraph converterGraph = new ConverterGraph(converterRefs);
+ //feed test results to the report generators
- ConverterPath[][] testSuites = converterGraph.getTestPaths();
- ConverterPath[] comparePaths = converterGraph.getComparePaths();
-
- //run tests on test paths
-
- TestResult[] results = runTests(testSuites, comparePaths,
- cContext, bContext);
-
- //generate reports based on test results
-
for (int ii = 0; ii < reportGenerators.length; ii++) {
ReportGenerator reportGenerator = reportGenerators[ii];
- reportGenerator.generateReport(results);
+ reportGenerator.generateReport(allTestsResult);
}
}
-
- public TestResult[] runTests(ConverterPath[][] testSuites,
- ConverterPath[] comparePaths, CIShellContext cContext,
- BundleContext bContext) {
+ public TestResult[] runAllTests(ConverterGraph convGraph,
+ CIShellContext cContext, BundleContext bContext) {
+
+
+ Map fileFormatToTestConvs = convGraph.getTestMap();
+ Map fileFormatToCompareConvs = convGraph.getCompareMap();
+
List testResults = new ArrayList();
- for (int ii = 0; ii < testSuites.length; ii++) {
- ConverterPath[] testSuite = testSuites[ii];
- ConverterPath testSuiteComparePath = comparePaths[ii];
+ Set fileFormats = fileFormatToTestConvs.keySet();
+
+ /*
+ * for each file format, get the corresponding test converter paths
+ * and comparison converter path.
+ */
+
+ Iterator iter = fileFormats.iterator();
+ while(iter.hasNext()) {
+ String fileFormat = (String) iter.next();
- for (int jj = 0; jj < testSuite.length; jj++) {
- ConverterPath testPath = testSuite[jj];
+ ArrayList testConvList =
+ (ArrayList) fileFormatToTestConvs.get(fileFormat);
+
+ ConverterPath[] testConvs =
+ (ConverterPath[]) testConvList.toArray(new ConverterPath[0]);
+
+ ConverterPath compareConv =
+ (ConverterPath) fileFormatToCompareConvs.get(fileFormat);
+
+ /*
+ * For each test converter, use that test converter and
+ * the corresponding comparison converter to run a test.
+ */
+
+ for (int kk = 0; kk < testConvs.length; kk++) {
+ ConverterPath testConv = testConvs[kk];
- TestResult testResult = runATest(testPath,
- testSuiteComparePath, cContext, bContext);
+ TestResult testResult =
+ runATest(testConv, compareConv, cContext, bContext);
if (testResult != null) {
testResults.add(testResult);
}
}
-
}
return (TestResult[]) testResults.toArray(new TestResult[0]);
@@ -119,57 +125,34 @@
private TestResult runATest(ConverterPath testConvs,
- ConverterPath comparisonConvs, CIShellContext cContext,
+ ConverterPath compareConvs, CIShellContext cContext,
BundleContext bContext) {
- ServiceReference[] testConvRefs = testConvs.getPathAsArray();
- ServiceReference[] compareConvRefs = comparisonConvs.getPathAsArray();
+ //get test file data corresponding to the format these converters accept.
- AlgorithmFactory[] testConvAlgs = extractAlgorithms(
- testConvRefs, bContext);
- AlgorithmFactory[] compareConvAlgs = extractAlgorithms(
- compareConvRefs, bContext);
-
- if (testConvRefs.length <= 0) {
- System.out.println("Must have at least one test converter..");
- return null;
- }
-
- //get test files corresponding to the format these converters accept.
-
- String fileFormat =
- (String) testConvRefs[0].getProperty(AlgorithmProperty.OUT_DATA);
+ String fileFormat = testConvs.getAcceptedFileFormat();
String[] testFilePaths = testFileKeeper.getTestFilePaths(fileFormat);
- Data[][] fileData = wrapInData(testFilePaths, fileFormat);
+ Data[][] testFileData = wrapInData(testFilePaths, fileFormat);
//determine how we will compare the graphs
- boolean areLossy = areLossy(testConvRefs) && areLossy(compareConvRefs);
- boolean preserveIds = false; //TODO: determine this somehow
- NewGraphComparer comparer = getComparer(areLossy, preserveIds);
+ boolean isLossy = testConvs.isLossy() && compareConvs.isLossy();
+ boolean preserveIDs = testConvs.preservesIDs() &&
+ compareConvs.preservesIDs();
+
+ NewGraphComparer comparer = getComparer(isLossy, preserveIDs);
//pack all the data relevant to the test into a single object.
- TestConfigData testData = new TestConfigData(comparer, testConvAlgs,
- compareConvAlgs, cContext, fileData);
+ TestConfigData testBasicData = new TestConfigData(comparer, testConvs,
+ compareConvs, cContext, testFileData);
//run the test
- FilePassResult[] results = this.testRunner.runTest(testData);
+ FilePassResult[] results = this.testRunner.runTest(testBasicData);
//return the results of the test
- return new TestResult(results);
+ return new TestResult(results, testConvs, compareConvs);
}
-
-
- private AlgorithmFactory[] extractAlgorithms(ServiceReference[] convRefs,
- BundleContext bContext) {
- AlgorithmFactory[] results = new AlgorithmFactory[convRefs.length];
- for (int ii = 0; ii < convRefs.length; ii++) {
- results[ii] = (AlgorithmFactory) bContext.getService(convRefs[ii]);
- }
- return results;
- }
-
-
+
private Data[][] wrapInData(String[] testFilePaths, String format) {
Data[][] results = new Data[testFilePaths.length][1];
@@ -178,26 +161,14 @@
results[ii] =
new Data[] {new BasicData(new File(filePath), format)};
+
+ Dictionary metadata = results[ii][0].getMetaData();
+ metadata.put(DataProperty.LABEL, filePath);
}
return results;
}
-
- private boolean areLossy(ServiceReference[] refs) {
-
- String lossiness = LOSSLESS;
- for (int i=0; i < refs.length; i++) {
- if (LOSSY.equals(refs[i].getProperty(CONVERSION))) {
- lossiness = LOSSY;
- }
- }
-
- boolean result = lossiness.equals(LOSSY);
- return result;
- }
-
-
private NewGraphComparer getComparer(boolean areLossy,
boolean idsPreserved) {
@@ -210,5 +181,4 @@
}
}
-
}
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-08-10 17:32:32 UTC (rev 468)
+++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/DefaultTestRunner.java 2007-08-15 19:55:26 UTC (rev 469)
@@ -13,13 +13,14 @@
import org.cishell.framework.algorithm.AlgorithmFactory;
import org.cishell.framework.data.BasicData;
import org.cishell.framework.data.Data;
+import org.cishell.testing.convertertester.core.converter.graph.ConverterPath;
import org.cishell.testing.convertertester.core.tester.graphcomparison.ComparisonResult;
-import org.cishell.testing.convertertester.core.tester2.filepassresults.ComparePhaseFailure;
-import org.cishell.testing.convertertester.core.tester2.filepassresults.ConvertPhaseFailure;
-import org.cishell.testing.convertertester.core.tester2.filepassresults.FilePassResult;
-import org.cishell.testing.convertertester.core.tester2.filepassresults.FilePassSuccess;
import org.cishell.testing.convertertester.core.tester2.graphcomparison.NewGraphComparer;
-import org.cishell.testing.convertertester.core.tester2.reportgen.results.ConvFailureInfo;
+import org.cishell.testing.convertertester.core.tester2.reportgen.results.FilePassResult;
+import org.cishell.testing.convertertester.core.tester2.reportgen.results.converter.ConvFailureInfo;
+import org.cishell.testing.convertertester.core.tester2.reportgen.results.filepass.ComparePhaseFailure;
+import org.cishell.testing.convertertester.core.tester2.reportgen.results.filepass.ConvertPhaseFailure;
+import org.cishell.testing.convertertester.core.tester2.reportgen.results.filepass.FilePassSuccess;
import org.osgi.service.log.LogService;
import prefuse.data.Graph;
@@ -35,14 +36,12 @@
public FilePassResult[] runTest(TestConfigData testData) {
Data[][] testFileData = testData.getTestFileData();
- AlgorithmFactory[] testConverters = testData.getTestConverters();
- AlgorithmFactory[] comparisonConverters = testData
+ ConverterPath testConverters = testData.getTestConverters();
+ ConverterPath comparisonConverters = testData
.getComparisonConverters();
+ List testResults = new ArrayList();
- // list of FilePassResult
- final List testResults = new ArrayList();
-
for (int ii = 0; ii < testFileData.length; ii++) {
Data[] originalFileData = testFileData[ii];
@@ -53,8 +52,7 @@
if (!testPhaseResult.succeeded()) {
ConvertPhaseFailure failure = new ConvertPhaseFailure(
- originalFileData, testConverters, comparisonConverters,
- testPhaseResult.getFailInfo(),
+ originalFileData, testPhaseResult.getFailInfo(),
ConvertPhaseFailure.TEST_PHASE);
testResults.add(failure);
continue;
@@ -68,7 +66,7 @@
if (!comparisonPhaseResult1.succeeded()) {
ConvertPhaseFailure failure = new ConvertPhaseFailure(
- originalFileData, testConverters, comparisonConverters,
+ originalFileData,
comparisonPhaseResult1.getFailInfo(),
ConvertPhaseFailure.TEST_PHASE);
testResults.add(failure);
@@ -81,7 +79,7 @@
if (!comparisonPhaseResult2.succeeded()) {
ConvertPhaseFailure failure = new ConvertPhaseFailure(
- originalFileData, testConverters, comparisonConverters,
+ originalFileData,
comparisonPhaseResult2.getFailInfo(),
ConvertPhaseFailure.COMPARISON_PHASE);
testResults.add(failure);
@@ -101,14 +99,13 @@
if (!graphComparisonPhaseResult.comparisonSucceeded()) {
String explanation = graphComparisonPhaseResult.getLog();
ComparePhaseFailure failure = new ComparePhaseFailure(
- originalFileData, testConverters, comparisonConverters,
+ originalFileData,
explanation);
testResults.add(failure);
continue;
}
- FilePassSuccess success = new FilePassSuccess(originalFileData,
- testConverters, comparisonConverters);
+ FilePassSuccess success = new FilePassSuccess(originalFileData);
testResults.add(success);
}
@@ -118,38 +115,45 @@
}
private ConvertResult convert(Data[] startData,
- AlgorithmFactory[] converters, TestConfigData testData) {
+ ConverterPath converters, TestConfigData testData) {
- // validator takes a string file path, all others just take files or
- // graphs or whatever);
Data[] currentData = getFilePathData(startData);
-
- AlgorithmFactory currentConverter = converters[0];
+ AlgorithmFactory[] converterAlgs = converters.getPathAsAlgorithms();
+
+ AlgorithmFactory currentConverterAlg = converterAlgs[0];
try {
- for (int ii = 0; ii < converters.length; ii++) {
- currentConverter = converters[ii];
- Algorithm currentAlgorithm = currentConverter.createAlgorithm(
- currentData, new Hashtable(), testData.getContext());
+ for (int ii = 0; ii < converterAlgs.length; ii++) {
+ currentConverterAlg = converterAlgs[ii];
+ Algorithm currentAlgorithm =
+ currentConverterAlg.createAlgorithm(currentData,
+ new Hashtable(), testData.getContext());
currentData = currentAlgorithm.execute();
if (currentData == null) {
+ String converterName = converters.getConverterName(ii);
ConvFailureInfo failInfo = new ConvFailureInfo(
- "null result data", currentConverter);
+ "Result data is null. " +
+ "Check NWB GUI Console for specific error.",
+ converterName);
ConvertResult result = new ConvertResult(failInfo);
return result;
}
- BasicData currentDataImpl = (BasicData) currentData[0];
+ Data currentDataImpl = (Data) currentData[0];
if (currentDataImpl.getData() == null) {
+ String converterName = converters.getConverterName(ii);
ConvFailureInfo failInfo = new ConvFailureInfo(
- "null result data contents", currentConverter);
+ "Contents of result data is null. " +
+ "Check NWB GUI Console for specific error.",
+ converterName);
ConvertResult result = new ConvertResult(failInfo);
return result;
}
}
} catch (Throwable t) {
ConvFailureInfo failInfo = new ConvFailureInfo(t.toString()
- + getStackTrace(t), currentConverter);
+ + getStackTrace(t),
+ currentConverterAlg.getClass().toString());
ConvertResult result = new ConvertResult(failInfo);
return result;
}
@@ -201,12 +205,12 @@
}
private Data[] getFilePathData(Data[] fileData) {
- BasicData basicData = (BasicData) fileData[0];
- String format = basicData.getFormat();
- File actualFile = (File) basicData.getData();
+ Data Data = (Data) fileData[0];
+ String format = Data.getFormat();
+ File actualFile = (File) Data.getData();
try {
String filePath = actualFile.getCanonicalPath();
- BasicData result = new BasicData(filePath, format);
+ Data result = new BasicData(filePath, format);
return new Data[] { result };
} catch (IOException e) {
this.log.log(LogService.LOG_ERROR, "Could not get file path " +
Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/TestConfigData.java
===================================================================
--- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/TestConfigData.java 2007-08-10 17:32:32 UTC (rev 468)
+++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester2/TestConfigData.java 2007-08-15 19:55:26 UTC (rev 469)
@@ -1,21 +1,21 @@
package org.cishell.testing.convertertester.core.tester2;
import org.cishell.framework.CIShellContext;
-import org.cishell.framework.algorithm.AlgorithmFactory;
import org.cishell.framework.data.Data;
+import org.cishell.testing.convertertester.core.converter.graph.ConverterPath;
import org.cishell.testing.convertertester.core.tester2.graphcomparison.NewGraphComparer;
public class TestConfigData {
private NewGraphComparer comparer;
- private AlgorithmFactory[] testConverters;
- private AlgorithmFactory[] comparisonConverters;
+ priva...
[truncated message content] |