From f4597886b293ef6aaba513660422ed146975fb48 Mon Sep 17 00:00:00 2001 From: Dirk Mahler Date: Sat, 13 Jul 2024 21:59:32 +0200 Subject: [PATCH] #408 added baseline IT for Maven and updated manual --- .../core/analysis/api/Analyzer.java | 8 --- .../api/baseline/BaselineManager.java | 8 +-- .../core/analysis/impl/AnalyzerImpl.java | 20 ++++--- .../analysis/impl/AnalyzerRuleVisitor.java | 2 +- .../api/baseline/BaselineManagerTest.java | 14 +++-- .../rule/impl/reader/XmlRuleParserPlugin.java | 53 +++++++++++++------ core/schemata/pom.xml | 2 +- ...v2.3.xsd => jqassistant-baseline-v2.4.xsd} | 4 +- .../main/asciidoc/include/configuration.adoc | 25 +++++++++ .../main/asciidoc/include/introduction.adoc | 43 +++++++++++++++ .../src/it/analyze/baseline/.jqassistant.yml | 11 ++++ .../it/analyze/baseline/invoker.properties | 5 ++ .../it/analyze/baseline/jqassistant/it.xml | 48 +++++++++++++++++ maven/src/it/analyze/baseline/pom.xml | 11 ++++ maven/src/it/analyze/baseline/verify.groovy | 23 ++++++++ 15 files changed, 228 insertions(+), 49 deletions(-) rename core/schemata/src/main/resources/META-INF/baseline/xsd/{jqassistant-baseline-v2.3.xsd => jqassistant-baseline-v2.4.xsd} (99%) create mode 100644 maven/src/it/analyze/baseline/.jqassistant.yml create mode 100644 maven/src/it/analyze/baseline/invoker.properties create mode 100644 maven/src/it/analyze/baseline/jqassistant/it.xml create mode 100644 maven/src/it/analyze/baseline/pom.xml create mode 100644 maven/src/it/analyze/baseline/verify.groovy diff --git a/core/analysis/src/main/java/com/buschmais/jqassistant/core/analysis/api/Analyzer.java b/core/analysis/src/main/java/com/buschmais/jqassistant/core/analysis/api/Analyzer.java index caab22149e..3509fc642e 100644 --- a/core/analysis/src/main/java/com/buschmais/jqassistant/core/analysis/api/Analyzer.java +++ b/core/analysis/src/main/java/com/buschmais/jqassistant/core/analysis/api/Analyzer.java @@ -1,6 +1,5 @@ package com.buschmais.jqassistant.core.analysis.api; -import com.buschmais.jqassistant.core.analysis.api.configuration.Analyze; import com.buschmais.jqassistant.core.rule.api.model.RuleException; import com.buschmais.jqassistant.core.rule.api.model.RuleSelection; import com.buschmais.jqassistant.core.rule.api.model.RuleSet; @@ -10,13 +9,6 @@ */ public interface Analyzer { - /** - * Return the {@link Analyze} configuration. - * - * @return The {@link Analyze} configuration. - */ - Analyze getConfiguration(); - /** * Executes the given rule set. * diff --git a/core/analysis/src/main/java/com/buschmais/jqassistant/core/analysis/api/baseline/BaselineManager.java b/core/analysis/src/main/java/com/buschmais/jqassistant/core/analysis/api/baseline/BaselineManager.java index ae4877dcca..bdabbe27e5 100644 --- a/core/analysis/src/main/java/com/buschmais/jqassistant/core/analysis/api/baseline/BaselineManager.java +++ b/core/analysis/src/main/java/com/buschmais/jqassistant/core/analysis/api/baseline/BaselineManager.java @@ -80,19 +80,19 @@ private Boolean isExistingResult(ExecutableRule executableRule, Row row, List Baseline.RuleBaseline oldRuleBaseline = ruleBaseline.get(ruleId); if (oldRuleBaseline != null && oldRuleBaseline.getRows() .containsKey(rowKey)) { - add(ruleId, rowKey, columns); + add(ruleId, rowKey, columns, rows); return true; } return false; }) .orElseGet(() -> { - add(ruleId, rowKey, columns); + add(ruleId, rowKey, columns, rows); return false; }); } - private void add(String constraintId, String rowKey, Map> columns) { - Baseline.RuleBaseline newRuleBaseline = newBaseline.getConstraints() + private void add(String constraintId, String rowKey, Map> columns, Function> rows) { + Baseline.RuleBaseline newRuleBaseline = rows.apply(newBaseline) .computeIfAbsent(constraintId, key -> new Baseline.RuleBaseline()); TreeMap row = new TreeMap<>(); columns.entrySet() diff --git a/core/analysis/src/main/java/com/buschmais/jqassistant/core/analysis/impl/AnalyzerImpl.java b/core/analysis/src/main/java/com/buschmais/jqassistant/core/analysis/impl/AnalyzerImpl.java index 5ece037bea..8624ba6024 100644 --- a/core/analysis/src/main/java/com/buschmais/jqassistant/core/analysis/impl/AnalyzerImpl.java +++ b/core/analysis/src/main/java/com/buschmais/jqassistant/core/analysis/impl/AnalyzerImpl.java @@ -23,10 +23,14 @@ public class AnalyzerImpl implements Analyzer { private final Analyze configuration; - private final AnalyzerContext analyzerContext; + private final ClassLoader classLoader; + + private final Store store; private final Map> ruleInterpreterPlugins; + private final BaselineManager baselineManager; + private final ReportPlugin reportPlugin; /** @@ -46,22 +50,22 @@ public class AnalyzerImpl implements Analyzer { * The report writer. */ public AnalyzerImpl(Analyze configuration, ClassLoader classLoader, Store store, Map> ruleInterpreterPlugins, - BaselineManager baselineManager, ReportPlugin reportPlugin) throws RuleException { + BaselineManager baselineManager, ReportPlugin reportPlugin) { this.configuration = configuration; - this.analyzerContext = new AnalyzerContextImpl(configuration, classLoader, store, baselineManager); + this.classLoader = classLoader; + this.store = store; this.ruleInterpreterPlugins = ruleInterpreterPlugins; + this.baselineManager = baselineManager; this.reportPlugin = reportPlugin; } - @Override - public Analyze getConfiguration() { - return configuration; - } - @Override public void execute(RuleSet ruleSet, RuleSelection ruleSelection) throws RuleException { + AnalyzerContext analyzerContext = new AnalyzerContextImpl(configuration, classLoader, store, baselineManager); + baselineManager.start(); AnalyzerRuleVisitor visitor = new AnalyzerRuleVisitor(configuration, analyzerContext, ruleInterpreterPlugins, reportPlugin); RuleSetExecutor executor = new RuleSetExecutor<>(visitor, configuration.rule()); executor.execute(ruleSet, ruleSelection); + baselineManager.stop(); } } diff --git a/core/analysis/src/main/java/com/buschmais/jqassistant/core/analysis/impl/AnalyzerRuleVisitor.java b/core/analysis/src/main/java/com/buschmais/jqassistant/core/analysis/impl/AnalyzerRuleVisitor.java index a61ca66a8f..55e6055962 100644 --- a/core/analysis/src/main/java/com/buschmais/jqassistant/core/analysis/impl/AnalyzerRuleVisitor.java +++ b/core/analysis/src/main/java/com/buschmais/jqassistant/core/analysis/impl/AnalyzerRuleVisitor.java @@ -34,8 +34,8 @@ public class AnalyzerRuleVisitor extends AbstractRuleVisitor { private final Analyze configuration; private final AnalyzerContext analyzerContext; - private final ReportPlugin reportPlugin; private final Map> ruleInterpreterPlugins; + private final ReportPlugin reportPlugin; private final Store store; private final RuleRepository ruleRepository; private final Deque ruleGroups = new ArrayDeque<>(); diff --git a/core/analysis/src/test/java/com/buschmais/jqassistant/core/analysis/api/baseline/BaselineManagerTest.java b/core/analysis/src/test/java/com/buschmais/jqassistant/core/analysis/api/baseline/BaselineManagerTest.java index c09f3e4826..cff804b50b 100644 --- a/core/analysis/src/test/java/com/buschmais/jqassistant/core/analysis/api/baseline/BaselineManagerTest.java +++ b/core/analysis/src/test/java/com/buschmais/jqassistant/core/analysis/api/baseline/BaselineManagerTest.java @@ -4,7 +4,6 @@ import java.util.Map; import java.util.SortedMap; import java.util.TreeMap; -import java.util.function.Function; import java.util.stream.Stream; import com.buschmais.jqassistant.core.report.api.model.Column; @@ -93,7 +92,7 @@ void noBaselineWithNewConstraintViolation(ExecutableRule executableRule) { assertThat(baselineManager.isExisting(executableRule, row)).isFalse(); baselineManager.stop(); - verifyNewBaseline(executableRule, baseline -> baseline.getConstraints(), "1"); + verifyNewBaseline(executableRule, "1"); } @ParameterizedTest @@ -114,7 +113,7 @@ void existingBaselineWithExistingConstraintViolation(ExecutableRule executabl assertThat(baselineManager.isExisting(executableRule, row)).isTrue(); baselineManager.stop(); - verifyNewBaseline(executableRule, baseline -> baseline.getConstraints(), "1"); + verifyNewBaseline(executableRule, "1"); } @ParameterizedTest @@ -142,7 +141,7 @@ void existingBaselineWithNewConstraintViolation(ExecutableRule executableRule assertThat(baselineManager.isExisting(executableRule, newRow)).isFalse(); baselineManager.stop(); - verifyNewBaseline(executableRule, baseline -> baseline.getConstraints(), "1"); + verifyNewBaseline(executableRule, "1"); } @ParameterizedTest @@ -163,7 +162,7 @@ void existingBaselineWithRemovedConstraintViolation(ExecutableRule executable assertThat(baselineManager.isExisting(executableRule, row)).isTrue(); baselineManager.stop(); - verifyNewBaseline(executableRule, baseline -> baseline.getConstraints(), "1"); + verifyNewBaseline(executableRule, "1"); } @Test @@ -245,11 +244,10 @@ private static Baseline createOldBaseline(ExecutableRule rule, String... rowK return oldBaseline; } - private void verifyNewBaseline(ExecutableRule executableRule, Function> rulebaseLinesFunction, - String... expectedRowKeys) { + private void verifyNewBaseline(ExecutableRule executableRule, String... expectedRowKeys) { verify(baselineRepository).write(baselineArgumentCaptor.capture()); Baseline newBaseline = baselineArgumentCaptor.getValue(); - SortedMap ruleBaselines = rulebaseLinesFunction.apply(newBaseline); + SortedMap ruleBaselines = executableRule instanceof Concept ? newBaseline.getConcepts() : newBaseline.getConstraints(); assertThat(ruleBaselines).hasSize(1) .containsKey(executableRule.getId()); Baseline.RuleBaseline ruleBaseline = ruleBaselines.get(executableRule.getId()); diff --git a/core/rule/src/main/java/com/buschmais/jqassistant/core/rule/impl/reader/XmlRuleParserPlugin.java b/core/rule/src/main/java/com/buschmais/jqassistant/core/rule/impl/reader/XmlRuleParserPlugin.java index 06a736d291..a81cc1ad0d 100644 --- a/core/rule/src/main/java/com/buschmais/jqassistant/core/rule/impl/reader/XmlRuleParserPlugin.java +++ b/core/rule/src/main/java/com/buschmais/jqassistant/core/rule/impl/reader/XmlRuleParserPlugin.java @@ -15,13 +15,16 @@ import com.buschmais.jqassistant.core.rule.impl.SourceExecutable; import com.buschmais.jqassistant.core.shared.xml.JAXBUnmarshaller; +import lombok.extern.slf4j.Slf4j; import org.jqassistant.schema.rule.v2.*; import static com.buschmais.jqassistant.core.rule.impl.reader.IndentHelper.removeIndent; import static java.util.stream.Collectors.toSet; + /** * A {@link RuleParserPlugin} implementation. */ +@Slf4j public class XmlRuleParserPlugin extends AbstractRuleParserPlugin { private static final String NAMESPACE_RULE = "http://schema.jqassistant.org/rule/v2.2"; @@ -38,7 +41,9 @@ public void initialize() { @Override public boolean accepts(RuleSource ruleSource) { - return ruleSource.getId().toLowerCase().endsWith(".xml"); + return ruleSource.getId() + .toLowerCase() + .endsWith(".xml"); } @Override @@ -51,7 +56,7 @@ public void doParse(RuleSource ruleSource, RuleSetBuilder ruleSetBuilder) throws * Read rules from XML documents. * * @param ruleSource - * The available sources. + * The available sources. * @return The list of found rules. */ private List readXmlSource(RuleSource ruleSource) { @@ -60,7 +65,9 @@ private List readXmlSource(RuleSource ruleSource) { JqassistantRules jqassistantRules = jaxbUnmarshaller.unmarshal(inputStream); rules.add(jqassistantRules); } catch (IOException e) { - throw new IllegalArgumentException("Cannot read rules from '" + ruleSource.getId() + "'.", e); + // TODO remove workaround, rule sources should be valid + // throw new IllegalArgumentException("Cannot read rules from '" + ruleSource.getId() + "'.", e); + log.warn("Cannot read rules from '{}'.", ruleSource); } return rules; } @@ -69,9 +76,9 @@ private List readXmlSource(RuleSource ruleSource) { * Converts a list of {@link JqassistantRules} to a rule set. * * @param rules - * The {@link JqassistantRules}. + * The {@link JqassistantRules}. * @throws RuleException - * If rules are not consistent. + * If rules are not consistent. */ private void convert(List rules, RuleSource ruleSource, RuleSetBuilder builder) throws RuleException { for (JqassistantRules rule : rules) { @@ -107,19 +114,21 @@ private Group createGroup(String id, RuleSource ruleSource, GroupType referencab .providedConcepts(providedConcepts) .constraints(includeConstraints) .groups(includeGroups) - .build(); + .build(); } private Concept createConcept(String id, RuleSource ruleSource, ConceptType conceptType) throws RuleException { String description = removeIndent(conceptType.getDescription()); - Executable executable = createExecutable(conceptType, conceptType.getSource(), conceptType.getCypher(), conceptType.getScript()); + Executable executable = createExecutable(conceptType.getSource(), conceptType.getCypher(), conceptType.getScript()); Map parameters = getRequiredParameters(conceptType.getRequiresParameter()); SeverityEnumType severityType = conceptType.getSeverity(); Severity severity = getSeverity(severityType, this::getDefaultConceptSeverity); List requiresConcept = conceptType.getRequiresConcept(); Map requiresConcepts = getRequiresConcepts(requiresConcept); List providesConcept = conceptType.getProvidesConcept(); - Set providesConcepts = providesConcept.stream().map(ReferenceType::getRefId).collect(toSet()); + Set providesConcepts = providesConcept.stream() + .map(ReferenceType::getRefId) + .collect(toSet()); String deprecated = conceptType.getDeprecated(); Verification verification = getVerification(conceptType.getVerify()); Report report = getReport(conceptType.getReport()); @@ -139,7 +148,7 @@ private Concept createConcept(String id, RuleSource ruleSource, ConceptType conc } private Constraint createConstraint(String id, RuleSource ruleSource, ConstraintType constraintType) throws RuleException { - Executable executable = createExecutable(constraintType, constraintType.getSource(), constraintType.getCypher(), constraintType.getScript()); + Executable executable = createExecutable(constraintType.getSource(), constraintType.getCypher(), constraintType.getScript()); String description = removeIndent(constraintType.getDescription()); Map parameters = getRequiredParameters(constraintType.getRequiresParameter()); SeverityEnumType severityType = constraintType.getSeverity(); @@ -163,16 +172,18 @@ private Constraint createConstraint(String id, RuleSource ruleSource, Constraint .build(); } - private Executable createExecutable(SeverityRuleType severityRuleType, SourceType source, CypherType cypherType, SourceType scriptType) throws RuleException { + private Executable createExecutable(SourceType source, CypherType cypherType, SourceType scriptType) { if (source != null) { - return new SourceExecutable<>(source.getLanguage().toLowerCase(), source.getValue(), String.class); + return new SourceExecutable<>(source.getLanguage() + .toLowerCase(), source.getValue(), String.class); } // for compatibility if (cypherType != null) { return new CypherExecutable(cypherType.getValue()); } if (scriptType != null) { - return new ScriptExecutable(scriptType.getLanguage().toLowerCase(), scriptType.getValue()); + return new ScriptExecutable(scriptType.getLanguage() + .toLowerCase(), scriptType.getValue()); } return null; } @@ -185,10 +196,16 @@ private Verification getVerification(VerificationType verificationType) throws R RowCountVerificationType rowCountVerificationType = verificationType.getRowCount(); AggregationVerificationType aggregationVerificationType = verificationType.getAggregation(); if (aggregationVerificationType != null) { - return AggregationVerification.builder().column(aggregationVerificationType.getColumn()).min(aggregationVerificationType.getMin()) - .max(aggregationVerificationType.getMax()).build(); + return AggregationVerification.builder() + .column(aggregationVerificationType.getColumn()) + .min(aggregationVerificationType.getMin()) + .max(aggregationVerificationType.getMax()) + .build(); } else if (rowCountVerificationType != null) { - return RowCountVerification.builder().min(rowCountVerificationType.getMin()).max(rowCountVerificationType.getMax()).build(); + return RowCountVerification.builder() + .min(rowCountVerificationType.getMin()) + .max(rowCountVerificationType.getMax()) + .build(); } else { throw new RuleException("Unsupported verification " + verificationType); } @@ -200,7 +217,7 @@ private Verification getVerification(VerificationType verificationType) throws R * Read the report definition. * * @param reportType - * The report type. + * The report type. * @return The report definition. */ private Report getReport(ReportType reportType) { @@ -214,7 +231,9 @@ private Report getReport(ReportType reportType) { properties.setProperty(propertyType.getName(), propertyType.getValue()); } } - Report.ReportBuilder reportBuilder = Report.builder().primaryColumn(primaryColumn).properties(properties); + Report.ReportBuilder reportBuilder = Report.builder() + .primaryColumn(primaryColumn) + .properties(properties); if (type != null) { reportBuilder.selectedTypes(Report.selectTypes(type)); } diff --git a/core/schemata/pom.xml b/core/schemata/pom.xml index 809f3fab71..a52688655b 100644 --- a/core/schemata/pom.xml +++ b/core/schemata/pom.xml @@ -62,7 +62,7 @@ ${project.basedir}/src/main/resources/META-INF/baseline/xsd - jqassistant-baseline-v2.3.xsd + jqassistant-baseline-v2.4.xsd diff --git a/core/schemata/src/main/resources/META-INF/baseline/xsd/jqassistant-baseline-v2.3.xsd b/core/schemata/src/main/resources/META-INF/baseline/xsd/jqassistant-baseline-v2.4.xsd similarity index 99% rename from core/schemata/src/main/resources/META-INF/baseline/xsd/jqassistant-baseline-v2.3.xsd rename to core/schemata/src/main/resources/META-INF/baseline/xsd/jqassistant-baseline-v2.4.xsd index b2d78482e0..3e174caac4 100644 --- a/core/schemata/src/main/resources/META-INF/baseline/xsd/jqassistant-baseline-v2.3.xsd +++ b/core/schemata/src/main/resources/META-INF/baseline/xsd/jqassistant-baseline-v2.4.xsd @@ -1,7 +1,7 @@ diff --git a/manual/src/main/asciidoc/include/configuration.adoc b/manual/src/main/asciidoc/include/configuration.adoc index aabd41285b..0e90e1453d 100644 --- a/manual/src/main/asciidoc/include/configuration.adoc +++ b/manual/src/main/asciidoc/include/configuration.adoc @@ -211,6 +211,31 @@ jqassistant: # -Djqassistant.analyze.rule.default-group-severity: INFO|MINOR|MAJOR|CRITICAL|BLOCKER default-group-severity: + # The baseline configuration + baseline: + + # Enables baseline management for concept and constraint results. + # + # -Djqassistant.analyze.baseline.enabled: true|false + enabled: false + + # The file name for storing the baseline. + # + # -Djqassistant.analyze.baseline.file + file: jqassistant/jqassistant-baseline.xml + + # The concepts to be managed in the baseline (default: none) + # + # -Djqassistant.analyze.baseline-include.concepts[0] + include.concepts: + # - my-concept + + # The constraints to be managed in the baseline (default: all) + # + # -Djqassistant.analyze.baseline.include-constraints[0] + include-constraints: + - "*" + # The report configuration report: diff --git a/manual/src/main/asciidoc/include/introduction.adoc b/manual/src/main/asciidoc/include/introduction.adoc index 2ea9c6404c..46e2382c75 100644 --- a/manual/src/main/asciidoc/include/introduction.adoc +++ b/manual/src/main/asciidoc/include/introduction.adoc @@ -421,3 +421,46 @@ in SonarQube: ---- NOTE: The first column will be used automatically if no primary column is explicitly specified. + +==== Baseline Management + +Introducing rules to an existing codebase usually leads to a large number of existing violations. +It is a common strategy to suppress them and only check for new ones. +This can be achieved by enabling baseline management in the configuration: + +[source,yaml] +.jqassistant.yml +---- +jqassistant: + analyze: + baseline: + enabled: true +---- + +In the first analysis the existing violations will be reported. +At the same time a file `jqassistant-baseline.xml` will be created in the rule directory containing these violations as entries. +These will no longer be reported by subsequent executions. + +The file `jqassistant-baseline.xml` is supposed to be checked in into the VCS. +If an entry contained in the baseline file is no longer detected during an analysis, then the according entry will be removed from the file which can be updated in the VCS again. + +If baseline management is enabled the by default all constraint violations will be included. +This can be fine-tuned by adding further configuration properties: + +[source,yaml] +.jqassistant.yml +---- +jqassistant: + analyze: + baseline: + enabled: true + include-constraints: + - "spring-injection:*" + include-concepts: + - "spring-injection:*" +---- + +TIP: By default concepts are not included in the baseline but this can be activated (see above). +This is useful for monitoring existing concepts. +If they disappear for any reason (i.e. changed code or updated rules), then the baseline file will be updated and the change be reported by the VCS. + diff --git a/maven/src/it/analyze/baseline/.jqassistant.yml b/maven/src/it/analyze/baseline/.jqassistant.yml new file mode 100644 index 0000000000..d737602638 --- /dev/null +++ b/maven/src/it/analyze/baseline/.jqassistant.yml @@ -0,0 +1,11 @@ +jqassistant: + analyze: + groups: + - it + baseline: + enabled: true + include-concepts: + - "it:IncludedConcept" + include-constraints: + - "it:IncludedConstraint" + diff --git a/maven/src/it/analyze/baseline/invoker.properties b/maven/src/it/analyze/baseline/invoker.properties new file mode 100644 index 0000000000..eb042f5c52 --- /dev/null +++ b/maven/src/it/analyze/baseline/invoker.properties @@ -0,0 +1,5 @@ +invoker.goals.1 = verify +invoker.buildResult.1 = failure + +invoker.goals.2 = verify +invoker.buildResult.2 = success diff --git a/maven/src/it/analyze/baseline/jqassistant/it.xml b/maven/src/it/analyze/baseline/jqassistant/it.xml new file mode 100644 index 0000000000..715851efc9 --- /dev/null +++ b/maven/src/it/analyze/baseline/jqassistant/it.xml @@ -0,0 +1,48 @@ + + + + + + + + + A constraint which shall be executed. + + RETURN 1 + + + + + + + + A constraint which shall be executed. + + RETURN 1 + + + + + + + + A concept which shall be executed. + + RETURN 1 + + + + + + + + A constraint which shall be executed. + + RETURN 1 + + + + + + + diff --git a/maven/src/it/analyze/baseline/pom.xml b/maven/src/it/analyze/baseline/pom.xml new file mode 100644 index 0000000000..f179f3dbe8 --- /dev/null +++ b/maven/src/it/analyze/baseline/pom.xml @@ -0,0 +1,11 @@ + + 4.0.0 + + @project.groupId@ + @project.artifactId@.integration + @project.version@ + ../../pom.xml + + @project.artifactId@.integration.analyze.baseline + + diff --git a/maven/src/it/analyze/baseline/verify.groovy b/maven/src/it/analyze/baseline/verify.groovy new file mode 100644 index 0000000000..7f3288b8a9 --- /dev/null +++ b/maven/src/it/analyze/baseline/verify.groovy @@ -0,0 +1,23 @@ +def reportFile = new File(basedir, 'target/jqassistant/jqassistant-report.xml') +assert reportFile.exists() + +def xmlSlurper = new groovy.xml.XmlSlurper() + +def jqassistantReport = xmlSlurper.parse(reportFile) +def itGroup = jqassistantReport.group.find { it.@id = 'it' } +def includedConstraint = itGroup.constraint.find { it.@id == 'it:IncludedConstraint' } +assert includedConstraint.status == 'success' + +def baselineFile = new File(basedir, 'jqassistant/jqassistant-baseline.xml') +assert baselineFile.exists() +def jqassistantBaseline = xmlSlurper.parse(baselineFile) + +def jqassistantBaselineConstraints = jqassistantBaseline.constraint +assert jqassistantBaselineConstraints.size() == 1 +def includedConstraintBaseline = jqassistantBaselineConstraints.find { it.@id == 'it:IncludedConstraint' } +assert includedConstraintBaseline.row.size() == 1 + +def jqassistantBaselineConcepts = jqassistantBaseline.concept +assert jqassistantBaselineConcepts.size() == 1 +def includedConceptBaseline = jqassistantBaselineConcepts.find { it.@id == 'it:IncludedConcept' } +assert includedConceptBaseline.row.size() == 1