Author: tchemit Date: 2009-09-22 21:04:32 +0200 (Tue, 22 Sep 2009) New Revision: 222 Added: jredmine/trunk/jredmine-client/src/test/java/org/nuiton/jredmine/DefaultRedmineServiceTest.java jredmine/trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/NextVersionMojo.java jredmine/trunk/maven-jredmine-plugin/src/test/java/org/nuiton/jredmine/plugin/NextVersionMojoTest.java jredmine/trunk/maven-jredmine-plugin/src/test/resources/org/nuiton/jredmine/plugin/NextVersionMojoTest/ jredmine/trunk/maven-jredmine-plugin/src/test/resources/org/nuiton/jredmine/plugin/NextVersionMojoTest/nextVersion.xml jredmine/trunk/maven-jredmine-plugin/src/test/resources/org/nuiton/jredmine/plugin/NextVersionMojoTest/skipNextVersion.xml Removed: jredmine/trunk/jredmine-client/src/test/java/org/nuiton/jredmine/RemoteServiceTest.java Modified: jredmine/trunk/jredmine-client/src/main/java/org/nuiton/jredmine/DefaultRedmineService.java jredmine/trunk/jredmine-client/src/main/java/org/nuiton/jredmine/RedmineService.java jredmine/trunk/jredmine-client/src/main/java/org/nuiton/jredmine/rest/RedmineRestClient.java jredmine/trunk/jredmine-client/src/main/redmine/jredmine/app/controllers/jredmine_controller.rb jredmine/trunk/maven-jredmine-plugin/src/test/resources/org/nuiton/jredmine/plugin/UpdateVersionMojoTest/updateVersion.xml Log: implements next-version jredmine service Modified: jredmine/trunk/jredmine-client/src/main/java/org/nuiton/jredmine/DefaultRedmineService.java =================================================================== --- jredmine/trunk/jredmine-client/src/main/java/org/nuiton/jredmine/DefaultRedmineService.java 2009-09-22 19:04:25 UTC (rev 221) +++ jredmine/trunk/jredmine-client/src/main/java/org/nuiton/jredmine/DefaultRedmineService.java 2009-09-22 19:04:32 UTC (rev 222) @@ -144,6 +144,21 @@ } @Override + public Version nextVersion(String projectId, String oldVersionId, Version newVersion) throws RedmineServiceException { + checkInit(); + RestRequest r = getRequest(RedmineRestClient.NEXT_VERSION, projectId, oldVersionId, newVersion); + // send data and obtain updated version + try { + + InputStream stream = session.sendData(r); + Version v = getDataFromStream(Version.class, stream); + return v; + } catch (Exception e) { + throw new RedmineServiceException("could not send for reason " + e.getMessage(), e); + } + } + + @Override public IssueStatus[] getIssueStatuses() throws RedmineServiceException { return getDatas(IssueStatus.class); } Modified: jredmine/trunk/jredmine-client/src/main/java/org/nuiton/jredmine/RedmineService.java =================================================================== --- jredmine/trunk/jredmine-client/src/main/java/org/nuiton/jredmine/RedmineService.java 2009-09-22 19:04:25 UTC (rev 221) +++ jredmine/trunk/jredmine-client/src/main/java/org/nuiton/jredmine/RedmineService.java 2009-09-22 19:04:32 UTC (rev 222) @@ -189,6 +189,21 @@ Version updateVersion(String projectId, Version version) throws RedmineServiceException; /** + * Prepare a new version (create it or update it). + * + * If the {@code oldVersionName} is given, then all issues unclosed from this + * old version will be move to the new version. + * + * @param projectId the name of the project + * @param oldVersionName the name of the old version (optional) + * @param newVersion the newVersion to create or update + * @return the created version + * @throws RedmineServiceException + * @see Version + */ + Version nextVersion(String projectId, String oldVersionName, Version newVersion) throws RedmineServiceException; + + /** * Add a news for a given project. * * @param projectId the name of the project Modified: jredmine/trunk/jredmine-client/src/main/java/org/nuiton/jredmine/rest/RedmineRestClient.java =================================================================== --- jredmine/trunk/jredmine-client/src/main/java/org/nuiton/jredmine/rest/RedmineRestClient.java 2009-09-22 19:04:25 UTC (rev 221) +++ jredmine/trunk/jredmine-client/src/main/java/org/nuiton/jredmine/rest/RedmineRestClient.java 2009-09-22 19:04:32 UTC (rev 222) @@ -74,6 +74,7 @@ public static final String GET_VERSION = Version.class.getName() + "detail"; public static final String ADD_VERSION = Version.class.getName() + "add"; public static final String UPDATE_VERSION = Version.class.getName() + "update"; + public static final String NEXT_VERSION = Version.class.getName() + "next"; public static final String ADD_NEWS = News.class.getName() + "add"; public static final String ADD_ATTACHMENT = Attachment.class.getName() + "add"; public static final String LOGIN = "login"; @@ -129,26 +130,46 @@ @Override public String[] getParameters(Object... args) { Version version = (Version) args[1]; + String date = version.getEffectiveDate() == null ? "" : DATE_FORMAT.format(version.getEffectiveDate()); return new String[]{ "version[name]", version.getName(), "version[description]", version.getDescription(), - "version[effective_date]", DATE_FORMAT.format(version.getEffectiveDate()) + "version[effective_date]", date }; } }); + addRequestBuilder(new ProjectScopeRequestBuilder(UPDATE_VERSION, "update_version.xml") { @Override public String[] getParameters(Object... args) { Version version = (Version) args[1]; + String date = version.getEffectiveDate() == null ? "" : DATE_FORMAT.format(version.getEffectiveDate()); return new String[]{ "version[name]", version.getName(), "version[description]", version.getDescription(), - "version[effective_date]", DATE_FORMAT.format(version.getEffectiveDate()) + "version[effective_date]", date }; } }); + addRequestBuilder(new ProjectScopeRequestBuilder(NEXT_VERSION, "next_version.xml") { + + @Override + public String[] getParameters(Object... args) { + + String oldVersionId = (String) args[1]; + Version version = (Version) args[2]; + String date = version.getEffectiveDate() == null ? "" : DATE_FORMAT.format(version.getEffectiveDate()); + return new String[]{ + "oldVersionName", oldVersionId, + "version[name]", version.getName(), + "version[description]", version.getDescription(), + "version[effective_date]", date + }; + } + }); + addRequestBuilder(new ProjectScopeRequestBuilder(ADD_NEWS, "add_news.xml") { @Override Modified: jredmine/trunk/jredmine-client/src/main/redmine/jredmine/app/controllers/jredmine_controller.rb =================================================================== --- jredmine/trunk/jredmine-client/src/main/redmine/jredmine/app/controllers/jredmine_controller.rb 2009-09-22 19:04:25 UTC (rev 221) +++ jredmine/trunk/jredmine-client/src/main/redmine/jredmine/app/controllers/jredmine_controller.rb 2009-09-22 19:04:32 UTC (rev 222) @@ -168,6 +168,52 @@ end end + # add a new version for a given project + def next_version(version = params["version"],old_version_name=params[:oldVersionName]) + if !request.post? + render_status 405, "POST method required for action next_version" + return false + end + @version = @project.versions.find_by_name(version[:name]) + if !@version + allowed = User.current.allowed_to?({:controller => 'projects', :action => "add_version"}, @project) + if !allowed + render_status 401, "No permission to add a version" + else + @version = Version.create(:project => @project, :name => version[:name]) + if version[:description] + @version['description'] = version[:description] + end + if version[:effective_date] + @version['effective_date'] = version[:effective_date] + end + if !@version.save + render_status 505, "Could not add the version..." + return false + end + end + end + if old_version_name + old_version = @project.versions.find_by_name(old_version_name) + if !old_version + render_status 505, "Could not find old version " + old_version_name + return false + end + old_issues = old_version.fixed_issues.find(:all) + + old_issues.each do |issue| + if !issue.closed? && issue.status_id != 3 + journal = issue.init_journal(User.current, params[:notes]) + # move to new version + issue.fixed_version_id = @version[:id] + issue.save + Mailer.deliver_issue_edit(journal) if Setting.notified_events.include?('issue_updated') + end + end + end + render_result @version + end + # update a existing version for a given project def update_version(version=params["version"]) if !request.post? Copied: jredmine/trunk/jredmine-client/src/test/java/org/nuiton/jredmine/DefaultRedmineServiceTest.java (from rev 208, jredmine/trunk/jredmine-client/src/test/java/org/nuiton/jredmine/RemoteServiceTest.java) =================================================================== --- jredmine/trunk/jredmine-client/src/test/java/org/nuiton/jredmine/DefaultRedmineServiceTest.java (rev 0) +++ jredmine/trunk/jredmine-client/src/test/java/org/nuiton/jredmine/DefaultRedmineServiceTest.java 2009-09-22 19:04:32 UTC (rev 222) @@ -0,0 +1,181 @@ +/* + * *##% + * JRedmine client + * Copyright (C) 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package org.nuiton.jredmine; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Assume; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.nuiton.io.rest.RestClientConfiguration; +import org.nuiton.jredmine.model.Attachment; +import org.nuiton.jredmine.model.Issue; +import org.nuiton.jredmine.model.IssueCategory; +import org.nuiton.jredmine.model.IssuePriority; +import org.nuiton.jredmine.model.IssueStatus; +import org.nuiton.jredmine.model.News; +import org.nuiton.jredmine.model.Project; +import org.nuiton.jredmine.model.Tracker; +import org.nuiton.jredmine.model.User; +import org.nuiton.jredmine.model.Version; +import org.nuiton.jredmine.rest.RedmineRestClient; + +/** + * + * @author chemit + */ +public class DefaultRedmineServiceTest { + + /** + * shared rest client (open only one session for all the test) + */ + static RedmineRestClient client; + /** + * service to test + */ + RedmineService service; + + @BeforeClass + public static void setUpClass() throws Exception { + RestClientConfiguration configuration = TestHelper.getTestConfiguration(); + + client = new RedmineRestClient(configuration); + try { + + client.open(); + } catch (Exception e) { + + // could not log + System.out.println("can not connect to server " + configuration.getRestUrl() + ", will skip test " + DefaultRedmineServiceTest.class.getName()); + } finally { + Assume.assumeTrue(client != null && client.isOpen()); + } + } + + @AfterClass + public static void tearDownClass() throws Exception { + if (client != null) { + client.close(); + } + } + + @Before + public void setUp() throws Exception { + service = new DefaultRedmineService(); + + ((RedmineServiceImplementor) service).init(client); + } + + @After + public void tearDown() throws Exception { + + service = null; + } + + @Test + public void isInit() throws Exception { + + Assert.assertFalse(new DefaultRedmineService().isInit()); + + } + + @Test + public void getProjects() throws Exception { + Project[] projects = service.getProjects(); + } + + @Test + public void getIssuePriorities() throws Exception { + IssuePriority[] suePriorities = service.getIssuePriorities(); + } + + @Test + public void getIssueStatuses() throws Exception { + IssueStatus[] sueStatuses = service.getIssueStatuses(); + } + + @Test + public void getProject() throws Exception { + Project project = service.getProject("one"); + } + + @Test + public void getIssueCategories() throws Exception { + IssueCategory[] sueCategories = service.getIssueCategories("one"); + } + + @Test + public void getTrackers() throws Exception { + Tracker[] trackers = service.getTrackers("one"); + } + + @Test + public void getNews() throws Exception { + News[] news = service.getNews("one"); + } + + @Test + public void getUsers() throws Exception { + User[] users = service.getUsers("one"); + } + + @Test + public void getVersions() throws Exception { + Version[] versions = service.getVersions("one"); + } + + @Test + public void getVersion() throws Exception { + Version version = service.getVersion("one", "1.0.0"); + } + + @Test + public void getIssues() throws Exception { + Issue[] sues = service.getIssues("one", "1.0.0"); + } + + @Test + public void getAttachments() throws Exception { + Attachment[] attachments = service.getAttachments("one", "1.0.0"); + } + + @Test + public void addVersion() throws Exception { + } + + @Test + public void addAttachment() throws Exception { + } + + @Test + public void addNews() throws Exception { + } + + @Test + public void updateVersion() throws Exception { + } + + @Test + public void nextVersion() throws Exception { + } +} Property changes on: jredmine/trunk/jredmine-client/src/test/java/org/nuiton/jredmine/DefaultRedmineServiceTest.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: svn:mergeinfo + Deleted: jredmine/trunk/jredmine-client/src/test/java/org/nuiton/jredmine/RemoteServiceTest.java =================================================================== --- jredmine/trunk/jredmine-client/src/test/java/org/nuiton/jredmine/RemoteServiceTest.java 2009-09-22 19:04:25 UTC (rev 221) +++ jredmine/trunk/jredmine-client/src/test/java/org/nuiton/jredmine/RemoteServiceTest.java 2009-09-22 19:04:32 UTC (rev 222) @@ -1,177 +0,0 @@ -/* - * *##% - * JRedmine client - * Copyright (C) 2009 CodeLutin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * ##%* - */ -package org.nuiton.jredmine; - -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Assume; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.nuiton.io.rest.RestClientConfiguration; -import org.nuiton.jredmine.model.Attachment; -import org.nuiton.jredmine.model.Issue; -import org.nuiton.jredmine.model.IssueCategory; -import org.nuiton.jredmine.model.IssuePriority; -import org.nuiton.jredmine.model.IssueStatus; -import org.nuiton.jredmine.model.News; -import org.nuiton.jredmine.model.Project; -import org.nuiton.jredmine.model.Tracker; -import org.nuiton.jredmine.model.User; -import org.nuiton.jredmine.model.Version; -import org.nuiton.jredmine.rest.RedmineRestClient; - -/** - * - * @author chemit - */ -public class RemoteServiceTest { - - /** - * shared rest client (open only one session for all the test) - */ - static RedmineRestClient client; - /** - * service to test - */ - RedmineService service; - - @BeforeClass - public static void setUpClass() throws Exception { - RestClientConfiguration configuration = TestHelper.getTestConfiguration(); - - client = new RedmineRestClient(configuration); - try { - - client.open(); - } catch (Exception e) { - - // could not log - System.out.println("can not connect to server " + configuration.getRestUrl() + ", will skip test " + RemoteServiceTest.class.getName()); - } finally { - Assume.assumeTrue(client != null && client.isOpen()); - } - } - - @AfterClass - public static void tearDownClass() throws Exception { - if (client != null) { - client.close(); - } - } - - @Before - public void setUp() throws Exception { - service = new DefaultRedmineService(); - - ((RedmineServiceImplementor) service).init(client); - } - - @After - public void tearDown() throws Exception { - - service = null; - } - - @Test - public void testIsInit() throws Exception { - - Assert.assertFalse(new DefaultRedmineService().isInit()); - - } - - @Test - public void testGetProjects() throws Exception { - Project[] projects = service.getProjects(); - } - - @Test - public void testGetIssuePriorities() throws Exception { - IssuePriority[] suePriorities = service.getIssuePriorities(); - } - - @Test - public void testGetIssueStatuses() throws Exception { - IssueStatus[] sueStatuses = service.getIssueStatuses(); - } - - @Test - public void testGetProject() throws Exception { - Project project = service.getProject("one"); - } - - @Test - public void testGetIssueCategories() throws Exception { - IssueCategory[] sueCategories = service.getIssueCategories("one"); - } - - @Test - public void testGetTrackers() throws Exception { - Tracker[] trackers = service.getTrackers("one"); - } - - @Test - public void testGetNews() throws Exception { - News[] news = service.getNews("one"); - } - - @Test - public void testGetUsers() throws Exception { - User[] users = service.getUsers("one"); - } - - @Test - public void testGetVersions() throws Exception { - Version[] versions = service.getVersions("one"); - } - - @Test - public void testGetVersion() throws Exception { - Version version = service.getVersion("one", "1.0.0"); - } - - @Test - public void testGetIssues() throws Exception { - Issue[] sues = service.getIssues("one", "1.0.0"); - } - - @Test - public void testGetAttachments() throws Exception { - Attachment[] attachments = service.getAttachments("one", "1.0.0"); - } - - @Test - public void testAddVersion() throws Exception { - } - - @Test - public void testAddAttachment() throws Exception { - } - - @Test - public void testAddNews() throws Exception { - } - - @Test - public void testUpdateVersion() throws Exception { - } -} Added: jredmine/trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/NextVersionMojo.java =================================================================== --- jredmine/trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/NextVersionMojo.java (rev 0) +++ jredmine/trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/NextVersionMojo.java 2009-09-22 19:04:32 UTC (rev 222) @@ -0,0 +1,204 @@ +/* + * *##% + * JRedmine maven plugin + * Copyright (C) 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package org.nuiton.jredmine.plugin; + +import java.text.ParseException; +import java.util.Date; +import org.apache.maven.plugin.MojoExecutionException; +import org.nuiton.jredmine.model.ModelHelper; +import org.nuiton.jredmine.model.Version; +import org.nuiton.util.PluginHelper; + +/** + * Prepare the next version to be used. + * </p> + * If a previous version is given, then move all unclosed issues from the + * previous version to the new one. + *<p/> + * + * @goal next-version + * + * @author tchemit + * @since 1.0.0 + */ +public class NextVersionMojo extends AbstractRedmineMojo { + + /** + * The news description to update to redmine server. + * + * Note : if not set, no update of the description will be made. + * + * @parameter expression="${redmine.versionDescription}" + * @since 1.0.0 + */ + protected String versionDescription; + /** + * The effective date to set on the version. + * <p/> + * The format of the date is {@code yyyy-mm-dd}. + * <p/> + * If not Set - will use current day date only if {@link #closeVersion} + * flag is on. + * + * @parameter expression="${redmine.effectiveDate}" + * @since 1.0.0 + */ + private String effectiveDate; + /** + * The name of a previous version. + * <p/> + * If not Set - will not move any issues to the new version. + * + * @parameter expression="${redmine.previousVersionName}" + * @since 1.0.0 + */ + private String previousVersionName; + /** + * A flag to skip the goal. + * + * @parameter expression="${redmine.skipNextVersion}" default-value="false" + * @since 1.0.0 + */ + private boolean skipNextVersion; + /** + * A flag to test plugin but send nothing to redmine. + * + * @parameter expression="${redmine.dryRun}" default-value="false" + * @since 1.0.0 + */ + protected boolean dryRun; + /** + * A flag to restirct only one run in a build (for multi-module context). + * + * @parameter expression="${redmine.runOnce}" default-value="true" + * @since 1.0.0 + */ + private boolean runOnce; + /** + * effective date to set + */ + private Date date; + private boolean runOnceDone; + + public NextVersionMojo() { + super(true, false, true); + } + + protected boolean isGoalSkip() { + return skipNextVersion; + } + + @Override + protected boolean init() throws Exception { + + if (isGoalSkip()) { + return true; + } + runOnceDone = false; + if (runOnce) { + // check + + if (!isExecutionRoot()) { + getLog().info("runOnce flag is on, will skip the goal"); + runOnceDone = true; + return true; + } + } + + if (versionId == null || versionId.trim().isEmpty()) { + throw new MojoExecutionException("required a versionId parameter"); + } + + versionId = PluginHelper.removeSnapshotSuffix(versionId); + + if (effectiveDate != null && !effectiveDate.trim().isEmpty()) { + try { + date = dateFormat.parse(effectiveDate); + } catch (ParseException e) { + throw new MojoExecutionException("could not parse effectivate date " + effectiveDate + " for reason " + e.getMessage(), e); + } + } + return super.init(); + } + + @Override + protected void doAction() throws Exception { + if (runOnce && runOnceDone) { + return; + } + if (isGoalSkip()) { + getLog().info("skipGoal flag is on, the goal is skip."); + return; + } + + if (dryRun) { + getLog().info("\n dryRun flag is on, no data will be send!\n"); + } + + // get version + + boolean needCreateVersion; + + Version[] versions = service.getVersions(projectId); + Version v = ModelHelper.byVersionName(versionId, versions); + + boolean usePreviousVersion = false; + if (previousVersionName != null && !previousVersionName.trim().isEmpty()) { + // retrieve previous version + Version previousVersion = ModelHelper.byVersionName(previousVersionName, versions); + if (previousVersion == null) { + getLog().warn("can not find the previous version " + previousVersionName); + } else { + usePreviousVersion = true; + } + } + + if (v == null) { + // version must be created + needCreateVersion = true; + v = new Version(); + v.setName(versionId); + } else { + + needCreateVersion = false; + } + + if (versionDescription != null && !versionDescription.trim().isEmpty()) { + v.setDescription(versionDescription.trim()); + } + + if (date != null) { + v.setEffectiveDate(date); + } + + this.releaseVersion = v; + + if (!dryRun) { + + // create version + getLog().info("next version " + releaseVersion.getName() + (usePreviousVersion ? " from previous version " + previousVersionName : "")); + + service.nextVersion(projectId, usePreviousVersion ? previousVersionName : null, releaseVersion); + } + + + } +} Property changes on: jredmine/trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/NextVersionMojo.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: jredmine/trunk/maven-jredmine-plugin/src/test/java/org/nuiton/jredmine/plugin/NextVersionMojoTest.java =================================================================== --- jredmine/trunk/maven-jredmine-plugin/src/test/java/org/nuiton/jredmine/plugin/NextVersionMojoTest.java (rev 0) +++ jredmine/trunk/maven-jredmine-plugin/src/test/java/org/nuiton/jredmine/plugin/NextVersionMojoTest.java 2009-09-22 19:04:32 UTC (rev 222) @@ -0,0 +1,47 @@ +/* + * *##% + * JRedmine maven plugin + * Copyright (C) 2009 CodeLutin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * ##%* + */ +package org.nuiton.jredmine.plugin; + +import org.junit.Test; + +/** + * @author tchemit + * @since 1.0.0 + */ +public class NextVersionMojoTest extends AbstractRedmineMojoTest<NextVersionMojo> { + + @Override + protected String getGoalName(String methodName) { + return "next-version"; + } + + @Test + public void nextVersion() throws Exception { + + mojoDoAction(); + } + + @Test + public void skipNextVersion() throws Exception { + + mojoDoAction(); + } +} Property changes on: jredmine/trunk/maven-jredmine-plugin/src/test/java/org/nuiton/jredmine/plugin/NextVersionMojoTest.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: jredmine/trunk/maven-jredmine-plugin/src/test/resources/org/nuiton/jredmine/plugin/NextVersionMojoTest/nextVersion.xml =================================================================== --- jredmine/trunk/maven-jredmine-plugin/src/test/resources/org/nuiton/jredmine/plugin/NextVersionMojoTest/nextVersion.xml (rev 0) +++ jredmine/trunk/maven-jredmine-plugin/src/test/resources/org/nuiton/jredmine/plugin/NextVersionMojoTest/nextVersion.xml 2009-09-22 19:04:32 UTC (rev 222) @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <groupId>org.nuiton.maven-redmine-plugin</groupId> + <artifactId>test-generate-changes</artifactId> + <version>0</version> + + <name>generate-changes</name> + + <build> + + <plugins> + <plugin> + <groupId>org.nuiton.jredmine</groupId> + <artifactId>maven-jredmine-plugin</artifactId> + <configuration> + <projectId>one</projectId> + <versionId>1.0.33</versionId> + <versionDescription>The next version description</versionDescription> + <previousVersionName>1.0.3</previousVersionName> + <skipNextVersion>false</skipNextVersion> + <dryRun>true</dryRun> + </configuration> + <executions> + <execution> + <goals> + <goal>next-version</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file Added: jredmine/trunk/maven-jredmine-plugin/src/test/resources/org/nuiton/jredmine/plugin/NextVersionMojoTest/skipNextVersion.xml =================================================================== --- jredmine/trunk/maven-jredmine-plugin/src/test/resources/org/nuiton/jredmine/plugin/NextVersionMojoTest/skipNextVersion.xml (rev 0) +++ jredmine/trunk/maven-jredmine-plugin/src/test/resources/org/nuiton/jredmine/plugin/NextVersionMojoTest/skipNextVersion.xml 2009-09-22 19:04:32 UTC (rev 222) @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <groupId>org.nuiton.maven-redmine-plugin</groupId> + <artifactId>test-generate-changes</artifactId> + <version>0</version> + + <name>generate-changes</name> + + <build> + + <plugins> + <plugin> + <groupId>org.nuiton.jredmine</groupId> + <artifactId>maven-jredmine-plugin</artifactId> + <configuration> + <projectId>one</projectId> + <versionId>1.0.33</versionId> + <versionDescription>The next version description</versionDescription> + <previousVersionName>1.0.3</previousVersionName> + <skipNextVersion>true</skipNextVersion> + <!--<dryRun>true</dryRun>--> + </configuration> + <executions> + <execution> + <goals> + <goal>next-version</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file Modified: jredmine/trunk/maven-jredmine-plugin/src/test/resources/org/nuiton/jredmine/plugin/UpdateVersionMojoTest/updateVersion.xml =================================================================== --- jredmine/trunk/maven-jredmine-plugin/src/test/resources/org/nuiton/jredmine/plugin/UpdateVersionMojoTest/updateVersion.xml 2009-09-22 19:04:25 UTC (rev 221) +++ jredmine/trunk/maven-jredmine-plugin/src/test/resources/org/nuiton/jredmine/plugin/UpdateVersionMojoTest/updateVersion.xml 2009-09-22 19:04:32 UTC (rev 222) @@ -27,7 +27,7 @@ <executions> <execution> <goals> - <goal>publish-release-version</goal> + <goal>update-version</goal> </goals> </execution> </executions>