]> git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc/src/main/java/org/argeo/slc/ant/test/SlcCloseTestResultTask.java
Change default separator
[gpl/argeo-slc.git] / org.argeo.slc / src / main / java / org / argeo / slc / ant / test / SlcCloseTestResultTask.java
1 package org.argeo.slc.ant.test;
2
3 import org.argeo.slc.ant.structure.SAwareTask;
4 import org.argeo.slc.core.structure.StructureAware;
5 import org.argeo.slc.core.structure.StructureRegistry;
6 import org.argeo.slc.core.test.TestReport;
7 import org.argeo.slc.core.test.TestResult;
8
9 /** Ant tasks closing a given result, and optionally generating a report. */
10 public class SlcCloseTestResultTask extends SAwareTask {
11 private String result;
12 private String report;
13
14 @Override
15 public void executeActions(String mode) {
16 if (!mode.equals(StructureRegistry.READ)) {
17 TestResult testResult = (TestResult) getContext().getBean(result);
18 testResult.close();
19
20 if (report != null) {
21 TestReport testReport = (TestReport) getContext().getBean(
22 report);
23 if (testReport instanceof StructureAware) {
24 ((StructureAware) testReport).notifyCurrentPath(
25 getRegistry(), null);
26 }
27 testReport.generateTestReport(testResult);
28 }
29 }
30 }
31
32 /** Sets the bean name of the result to close. */
33 public void setResult(String bean) {
34 this.result = bean;
35 }
36
37 /** Sets the bean name of the report to generate. */
38 public void setReport(String report) {
39 this.report = report;
40 }
41
42 }