use of com.buschmais.jqassistant.core.report.impl.XmlReportWriter in project jqa-core-framework by buschmais.
the class XmlReportTestHelper method createXmlReportWithConstraints.
/**
* Creates a test report with {@link Constraint}.
*
* @return The test report.
* @throws ReportException
* If the test fails.
*/
public static String createXmlReportWithConstraints() throws ReportException {
StringWriter writer = new StringWriter();
XmlReportWriter xmlReportWriter = new XmlReportWriter(writer);
xmlReportWriter.begin();
Constraint constraint = Constraint.Builder.newConstraint().id("my:Constraint").description("My constraint description").severity(Severity.BLOCKER).executable(new CypherExecutable("match...")).verification(ROW_COUNT_VERIFICATION).report(Report.Builder.newInstance().get()).get();
Map<String, Severity> constraints = new HashMap<>();
constraints.put("my:Constraint", Severity.INFO);
Group group = Group.Builder.newGroup().id("default").description("My group").constraintIds(constraints).get();
xmlReportWriter.beginGroup(group);
xmlReportWriter.beginConstraint(constraint);
List<Map<String, Object>> rows = new ArrayList<>();
rows.add(createRow());
Result<Constraint> result = new Result<>(constraint, Result.Status.FAILURE, Severity.CRITICAL, Arrays.asList(C1, C2), rows);
xmlReportWriter.setResult(result);
xmlReportWriter.endConstraint();
xmlReportWriter.endGroup();
xmlReportWriter.end();
return writer.toString();
}
use of com.buschmais.jqassistant.core.report.impl.XmlReportWriter in project jqa-core-framework by buschmais.
the class XmlReportTestHelper method createXmlReport.
/**
* Creates a test report.
*
* @return The test report.
* @throws ReportException
* If the test fails.
*/
public static String createXmlReport() throws ReportException {
StringWriter writer = new StringWriter();
XmlReportWriter xmlReportWriter = new XmlReportWriter(writer);
xmlReportWriter.begin();
Concept concept = Concept.Builder.newConcept().id("my:concept").description("My concept description").severity(Severity.MAJOR).executable(new CypherExecutable("match...")).verification(ROW_COUNT_VERIFICATION).report(Report.Builder.newInstance().primaryColumn("c2").get()).get();
Map<String, Severity> concepts = new HashMap<>();
concepts.put("my:concept", Severity.INFO);
Group group = Group.Builder.newGroup().id("default").description("My group").conceptIds(concepts).get();
xmlReportWriter.beginGroup(group);
xmlReportWriter.beginConcept(concept);
List<Map<String, Object>> rows = new ArrayList<>();
rows.add(createRow());
Result<Concept> result = new Result<>(concept, Result.Status.SUCCESS, Severity.CRITICAL, Arrays.asList(C1, C2), rows);
xmlReportWriter.setResult(result);
xmlReportWriter.endConcept();
xmlReportWriter.endGroup();
xmlReportWriter.end();
return writer.toString();
}
use of com.buschmais.jqassistant.core.report.impl.XmlReportWriter in project jqa-core-framework by buschmais.
the class XmlReportTestHelper method createXmlWithUmlauts.
public static String createXmlWithUmlauts(String description) throws ReportException {
StringWriter writer = new StringWriter();
XmlReportWriter xmlReportWriter = new XmlReportWriter(writer);
xmlReportWriter.begin();
Concept concept = Concept.Builder.newConcept().id("mein:Konzept").description(description).severity(Severity.MAJOR).executable(new CypherExecutable("match...")).verification(ROW_COUNT_VERIFICATION).report(Report.Builder.newInstance().primaryColumn("c2").get()).get();
Map<String, Severity> concepts = new HashMap<>();
concepts.put("mein:Konzept", Severity.INFO);
Group group = Group.Builder.newGroup().id("default").description("Meine Gruppe").conceptIds(concepts).get();
xmlReportWriter.beginGroup(group);
xmlReportWriter.beginConcept(concept);
List<Map<String, Object>> rows = new ArrayList<>();
rows.add(createRow());
Result<Concept> result = new Result<>(concept, Result.Status.SUCCESS, Severity.CRITICAL, Arrays.asList(C1, C2), rows);
xmlReportWriter.setResult(result);
xmlReportWriter.endConcept();
xmlReportWriter.endGroup();
xmlReportWriter.end();
return writer.toString();
}
Aggregations