Skip to content
Permalink
Browse files

Merge pull request #28 from multimediabs/master

add environment variables support for fitnesse hostname and port
  • Loading branch information...
lessonz committed Jun 21, 2016
2 parents 4fd22d6 + 53410e5 commit 9406f48b00357c97c30029da57dedf031cc374d2
@@ -9,10 +9,7 @@
import hudson.tasks.test.TestResult;

import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.*;

import jenkins.model.Jenkins;

@@ -23,9 +20,10 @@
public class FitnesseResults extends TabulatedResult implements
Comparable<FitnesseResults> {
private static final String DETAILS = "Details";
private static final String FITNESSE_HOSTNAME = "FITNESSE_HOSTNAME";
private static final String FITNESSE_PORT = "FITNESSE_PORT";

// private static final Logger log = Logger.getLogger(FitnesseResults.class.getName());

private static final long serialVersionUID = 1L;
private transient List<FitnesseResults> failed;
private transient List<FitnesseResults> skipped;
@@ -313,11 +311,7 @@ public boolean include(FitnesseResults results) {
* referenced in body.jelly
*/
public String toHtml(FitnesseResults results) {
FitnesseBuildAction buildAction = getOwner().getAction(
FitnesseBuildAction.class);
if (buildAction == null) {
buildAction = FitnesseBuildAction.NULL_ACTION;
}
FitnesseBuildAction buildAction = getFitnesseBuildAction();
return buildAction.getLinkFor(results.getName(), Jenkins.getInstance().getRootUrl());
}

@@ -339,15 +333,35 @@ public String getDetailsLink() {
* server. Note the history may not always be available.
*/
public String getDetailRemoteLink() {
FitnesseBuildAction buildAction = getOwner().getAction(
FitnesseBuildAction.class);
if (buildAction == null) {
buildAction = FitnesseBuildAction.NULL_ACTION;
}
FitnesseBuildAction buildAction = getFitnesseBuildAction();
return buildAction.getLinkFor(getName() + "?pageHistory&resultDate="
+ getResultsDate(), null, "Details");
}

public String getRunTestRemoteLink() {
FitnesseBuildAction buildAction = getFitnesseBuildAction();
String image = "<img class=\"icon-next icon-md\" title=\"Run Test\" src=\"/static/abafcc7b/images/24x24/next.png\" />";
return buildAction.getLinkFor(getName() + "?test", null, image);
}

private FitnesseBuildAction getFitnesseBuildAction() {
FitnesseBuildAction buildAction = getOwner().getAction(FitnesseBuildAction.class);
if (buildAction == null) {
buildAction = getDefaultFitnesseBuildAction();
}
return buildAction;
}

private FitnesseBuildAction getDefaultFitnesseBuildAction() {
final FitnesseBuildAction buildAction;Map<String, String> envVars = getOwner().getEnvVars();
if (envVars.containsKey(FITNESSE_HOSTNAME) && envVars.containsKey(FITNESSE_PORT)) {
buildAction = new FitnesseBuildAction(false, envVars.get(FITNESSE_HOSTNAME), Integer.valueOf(envVars.get(FITNESSE_PORT)));
} else {
buildAction = FitnesseBuildAction.NULL_ACTION;
}
return buildAction;
}

/**
* called from links embedded in history/trend graphs
* TODO: Expose sub-suites as separate elements of the fitnesse report.
@@ -20,13 +20,16 @@
<td class="pane-header">Duration</td>
<td class="pane-header">Details-Captured</td>
<td class="pane-header">Details-Remote</td>
<td class="pane-header">Run</td>
</tr>
<j:forEach var="r" items="${it.failedTests}">
<tr>
<td><j:out value="${it.toHtml(r)}"/></td>
<td>${r.passCount}</td><td>${r.failOnlyCount}</td><td>${r.ignoredCount}</td><td>${r.exceptionCount}</td>
<td>${r.duration}</td>
<td><j:out value="${r.getDetailsLink()}"/></td><td><j:out value="${r.getDetailRemoteLink()}"/></td>
<td><j:out value="${r.getDetailsLink()}"/></td>
<td><j:out value="${r.getDetailRemoteLink()}"/></td>
<td><j:out value="${r.getRunTestRemoteLink()}"/></td>
</tr>
</j:forEach>
</table>
@@ -70,7 +73,8 @@
<td>${r.passCount}</td>
<td>${r.ignoredCount}</td>
<td>${r.duration}</td>
<td><j:out value="${r.getDetailsLink()}"/></td><td><j:out value="${r.getDetailRemoteLink()}"/></td>
<td><j:out value="${r.getDetailsLink()}"/></td>
<td><j:out value="${r.getDetailRemoteLink()}"/></td>
</tr>
</j:forEach>
</table>

0 comments on commit 9406f48

Please sign in to comment.
You can’t perform that action at this time.