r46 - in trunk: . jredmine-client/src/main/java/org/nuiton/jredmine jredmine-client/src/main/java/org/nuiton/jredmine/rest jredmine-client/src/test/java/org/nuiton/jredmine maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin
Author: tchemit Date: 2009-11-12 21:41:02 +0100 (Thu, 12 Nov 2009) New Revision: 46 Modified: trunk/jredmine-client/src/main/java/org/nuiton/jredmine/DefaultRedmineService.java trunk/jredmine-client/src/main/java/org/nuiton/jredmine/RedmineService.java trunk/jredmine-client/src/main/java/org/nuiton/jredmine/rest/DefaultRequestBuilder.java trunk/jredmine-client/src/main/java/org/nuiton/jredmine/rest/ProjectScopeRequestBuilder.java trunk/jredmine-client/src/main/java/org/nuiton/jredmine/rest/RedmineRestClient.java trunk/jredmine-client/src/main/java/org/nuiton/jredmine/rest/VersionScopeRequestBuilder.java trunk/jredmine-client/src/test/java/org/nuiton/jredmine/DefaultRedmineServiceTest.java trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/AbstractRedmineMojo.java trunk/pom.xml Log: fix Anomalie #126 Modified: trunk/jredmine-client/src/main/java/org/nuiton/jredmine/DefaultRedmineService.java =================================================================== --- trunk/jredmine-client/src/main/java/org/nuiton/jredmine/DefaultRedmineService.java 2009-11-07 10:48:58 UTC (rev 45) +++ trunk/jredmine-client/src/main/java/org/nuiton/jredmine/DefaultRedmineService.java 2009-11-12 20:41:02 UTC (rev 46) @@ -21,6 +21,7 @@ package org.nuiton.jredmine; import java.io.IOException; + import org.nuiton.io.rest.RestException; import org.nuiton.jredmine.model.Attachment; import org.nuiton.jredmine.model.News; @@ -29,7 +30,9 @@ import org.apache.commons.logging.LogFactory; import org.nuiton.io.rest.RestClient; import org.nuiton.io.rest.RestRequest; + import java.io.InputStream; + import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import org.nuiton.io.rest.RestClientConfiguration; import org.nuiton.jredmine.model.Issue; @@ -44,20 +47,19 @@ /** * Default {@link RedmineService} implementation base on a {@link RestClient} - * + * * @author chemit + * @plexus.component role="org.nuiton.jredmine.RedmineService" role-hint="default" * @since 1.0.0 - * - * @plexus.component role="org.nuiton.jredmine.RedmineService" - * role-hint="default" */ public class DefaultRedmineService implements RedmineService, RedmineServiceImplementor { protected static final Log log = LogFactory.getLog(DefaultRedmineService.class); /** * client Rest + * * @plexus.requirement role="org.nuiton.io.rest.RestClient" - * role-hint="redmine" + * role-hint="redmine" */ protected RestClient session; /** @@ -80,9 +82,9 @@ /// RedmineService implementation /////////////////////////////////////////////////////////////////////////// @Override - public Version addVersion(String projectId, Version version) throws RedmineServiceException { + public Version addVersion(String projectName, Version version) throws RedmineServiceException { checkInit(); - RestRequest r = getRequest(RedmineRestClient.ADD_VERSION, projectId, version); + RestRequest r = getRequest(RedmineRestClient.ADD_VERSION, projectName, version); // send data and obtain created version try { @@ -96,9 +98,9 @@ } @Override - public Attachment addAttachment(String projectId, String versionId, Attachment attachement) throws RedmineServiceException { + public Attachment addAttachment(String projectName, String versionName, Attachment attachement) throws RedmineServiceException { checkInit(); - RestRequest r = getRequest(RedmineRestClient.ADD_ATTACHMENT, projectId, versionId, attachement); + RestRequest r = getRequest(RedmineRestClient.ADD_ATTACHMENT, projectName, versionName, attachement); // send data and obtain created attachment try { @@ -112,9 +114,9 @@ } @Override - public News addNews(String projectId, News news) throws RedmineServiceException { + public News addNews(String projectName, News news) throws RedmineServiceException { checkInit(); - RestRequest r = getRequest(RedmineRestClient.ADD_NEWS, projectId, news); + RestRequest r = getRequest(RedmineRestClient.ADD_NEWS, projectName, news); // send data and obtain created news try { @@ -128,9 +130,9 @@ } @Override - public Version updateVersion(String projectId, Version version) throws RedmineServiceException { + public Version updateVersion(String projectName, Version version) throws RedmineServiceException { checkInit(); - RestRequest r = getRequest(RedmineRestClient.UPDATE_VERSION, projectId, version); + RestRequest r = getRequest(RedmineRestClient.UPDATE_VERSION, projectName, version); // send data and obtain updated version try { @@ -144,9 +146,9 @@ } @Override - public Version nextVersion(String projectId, String oldVersionId, Version newVersion) throws RedmineServiceException { + public Version nextVersion(String projectName, String oldVersionName, Version newVersion) throws RedmineServiceException { checkInit(); - RestRequest r = getRequest(RedmineRestClient.NEXT_VERSION, projectId, oldVersionId, newVersion); + RestRequest r = getRequest(RedmineRestClient.NEXT_VERSION, projectName, oldVersionName, newVersion); // send data and obtain updated version try { @@ -174,48 +176,48 @@ } @Override - public IssueCategory[] getIssueCategories(String projectId) throws RedmineServiceException { - return getDatas(IssueCategory.class, projectId); + public IssueCategory[] getIssueCategories(String projectName) throws RedmineServiceException { + return getDatas(IssueCategory.class, projectName); } @Override - public Project getProject(String projectId) throws RedmineServiceException { - return getData(Project.class, projectId); + public Project getProject(String projectName) throws RedmineServiceException { + return getData(Project.class, projectName); } @Override - public Tracker[] getTrackers(String projectId) throws RedmineServiceException { - return getDatas(Tracker.class, projectId); + public Tracker[] getTrackers(String projectName) throws RedmineServiceException { + return getDatas(Tracker.class, projectName); } @Override - public News[] getNews(String projectId) throws RedmineServiceException { - return getDatas(News.class, projectId); + public News[] getNews(String projectName) throws RedmineServiceException { + return getDatas(News.class, projectName); } @Override - public User[] getUsers(String projectId) throws RedmineServiceException { - return getDatas(User.class, projectId); + public User[] getUsers(String projectName) throws RedmineServiceException { + return getDatas(User.class, projectName); } @Override - public Version[] getVersions(String projectId) throws RedmineServiceException { - return getDatas(Version.class, projectId); + public Version[] getVersions(String projectName) throws RedmineServiceException { + return getDatas(Version.class, projectName); } @Override - public Version getVersion(String projectId, String versionId) throws RedmineServiceException { - return getData(Version.class, projectId, versionId); + public Version getVersion(String projectName, String versionName) throws RedmineServiceException { + return getData(Version.class, projectName, versionName); } @Override - public Attachment[] getAttachments(String projectId, String versionId) throws RedmineServiceException { - return getDatas(Attachment.class, projectId, versionId); + public Attachment[] getAttachments(String projectName, String versionName) throws RedmineServiceException { + return getDatas(Attachment.class, projectName, versionName); } @Override - public Issue[] getIssues(String projectId, String versionId) throws RedmineServiceException { - return getDatas(Issue.class, projectId, versionId); + public Issue[] getIssues(String projectName, String versionName) throws RedmineServiceException { + return getDatas(Issue.class, projectName, versionName); } /////////////////////////////////////////////////////////////////////////// Modified: trunk/jredmine-client/src/main/java/org/nuiton/jredmine/RedmineService.java =================================================================== --- trunk/jredmine-client/src/main/java/org/nuiton/jredmine/RedmineService.java 2009-11-07 10:48:58 UTC (rev 45) +++ trunk/jredmine-client/src/main/java/org/nuiton/jredmine/RedmineService.java 2009-11-12 20:41:02 UTC (rev 46) @@ -39,190 +39,192 @@ */ public interface RedmineService { - /** Plexus lookup name */ + /** + * Plexus lookup name + */ String ROLE = RedmineService.class.getName(); /** * Obtain all accessible projets for the loggued user. - * + * * @return all the projects - * @throws RedmineServiceException if any pb + * @throws RedmineServiceException if any pb while retriving datas * @see Project */ Project[] getProjects() throws RedmineServiceException; /** * Obtain all the priorities defined on a {@link Issue}. - * + * <p/> * <b>Note : </b> The priorities are common for all projects. * * @return all the issue properties - * @throws RedmineServiceException + * @throws RedmineServiceException if any pb while retriving datas * @see IssuePriority */ IssuePriority[] getIssuePriorities() throws RedmineServiceException; /** * Obtain all the statuses defined on a {@link Issue}. - * + * <p/> * <b>Note : </b> The statuses are common for all projects. * * @return all the issue statuses - * @throws RedmineServiceException + * @throws RedmineServiceException if any pb while retriving datas * @see IssueStatus */ IssueStatus[] getIssueStatuses() throws RedmineServiceException; /** * Obtain a project given his name. - * - * @param projectId the name of the project - * @return the project - * @throws RedmineServiceException + * + * @param projectName the name of the project + * @return the project + * @throws RedmineServiceException if any pb while retriving datas * @see Project */ - Project getProject(String projectId) throws RedmineServiceException; + Project getProject(String projectName) throws RedmineServiceException; /** * Obtain all categories defined on issues for a given project. - * - * @param projectId the name of the project + * + * @param projectName the name of the project * @return the categories of issues for the given project. - * @throws RedmineServiceException + * @throws RedmineServiceException if any pb while retriving datas * @see IssueCategory */ - IssueCategory[] getIssueCategories(String projectId) throws RedmineServiceException; + IssueCategory[] getIssueCategories(String projectName) throws RedmineServiceException; /** * Obtain all trackers defined on a given project. * - * @param projectId the name of the project + * @param projectName the name of the project * @return the trackers for the given project. - * @throws RedmineServiceException + * @throws RedmineServiceException if any pb while retriving datas * @see Tracker */ - Tracker[] getTrackers(String projectId) throws RedmineServiceException; + Tracker[] getTrackers(String projectName) throws RedmineServiceException; /** * Obtain all news defined on a given project. * - * @param projectId the name of the project + * @param projectName the name of the project * @return the news for the given project. - * @throws RedmineServiceException + * @throws RedmineServiceException if any pb while retriving datas * @see News */ - News[] getNews(String projectId) throws RedmineServiceException; + News[] getNews(String projectName) throws RedmineServiceException; /** * Obtain all users defined on a given project. * - * @param projectId the name of the project + * @param projectName the name of the project * @return the users for the given project. - * @throws RedmineServiceException + * @throws RedmineServiceException if any pb while retriving datas * @see User */ - User[] getUsers(String projectId) throws RedmineServiceException; + User[] getUsers(String projectName) throws RedmineServiceException; /** * Obtain all versions defined on a given project. * - * @param projectId the name of the project + * @param projectName the name of the project * @return the versions of the given project. - * @throws RedmineServiceException + * @throws RedmineServiceException if any pb while retriving datas * @see Version */ - Version[] getVersions(String projectId) throws RedmineServiceException; + Version[] getVersions(String projectName) throws RedmineServiceException; /** * Obtain a specific version for a given project. * - * @param projectId the name of the project - * @param versionId the name of the version + * @param projectName the name of the project + * @param versionName the name of the version * @return the version - * @throws RedmineServiceException + * @throws RedmineServiceException if any pb while retriving datas * @see Version */ - Version getVersion(String projectId, String versionId) throws RedmineServiceException; + Version getVersion(String projectName, String versionName) throws RedmineServiceException; /** * Obtain all issues for a specific version on a given project * - * @param projectId the name of the project - * @param versionId the name of the version + * @param projectName the name of the project + * @param versionName the name of the version * @return the issues - * @throws RedmineServiceException + * @throws RedmineServiceException if any pb while retriving datas * @see Issue */ - Issue[] getIssues(String projectId, String versionId) throws RedmineServiceException; + Issue[] getIssues(String projectName, String versionName) throws RedmineServiceException; /** * Obtain all attachments for a specific version on a given project * - * @param projectId the name of the project - * @param versionId the name of the version + * @param projectName the name of the project + * @param versionName the name of the version * @return the attachments - * @throws RedmineServiceException + * @throws RedmineServiceException if any pb while retriving datas * @see Attachment */ - Attachment[] getAttachments(String projectId, String versionId) throws RedmineServiceException; + Attachment[] getAttachments(String projectName, String versionName) throws RedmineServiceException; /** * Add a version for a given project. - * - * @param projectId the name of the project - * @param version the version to add + * + * @param projectName the name of the project + * @param version the version to add * @return the added version - * @throws RedmineServiceException + * @throws RedmineServiceException if any pb while sending and retriving datas to redmine server * @see Version */ - Version addVersion(String projectId, Version version) throws RedmineServiceException; + Version addVersion(String projectName, Version version) throws RedmineServiceException; /** * Update a version for a given project. * - * @param projectId the name of the project - * @param version the version to update + * @param projectName the name of the project + * @param version the version to update * @return the updated version - * @throws RedmineServiceException + * @throws RedmineServiceException if any pb while sending and retriving datas to redmine server * @see Version */ - Version updateVersion(String projectId, Version version) throws RedmineServiceException; + Version updateVersion(String projectName, Version version) throws RedmineServiceException; /** * Prepare a new version (create it or update it). - * + * <p/> * 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 projectName the name of the project * @param oldVersionName the name of the old version (optional) - * @param newVersion the newVersion to create or update + * @param newVersion the newVersion to create or update * @return the created version - * @throws RedmineServiceException + * @throws RedmineServiceException if any pb while sending and retriving datas to redmine server * @see Version */ - Version nextVersion(String projectId, String oldVersionName, Version newVersion) throws RedmineServiceException; + Version nextVersion(String projectName, String oldVersionName, Version newVersion) throws RedmineServiceException; /** * Add a news for a given project. * - * @param projectId the name of the project - * @param news the news to add + * @param projectName the name of the project + * @param news the news to add * @return the added news. - * @throws RedmineServiceException + * @throws RedmineServiceException if any pb while sending and retriving datas to redmine server * @see News */ - News addNews(String projectId, News news) throws RedmineServiceException; + News addNews(String projectName, News news) throws RedmineServiceException; /** * Add a attachment for a given version of a given project. - * - * @param projectId the name of the project - * @param versionId the name of the version + * + * @param projectName the name of the project + * @param versionName the name of the version * @param attachement the attachment to add * @return the added attachment - * @throws RedmineServiceException + * @throws RedmineServiceException if any pb while sending and retriving datas to redmine server * @see Attachment */ - Attachment addAttachment(String projectId, String versionId, Attachment attachement) throws RedmineServiceException; + Attachment addAttachment(String projectName, String versionName, Attachment attachement) throws RedmineServiceException; } Modified: trunk/jredmine-client/src/main/java/org/nuiton/jredmine/rest/DefaultRequestBuilder.java =================================================================== --- trunk/jredmine-client/src/main/java/org/nuiton/jredmine/rest/DefaultRequestBuilder.java 2009-11-07 10:48:58 UTC (rev 45) +++ trunk/jredmine-client/src/main/java/org/nuiton/jredmine/rest/DefaultRequestBuilder.java 2009-11-12 20:41:02 UTC (rev 46) @@ -22,12 +22,13 @@ import java.io.File; import java.util.Map; + import org.nuiton.io.rest.RestRequest; import org.nuiton.io.rest.RestRequestBuilder; /** * Default {@link RestRequestBuilder} to be used in {@link RedmineRestClient}. - * + * * @author chemit * @since 1.0.0 */ @@ -47,15 +48,23 @@ return name; } + /** + * + * @param args the args of the request + * @return TODO + */ public String[] getParameters(Object... args) { + // by default, no parameter return new String[0]; } public String[] getPath(Object... args) { + // by default, path is contextPath / action return new String[]{CONTEXT_PATH, action}; } public Map<String, File> getAttachments(Object... args) { + // by default, no attachments return null; } Modified: trunk/jredmine-client/src/main/java/org/nuiton/jredmine/rest/ProjectScopeRequestBuilder.java =================================================================== --- trunk/jredmine-client/src/main/java/org/nuiton/jredmine/rest/ProjectScopeRequestBuilder.java 2009-11-07 10:48:58 UTC (rev 45) +++ trunk/jredmine-client/src/main/java/org/nuiton/jredmine/rest/ProjectScopeRequestBuilder.java 2009-11-12 20:41:02 UTC (rev 46) @@ -22,7 +22,7 @@ /** * Builder of requests which are in a project context. - * + * * @author chemit * @since 1.0.0 */ @@ -35,14 +35,14 @@ @Override public String[] getPath(Object... args) { - // one args : projectId + // one args : projectName - String projectId = (String) args[0]; + String projectName = (String) args[0]; return new String[]{ - CONTEXT_PATH, - action, - projectId - }; + CONTEXT_PATH, + action, + projectName + }; } } Modified: trunk/jredmine-client/src/main/java/org/nuiton/jredmine/rest/RedmineRestClient.java =================================================================== --- trunk/jredmine-client/src/main/java/org/nuiton/jredmine/rest/RedmineRestClient.java 2009-11-07 10:48:58 UTC (rev 45) +++ trunk/jredmine-client/src/main/java/org/nuiton/jredmine/rest/RedmineRestClient.java 2009-11-12 20:41:02 UTC (rev 46) @@ -26,6 +26,7 @@ import java.text.SimpleDateFormat; import java.util.HashMap; import java.util.Map; + import org.apache.commons.httpclient.HttpMethod; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.StatusLine; @@ -49,12 +50,10 @@ /** * Implementation of a {@link RestClient} to access a Redmine server via the * {@code redmine_rest} rails plugin. - * + * * @author chemit + * @plexus.component role="org.nuiton.io.rest.RestClient" role-hint="redmine" * @since 1.0.0 - * - * @plexus.component role="org.nuiton.io.rest.RestClient" - * role-hint="redmine" */ public class RedmineRestClient extends RestClient { @@ -132,10 +131,10 @@ 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 - }; + "version[name]", version.getName(), + "version[description]", version.getDescription(), + "version[effective_date]", date + }; } }); @@ -146,10 +145,10 @@ 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 - }; + "version[name]", version.getName(), + "version[description]", version.getDescription(), + "version[effective_date]", date + }; } }); @@ -162,11 +161,11 @@ 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 - }; + "oldVersionName", oldVersionId, + "version[name]", version.getName(), + "version[description]", version.getDescription(), + "version[effective_date]", date + }; } }); @@ -176,10 +175,10 @@ public String[] getParameters(Object... args) { News news = (News) args[1]; return new String[]{ - "news[title]", news.getTitle(), - "news[summary]", news.getSummary(), - "news[description]", news.getDescription() - }; + "news[title]", news.getTitle(), + "news[summary]", news.getSummary(), + "news[description]", news.getDescription() + }; } }); @@ -190,9 +189,9 @@ String versionId = (String) args[1]; Attachment attachment = (Attachment) args[2]; return new String[]{ - "version_name", versionId, - "attachment[description]", attachment.getDescription() - }; + "version_name", versionId, + "attachment[description]", attachment.getDescription() + }; } @Override Modified: trunk/jredmine-client/src/main/java/org/nuiton/jredmine/rest/VersionScopeRequestBuilder.java =================================================================== --- trunk/jredmine-client/src/main/java/org/nuiton/jredmine/rest/VersionScopeRequestBuilder.java 2009-11-07 10:48:58 UTC (rev 45) +++ trunk/jredmine-client/src/main/java/org/nuiton/jredmine/rest/VersionScopeRequestBuilder.java 2009-11-12 20:41:02 UTC (rev 46) @@ -38,10 +38,10 @@ // args 1 = project id // args 2 = version name - String versionId = (String) args[1]; + String versionName = (String) args[1]; return new String[]{ - "version_name", versionId - }; + "version_name", versionName + }; } } Modified: trunk/jredmine-client/src/test/java/org/nuiton/jredmine/DefaultRedmineServiceTest.java =================================================================== --- trunk/jredmine-client/src/test/java/org/nuiton/jredmine/DefaultRedmineServiceTest.java 2009-11-07 10:48:58 UTC (rev 45) +++ trunk/jredmine-client/src/test/java/org/nuiton/jredmine/DefaultRedmineServiceTest.java 2009-11-12 20:41:02 UTC (rev 46) @@ -41,7 +41,6 @@ import org.nuiton.jredmine.rest.RedmineRestClient; /** - * * @author chemit */ public class DefaultRedmineServiceTest { @@ -161,21 +160,26 @@ @Test public void addVersion() throws Exception { + //TODO } @Test public void addAttachment() throws Exception { + //TODO } @Test public void addNews() throws Exception { + //TODO } @Test public void updateVersion() throws Exception { + //TODO } @Test public void nextVersion() throws Exception { + //TODO } } Modified: trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/AbstractRedmineMojo.java =================================================================== --- trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/AbstractRedmineMojo.java 2009-11-07 10:48:58 UTC (rev 45) +++ trunk/maven-jredmine-plugin/src/main/java/org/nuiton/jredmine/plugin/AbstractRedmineMojo.java 2009-11-12 20:41:02 UTC (rev 46) @@ -92,7 +92,7 @@ */ protected String encoding; /** - * Project identifier. + * Redmine project name. * * @parameter expression="${redmine.projectId}" default-value="${project.artifactId}" * @required @@ -100,7 +100,7 @@ */ protected String projectId; /** - * Version identifier. + * redmine version name. * * @parameter expression="${redmine.versionId}" default-value="${project.version}" * @since 1.0.0 Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2009-11-07 10:48:58 UTC (rev 45) +++ trunk/pom.xml 2009-11-12 20:41:02 UTC (rev 46) @@ -446,7 +446,7 @@ <maven.version>2.2.1</maven.version> <helper.version>1.1.0</helper.version> <license.version>2.0.0</license.version> - <jredmine.version>1.0.0-rc-2</jredmine.version> + <jredmine.version>1.0.0</jredmine.version> <!-- default license to use --> <license.licenseName>lgpl_v3</license.licenseName>
participants (1)
-
tchemit@users.nuiton.org