fixed issue #6

This commit is contained in:
Kingsley Hendrickse 2012-05-25 15:50:12 +01:00
parent 00da440cf8
commit 5932d2e347
5 changed files with 89 additions and 38 deletions

View File

@ -40,6 +40,7 @@
<orderEntry type="library" name="Maven: antlr:antlr:2.7.5" level="project" />
<orderEntry type="library" name="Maven: com.jamesmurty.utils:java-xmlbuilder:0.4" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.1" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:r09" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.jenkins-ci.main:jenkins-war:war:1.424" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jenkins-ci.main:jenkins-core:1.424" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jenkins-ci.main:remoting:2.4" level="project" />
@ -61,7 +62,6 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: org.kohsuke.stapler:json-lib:2.1-rev7" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.sf.ezmorph:ezmorph:1.0.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jvnet:tiger-types:1.3" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:r06" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-fileupload:commons-fileupload:1.2.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jenkins-ci:commons-jelly:1.1-jenkins-20110627" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.jvnet.hudson:commons-jexl:1.1-hudson-20090508" level="project" />

View File

@ -10,7 +10,7 @@
<groupId>net.masterthought.jenkins</groupId>
<artifactId>cucumber-reports</artifactId>
<version>0.0.9</version>
<version>0.0.10</version>
<packaging>hpi</packaging>
<!-- get every artifact through repo.jenkins-ci.org, which proxies all the artifacts that we need -->
@ -54,5 +54,10 @@
<artifactId>joda-time</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>r09</version>
</dependency>
</dependencies>
</project>

View File

@ -1,23 +1,23 @@
//package net.masterthought.jenkins;
//
//
//import java.io.File;
//import java.util.ArrayList;
//import java.util.List;
//
//public class Runner {
//
// public static void main(String[] args) throws Exception {
// File rd = new File("/Users/kings/.jenkins/jobs/aaaaa/builds/15/cucumber-html-reports");
// List<String> list = new ArrayList<String>();
package net.masterthought.jenkins;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class Runner {
public static void main(String[] args) throws Exception {
File rd = new File("/Users/kings/.jenkins/jobs/aaaaa/builds/15/cucumber-html-reports");
List<String> list = new ArrayList<String>();
// list.add("/Users/kings/.jenkins/jobs/aaaaa/builds/15/cucumber-html-reports/french.json");
// list.add("/Users/kings/.jenkins/jobs/aaaaa/builds/15/cucumber-html-reports/co_cucumber.json");
// list.add("/Users/kings/.jenkins/jobs/aaaaa/builds/15/cucumber-html-reports/ccp_cucumber.json");
// list.add("/Users/kings/.jenkins/jobs/aaaaa/builds/15/cucumber-html-reports/ss_cucumber.json");
// list.add("/Users/kings/.jenkins/jobs/aaaaa/builds/15/cucumber-html-reports/local.json");
//
// FeatureReportGenerator featureReportGenerator = new FeatureReportGenerator(list,rd,"","15","aaaaa");
// featureReportGenerator.generateReports();
//
// }
//}
list.add("/Users/kings/.jenkins/jobs/aaaaa/builds/15/cucumber-html-reports/local.json");
FeatureReportGenerator featureReportGenerator = new FeatureReportGenerator(list,rd,"","15","aaaaa");
featureReportGenerator.generateReports();
}
}

View File

