Search in sources :

Example 1 with Severity

use of com.buschmais.jqassistant.core.rule.api.model.Severity 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 File createXmlReportWithConstraints() throws ReportException {
    xmlReportWriter.begin();
    Constraint constraint = Constraint.builder().id("my:Constraint").description("My constraint description").severity(Severity.BLOCKER).executable(new CypherExecutable("match...")).verification(ROW_COUNT_VERIFICATION).report(Report.builder().build()).build();
    Map<String, Severity> constraints = new HashMap<>();
    constraints.put("my:Constraint", Severity.INFO);
    Group group = Group.builder().id("default").description("My group").constraints(constraints).build();
    xmlReportWriter.beginGroup(group);
    xmlReportWriter.beginConstraint(constraint);
    List<Map<String, Object>> rows = new ArrayList<>();
    rows.add(createRow());
    Result<Constraint> result = Result.<Constraint>builder().rule(constraint).status(Result.Status.FAILURE).severity(Severity.CRITICAL).columnNames(Arrays.asList(C1, C2)).rows(rows).build();
    xmlReportWriter.setResult(result);
    xmlReportWriter.endConstraint();
    xmlReportWriter.endGroup();
    xmlReportWriter.end();
    return xmlReportWriter.getXmlReportFile();
}
Also used : Group(com.buschmais.jqassistant.core.rule.api.model.Group) Constraint(com.buschmais.jqassistant.core.rule.api.model.Constraint) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Severity(com.buschmais.jqassistant.core.rule.api.model.Severity) CypherExecutable(com.buschmais.jqassistant.core.rule.api.model.CypherExecutable) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with Severity

use of com.buschmais.jqassistant.core.rule.api.model.Severity 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 File createXmlReport() throws ReportException {
    xmlReportWriter.begin();
    Concept concept = Concept.builder().id("my:concept").description("My concept description").severity(Severity.MAJOR).executable(new CypherExecutable("match...")).verification(ROW_COUNT_VERIFICATION).report(Report.builder().primaryColumn("c2").build()).build();
    Map<String, Severity> concepts = new HashMap<>();
    concepts.put("my:concept", Severity.INFO);
    Group group = Group.builder().id("default").description("My group").concepts(concepts).build();
    xmlReportWriter.beginGroup(group);
    xmlReportWriter.beginConcept(concept);
    List<Map<String, Object>> rows = new ArrayList<>();
    rows.add(createRow());
    Result<Concept> result = Result.<Concept>builder().rule(concept).status(Result.Status.SUCCESS).severity(Severity.CRITICAL).columnNames(Arrays.asList(C1, C2)).rows(rows).build();
    xmlReportWriter.setResult(result);
    xmlReportWriter.endConcept();
    xmlReportWriter.endGroup();
    xmlReportWriter.end();
    return xmlReportWriter.getXmlReportFile();
}
Also used : Concept(com.buschmais.jqassistant.core.rule.api.model.Concept) Group(com.buschmais.jqassistant.core.rule.api.model.Group) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Severity(com.buschmais.jqassistant.core.rule.api.model.Severity) CypherExecutable(com.buschmais.jqassistant.core.rule.api.model.CypherExecutable) HashMap(java.util.HashMap) Map(java.util.Map)

Example 3 with Severity

use of com.buschmais.jqassistant.core.rule.api.model.Severity in project jqa-core-framework by buschmais.

the class XmlReportTestHelper method createXmlWithUmlauts.

public File createXmlWithUmlauts(String description) throws ReportException {
    xmlReportWriter.begin();
    Concept concept = Concept.builder().id("mein:Konzept").description(description).severity(Severity.MAJOR).executable(new CypherExecutable("match...")).verification(ROW_COUNT_VERIFICATION).report(Report.builder().primaryColumn("c2").build()).build();
    Map<String, Severity> concepts = new HashMap<>();
    concepts.put("mein:Konzept", Severity.INFO);
    Group group = Group.builder().id("default").description("Meine Gruppe").concepts(concepts).build();
    xmlReportWriter.beginGroup(group);
    xmlReportWriter.beginConcept(concept);
    List<Map<String, Object>> rows = new ArrayList<>();
    rows.add(createRow());
    Result<Concept> result = Result.<Concept>builder().rule(concept).status(Result.Status.SUCCESS).severity(Severity.CRITICAL).columnNames(Arrays.asList(C1, C2)).rows(rows).build();
    xmlReportWriter.setResult(result);
    xmlReportWriter.endConcept();
    xmlReportWriter.endGroup();
    xmlReportWriter.end();
    return xmlReportWriter.getXmlReportFile();
}
Also used : Concept(com.buschmais.jqassistant.core.rule.api.model.Concept) Group(com.buschmais.jqassistant.core.rule.api.model.Group) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Severity(com.buschmais.jqassistant.core.rule.api.model.Severity) CypherExecutable(com.buschmais.jqassistant.core.rule.api.model.CypherExecutable) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

CypherExecutable (com.buschmais.jqassistant.core.rule.api.model.CypherExecutable)3 Group (com.buschmais.jqassistant.core.rule.api.model.Group)3 Severity (com.buschmais.jqassistant.core.rule.api.model.Severity)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 Concept (com.buschmais.jqassistant.core.rule.api.model.Concept)2 Constraint (com.buschmais.jqassistant.core.rule.api.model.Constraint)1