Skip to content

Commit 6fef78c

Browse files
authored
Support setting tags on specification items (#9)
* [#7] Support setting tags on specification items * Upgrade to most recent Asciidoc Java library Upgraded to asciidoctorj 3.0.0.
1 parent eda25aa commit 6fef78c

File tree

7 files changed

+61
-25
lines changed

7 files changed

+61
-25
lines changed

doc/changes/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22

33
* [0.1.0](changes_0.1.0.md)
44
* [0.2.0](changes_0.2.0.md)
5+
* [0.3.0](changes_0.3.0.md)

doc/changes/changes_0.3.0.md

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
11
# OpenFastTrace AsciiDoc Plugin 0.3.0, released YYYY-MM-DD
22

3-
Code name: {Codename}
3+
Code name: Add support for Tags
44

55
## Summary
66

7-
Here you can add more details about the general changes and improvements of this version.
8-
9-
## Breaking Changes
10-
11-
If there were significant or breaking changes made in this version, describe them here.
7+
Starting with this release, OpenFastTrace Tags can be set on specification items by means of the `oft-tags` attribute.
128

139
## Features
1410

15-
* If there were any major features added in this version, list them here. Each feature should contain a brief explanation and, if applicable, any issue or PR numbers related to the feature.
16-
17-
## Bug Fixes
18-
19-
* If there were any bugs fixed in this version, detail them here. Like the features, they should contain a concise explanation and relevant issue numbers.
20-
21-
## Known Issues
22-
23-
* If there are any known issues in this version that were not fixed, list them here. Provide as much detail as possible to help users understand the impact and any potential workarounds.
24-
25-
Please replace 'YYYY-MM-DD' with the actual release date, and '{Codename}' with the actual codename for this version, if any.
11+
* [Issue #7](https://github.com/itsallcode/openfasttrace-asciidoc-plugin/issues/7): Add support for specifying OpenFastTrace Tags on specitems

doc/changes/changes_0.4.0.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# OpenFastTrace AsciiDoc Plugin 0.4.0, released YYYY-MM-DD
2+
3+
Code name: {Codename}
4+
5+
## Summary
6+
7+
Here you can add more details about the general changes and improvements of this version.
8+
9+
## Breaking Changes
10+
11+
If there were significant or breaking changes made in this version, describe them here.
12+
13+
## Features
14+
15+
* If there were any major features added in this version, list them here. Each feature should contain a brief explanation and, if applicable, any issue or PR numbers related to the feature.
16+
17+
## Bug Fixes
18+
19+
* If there were any bugs fixed in this version, detail them here. Like the features, they should contain a concise explanation and relevant issue numbers.
20+
21+
## Known Issues
22+
23+
* If there are any known issues in this version that were not fixed, list them here. Provide as much detail as possible to help users understand the impact and any potential workarounds.
24+
25+
Please replace 'YYYY-MM-DD' with the actual release date, and '{Codename}' with the actual codename for this version, if any.

doc/spec/design.adoc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,19 @@ The list of artifact types that are needed to fully cover another specification
234234
This is the description of the first design item.
235235
----
236236

237+
[.specitem, oft-sid="dsn~adoc-tags-list~1", oft-covers="req~asciidoc-standard-syntax~1", oft-needs="impl, utest"]
238+
==== AsciiDoc "Tags" List
239+
240+
The list of tags that apply to a specification item can be set by means of assigning the `oft-tags` _named attribute_ to it. The value of the attribute is a comma separated list of tags.
241+
242+
.Example
243+
[example]
244+
----
245+
[.specitem, oft-sid="dsn~first-design-item~1", oft-needs="impl, utest", oft-tags="Priority1"]
246+
== First Design Item
247+
248+
This is the description of the first design item.
249+
----
237250

238251
[.specitem, oft-sid="dsn~adoc-artifact-forwarding-notation~1", oft-covers="req~artifact-type-forwarding-in-asciidoc~1", oft-needs="impl, utest"]
239252
==== AsciiDoc Artifact Forwarding Notation

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>org.itsallcode</groupId>
66
<artifactId>openfasttrace-asciidoc-plugin</artifactId>
7-
<version>0.2.0</version>
7+
<version>0.3.0-SNAPSHOT</version>
88
<packaging>jar</packaging>
99

1010
<name>OpenFastTrace AsciiDoc Importer</name>
@@ -16,9 +16,9 @@
1616
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1717
<java.version>17</java.version>
1818
<oft.version>4.1.0</oft.version>
19-
<junit.version>5.11.0-RC1</junit.version>
19+
<junit.version>5.11.4</junit.version>
2020
<jacoco.version>0.8.12</jacoco.version>
21-
<asciidoctor.version>2.5.13</asciidoctor.version>
21+
<asciidoctor.version>3.0.0</asciidoctor.version>
2222
<sonar.organization>itsallcode</sonar.organization>
2323
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
2424
<project.build.outputTimestamp>${git.commit.time}</project.build.outputTimestamp>
@@ -353,7 +353,7 @@
353353
<plugin>
354354
<groupId>org.apache.maven.plugins</groupId>
355355
<artifactId>maven-surefire-plugin</artifactId>
356-
<version>3.3.1</version>
356+
<version>3.5.2</version>
357357
<configuration>
358358
<systemPropertyVariables>
359359
<java.util.logging.config.file>src/test/resources/logging.properties</java.util.logging.config.file>

src/main/java/org/itsallcode/openfasttrace/importer/asciidoc/AsciiDocImporter.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class AsciiDocImporter implements Importer
2121
private static final String ATTRIBUTE_OFT_NEEDS = "oft-needs";
2222
private static final String ATTRIBUTE_OFT_SID = "oft-sid";
2323
private static final String ATTRIBUTE_OFT_SKIPPED = "oft-skipped";
24+
private static final String ATTRIBUTE_OFT_TAGS = "oft-tags";
2425
private static final String ATTRIBUTE_OFT_TITLE = "oft-title";
2526

2627
private static final String CONTENT_MODEL_SIMPLE = "simple";
@@ -127,6 +128,13 @@ private void processSpecificationItemCovers(final StructuralNode block)
127128
.forEach(this.listener::addCoveredId);
128129
}
129130

131+
// [impl->dsn~adoc-tags-list~1]
132+
private void processSpecificationItemTags(final StructuralNode block)
133+
{
134+
getAttributeValueAsList(block, ATTRIBUTE_OFT_TAGS)
135+
.forEach(this.listener::addTag);
136+
}
137+
130138
// [impl->dsn~adoc-specification-item-description~1]
131139
private void processSpecificationItemDescription(final StructuralNode block)
132140
{
@@ -170,6 +178,7 @@ private void processSpecificationItemBlock(final String sid, final StructuralNod
170178
processSpecificationItemDepends(block);
171179
processSpecificationItemNeeds(block);
172180
processSpecificationItemCovers(block);
181+
processSpecificationItemTags(block);
173182
processSpecificationItemDescription(block);
174183
processSpecificationItemRationale(block);
175184
processSpecificationItemComment(block);

src/test/java/org/itsallcode/openfasttrace/importer/asciidoc/AsciiDocImporterTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void testImporterIgnoresSpecItemWithoutId(final String content)
6666
"""
6767
# Spec
6868
69-
[.specitem, oft-sid="dsn~detail-design~1", oft-depends="dsn~grand-design~1, arch~general-constraints~1", oft-needs="impl, utest", oft-covers="req~first-requirement~1, req~second-requirement~1"]
69+
[.specitem, oft-sid="dsn~detail-design~1", oft-depends="dsn~grand-design~1, arch~general-constraints~1", oft-needs="impl, utest", oft-covers="req~first-requirement~1, req~second-requirement~1", oft-tags="Priority1, OtherComponent"]
7070
## A Requirement
7171
7272
The description
@@ -80,7 +80,7 @@ void testImporterIgnoresSpecItemWithoutId(final String content)
8080
"""
8181
# Spec
8282
83-
[.specitem, oft-sid="dsn~detail-design~1", oft-depends="dsn~grand-design~1, arch~general-constraints~1", oft-needs="impl, utest", oft-covers="req~first-requirement~1, req~second-requirement~1"]
83+
[.specitem, oft-sid="dsn~detail-design~1", oft-depends="dsn~grand-design~1, arch~general-constraints~1", oft-needs="impl, utest", oft-covers="req~first-requirement~1, req~second-requirement~1", oft-tags="Priority1, OtherComponent"]
8484
## A Requirement
8585
8686
[.rationale]
@@ -96,7 +96,7 @@ void testImporterIgnoresSpecItemWithoutId(final String content)
9696
# Spec
9797
9898
.A Requirement
99-
[.specitem, oft-sid="dsn~detail-design~1", oft-depends="dsn~grand-design~1, arch~general-constraints~1", oft-needs="impl, utest", oft-covers="req~first-requirement~1, req~second-requirement~1"]
99+
[.specitem, oft-sid="dsn~detail-design~1", oft-depends="dsn~grand-design~1, arch~general-constraints~1", oft-needs="impl, utest", oft-covers="req~first-requirement~1, req~second-requirement~1", oft-tags="Priority1, OtherComponent"]
100100
====
101101
102102
The description
@@ -112,7 +112,7 @@ void testImporterIgnoresSpecItemWithoutId(final String content)
112112
# Spec
113113
114114
.A Requirement
115-
[.specitem, oft-sid="dsn~detail-design~1", oft-depends="dsn~grand-design~1, arch~general-constraints~1", oft-needs="impl, utest", oft-covers="req~first-requirement~1, req~second-requirement~1"]
115+
[.specitem, oft-sid="dsn~detail-design~1", oft-depends="dsn~grand-design~1, arch~general-constraints~1", oft-needs="impl, utest", oft-covers="req~first-requirement~1, req~second-requirement~1", oft-tags="Priority1, OtherComponent"]
116116
====
117117
118118
[.rationale]
@@ -140,6 +140,8 @@ void testImporterReadsFullSpecItem(final String content)
140140
Mockito.verify(listener).addNeededArtifactType("utest");
141141
Mockito.verify(listener).addCoveredId(new SpecificationItemId.Builder("req~first-requirement~1").build());
142142
Mockito.verify(listener).addCoveredId(new SpecificationItemId.Builder("req~second-requirement~1").build());
143+
Mockito.verify(listener).addTag("Priority1");
144+
Mockito.verify(listener).addTag("OtherComponent");
143145
Mockito.verify(listener).appendDescription("The description");
144146
Mockito.verify(listener).appendRationale("The rationale");
145147
Mockito.verify(listener).appendComment("A comment");

0 commit comments

Comments
 (0)