@ -1,6 +1,10 @@
package net.masterthought.jenkins.json;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import org.apache.commons.lang.StringUtils;
import org.apache.tools.ant.util.regexp.Regexp;
import org.joda.time.DateTime;
import java.util.ArrayList;
import java.util.List;
@ -25,14 +29,14 @@ public class Feature {
return elements;
}
public boolean hasTags(){
public boolean hasTags() {
return Util.itemExists(tags);
}
public List<String> getTagList(){
public List<String> getTagList() {
List<String> tagList = new ArrayList<String>();
for(Tag tag : tags){
tagList.add(tag.getName());
for (Tag tag : tags) {
tagList.add(tag.getName());
}
return tagList;
}
@ -45,7 +49,7 @@ public class Feature {
}
return result;
}
public Util.Status getStatus() {
Closure<String, Element> scenarioStatus = new Closure<String, Element>() {
public Util.Status call(Element step) {
@ -58,9 +62,9 @@ public class Feature {
private List<Util.Status> lookUpSteps() {
List<Util.Status> stepStatuses = new ArrayList<Util.Status>();
for(Element element : elements){
for(Step step : element.getSteps()){
stepStatuses.add(step.getStatus());
for (Element element : elements) {
for (Step step : element.getSteps()) {
stepStatuses.add(step.getStatus());
}
}
return stepStatuses;
@ -86,9 +90,18 @@ public class Feature {
return result;
}
public String getFileName() {
return uri.replaceAll("/", "-").replaceAll("\\\\", "-") + ".html";
}
public String getFileName() {
List<String> matches = new ArrayList<String>();
for (String line : Splitter.onPattern("/|\\\\").split(uri)) {
String modified = line.replaceAll("\\)|\\(","");
modified = StringUtils.deleteWhitespace(modified).trim();
matches.add(modified);
}
matches = matches.subList(1,matches.size());
String fileName = Joiner.on("-").join(matches) + ".html";
return fileName;
}
public int getNumberOfScenarios() {
return elements.length;
@ -113,17 +126,22 @@ public class Feature {
public String getRawStatus() {
return getStatus().toString().toLowerCase();
}
public String getDurationOfSteps(){
public String getDurationOfSteps() {
Long totalDuration = 0L;
for(Element element : elements){
for(Step step : element.getSteps()){
totalDuration = totalDuration + step.getDuration();
for (Element element : elements) {
for (Step step : element.getSteps()) {
totalDuration = totalDuration + step.getDuration();
}
}
return Util.formatDuration(totalDuration);
}
private String getTimestamp() {
DateTime dateTime = new DateTime();
return dateTime.getYear() + "" + dateTime.getMonthOfYear() + "" + dateTime.getDayOfMonth() + "" + dateTime.getHourOfDay() + "" + dateTime.getMinuteOfHour() + "" + dateTime.getSecondOfMinute() + "" + dateTime.getMillis();
}
}

28
velocity.log Normal file
View File

@ -0,0 +1,28 @@
Fri May 25 15:35:24 BST 2012 [debug] AvalonLogChute initialized using file 'velocity.log'
Fri May 25 15:35:24 BST 2012 [trace] *******************************************************************
Fri May 25 15:35:24 BST 2012 [debug] Starting Jakarta Velocity v1.5-SNAPSHOT (compiled: 2006-07-21 06:25:35)
Fri May 25 15:35:24 BST 2012 [trace] RuntimeInstance initializing.
Fri May 25 15:35:24 BST 2012 [debug] Default Properties File: org/apache/velocity/runtime/defaults/velocity.properties
Fri May 25 15:35:24 BST 2012 [debug] Trying to use logger class org.apache.velocity.runtime.log.AvalonLogChute
Fri May 25 15:35:24 BST 2012 [debug] Using logger class org.apache.velocity.runtime.log.AvalonLogChute
Fri May 25 15:35:24 BST 2012 [debug] Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
Fri May 25 15:35:24 BST 2012 [debug] ResourceLoader instantiated: org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
Fri May 25 15:35:24 BST 2012 [trace] ClasspathResourceLoader : initialization complete.
Fri May 25 15:35:24 BST 2012 [debug] ResourceCache: initialized (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
Fri May 25 15:35:24 BST 2012 [trace] Default ResourceManager initialization complete.
Fri May 25 15:35:24 BST 2012 [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Literal
Fri May 25 15:35:24 BST 2012 [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Macro
Fri May 25 15:35:24 BST 2012 [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Parse
Fri May 25 15:35:24 BST 2012 [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Include
Fri May 25 15:35:24 BST 2012 [debug] Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
Fri May 25 15:35:24 BST 2012 [debug] Created '20' parsers.
Fri May 25 15:35:24 BST 2012 [trace] Velocimacro : initialization starting.
Fri May 25 15:35:24 BST 2012 [debug] Velocimacro : "velocimacro.library" is not set. Trying default library: VM_global_library.vm
Fri May 25 15:35:24 BST 2012 [debug] Velocimacro : Default library not found.
Fri May 25 15:35:24 BST 2012 [debug] Velocimacro : allowInline = true : VMs can be defined inline in templates
Fri May 25 15:35:24 BST 2012 [debug] Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions
Fri May 25 15:35:24 BST 2012 [debug] Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
Fri May 25 15:35:24 BST 2012 [debug] Velocimacro : autoload off : VM system will not automatically reload global library macros
Fri May 25 15:35:24 BST 2012 [trace] Velocimacro : initialization complete.
Fri May 25 15:35:24 BST 2012 [trace] RuntimeInstance successfully initialized.
Fri May 25 15:35:24 BST 2012 [debug] ResourceManager : found templates/tagOverview.vm with loader org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader