This is an automated email from the ASF dual-hosted git repository. sjaranowski pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-changes-plugin.git
The following commit(s) were added to refs/heads/master by this push: new 2767cee [MCHANGES-425] Use the latest version of modello, update changes schema 2767cee is described below commit 2767cee942d55d4b0f7d46f316b588f50ba7b809 Author: Slawomir Jaranowski <s.jaranow...@gmail.com> AuthorDate: Sat Nov 23 15:03:19 2024 +0100 [MCHANGES-425] Use the latest version of modello, update changes schema --- pom.xml | 24 +-- .../src/changes/changes.xml | 34 ++-- .../src/changes/changes.xml | 34 ++-- .../src/changes/changes.xml | 34 ++-- src/it/announce-generate/src/changes/changes.xml | 34 ++-- .../src/changes/changes.xml | 14 +- src/it/email-sender/src/changes/changes.xml | 34 ++-- .../module1/src/changes/changes.xml | 12 +- .../module3/src/changes/changes.xml | 15 +- .../src/changes/changes.xml | 12 +- .../src/changes/changes.xml | 34 ++-- src/it/report-changes-generation/verify.bsh | 86 ---------- src/it/report-changes-generation/verify.groovy | 40 +++++ .../src/changes/changes.xml | 33 ++-- .../src/changes/changes.xml | 4 +- .../report-changes-system/src/changes/changes.xml | 4 +- .../src/changes/changes.xml | 4 +- .../plugins/changes/ChangesReportGenerator.java | 53 ++---- .../plugins/changes/ChangesValidatorMojo.java | 2 +- .../plugins/changes/model/AbstractAction.java | 102 ++++++++++++ .../plugins/changes/model/AbstractRelease.java | 58 +++++++ src/main/mdo/changes.mdo | 184 ++++++--------------- src/main/script/patch-modello.groovy | 36 ---- .../using-a-custom-announcement-template.apt.vm | 22 ++- src/site/apt/index.apt.vm | 12 ++ src/site/apt/usage.apt.vm | 4 +- src/site/apt/using-changes-xsd.apt | 10 +- src/site/changes/sample-changes.xml | 6 +- src/site/site.xml | 2 +- .../plugins/changes/ChangesValidatorMojoTest.java | 4 +- .../maven/plugins/changes/ChangesXMLTest.java | 110 ++++-------- src/test/unit/announce-changes.xml | 31 ++-- src/test/unit/changes.xml | 17 +- 33 files changed, 489 insertions(+), 616 deletions(-) diff --git a/pom.xml b/pom.xml index a44265b..474e20c 100644 --- a/pom.xml +++ b/pom.xml @@ -399,15 +399,12 @@ under the License. <plugin> <groupId>org.codehaus.modello</groupId> <artifactId>modello-maven-plugin</artifactId> - <version>1.0.1</version> <configuration> - <useJava5>true</useJava5> - <version>1.0.0</version> + <version>2.0.0</version> <models> <model>src/main/mdo/changes.mdo</model> </models> </configuration> - <!-- cannot upgrade because of MODELLO-254 --> <executions> <execution> <id>site-docs</id> @@ -421,7 +418,6 @@ under the License. <goals> <goal>java</goal> <goal>xpp3-reader</goal> - <goal>xpp3-writer</goal> </goals> </execution> <execution> @@ -446,24 +442,6 @@ under the License. </execution> </executions> </plugin> - <!-- workaround to remove timestamp inserted by Modello 1.0.1 into generated .java and .xsd --> - <plugin> - <groupId>org.codehaus.gmaven</groupId> - <artifactId>groovy-maven-plugin</artifactId> - <version>2.1.1</version> - <executions> - <execution> - <id>patch-changes-xsd</id> - <goals> - <goal>execute</goal> - </goals> - <phase>process-resources</phase> - <configuration> - <source>${project.basedir}/src/main/script/patch-modello.groovy</source> - </configuration> - </execution> - </executions> - </plugin> </plugins> </build> diff --git a/src/it/announce-generate-inconsistent-issue-management/src/changes/changes.xml b/src/it/announce-generate-inconsistent-issue-management/src/changes/changes.xml index 7c86280..75a697b 100644 --- a/src/it/announce-generate-inconsistent-issue-management/src/changes/changes.xml +++ b/src/it/announce-generate-inconsistent-issue-management/src/changes/changes.xml @@ -17,9 +17,9 @@ specific language governing permissions and limitations under the License. --> -<document xmlns="http://maven.apache.org/changes/1.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd"> +<document xmlns="http://maven.apache.org/changes/2.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/changes/2.0.0 http://maven.apache.org/xsd/changes-2.0.0.xsd"> <properties> <title>Changes report Project</title> <author email="zl...@toto.com">Mr Zloug</author> @@ -32,33 +32,29 @@ under the License. <action dev="me" type="fix" issue="MCHANGES-88"> Enable retrieving component-specific issues. </action> - <action dev="jruiz" type="remove" issue="MCHANGES-899"> + <action dev="jruiz" type="remove" issue="MCHANGES-899" + fixedIssues="MCHANGES-1,JIRA-12" + due-to="John Doe,John Doe" due-to-email="j...@doe.com"> The element type " link " must be terminated by the matching end-tag. Deleted the erroneous code. - <fixes issue="MCHANGES-1"/> - <fixes issue="JIRA-12"/> - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> - <action dev="you" type="update" issue="MCHANGES-999" system="bugzilla" due-to="External Submitter"> + <action dev="you" type="update" issue="MCHANGES-999" + fixedIssues="bug-12345" + system="bugzilla" + due-to="External Submitter,John Doe" due-to-email=",j...@doe.com"> Handle different issue systems. - <fixes issue="bug-12345"/> - <dueto name="John Doe" email="j...@doe.com"/> </action> - <action dev="him" type="update"> + <action dev="him" type="update" + due-to="John Doe,John Doe" due-to-email="j...@doe.com"> Updated dependencies. - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> </release> <release version="1.0" date="2005-01-01" description="First release"> - <action dev="me" type="update" issue="MCHANGES-47" due-to="others" due-to-email="oth...@users.com"> + <action dev="me" type="update" issue="MCHANGES-47" + fixedIssues="MCHANGES-88,JIRA-YYY" + due-to="others,John Doe,John Doe" due-to-email="oth...@users.com,j...@doe.com"> Uploaded documentation on how to use the plugin. - <fixes issue="MCHANGES-88"/> - <fixes issue="JIRA-YYY"/> - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> </release> </body> diff --git a/src/it/announce-generate-no-issue-management/src/changes/changes.xml b/src/it/announce-generate-no-issue-management/src/changes/changes.xml index 7c86280..75a697b 100644 --- a/src/it/announce-generate-no-issue-management/src/changes/changes.xml +++ b/src/it/announce-generate-no-issue-management/src/changes/changes.xml @@ -17,9 +17,9 @@ specific language governing permissions and limitations under the License. --> -<document xmlns="http://maven.apache.org/changes/1.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd"> +<document xmlns="http://maven.apache.org/changes/2.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/changes/2.0.0 http://maven.apache.org/xsd/changes-2.0.0.xsd"> <properties> <title>Changes report Project</title> <author email="zl...@toto.com">Mr Zloug</author> @@ -32,33 +32,29 @@ under the License. <action dev="me" type="fix" issue="MCHANGES-88"> Enable retrieving component-specific issues. </action> - <action dev="jruiz" type="remove" issue="MCHANGES-899"> + <action dev="jruiz" type="remove" issue="MCHANGES-899" + fixedIssues="MCHANGES-1,JIRA-12" + due-to="John Doe,John Doe" due-to-email="j...@doe.com"> The element type " link " must be terminated by the matching end-tag. Deleted the erroneous code. - <fixes issue="MCHANGES-1"/> - <fixes issue="JIRA-12"/> - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> - <action dev="you" type="update" issue="MCHANGES-999" system="bugzilla" due-to="External Submitter"> + <action dev="you" type="update" issue="MCHANGES-999" + fixedIssues="bug-12345" + system="bugzilla" + due-to="External Submitter,John Doe" due-to-email=",j...@doe.com"> Handle different issue systems. - <fixes issue="bug-12345"/> - <dueto name="John Doe" email="j...@doe.com"/> </action> - <action dev="him" type="update"> + <action dev="him" type="update" + due-to="John Doe,John Doe" due-to-email="j...@doe.com"> Updated dependencies. - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> </release> <release version="1.0" date="2005-01-01" description="First release"> - <action dev="me" type="update" issue="MCHANGES-47" due-to="others" due-to-email="oth...@users.com"> + <action dev="me" type="update" issue="MCHANGES-47" + fixedIssues="MCHANGES-88,JIRA-YYY" + due-to="others,John Doe,John Doe" due-to-email="oth...@users.com,j...@doe.com"> Uploaded documentation on how to use the plugin. - <fixes issue="MCHANGES-88"/> - <fixes issue="JIRA-YYY"/> - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> </release> </body> diff --git a/src/it/announce-generate-no-url/src/changes/changes.xml b/src/it/announce-generate-no-url/src/changes/changes.xml index 7c86280..75a697b 100644 --- a/src/it/announce-generate-no-url/src/changes/changes.xml +++ b/src/it/announce-generate-no-url/src/changes/changes.xml @@ -17,9 +17,9 @@ specific language governing permissions and limitations under the License. --> -<document xmlns="http://maven.apache.org/changes/1.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd"> +<document xmlns="http://maven.apache.org/changes/2.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/changes/2.0.0 http://maven.apache.org/xsd/changes-2.0.0.xsd"> <properties> <title>Changes report Project</title> <author email="zl...@toto.com">Mr Zloug</author> @@ -32,33 +32,29 @@ under the License. <action dev="me" type="fix" issue="MCHANGES-88"> Enable retrieving component-specific issues. </action> - <action dev="jruiz" type="remove" issue="MCHANGES-899"> + <action dev="jruiz" type="remove" issue="MCHANGES-899" + fixedIssues="MCHANGES-1,JIRA-12" + due-to="John Doe,John Doe" due-to-email="j...@doe.com"> The element type " link " must be terminated by the matching end-tag. Deleted the erroneous code. - <fixes issue="MCHANGES-1"/> - <fixes issue="JIRA-12"/> - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> - <action dev="you" type="update" issue="MCHANGES-999" system="bugzilla" due-to="External Submitter"> + <action dev="you" type="update" issue="MCHANGES-999" + fixedIssues="bug-12345" + system="bugzilla" + due-to="External Submitter,John Doe" due-to-email=",j...@doe.com"> Handle different issue systems. - <fixes issue="bug-12345"/> - <dueto name="John Doe" email="j...@doe.com"/> </action> - <action dev="him" type="update"> + <action dev="him" type="update" + due-to="John Doe,John Doe" due-to-email="j...@doe.com"> Updated dependencies. - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> </release> <release version="1.0" date="2005-01-01" description="First release"> - <action dev="me" type="update" issue="MCHANGES-47" due-to="others" due-to-email="oth...@users.com"> + <action dev="me" type="update" issue="MCHANGES-47" + fixedIssues="MCHANGES-88,JIRA-YYY" + due-to="others,John Doe,John Doe" due-to-email="oth...@users.com,j...@doe.com"> Uploaded documentation on how to use the plugin. - <fixes issue="MCHANGES-88"/> - <fixes issue="JIRA-YYY"/> - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> </release> </body> diff --git a/src/it/announce-generate/src/changes/changes.xml b/src/it/announce-generate/src/changes/changes.xml index 7c86280..75a697b 100644 --- a/src/it/announce-generate/src/changes/changes.xml +++ b/src/it/announce-generate/src/changes/changes.xml @@ -17,9 +17,9 @@ specific language governing permissions and limitations under the License. --> -<document xmlns="http://maven.apache.org/changes/1.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd"> +<document xmlns="http://maven.apache.org/changes/2.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/changes/2.0.0 http://maven.apache.org/xsd/changes-2.0.0.xsd"> <properties> <title>Changes report Project</title> <author email="zl...@toto.com">Mr Zloug</author> @@ -32,33 +32,29 @@ under the License. <action dev="me" type="fix" issue="MCHANGES-88"> Enable retrieving component-specific issues. </action> - <action dev="jruiz" type="remove" issue="MCHANGES-899"> + <action dev="jruiz" type="remove" issue="MCHANGES-899" + fixedIssues="MCHANGES-1,JIRA-12" + due-to="John Doe,John Doe" due-to-email="j...@doe.com"> The element type " link " must be terminated by the matching end-tag. Deleted the erroneous code. - <fixes issue="MCHANGES-1"/> - <fixes issue="JIRA-12"/> - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> - <action dev="you" type="update" issue="MCHANGES-999" system="bugzilla" due-to="External Submitter"> + <action dev="you" type="update" issue="MCHANGES-999" + fixedIssues="bug-12345" + system="bugzilla" + due-to="External Submitter,John Doe" due-to-email=",j...@doe.com"> Handle different issue systems. - <fixes issue="bug-12345"/> - <dueto name="John Doe" email="j...@doe.com"/> </action> - <action dev="him" type="update"> + <action dev="him" type="update" + due-to="John Doe,John Doe" due-to-email="j...@doe.com"> Updated dependencies. - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> </release> <release version="1.0" date="2005-01-01" description="First release"> - <action dev="me" type="update" issue="MCHANGES-47" due-to="others" due-to-email="oth...@users.com"> + <action dev="me" type="update" issue="MCHANGES-47" + fixedIssues="MCHANGES-88,JIRA-YYY" + due-to="others,John Doe,John Doe" due-to-email="oth...@users.com,j...@doe.com"> Uploaded documentation on how to use the plugin. - <fixes issue="MCHANGES-88"/> - <fixes issue="JIRA-YYY"/> - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> </release> </body> diff --git a/src/it/announcement-generate-custom-template/src/changes/changes.xml b/src/it/announcement-generate-custom-template/src/changes/changes.xml index 3f89c6a..9e832e9 100644 --- a/src/it/announcement-generate-custom-template/src/changes/changes.xml +++ b/src/it/announcement-generate-custom-template/src/changes/changes.xml @@ -17,9 +17,9 @@ specific language governing permissions and limitations under the License. --> -<document xmlns="http://maven.apache.org/changes/1.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd"> +<document xmlns="http://maven.apache.org/changes/2.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/changes/2.0.0 http://maven.apache.org/xsd/changes-2.0.0.xsd"> <properties> <title>Changes report Project</title> <author email="zl...@toto.com">Mr Zloug</author> @@ -39,12 +39,10 @@ under the License. </release> <release version="1.0" date="2005-01-01" description="First release"> - <action dev="me" type="update" issue="MCHANGES-47" due-to="others" due-to-email="oth...@users.com"> + <action dev="me" type="update" issue="MCHANGES-47" + due-to="others,John Doe,John Doe" due-to-email="oth...@users.com,j...@doe.com" + fixedIssues="MCHANGES-88,JIRA-YYY"> Uploaded documentation on how to use the plugin. - <fixes issue="MCHANGES-88"/> - <fixes issue="JIRA-YYY"/> - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> </release> </body> diff --git a/src/it/email-sender/src/changes/changes.xml b/src/it/email-sender/src/changes/changes.xml index 48c21a4..75a697b 100644 --- a/src/it/email-sender/src/changes/changes.xml +++ b/src/it/email-sender/src/changes/changes.xml @@ -17,9 +17,9 @@ specific language governing permissions and limitations under the License. --> -<document xmlns="http://maven.apache.org/changes/1.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd"> +<document xmlns="http://maven.apache.org/changes/2.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/changes/2.0.0 http://maven.apache.org/xsd/changes-2.0.0.xsd"> <properties> <title>Changes report Project</title> <author email="zl...@toto.com">Mr Zloug</author> @@ -32,33 +32,29 @@ under the License. <action dev="me" type="fix" issue="MCHANGES-88"> Enable retrieving component-specific issues. </action> - <action dev="jruiz" type="remove" issue="MCHANGES-899"> + <action dev="jruiz" type="remove" issue="MCHANGES-899" + fixedIssues="MCHANGES-1,JIRA-12" + due-to="John Doe,John Doe" due-to-email="j...@doe.com"> The element type " link " must be terminated by the matching end-tag. Deleted the erroneous code. - <fixes issue="MCHANGES-1"/> - <fixes issue="JIRA-12"/> - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> - <action dev="you" type="update" issue="MCHANGES-999" system="bugzilla"> + <action dev="you" type="update" issue="MCHANGES-999" + fixedIssues="bug-12345" + system="bugzilla" + due-to="External Submitter,John Doe" due-to-email=",j...@doe.com"> Handle different issue systems. - <fixes issue="bug-12345"/> - <dueto name="John Doe" email="j...@doe.com"/> </action> - <action dev="him" type="update"> + <action dev="him" type="update" + due-to="John Doe,John Doe" due-to-email="j...@doe.com"> Updated dependencies. - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> </release> <release version="1.0" date="2005-01-01" description="First release"> - <action dev="me" type="update" issue="MCHANGES-47" due-to="others" due-to-email="oth...@users.com"> + <action dev="me" type="update" issue="MCHANGES-47" + fixedIssues="MCHANGES-88,JIRA-YYY" + due-to="others,John Doe,John Doe" due-to-email="oth...@users.com,j...@doe.com"> Uploaded documentation on how to use the plugin. - <fixes issue="MCHANGES-88"/> - <fixes issue="JIRA-YYY"/> - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> </release> </body> diff --git a/src/it/report-aggregated-changes-generation/module1/src/changes/changes.xml b/src/it/report-aggregated-changes-generation/module1/src/changes/changes.xml index fca6b1e..23b79a0 100644 --- a/src/it/report-aggregated-changes-generation/module1/src/changes/changes.xml +++ b/src/it/report-aggregated-changes-generation/module1/src/changes/changes.xml @@ -17,22 +17,20 @@ specific language governing permissions and limitations under the License. --> -<document xmlns="http://maven.apache.org/changes/1.0.0" +<document xmlns="http://maven.apache.org/changes/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/changes/2.0.0 http://maven.apache.org/xsd/changes-2.0.0.xsd"> <properties> <title>Changes report Project</title> <author email="zl...@toto.com">Mr Zloug</author> </properties> <body> <release version="1.1" date="2005-03-01" description="Subsequent release"> - <action dev="jruiz" type="remove"> + <action dev="jruiz" type="remove" + fixedIssues="MCHANGES-1,JIRA-12" + due-to="John Doe,John Doe" due-to-email="j...@doe.com"> The element type " link " must be terminated by the matching end-tag. Deleted the erroneous code. - <fixes issue="MCHANGES-1"/> - <fixes issue="JIRA-12"/> - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> </release> </body> diff --git a/src/it/report-aggregated-changes-generation/module3/src/changes/changes.xml b/src/it/report-aggregated-changes-generation/module3/src/changes/changes.xml index 9e5237b..d53ac96 100644 --- a/src/it/report-aggregated-changes-generation/module3/src/changes/changes.xml +++ b/src/it/report-aggregated-changes-generation/module3/src/changes/changes.xml @@ -17,24 +17,23 @@ specific language governing permissions and limitations under the License. --> -<document xmlns="http://maven.apache.org/changes/1.0.0" +<document xmlns="http://maven.apache.org/changes/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/changes/2.0.0 http://maven.apache.org/xsd/changes-2.0.0.xsd"> <properties> <title>Changes report Project</title> <author email="zl...@toto.com">Mr Zloug</author> </properties> <body> <release version="1.1" date="2005-03-01" description="Subsequent release"> - <action dev="you" type="update" system="bugzilla"> + <action dev="you" type="update" system="bugzilla" + fixedIssues="bug-12345" + due-to="John Doe" due-to-email="j...@doe.com"> Handle different issue systems. - <fixes issue="bug-12345"/> - <dueto name="John Doe" email="j...@doe.com"/> </action> - <action dev="him" type="update"> + <action dev="him" type="update" + due-to="John Doe,John Doe" due-to-email="j...@doe.com"> Updated dependencies. - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> </release> </body> diff --git a/src/it/report-aggregated-changes-generation/src/changes/changes.xml b/src/it/report-aggregated-changes-generation/src/changes/changes.xml index 8dd6310..1575513 100644 --- a/src/it/report-aggregated-changes-generation/src/changes/changes.xml +++ b/src/it/report-aggregated-changes-generation/src/changes/changes.xml @@ -17,9 +17,9 @@ specific language governing permissions and limitations under the License. --> -<document xmlns="http://maven.apache.org/changes/1.0.0" +<document xmlns="http://maven.apache.org/changes/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/changes/2.0.0 http://maven.apache.org/xsd/changes-2.0.0.xsd"> <properties> <title>Changes report Project</title> <author email="zl...@toto.com">Mr Zloug</author> @@ -35,12 +35,10 @@ under the License. </release> <release version="1.0" date="2005-01-01" description="First release"> - <action dev="me" type="update" issue="MCHANGES-47" due-to="others" due-to-email="oth...@users.com"> + <action dev="me" type="update" issue="MCHANGES-47" + fixedIssues="MCHANGES-88,JIRA-YYY" + due-to="others,John Doe,John Doe" due-to-email="oth...@users.com,j...@doe.com"> Uploaded documentation on how to use the plugin. - <fixes issue="MCHANGES-88"/> - <fixes issue="JIRA-YYY"/> - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> </release> diff --git a/src/it/report-changes-generation/src/changes/changes.xml b/src/it/report-changes-generation/src/changes/changes.xml index a3ce68e..75a697b 100644 --- a/src/it/report-changes-generation/src/changes/changes.xml +++ b/src/it/report-changes-generation/src/changes/changes.xml @@ -17,9 +17,9 @@ specific language governing permissions and limitations under the License. --> -<document xmlns="http://maven.apache.org/changes/1.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd"> +<document xmlns="http://maven.apache.org/changes/2.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/changes/2.0.0 http://maven.apache.org/xsd/changes-2.0.0.xsd"> <properties> <title>Changes report Project</title> <author email="zl...@toto.com">Mr Zloug</author> @@ -32,33 +32,29 @@ under the License. <action dev="me" type="fix" issue="MCHANGES-88"> Enable retrieving component-specific issues. </action> - <action dev="jruiz" type="remove"> + <action dev="jruiz" type="remove" issue="MCHANGES-899" + fixedIssues="MCHANGES-1,JIRA-12" + due-to="John Doe,John Doe" due-to-email="j...@doe.com"> The element type " link " must be terminated by the matching end-tag. Deleted the erroneous code. - <fixes issue="MCHANGES-1"/> - <fixes issue="JIRA-12"/> - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> - <action dev="you" type="update" system="bugzilla"> + <action dev="you" type="update" issue="MCHANGES-999" + fixedIssues="bug-12345" + system="bugzilla" + due-to="External Submitter,John Doe" due-to-email=",j...@doe.com"> Handle different issue systems. - <fixes issue="bug-12345"/> - <dueto name="John Doe" email="j...@doe.com"/> </action> - <action dev="him" type="update"> + <action dev="him" type="update" + due-to="John Doe,John Doe" due-to-email="j...@doe.com"> Updated dependencies. - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> </release> <release version="1.0" date="2005-01-01" description="First release"> - <action dev="me" type="update" issue="MCHANGES-47" due-to="others" due-to-email="oth...@users.com"> + <action dev="me" type="update" issue="MCHANGES-47" + fixedIssues="MCHANGES-88,JIRA-YYY" + due-to="others,John Doe,John Doe" due-to-email="oth...@users.com,j...@doe.com"> Uploaded documentation on how to use the plugin. - <fixes issue="MCHANGES-88"/> - <fixes issue="JIRA-YYY"/> - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> </release> </body> diff --git a/src/it/report-changes-generation/verify.bsh b/src/it/report-changes-generation/verify.bsh deleted file mode 100644 index 81d4fed..0000000 --- a/src/it/report-changes-generation/verify.bsh +++ /dev/null @@ -1,86 +0,0 @@ - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.*; -import java.nio.file.*; -import java.util.*; -import java.util.jar.*; - -boolean result = true; - -try -{ - File report = new File( basedir, "target/site/changes-report.html" ); - if ( !report.exists() ) - { - System.err.println( "report file is missing." ); - return false; - } - if ( report.isDirectory() ) - { - System.err.println( "report is directory." ); - return false; - } - String reportContent = new String(Files.readAllBytes( report.toPath() ), "UTF-8"); - - int indexOf = reportContent.indexOf( "Changes" ); - if ( indexOf < 0 ) - { - System.err.println( "changes-report.html doesn't contain Changes title" ); - return false; - } - - indexOf = reportContent.indexOf( "href=\"http://myjira/browse/MCHANGES-88\"" ); - if ( indexOf < 0 ) - { - System.err.println( "changes-report.html doesn't contain jira issue link" ); - return false; - } - - // Test for output problem caused by only using <dueTo> elements - indexOf = reportContent.indexOf( "Thanks to , " ); - if ( indexOf != -1 ) - { - System.err.println( "changes-report.html has too many dueTos in the Map" ); - return false; - } - - // Tests output problems caused by only using <fixes> element - indexOf = reportContent.indexOf( "bug-12345" ); - if ( indexOf < 0 ) - { - System.err.println( "changes-report.html doesn't contain issue text for issue specified with <fixes> element" ); - return false; - } - indexOf = reportContent.indexOf( "Fixes ." ); - if ( indexOf != -1 ) - { - System.err.println( "changes-report.html doesn't handle empty fixes attribute properly" ); - return false; - } - -} -catch( Throwable e ) -{ - e.printStackTrace(); - result = false; -} - -return result; diff --git a/src/it/report-changes-generation/verify.groovy b/src/it/report-changes-generation/verify.groovy new file mode 100644 index 0000000..d567238 --- /dev/null +++ b/src/it/report-changes-generation/verify.groovy @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +def report = new File(basedir, 'target/site/changes-report.html') +assert report.exists() + +def content = report.text + +assert content.contains('Changes'): 'changes-report.html doesn\'t contain Changes title' + +assert content.contains('href="http://myjira/browse/MCHANGES-88"'): 'changes-report.html doesn\'t contain jira issue link' + +// Test for output problem caused by only using <dueTo> elements +assert !content.contains('Thanks to , '): 'changes-report.html has too many dueTos in the Map' + +// Tests output problems caused by only using fixedIssues attribute +assert content.contains('bug-12345'): 'changes-report.html doesn\'t contain issue text for issue specified with <fixes> element' +assert !content.contains('Fixes .'): 'changes-report.html doesn\'t handle empty fixes attribute properly' + +// due-to verification +assert content.contains('<a class="externalLink" href="mailto:j...@doe.com">John Doe</a>') +assert content.contains('Thanks to External Submitter,') +assert content.contains('<a class="externalLink" href="mailto:oth...@users.com">others</a>') diff --git a/src/it/report-changes-interpolation/src/changes/changes.xml b/src/it/report-changes-interpolation/src/changes/changes.xml index 98ba05e..2f74189 100644 --- a/src/it/report-changes-interpolation/src/changes/changes.xml +++ b/src/it/report-changes-interpolation/src/changes/changes.xml @@ -17,9 +17,9 @@ specific language governing permissions and limitations under the License. --> -<document xmlns="http://maven.apache.org/changes/1.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd"> +<document xmlns="http://maven.apache.org/changes/2.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/changes/2.0.0 http://maven.apache.org/xsd/changes-2.0.0.xsd"> <properties> <title>Changes report Project</title> <author email="zl...@toto.com">Mr Zloug</author> @@ -32,33 +32,28 @@ under the License. <action dev="me" type="fix" issue="MCHANGES-88"> Enable retrieving component-specific issues. </action> - <action dev="jruiz" type="remove"> + <action dev="jruiz" type="remove" issue="MCHANGES-899" + fixedIssues="MCHANGES-1,JIRA-12" + due-to="John Doe,John Doe" due-to-email="j...@doe.com"> The element type " link " must be terminated by the matching end-tag. Deleted the erroneous code. - <fixes issue="MCHANGES-1"/> - <fixes issue="JIRA-12"/> - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> - <action dev="you" type="update" system="bugzilla"> + <action dev="you" type="update" system="bugzilla" + fixedIssues="bug-12345" + due-to="John Doe" due-to-email=",j...@doe.com"> Handle different issue systems. - <fixes issue="bug-12345"/> - <dueto name="John Doe" email="j...@doe.com"/> </action> - <action dev="him" type="update"> + <action dev="him" type="update" + due-to="John Doe,John Doe" due-to-email="j...@doe.com"> Updated dependencies. - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> </release> <release version="1.0" date="2005-01-01" description="First release"> - <action dev="me" type="update" issue="MCHANGES-47" due-to="others" due-to-email="oth...@users.com"> + <action dev="me" type="update" issue="MCHANGES-47" + fixedIssues="MCHANGES-88,JIRA-YYY" + due-to="others,John Doe,John Doe" due-to-email="oth...@users.com,j...@doe.com"> Uploaded documentation on how to use the plugin. - <fixes issue="MCHANGES-88"/> - <fixes issue="JIRA-YYY"/> - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> </release> </body> diff --git a/src/it/report-changes-system-noissuemanagement/src/changes/changes.xml b/src/it/report-changes-system-noissuemanagement/src/changes/changes.xml index 6e8d498..32e2eff 100644 --- a/src/it/report-changes-system-noissuemanagement/src/changes/changes.xml +++ b/src/it/report-changes-system-noissuemanagement/src/changes/changes.xml @@ -17,9 +17,9 @@ specific language governing permissions and limitations under the License. --> -<document xmlns="http://maven.apache.org/changes/1.0.0" +<document xmlns="http://maven.apache.org/changes/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/changes/2.0.0 http://maven.apache.org/xsd/changes-2.0.0.xsd"> <properties> <title>Changes report Project</title> <author email="zl...@toto.com">Mr Zloug</author> diff --git a/src/it/report-changes-system/src/changes/changes.xml b/src/it/report-changes-system/src/changes/changes.xml index 13e9732..5a3f838 100644 --- a/src/it/report-changes-system/src/changes/changes.xml +++ b/src/it/report-changes-system/src/changes/changes.xml @@ -17,9 +17,9 @@ specific language governing permissions and limitations under the License. --> -<document xmlns="http://maven.apache.org/changes/1.0.0" +<document xmlns="http://maven.apache.org/changes/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/changes/2.0.0 http://maven.apache.org/xsd/changes-2.0.0.xsd"> <properties> <title>Changes report Project</title> <author email="zl...@toto.com">Mr Zloug</author> diff --git a/src/it/report-jira-invalid-issuemanagement/src/changes/changes.xml b/src/it/report-jira-invalid-issuemanagement/src/changes/changes.xml index 6e8d498..32e2eff 100644 --- a/src/it/report-jira-invalid-issuemanagement/src/changes/changes.xml +++ b/src/it/report-jira-invalid-issuemanagement/src/changes/changes.xml @@ -17,9 +17,9 @@ specific language governing permissions and limitations under the License. --> -<document xmlns="http://maven.apache.org/changes/1.0.0" +<document xmlns="http://maven.apache.org/changes/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/changes/2.0.0 http://maven.apache.org/xsd/changes-2.0.0.xsd"> <properties> <title>Changes report Project</title> <author email="zl...@toto.com">Mr Zloug</author> diff --git a/src/main/java/org/apache/maven/plugins/changes/ChangesReportGenerator.java b/src/main/java/org/apache/maven/plugins/changes/ChangesReportGenerator.java index ae4806c..4deefd2 100644 --- a/src/main/java/org/apache/maven/plugins/changes/ChangesReportGenerator.java +++ b/src/main/java/org/apache/maven/plugins/changes/ChangesReportGenerator.java @@ -20,7 +20,6 @@ package org.apache.maven.plugins.changes; import java.util.HashMap; import java.util.Iterator; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.ResourceBundle; @@ -33,7 +32,6 @@ import org.apache.maven.doxia.util.DoxiaUtils; import org.apache.maven.plugins.changes.model.Action; import org.apache.maven.plugins.changes.model.Component; import org.apache.maven.plugins.changes.model.DueTo; -import org.apache.maven.plugins.changes.model.FixedIssue; import org.apache.maven.plugins.changes.model.Release; import org.apache.maven.plugins.issues.AbstractIssuesReportGenerator; @@ -226,8 +224,8 @@ public class ChangesReportGenerator extends AbstractIssuesReportGenerator { sink.text("."); } - if (StringUtils.isNotEmpty(action.getDueTo()) || (!action.getDueTos().isEmpty())) { - constructDueTo(sink, action, bundle, action.getDueTos()); + if (!action.getDueTos().isEmpty()) { + constructDueTo(sink, action, bundle); } sink.tableCell_(); @@ -251,39 +249,21 @@ public class ChangesReportGenerator extends AbstractIssuesReportGenerator { * @param sink The sink * @param action The action that was done * @param bundle A resource bundle for i18n - * @param dueTos Other people that helped with an action */ - private void constructDueTo(Sink sink, Action action, ResourceBundle bundle, List<DueTo> dueTos) { - - // Create a Map with key : dueTo name, value : dueTo email - Map<String, String> namesEmailMap = new LinkedHashMap<>(); - - // Only add the dueTo specified as attributes, if it has either a dueTo or a dueToEmail - if (StringUtils.isNotEmpty(action.getDueTo()) || StringUtils.isNotEmpty(action.getDueToEmail())) { - namesEmailMap.put(action.getDueTo(), action.getDueToEmail()); - } - - for (DueTo dueTo : dueTos) { - namesEmailMap.put(dueTo.getName(), dueTo.getEmail()); - } - - if (namesEmailMap.isEmpty()) { - return; - } + private void constructDueTo(Sink sink, Action action, ResourceBundle bundle) { sink.text(" " + bundle.getString("report.changes.text.thanx") + " "); int i = 0; - for (String currentDueTo : namesEmailMap.keySet()) { - String currentDueToEmail = namesEmailMap.get(currentDueTo); + for (DueTo dueTo : action.getDueTos()) { i++; - if (StringUtils.isNotEmpty(currentDueToEmail)) { - sinkLink(sink, currentDueTo, "mailto:" + currentDueToEmail); - } else if (StringUtils.isNotEmpty(currentDueTo)) { - sink.text(currentDueTo); + if (StringUtils.isNotEmpty(dueTo.getEmail())) { + sinkLink(sink, dueTo.getName(), "mailto:" + dueTo.getEmail()); + } else { + sink.text(dueTo.getName()); } - if (i < namesEmailMap.size()) { + if (i < action.getDueTos().size()) { sink.text(", "); } } @@ -299,7 +279,7 @@ public class ChangesReportGenerator extends AbstractIssuesReportGenerator { * @param sink The sink * @param fixes The List of issues specified as fixes elements */ - private void constructIssueLink(String issue, String system, Sink sink, List<FixedIssue> fixes) { + private void constructIssueLink(String issue, String system, Sink sink, List<String> fixes) { if (StringUtils.isNotEmpty(issue)) { sink.link(parseIssueLink(issue, system)); @@ -312,9 +292,8 @@ public class ChangesReportGenerator extends AbstractIssuesReportGenerator { } } - for (Iterator<FixedIssue> iterator = fixes.iterator(); iterator.hasNext(); ) { - FixedIssue fixedIssue = iterator.next(); - String currentIssueId = fixedIssue.getIssue(); + for (Iterator<String> iterator = fixes.iterator(); iterator.hasNext(); ) { + String currentIssueId = iterator.next(); if (StringUtils.isNotEmpty(currentIssueId)) { sink.link(parseIssueLink(currentIssueId, system)); @@ -336,7 +315,7 @@ public class ChangesReportGenerator extends AbstractIssuesReportGenerator { * @param sink The sink * @param fixes The List of issues specified as fixes elements */ - private void constructIssueText(String issue, Sink sink, List<FixedIssue> fixes) { + private void constructIssueText(String issue, Sink sink, List<String> fixes) { if (StringUtils.isNotEmpty(issue)) { sink.text(issue); @@ -345,10 +324,8 @@ public class ChangesReportGenerator extends AbstractIssuesReportGenerator { } } - for (Iterator<FixedIssue> iterator = fixes.iterator(); iterator.hasNext(); ) { - FixedIssue fixedIssue = iterator.next(); - - String currentIssueId = fixedIssue.getIssue(); + for (Iterator<String> iterator = fixes.iterator(); iterator.hasNext(); ) { + String currentIssueId = iterator.next(); if (StringUtils.isNotEmpty(currentIssueId)) { sink.text(currentIssueId); } diff --git a/src/main/java/org/apache/maven/plugins/changes/ChangesValidatorMojo.java b/src/main/java/org/apache/maven/plugins/changes/ChangesValidatorMojo.java index 5dd2d76..cb2849c 100644 --- a/src/main/java/org/apache/maven/plugins/changes/ChangesValidatorMojo.java +++ b/src/main/java/org/apache/maven/plugins/changes/ChangesValidatorMojo.java @@ -44,7 +44,7 @@ public class ChangesValidatorMojo extends AbstractChangesMojo { /** * The changes xsd version. */ - @Parameter(property = "changes.xsdVersion", defaultValue = "1.0.0") + @Parameter(property = "changes.xsdVersion", defaultValue = "2.0.0") private String changesXsdVersion; /** diff --git a/src/main/java/org/apache/maven/plugins/changes/model/AbstractAction.java b/src/main/java/org/apache/maven/plugins/changes/model/AbstractAction.java new file mode 100644 index 0000000..cce9351 --- /dev/null +++ b/src/main/java/org/apache/maven/plugins/changes/model/AbstractAction.java @@ -0,0 +1,102 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugins.changes.model; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +/** + * Abstract class with helper methods for {@link Action}. + */ +public abstract class AbstractAction { + + private List<DueTo> dueTosList; + + private List<String> fixedIssueList; + + public abstract String getDueTo(); + + public abstract String getDueToEmail(); + + public abstract String getFixedIssuesString(); + + /** + * Parse due-to and due-to-email attributes. + * + * @return a List of due-to person + */ + public List<DueTo> getDueTos() { + if (dueTosList != null) { + return dueTosList; + } + List<DueTo> result = new ArrayList<>(); + List<String> dueTos = new ArrayList<>(); + List<String> dueToEmails = new ArrayList<>(); + + if (getDueTo() != null) { + Arrays.stream(getDueTo().split(",")) + .map(String::trim) + .filter(s -> !s.isEmpty()) + .forEach(dueTos::add); + } + + if (getDueToEmail() != null) { + Arrays.stream(getDueToEmail().split(",")).map(String::trim).forEach(dueToEmails::add); + } + + while (dueToEmails.size() < dueTos.size()) { + dueToEmails.add(""); + } + + for (int i = 0; i < dueTos.size(); i++) { + DueTo dueTo = new DueTo(); + dueTo.setName(dueTos.get(i)); + dueTo.setEmail(dueToEmails.get(i)); + result.add(dueTo); + } + dueTosList = Collections.unmodifiableList(result); + return dueTosList; + } + + /** + * Parse getFixedIssues attribute. + * + * @return a list of fixed issues + */ + public List<String> getFixedIssues() { + if (fixedIssueList != null) { + return fixedIssueList; + } + List<String> result; + if (getFixedIssuesString() != null) { + result = Arrays.stream(getFixedIssuesString().split(",")) + .map(String::trim) + .filter(s -> !s.isEmpty()) + .collect(Collectors.toList()); + } else { + result = Collections.emptyList(); + } + + fixedIssueList = Collections.unmodifiableList(result); + return fixedIssueList; + } +} diff --git a/src/main/java/org/apache/maven/plugins/changes/model/AbstractRelease.java b/src/main/java/org/apache/maven/plugins/changes/model/AbstractRelease.java new file mode 100644 index 0000000..963a19a --- /dev/null +++ b/src/main/java/org/apache/maven/plugins/changes/model/AbstractRelease.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.plugins.changes.model; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * Abstract calls with helper methods for {@link Release} + */ +public abstract class AbstractRelease { + + private final List<Component> components = new ArrayList<>(); + + public abstract List<Action> getActions(); + + /** + * Retrieve action list by given type + * + * @param type action type + * @return an action list + */ + public List<Action> getActions(String type) { + return getActions().stream() + .filter(a -> a.getType() != null) + .filter(a -> a.getType().equalsIgnoreCase(type)) + .collect(Collectors.toList()); + } + + public void addComponent(String name, Release release) { + final Component component = new Component(); + component.setName(name); + component.setDescription(release.getDescription()); + component.setActions(release.getActions()); + components.add(component); + } + + public List<Component> getComponents() { + return components; + } +} diff --git a/src/main/mdo/changes.mdo b/src/main/mdo/changes.mdo index 880cb85..fd8bcb7 100644 --- a/src/main/mdo/changes.mdo +++ b/src/main/mdo/changes.mdo @@ -17,11 +17,10 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> -<model xmlns="https://codehaus-plexus.github.io/MODELLO/1.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="https://codehaus-plexus.github.io/MODELLO/1.0.0 https://codehaus-plexus.github.io/modello/xsd/modello-1.0.0.xsd" - xsd.namespace="http://maven.apache.org/changes/1.0.0" - xsd.targetNamespace="http://maven.apache.org/changes/1.0.0"> +<model xmlns="http://codehaus-plexus.github.io/MODELLO/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://codehaus-plexus.github.io/MODELLO/2.0.0 https://codehaus-plexus.github.io/modello/xsd/modello-2.0.0.xsd" + xml.namespace="http://maven.apache.org/changes/${version}" + xml.schemaLocation="https://maven.apache.org/xsd/changes-${version}.xsd"> <id>changes</id> <name>Changes</name> <description> @@ -40,11 +39,11 @@ under the License. <description> Record every release with their subsequent changes. </description> - <version>1.0.0</version> + <version>1.0.0+</version> <fields> <field> <name>properties</name> - <version>1.0.0</version> + <version>1.0.0+</version> <association> <type>Properties</type> <multiplicity>1</multiplicity> @@ -55,7 +54,7 @@ under the License. </field> <field> <name>body</name> - <version>1.0.0</version> + <version>1.0.0+</version> <required>true</required> <association> <type>Body</type> @@ -69,18 +68,18 @@ under the License. </class> <class> <name>Properties</name> - <version>1.0.0</version> + <version>1.0.0+</version> <fields> <field> <name>title</name> - <version>1.0.0</version> + <version>1.0.0+</version> <required>true</required> <type>String</type> <description>The page title.</description> </field> <field> <name>author</name> - <version>1.0.0</version> + <version>1.0.0+</version> <description>The page author.</description> <association> <type>Author</type> @@ -91,11 +90,11 @@ under the License. </class> <class xsd.compositor="sequence"> <name>Body</name> - <version>1.0.0</version> + <version>1.0.0+</version> <fields> <field> <name>releases</name> - <version>1.0.0</version> + <version>1.0.0+</version> <association xml.itemsStyle="flat"> <type>Release</type> <multiplicity>*</multiplicity> @@ -106,12 +105,13 @@ under the License. </class> <class xsd.compositor="sequence"> <name>Release</name> - <version>1.0.0</version> + <superClass>AbstractRelease</superClass> + <version>1.0.0+</version> <description>A single release of this project.</description> <fields> <field xml.attribute="true"> <name>version</name> - <version>1.0.0</version> + <version>1.0.0+</version> <required>true</required> <type>String</type> <description> @@ -120,7 +120,7 @@ under the License. </field> <field xml.attribute="true" xml.tagName="date"> <name>dateRelease</name> - <version>1.0.0</version> + <version>1.0.0+</version> <required>true</required> <type>String</type> <description> @@ -132,7 +132,7 @@ under the License. </field> <field xml.attribute="true"> <name>description</name> - <version>1.0.0</version> + <version>1.0.0+</version> <type>String</type> <description> A short description of this release. @@ -140,7 +140,7 @@ under the License. </field> <field> <name>actions</name> - <version>1.0.0</version> + <version>1.0.0+</version> <association xml.itemsStyle="flat"> <type>Action</type> <multiplicity>*</multiplicity> @@ -148,65 +148,25 @@ under the License. <description>The list of actions taken for this release.</description> </field> </fields> - <codeSegments> - <codeSegment> - <version>1.0.0</version> - <code><![CDATA[ - public java.util.List<Action> getActions(String type) - { - java.util.List<Action> actions = new java.util.ArrayList<Action>(); - for (Action action : getActions()) - { - if ( action.getType() != null && action.getType().equalsIgnoreCase( type ) ) - { - actions.add( action ); - } - } - return actions; - } - ]]></code> - </codeSegment> - <codeSegment> - <version>1.0.0</version> - <code><![CDATA[ - private final java.util.List<Component> components = new java.util.ArrayList<Component>(); - - public void addComponent(String name, Release release) - { - final Component component = new Component(); - component.setName(name); - component.setDescription(release.getDescription()); - component.setActions(release.getActions()); - components.add(component); - } - - public java.util.List<Component> getComponents() - { - return components; - } - ]]></code> - </codeSegment> - </codeSegments> - </class> <class> <name>Author</name> - <version>1.0.0</version> + <version>1.0.0+</version> <description> A description of the author page. </description> <fields> - <field> + <field xml.content="true"> <name>name</name> - <version>1.0.0</version> - <type>Content</type> + <version>1.0.0+</version> + <type>String</type> <description> The page author name. </description> </field> <field xml.attribute="true" xml.tagName="email"> <name>authorEmail</name> - <version>1.0.0</version> + <version>1.0.0+</version> <type>String</type> <description> The page author email. @@ -216,14 +176,14 @@ under the License. </class> <class> <name>Component</name> - <version>1.0.0</version> + <version>1.0.0+</version> <description> A component as a part of current release. </description> <fields> <field> <name>name</name> - <version>1.0.0</version> + <version>1.0.0+</version> <type>String</type> <description> The component name. @@ -231,7 +191,7 @@ under the License. </field> <field> <name>description</name> - <version>1.0.0</version> + <version>1.0.0+</version> <type>String</type> <description> The component description. @@ -239,7 +199,7 @@ under the License. </field> <field> <name>actions</name> - <version>1.0.0</version> + <version>1.0.0+</version> <association> <type>Action</type> <multiplicity>*</multiplicity> @@ -249,23 +209,24 @@ under the License. </fields> </class> <class xsd.compositor="sequence"> + <superClass>AbstractAction</superClass> <name>Action</name> - <version>1.0.0</version> + <version>1.0.0+</version> <description> A single action done on the project, during this release. </description> <fields> - <field> + <field xml.content="true"> <name>action</name> - <version>1.0.0</version> - <type>Content</type> + <version>1.0.0+</version> + <type>String</type> <description> A short description of the action taken. </description> </field> <field xml.attribute="true"> <name>dev</name> - <version>1.0.0</version> + <version>1.0.0+</version> <required>true</required> <type>String</type> <description> @@ -277,24 +238,24 @@ under the License. </field> <field xml.attribute="true" xml.tagName="due-to"> <name>dueTo</name> - <version>1.0.0</version> + <version>1.0.0+</version> <type>String</type> <description> Name of the person to be credited for this change. This can be used when a patch is submitted by a non-committer. + Can be a comma separated list. </description> </field> <field xml.attribute="true" xml.tagName="due-to-email"> <name>dueToEmail</name> - <version>1.0.0</version> + <version>1.0.0+</version> <type>String</type> <description> - Email of the person to be credited for this change. + Email of the person to be credited for this change. Can be a comma separated list. </description> </field> <field xml.attribute="true"> <name>issue</name> - <version>1.0.0</version> - <required>true</required> + <version>1.0.0+</version> <type>String</type> <description> <![CDATA[ @@ -306,7 +267,7 @@ under the License. </field> <field xml.attribute="true"> <name>type</name> - <version>1.0.0</version> + <version>1.0.0+</version> <required>true</required> <type>String</type> <description> @@ -323,7 +284,7 @@ under the License. </field> <field xml.attribute="true"> <name>system</name> - <version>1.0.0</version> + <version>1.0.0+</version> <type>String</type> <description> <![CDATA[ @@ -335,86 +296,39 @@ under the License. </field> <field xml.attribute="true"> <name>date</name> - <version>1.0.0</version> + <version>1.0.0+</version> <type>String</type> <description>fix date</description> </field> - <field> - <name>fixedIssues</name> - <version>1.0.0</version> - <association xml.itemsStyle="flat" xml.tagName="fixes"> - <type>FixedIssue</type> - <multiplicity>*</multiplicity> - </association> - <description>A list of fixed issues.</description> - </field> - <field> - <name>dueTos</name> - <version>1.0.0</version> - <association xml.itemsStyle="flat" xml.tagName="dueto"> - <type>DueTo</type> - <multiplicity>*</multiplicity> - </association> - <description>A list of contributors for this issue.</description> + <field xml.attribute="true" xml.tagName="fixedIssues"> + <name>fixedIssuesString</name> + <version>2.0.0+</version> + <type>String</type> + <description>A comma separated list of fixed issues.</description> </field> </fields> - <codeSegments> - <codeSegment> - <version>1.0.9+</version> - <code><![CDATA[ - public static final String ADD_ACTION = "add"; - - public static final String FIX_ACTION = "fix"; - - public static final String UPDATE_ACTION = "update"; - - public static final String REMOVE_ACTION = "remove"; - ]]></code> - </codeSegment> - </codeSegments> </class> <class xsd.compositor="sequence"> <name>DueTo</name> - <version>1.0.0</version> + <version>1.0.0+</version> <description> Name and email of the person to be credited for this change. This can be used when a patch is submitted by a non-committer. </description> <fields> <field xml.attribute="true"> <name>name</name> - <version>1.0.0</version> + <version>1.0.0+</version> <type>String</type> <description>Name of the person to be credited for this change.</description> </field> <field xml.attribute="true"> <name>email</name> - <version>1.0.0</version> + <version>1.0.0+</version> <type>String</type> <description>Email of the person to be credited for this change.</description> </field> </fields> </class> - <class xsd.compositor="sequence"> - <name>FixedIssue</name> - <version>1.0.0</version> - <description> - A fixed issue. - </description> - <fields> - <field xml.attribute="true"> - <name>issue</name> - <version>1.0.0</version> - <type>String</type> - <description> - <![CDATA[ - Id of the issue related to this change. This is the id in your issue tracking system. - <p>The Changes plugin will generate a URL out of this id. The URL is constructed using the value of the issueLinkTemplate parameter.</p> - <p>See the <a href="changes-report.html">changes-report mojo</a> for more details.</p> - ]]> - </description> - </field> - </fields> - </class> </classes> </model> diff --git a/src/main/script/patch-modello.groovy b/src/main/script/patch-modello.groovy deleted file mode 100644 index 0a29394..0000000 --- a/src/main/script/patch-modello.groovy +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -def patch( String path ) -{ - File dir = new File( basedir, path ); - for( File f : dir.listFiles() ) - { - if ( f.isFile() ) - { - content = f.text; - content = content.replaceAll( 'on \\d+-\\d+-\\d+ \\d+:\\d+:\\d+', '' ); - f.write( content ); - } - } -} - -patch( 'target/classes/META-INF/changes/xsd' ); -patch( 'target/generated-sources/modello/org/apache/maven/plugins/changes/model' ); -patch( 'target/generated-sources/modello/org/apache/maven/plugins/changes/model/io/xpp3' ); diff --git a/src/site/apt/examples/using-a-custom-announcement-template.apt.vm b/src/site/apt/examples/using-a-custom-announcement-template.apt.vm index d632395..4356eda 100644 --- a/src/site/apt/examples/using-a-custom-announcement-template.apt.vm +++ b/src/site/apt/examples/using-a-custom-announcement-template.apt.vm @@ -29,7 +29,7 @@ Using a Custom Announcement Template - The <<<announcement-generate>>> goal uses a {{{http://velocity.apache.org/}Velocity}} + The <<<announcement-generate>>> goal uses a {{{https://velocity.apache.org/}Velocity}} template to create an announcement. If you want to, you can create your own custom template. @@ -67,8 +67,7 @@ Using a Custom Announcement Template Next you want to create your own template. A wise thing is to start with the default one that is included in the plugin. You can download it from - Subversion - {{{http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-changes-plugin/src/main/resources/org/apache/maven/plugins/announcement/announcement.vm}here}}. + {{{https://github.com/apache/maven-changes-plugin/blob/master/src/main/resources/org/apache/maven/plugins/announcement/announcement.vm}here}}. It will provide you with examples on how to iterate over the actions of a release among other things. @@ -131,21 +130,26 @@ Using a Custom Announcement Template *-----------------+----------+-----------+-----------------+ | action* | String | 2.0 | What was done. *-----------------+----------+-----------+-----------------+ +| date | String | 2.0 | Fix date. +*-----------------+----------+-----------+-----------------+ | dev* | String | 2.0 | The developer who made the change. *-----------------+----------+-----------+-----------------+ -| dueTo* | String | 2.0 | If this was a contribution from a non-developer, the name of that person. +| dueTo* | String | 2.0 | If this was a contribution from a non-committer, the name of that person. *-----------------+----------+-----------+-----------------+ -| dueToEmail* | String | 2.0 | If this was a contribution from a non-developer, the e-mail address of that person. +| dueToEmail* | String | 2.0 | If this was a contribution from a non-committer, the e-mail address of that person. *-----------------+----------+-----------+-----------------+ | issue* | String | 2.0 | The key of the issue in your issue tracking system. *-----------------+----------+-----------+-----------------+ | type* | String | 2.0 | What kind of change was this. *-----------------+----------+-----------+-----------------+ +| dueTos* | List | 3.0 | Collection of parsed dueTo and dueToEmail. Each item has variable name and email. +*-----------------+----------+-----------+-----------------+ +| fixedIssues* | List | 3.0 | Collection of fixed issues. +*-----------------+----------+-----------+-----------------+ <Variables marked with * are read-only.> - Since 2.8 the Velocity Context contains all default tools as provided by the {{{http://velocity.apache.org/tools/devel/standalone.html}ToolManager}}. - See the {{{http://velocity.apache.org/tools/devel/summary.html}Tools Usage Summary}} for further details. + Velocity Context contains all default tools provided by the {{{https://velocity.apache.org/tools/devel/standalone.html}ToolManager}}. + See the {{{https://velocity.apache.org/tools/devel/tools-summary.html}Tools Usage Summary}} for further details. For information on how to access variables in your template and more, - please see the - {{{http://velocity.apache.org/engine/releases/velocity-1.4/user-guide.html}Velocity user guide}}. + see the {{{https://velocity.apache.org/engine/devel/developer-guide.html}Velocity user guide}}. diff --git a/src/site/apt/index.apt.vm b/src/site/apt/index.apt.vm index c822d1e..7132fbf 100644 --- a/src/site/apt/index.apt.vm +++ b/src/site/apt/index.apt.vm @@ -77,6 +77,18 @@ ${project.name} {{{./scm.html}source repository}} and will find supplementary information in the {{{http://maven.apache.org/guides/development/guide-helping.html}guide to helping with Maven}}. +* Migration to 3.x + +** changes.xml - schema changes + + * you should update schema in your changes.xml to <<<2.0.0>>> - {{{./using-changes-xsd.html}Using the XML Schema}}. + + * tag <<<action/dueto>>> - was removed, you can put your data into existing + <<<due-to>>> and <<<dueToEmail>>> attributes of <<<action>>> tag, + which can be comma separated. + + * tag <<<action/fixedIssues>>> - was changed to an attribute of <<action>> tag, it also can be comma separated. + * Examples To provide you with better understanding of some usages of the Changes Plugin, diff --git a/src/site/apt/usage.apt.vm b/src/site/apt/usage.apt.vm index 8c740eb..e3f1b75 100644 --- a/src/site/apt/usage.apt.vm +++ b/src/site/apt/usage.apt.vm @@ -41,9 +41,9 @@ Usage Here's an example of a typical <<<changes.xml>>>, showing the syntax: ------------------- -<document xmlns="http://maven.apache.org/changes/1.0.0" +<document xmlns="http://maven.apache.org/changes/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/changes/2.0.0 https://maven.apache.org/xsd/changes-2.0.0.xsd"> <properties> <title>Changes Tester Project</title> <author email="jr...@exist.com">Johnny R. Ruiz III</author> diff --git a/src/site/apt/using-changes-xsd.apt b/src/site/apt/using-changes-xsd.apt index 5e3f0f1..2b8ef57 100644 --- a/src/site/apt/using-changes-xsd.apt +++ b/src/site/apt/using-changes-xsd.apt @@ -1,5 +1,5 @@ ----- - Using the XML Schema Changes 1.0.0 + Using the XML Schema Changes 2.0.0 ----- Vincent Siveton ------ @@ -26,18 +26,18 @@ ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html -Using the XML Schema Changes 1.0.0 +Using the XML Schema Changes 2.0.0 - The Changes XSD is located {{{http://maven.apache.org/xsd/changes-1.0.0.xsd}here}}. + The Changes XSD is located {{{https://maven.apache.org/xsd/changes-2.0.0.xsd}here}}. Your favorite IDE probably supports validation and/or syntax highlighting for XML files by using XSD schemas. For this to work you need to specify the schema in your <<<changes.xml>>> file: +-----+ -<document xmlns="http://maven.apache.org/changes/1.0.0" +<document xmlns="http://maven.apache.org/changes/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/changes/2.0.0 https://maven.apache.org/xsd/changes-2.0.0.xsd"> ... </document> +-----+ diff --git a/src/site/changes/sample-changes.xml b/src/site/changes/sample-changes.xml index 4c53a04..4a86eaf 100644 --- a/src/site/changes/sample-changes.xml +++ b/src/site/changes/sample-changes.xml @@ -16,9 +16,9 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> -<document xmlns="http://maven.apache.org/changes/1.0.0" +<document xmlns="http://maven.apache.org/changes/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/changes/2.0.0 http://maven.apache.org/xsd/changes-2.0.0.xsd"> <properties> <title>Sample Changes Report: Title</title> <author email="jr...@exist.com">Johnny R. Ruiz III</author> @@ -38,7 +38,7 @@ under the License. </release> <release version="1.0" date="2005-01-01" description="First release"> - <action dev="jruiz" type="update"> + <action dev="jruiz" type="update" fixedIssues="MABC-123,MABC-124"> Uploaded documentation. </action> </release> diff --git a/src/site/site.xml b/src/site/site.xml index 4119803..563e5a9 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -42,7 +42,7 @@ under the License. </menu> <menu name="Reference"> <item name="changes.xml" href="changes.html"/> - <item name="changes.xsd" href="xsd/changes-1.0.0.xsd"/> + <item name="changes.xsd" href="xsd/changes-2.0.0.xsd"/> </menu> <menu name="Samples"> <item name="Sample Changes Report" href="changes-report.html"/> diff --git a/src/test/java/org/apache/maven/plugins/changes/ChangesValidatorMojoTest.java b/src/test/java/org/apache/maven/plugins/changes/ChangesValidatorMojoTest.java index 13f7b3b..7c76e2d 100644 --- a/src/test/java/org/apache/maven/plugins/changes/ChangesValidatorMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/changes/ChangesValidatorMojoTest.java @@ -41,7 +41,7 @@ public class ChangesValidatorMojoTest extends AbstractMojoTestCase { public void testValidationSuccess() throws Exception { File changesXml = new File(getBasedir(), "/src/test/unit/changes.xml"); setVariableValueToObject(mojo, "xmlPath", changesXml); - setVariableValueToObject(mojo, "changesXsdVersion", "1.0.0"); + setVariableValueToObject(mojo, "changesXsdVersion", "2.0.0"); setVariableValueToObject(mojo, "failOnError", Boolean.TRUE); mojo.execute(); } @@ -49,7 +49,7 @@ public class ChangesValidatorMojoTest extends AbstractMojoTestCase { public void testValidationFailedWithMojoFailure() throws Exception { File changesXml = new File(getBasedir(), "/src/test/unit/non-valid-changes.xml"); setVariableValueToObject(mojo, "xmlPath", changesXml); - setVariableValueToObject(mojo, "changesXsdVersion", "1.0.0"); + setVariableValueToObject(mojo, "changesXsdVersion", "2.0.0"); setVariableValueToObject(mojo, "failOnError", Boolean.TRUE); try { mojo.execute(); diff --git a/src/test/java/org/apache/maven/plugins/changes/ChangesXMLTest.java b/src/test/java/org/apache/maven/plugins/changes/ChangesXMLTest.java index c021994..0c06f8a 100644 --- a/src/test/java/org/apache/maven/plugins/changes/ChangesXMLTest.java +++ b/src/test/java/org/apache/maven/plugins/changes/ChangesXMLTest.java @@ -21,118 +21,66 @@ package org.apache.maven.plugins.changes; import java.io.File; import java.util.List; -import org.apache.maven.plugin.logging.Log; +import org.apache.maven.plugin.logging.SystemStreamLog; import org.apache.maven.plugins.changes.model.Action; import org.apache.maven.plugins.changes.model.Release; -import org.codehaus.plexus.PlexusTestCase; -import org.codehaus.plexus.logging.Logger; -import org.codehaus.plexus.logging.console.ConsoleLogger; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; /** * @author Olivier Lamy * @since 27 juil. 2008 * @version $Id$ */ -public class ChangesXMLTest extends PlexusTestCase { - - private static class MockLog implements Log { - Logger consoleLogger; - - private MockLog() { - consoleLogger = new ConsoleLogger(1, "test"); - } - - public void debug(CharSequence content) { - consoleLogger.debug(content.toString()); - } - - public void debug(Throwable error) { - consoleLogger.debug(error.getMessage()); - } - - public void debug(CharSequence content, Throwable error) { - consoleLogger.debug(error.getMessage(), error); - } - - public void error(CharSequence content) { - consoleLogger.error(content.toString()); - } - - public void error(Throwable error) { - consoleLogger.error(error.getMessage()); - } - - public void error(CharSequence content, Throwable error) { - consoleLogger.error(error.getMessage(), error); - } - - public void info(CharSequence content) { - consoleLogger.info(content.toString()); - } - - public void info(Throwable error) { - consoleLogger.info(error.getMessage()); - } - - public void info(CharSequence content, Throwable error) { - consoleLogger.info(error.getMessage(), error); - } - - public boolean isDebugEnabled() { - return consoleLogger.isDebugEnabled(); - } +public class ChangesXMLTest { - public boolean isErrorEnabled() { - return consoleLogger.isErrorEnabled(); - } - - public boolean isInfoEnabled() { - return consoleLogger.isInfoEnabled(); - } - - public boolean isWarnEnabled() { - return consoleLogger.isWarnEnabled(); - } - - public void warn(CharSequence content) { - consoleLogger.warn(content.toString()); - } - - public void warn(Throwable error) { - consoleLogger.warn(error.getMessage()); - } - - public void warn(CharSequence content, Throwable error) { - consoleLogger.warn(content.toString(), error); - } + private String getBasedir() { + final String path = System.getProperty("basedir"); + return path != null ? path : new File("").getAbsolutePath(); } + @Test public void testParseChangesFile() { File changesFile = new File(getBasedir() + "/src/test/unit/changes.xml"); - ChangesXML changesXML = new ChangesXML(changesFile, new MockLog()); + ChangesXML changesXML = new ChangesXML(changesFile, new SystemStreamLog()); assertNotNull(changesXML.getChangesDocument()); assertEquals("Changes report Project", changesXML.getTitle()); List<Release> releases = changesXML.getReleaseList(); - assertEquals(2, releases.size()); + assertEquals(3, releases.size()); for (Release release : releases) { if ("1.0".equals(release.getVersion())) { Action action = release.getActions().get(0); assertEquals(2, action.getFixedIssues().size()); - assertEquals("JIRA-XXX", action.getFixedIssues().get(0).getIssue()); - assertEquals("JIRA-YYY", action.getFixedIssues().get(1).getIssue()); + assertEquals("JIRA-XXX", action.getFixedIssues().get(0)); + assertEquals("JIRA-YYY", action.getFixedIssues().get(1)); assertEquals(2, action.getDueTos().size()); - // MODELLO-254: <action> element contains both a text (action) and sub-elements + assertEquals("John Doe", action.getDueTos().get(0).getName()); + assertEquals("j...@doe.com", action.getDueTos().get(0).getEmail()); + assertEquals("John Doe", action.getDueTos().get(1).getName()); + assertEquals("", action.getDueTos().get(1).getEmail()); assertEquals("Uploaded documentation on how to use the plugin.", action.getAction()); } + if ("2.0".equals(release.getVersion())) { + Action action = release.getActions().get(0); + assertEquals(2, action.getDueTos().size()); + assertEquals("John Doe", action.getDueTos().get(0).getName()); + assertEquals("", action.getDueTos().get(0).getEmail()); + assertEquals("John Doe", action.getDueTos().get(1).getName()); + assertEquals("j...@doe.com", action.getDueTos().get(1).getEmail()); + } } } + @Test public void testParseInvalidChangesFile() { File changesFile = new File(getBasedir() + "/src/test/unit/invalid-changes.xml"); try { - new ChangesXML(changesFile, new MockLog()); + new ChangesXML(changesFile, new SystemStreamLog()); fail("Should have thrown a ChangesXMLRuntimeException due to the invalid changes.xml file"); } catch (ChangesXMLRuntimeException e) { assertEquals("An error occurred when parsing the changes.xml file", e.getMessage()); diff --git a/src/test/unit/announce-changes.xml b/src/test/unit/announce-changes.xml index b1e7901..b16f390 100644 --- a/src/test/unit/announce-changes.xml +++ b/src/test/unit/announce-changes.xml @@ -17,9 +17,9 @@ specific language governing permissions and limitations under the License. --> -<document xmlns="http://maven.apache.org/changes/1.0.0" +<document xmlns="http://maven.apache.org/changes/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd"> + xsi:schemaLocation="http://maven.apache.org/changes/2.0.0 http://maven.apache.org/xsd/changes-2.0.0.xsd"> <properties> <title>Changes report Project</title> <author email="zl...@toto.com">Mr Zloug</author> @@ -32,33 +32,28 @@ under the License. <action dev="me" type="fix" issue="MCHANGES-88"> Enable retrieving component-specific issues. </action> - <action dev="jruiz" type="remove"> + <action dev="jruiz" type="remove" + fixedIssues="MCHANGES-1,JIRA-12" + due-to="John Doe,John Doe" due-to-email="j...@doe.com"> The element type " link " must be terminated by the matching end-tag. Deleted the erroneous code. - <fixes issue="MCHANGES-1"/> - <fixes issue="JIRA-12"/> - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> - <action dev="you" type="update" system="bugzilla"> + <action dev="you" type="update" system="bugzilla" + fixedIssues="bug-12345" + due-to="John Doe" due-to-email="j...@doe.com"> Handle different issue systems. - <fixes issue="bug-12345"/> - <dueto name="John Doe" email="j...@doe.com"/> </action> - <action dev="him" type="update"> + <action dev="him" type="update" + due-to="John Doe,John Doe" due-to-email="j...@doe.com"> Updated dependencies. - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> </release> <release version="1.0" date="2005-01-01" description="First release"> - <action dev="me" type="update" issue="MCHANGES-47" due-to="others" due-to-email="oth...@users.com"> + <action dev="me" type="update" issue="MCHANGES-47" + fixedIssues="MCHANGES-88,JIRA-YYY" + due-to="others, John Doe, John Doe" due-to-email="oth...@users.com, j...@doe.com"> Uploaded documentation on how to use the plugin. - <fixes issue="MCHANGES-88"/> - <fixes issue="JIRA-YYY"/> - <dueto name="John Doe" email="j...@doe.com"/> - <dueto name="Jane Doe"/> </action> </release> </body> diff --git a/src/test/unit/changes.xml b/src/test/unit/changes.xml index bf02d4d..0b5f168 100644 --- a/src/test/unit/changes.xml +++ b/src/test/unit/changes.xml @@ -17,8 +17,8 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> -<document xmlns="http://maven.apache.org/changes/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/xsd/changes-1.0.0.xsd"> +<document xmlns="http://maven.apache.org/changes/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/changes/2.0.0 http://maven.apache.org/xsd/changes-2.0.0.xsd"> <properties> <title>Changes report Project</title> <author email="zl...@toto.com">Mr Zloug</author> @@ -41,12 +41,15 @@ under the License. </action> </release> <release version="1.0" date="2005-01-01" description="First release"> - <action dev="me" type="update" date="2008-01-01"> + <action dev="me" type="update" date="2008-01-01" fixedIssues="JIRA-XXX,JIRA-YYY" + due-to="John Doe, John Doe" due-to-email="j...@doe.com"> + Uploaded documentation on how to use the plugin. + </action> + </release> + <release version="2.0" date="2005-01-01" description="First release"> + <action dev="me" type="update" + due-to="John Doe, John Doe" due-to-email=",j...@doe.com"> Uploaded documentation on how to use the plugin. - <fixes issue="JIRA-XXX" /> - <fixes issue="JIRA-YYY" /> - <dueto name="John Doe" email="j...@doe.com" /> - <dueto name="Jane Doe" /> </action> </release> </body>