-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3990be8
Showing
17 changed files
with
1,582 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
####################################### | ||
# Eclipse | ||
####################################### | ||
*.pydevproject | ||
.metadata | ||
.gradle | ||
bin/ | ||
tmp/ | ||
*.tmp | ||
*.bak | ||
*.swp | ||
*~.nib | ||
#local.properties | ||
#.settings/ | ||
#.loadpath | ||
|
||
# Eclipse Core | ||
# .project | ||
|
||
# External tool builders | ||
.externalToolBuilders/ | ||
|
||
# Locally stored "Eclipse launch configurations" | ||
# *.launch | ||
|
||
# CDT-specific | ||
# .cproject | ||
|
||
# JDT-specific (Eclipse Java Development Tools) | ||
# .classpath | ||
|
||
# Java annotation processor (APT) | ||
# .factorypath | ||
|
||
# PDT-specific | ||
# .buildpath | ||
|
||
# sbteclipse plugin | ||
.target | ||
|
||
# TeXlipse plugin | ||
.texlipse | ||
|
||
####################################### | ||
# Java | ||
####################################### | ||
|
||
*.class | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.ear | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> | ||
<classpathentry kind="lib" path="jars/dom4j-1.6.1.jar"/> | ||
<classpathentry kind="lib" path="jars/miglayout15-swing.jar"/> | ||
<classpathentry kind="lib" path="jars/jaxen-1.1.1.jar"/> | ||
<classpathentry kind="lib" path="jars/poi-3.9-20121203.jar"/> | ||
<classpathentry kind="lib" path="jars/poi-ooxml-3.9-20121203.jar"/> | ||
<classpathentry kind="lib" path="jars/xmlbeans-2.3.0.jar"/> | ||
<classpathentry kind="lib" path="jars/poi-ooxml-schemas-3.9-20121203.jar"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>ATMLReportSniffer</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#Sun Jul 28 17:07:08 CST 2013 | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.6 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.6 |
186 changes: 186 additions & 0 deletions
186
ATMLReportSniffer/src/com/tomlu/ATMLReportSniffer/ATML/ExportHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
package com.tomlu.ATMLReportSniffer.ATML; | ||
|
||
import java.io.File; | ||
import java.io.FileNotFoundException; | ||
import java.io.FileOutputStream; | ||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
import org.apache.poi.ss.usermodel.Row; | ||
import org.apache.poi.ss.usermodel.Sheet; | ||
import org.apache.poi.ss.usermodel.Workbook; | ||
import org.apache.poi.xssf.streaming.SXSSFWorkbook; | ||
|
||
import com.tomlu.ATMLReportSniffer.GUI.UIHandler; | ||
|
||
public class ExportHandler { | ||
|
||
private static boolean includePassResult = true; | ||
private static boolean includeFailResult = true; | ||
|
||
public static boolean isIncludePassResult() { | ||
return includePassResult; | ||
} | ||
|
||
public static void setIncludePassResult(boolean includePassResult) { | ||
ExportHandler.includePassResult = includePassResult; | ||
} | ||
|
||
public static boolean isIncludeFailResult() { | ||
return includeFailResult; | ||
} | ||
|
||
public static void setIncludeFailResult(boolean includeFailResult) { | ||
ExportHandler.includeFailResult = includeFailResult; | ||
} | ||
|
||
private File ExportFile; | ||
private List<TestResult> ResultList; | ||
private List<Step> ExportStepList; | ||
private Workbook workbook; | ||
private Sheet sheet; | ||
private int totalResult = 0; | ||
private int passResult = 0; | ||
private int failResult = 0; | ||
|
||
private int getTotalResult() { | ||
return totalResult; | ||
} | ||
|
||
private void setTotalResult(int totalResult) { | ||
this.totalResult = totalResult; | ||
} | ||
|
||
private int getPassResult() { | ||
return passResult; | ||
} | ||
|
||
private void setPassResult(int passResult) { | ||
this.passResult = passResult; | ||
} | ||
|
||
private int getFailResult() { | ||
return failResult; | ||
} | ||
|
||
private void setFailResult(int failResult) { | ||
this.failResult = failResult; | ||
} | ||
|
||
private ExportHandler(File exportFile, List<TestResult> resultList, List<Step> exportStepList) { | ||
ExportFile = exportFile; | ||
ResultList = resultList; | ||
ExportStepList = exportStepList; | ||
} | ||
|
||
private void InitExcelFile() { | ||
workbook = new SXSSFWorkbook(); | ||
sheet = workbook.createSheet("TestData"); | ||
} | ||
|
||
private void SaveExcelFile() { | ||
FileOutputStream fileOut; | ||
try { | ||
|
||
fileOut = new FileOutputStream(ExportFile); | ||
workbook.write(fileOut); | ||
fileOut.close(); | ||
|
||
} catch (FileNotFoundException e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} catch (IOException e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
private void ExportHeader() { | ||
Row row = sheet.createRow(0); | ||
row.createCell(0).setCellValue("SerialNumber"); | ||
row.createCell(1).setCellValue("StartTime"); | ||
row.createCell(2).setCellValue("Result"); | ||
|
||
for(int i=3; i<ExportStepList.size()+3; i++) { | ||
row.createCell(i).setCellValue(ExportStepList.get(i-3).getName()); | ||
} | ||
} | ||
|
||
private void ExportSingleResult(TestResult result, int rowIndex) { | ||
|
||
Row row = sheet.createRow(rowIndex); | ||
row.createCell(0).setCellValue(result.getUut().getSerialNumber()); | ||
row.createCell(1).setCellValue(result.getStartTime()); | ||
row.createCell(2).setCellValue(result.getResult()); | ||
|
||
List<Step> stepList = result.getSteps(); | ||
for(int i=3; i<ExportStepList.size()+3; i++) { | ||
|
||
Step exportStep = ExportStepList.get(i-3); | ||
for(Step step : stepList) { | ||
if(step.equals(exportStep)) { | ||
if(step.getStepType().equals("NumericLimitTest") || step.getStepType().equals("NI_MultipleNumericLimitTest")) | ||
{ | ||
row.createCell(i).setCellValue(Double.parseDouble(step.getMeasureValue())); | ||
} | ||
else | ||
{ | ||
row.createCell(i).setCellValue(step.getMeasureValue()); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
private void ExportResultList() { | ||
|
||
int rowIndex = 1; | ||
for(int i=0; i< ResultList.size(); i++) { | ||
TestResult result = ResultList.get(i); | ||
|
||
if(result.getResult().equals("Passed")) { | ||
setPassResult(getPassResult()+1); | ||
} | ||
if(result.getResult().equals("Failed")) { | ||
setFailResult(getFailResult()+1); | ||
} | ||
|
||
if((result.getResult().equals("Passed") && isIncludePassResult()) || | ||
(result.getResult().equals("Failed") && isIncludeFailResult())) { | ||
ExportSingleResult(result, rowIndex++); | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
public static void Export(File exportFile, List<TestResult> resultList, List<Step> exportStepList) { | ||
|
||
ExportHandler handler = new ExportHandler(exportFile, resultList, exportStepList); | ||
|
||
handler.setTotalResult(resultList.size()); | ||
handler.setPassResult(0); | ||
handler.setFailResult(0); | ||
|
||
handler.InitExcelFile(); | ||
handler.ExportHeader(); | ||
handler.ExportResultList(); | ||
handler.SaveExcelFile(); | ||
|
||
UIHandler.AppendMessage("###########################################################################################################"); | ||
UIHandler.AppendMessage(" -- "); | ||
UIHandler.AppendMessage(" -- Total: " + handler.getTotalResult()); | ||
UIHandler.AppendMessage(" -- "); | ||
UIHandler.AppendMessage(" -- Pass Result: " + handler.getPassResult() + (isIncludePassResult() ? "" : " ( Skipped )") ); | ||
UIHandler.AppendMessage(" -- "); | ||
UIHandler.AppendMessage(" -- Fail Result: " + handler.getFailResult() + (isIncludeFailResult() ? "" : " ( Skipped )") ); | ||
UIHandler.AppendMessage(" -- "); | ||
UIHandler.AppendMessage("###########################################################################################################"); | ||
UIHandler.AppendMessage(" -- "); | ||
UIHandler.AppendMessage(" -- Export Task Done -- :)"); | ||
UIHandler.AppendMessage(" -- "); | ||
UIHandler.AppendMessage("###########################################################################################################"); | ||
} | ||
|
||
} |
Oops, something went wrong.