]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.launcher/src/main/java/org/argeo/slc/ant/test/SlcReportTask.java
Introduce org.argeo.slc.lib.detached
[gpl/argeo-slc.git] / runtime / org.argeo.slc.launcher / src / main / java / org / argeo / slc / ant / test / SlcReportTask.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 generating a report. */
10 public class SlcReportTask 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 = null;
18 if (result != null) {
19 testResult = (TestResult) getContext().getBean(result);
20 }
21 TestReport testReport = (TestReport) getContext().getBean(report);
22 if (testReport instanceof StructureAware) {
23 ((StructureAware) testReport).notifyCurrentPath(getRegistry(),
24 null);
25 }
26 testReport.generateTestReport(testResult);
27 }
28 }
29
30 /** Sets the bean name of the result to close. */
31 public void setResult(String bean) {
32 this.result = bean;
33 }
34
35 /** Sets the bean name of the report to generate. */
36 public void setReport(String report) {
37 this.report = report;
38 }
39
40 }