[ https://issues.apache.org/jira/browse/MCHANGES-425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17900606#comment-17900606 ]
ASF GitHub Bot commented on MCHANGES-425: ----------------------------------------- elharo commented on code in PR #42: URL: https://github.com/apache/maven-changes-plugin/pull/42#discussion_r1855231080 ########## src/main/java/org/apache/maven/plugins/changes/model/AbstractAction.java: ########## @@ -0,0 +1,95 @@ +/* + * 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.List; + +/** + * Abstract calls 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 dut-to person Review Comment: due-to? ########## 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 java.util.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 java.util.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 java.util.List<Component> getComponents() { Review Comment: don't need java.util here ########## 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 java.util.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 java.util.List<Action> getActions(String type) { Review Comment: just List ########## src/site/apt/examples/using-a-custom-announcement-template.apt.vm: ########## @@ -131,6 +130,8 @@ 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. Review Comment: Maybe you mean committer and non-committer? ########## 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 coma separated. Review Comment: comma ########## src/main/java/org/apache/maven/plugins/changes/model/AbstractAction.java: ########## @@ -0,0 +1,95 @@ +/* + * 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.List; + +/** + * Abstract calls 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 dut-to person + */ + public List<DueTo> getDueTos() { + if (dueTosList != null) { + return dueTosList; + } + dueTosList = 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)); + dueTosList.add(dueTo); + } + return dueTosList; + } + + /** + * Parse getFixedIssues articulate. Review Comment: What is an articulate? ########## 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 coma separated. + + * tag <<<action/fixedIssues>>> - was changed to attribute of <<action>> tag, it also can be comma separated. Review Comment: an attribute ########## src/site/apt/examples/using-a-custom-announcement-template.apt.vm: ########## @@ -141,11 +142,15 @@ Using a Custom Announcement Template *-----------------+----------+-----------+-----------------+ | 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 as 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 Review Comment: no "please" ########## src/test/java/org/apache/maven/plugins/changes/ChangesXMLTest.java: ########## @@ -21,118 +21,66 @@ 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 null != path ? path : new File("").getAbsolutePath(); Review Comment: path != null or path == null > Use the latest version of modello, update changes schema > -------------------------------------------------------- > > Key: MCHANGES-425 > URL: https://issues.apache.org/jira/browse/MCHANGES-425 > Project: Maven Changes Plugin > Issue Type: Improvement > Components: modello > Reporter: Slawomir Jaranowski > Assignee: Slawomir Jaranowski > Priority: Major > Fix For: 3.0.0 > > > The newer version of moddelo doesn't support mixed xml tagsĀ > We will do: > - move fixes to atribute > - drop dueto tag - we have already attribute due-to, due-to-email -- This message was sent by Atlassian Jira (v8.20.10#820010)