Author: tchemit Date: 2014-04-16 14:53:14 +0200 (Wed, 16 Apr 2014) New Revision: 447 Url: http://forge.nuiton.org/projects/jredmine/repository/revisions/447 Log: fixes #3157 Modified: trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/AbstractRedmineMojo.java trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/DisplayDataMojo.java trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/NextVersionMojo.java trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/PublishAttachmentsMojo.java trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/PublishNewsMojo.java trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/UpdateVersionMojo.java trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/announcement/AbstractAnnouncementMojo.java trunk/jredmine-maven-plugin/src/test/java/org/nuiton/jredmine/RedmineFixtures.java trunk/jredmine-maven-plugin/src/test/java/org/nuiton/jredmine/RedmineLogguedFixtureClassRule.java Modified: trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/AbstractRedmineMojo.java =================================================================== --- trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/AbstractRedmineMojo.java 2014-04-16 12:52:49 UTC (rev 446) +++ trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/AbstractRedmineMojo.java 2014-04-16 12:53:14 UTC (rev 447) @@ -268,20 +268,18 @@ ); if (verbose) { - if (isAnonymous()) { + + if (authConfiguration.isUseApiKey()) { + getLog().info("Redmine configuration :\n>> host : " + + getUrl() + "\n>> apiKey: " + + apiKey); + } else if (authConfiguration.isUseUsername()) { + getLog().info("Redmine configuration :\n>> host : " + + getUrl() + "\n>> username : " + + username); + } else { getLog().info("Redmine anonymous configuration :\n>> host : " + getUrl()); - } else { - - if (authConfiguration.isUseApiKey()) { - getLog().info("Redmine configuration :\n>> host : " + - getUrl() + "\n>> apiKey: " + - apiKey); - } else { - getLog().info("Redmine configuration :\n>> host : " + - getUrl() + "\n>> username : " + - username); - } } } Modified: trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/DisplayDataMojo.java =================================================================== --- trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/DisplayDataMojo.java 2014-04-16 12:52:49 UTC (rev 446) +++ trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/DisplayDataMojo.java 2014-04-16 12:53:14 UTC (rev 447) @@ -110,19 +110,6 @@ @Parameter(property = "sortById", defaultValue = "true", required = true) protected boolean sortById; - /** - * Flag to know if anonymous connexion to redmine server is required. - * <p/> - * For this goal, the default value is {@code true} - * <p/> - * <b>Note:</b> If set to {@code false}, you should fill {@link #username} - * and {@link #password} properties. - * - * @since 1.1.3 - */ - @Parameter(property = "anonymous", defaultValue = "true") - protected boolean anonymous; - /////////////////////////////////////////////////////////////////////////// /// Mojo internal attributes /////////////////////////////////////////////////////////////////////////// @@ -164,20 +151,6 @@ } /////////////////////////////////////////////////////////////////////////// - /// RedmineClientConfiguration - /////////////////////////////////////////////////////////////////////////// - - @Override - public boolean isAnonymous() { - return anonymous; - } - - @Override - public void setAnonymous(boolean anonymous) { - this.anonymous = anonymous; - } - - /////////////////////////////////////////////////////////////////////////// /// RedmineProjectAware /////////////////////////////////////////////////////////////////////////// @@ -301,7 +274,8 @@ throw new MojoFailureException( "The data type '" + dataType + "' can not be used, Accepted types are : " + - universeList); + universeList + ); } DataScope scope = namestoScope.get(dataType); @@ -314,7 +288,8 @@ throw new MojoFailureException( "The data type '" + dataType + "', depends on a project, but the 'projectId' was " + - "not filled."); + "not filled." + ); } } if (DataScope.VERSION.equals(scope)) { @@ -324,7 +299,8 @@ throw new MojoFailureException( "The data type '" + dataType + "', depends on a version, but the 'versionId' was " + - "not filled."); + "not filled." + ); } } results.add(dataType); Modified: trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/NextVersionMojo.java =================================================================== --- trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/NextVersionMojo.java 2014-04-16 12:52:49 UTC (rev 446) +++ trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/NextVersionMojo.java 2014-04-16 12:53:14 UTC (rev 447) @@ -52,17 +52,6 @@ /////////////////////////////////////////////////////////////////////////// /** - * Flag to know if anonymous connexion to redmine server is required. - * <p/> - * <b>Note:</b> If set to {@code false}, you should fill {@link #username} - * and {@link #password} properties. - * - * @since 1.1.3 - */ - @Parameter(property = "redmine.anonymous", defaultValue = "false") - protected boolean anonymous; - - /** * The news description to update to redmine server. * <p/> * Note : if not set, no update of the description will be made. @@ -155,20 +144,6 @@ } /////////////////////////////////////////////////////////////////////////// - /// RedmineClientConfiguration - /////////////////////////////////////////////////////////////////////////// - - @Override - public boolean isAnonymous() { - return anonymous; - } - - @Override - public void setAnonymous(boolean anonymous) { - this.anonymous = anonymous; - } - - /////////////////////////////////////////////////////////////////////////// /// DryRunAware /////////////////////////////////////////////////////////////////////////// Modified: trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/PublishAttachmentsMojo.java =================================================================== --- trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/PublishAttachmentsMojo.java 2014-04-16 12:52:49 UTC (rev 446) +++ trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/PublishAttachmentsMojo.java 2014-04-16 12:53:14 UTC (rev 447) @@ -53,17 +53,6 @@ /////////////////////////////////////////////////////////////////////////// /** - * Flag to know if anonymous connexion to redmine server is required. - * <p/> - * <b>Note:</b> If set to {@code false}, you should fill {@link #username} - * and {@link #password} properties. - * - * @since 1.1.3 - */ - @Parameter(property = "redmine.anonymous", defaultValue = "false") - protected boolean anonymous; - - /** * The path of a properties files where files to deploy are descriped. * <p/> * The key of a property is the sortor key @@ -134,20 +123,6 @@ } /////////////////////////////////////////////////////////////////////////// - /// RedmineClientConfiguration - /////////////////////////////////////////////////////////////////////////// - - @Override - public boolean isAnonymous() { - return anonymous; - } - - @Override - public void setAnonymous(boolean anonymous) { - this.anonymous = anonymous; - } - - /////////////////////////////////////////////////////////////////////////// /// DryRunAware /////////////////////////////////////////////////////////////////////////// Modified: trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/PublishNewsMojo.java =================================================================== --- trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/PublishNewsMojo.java 2014-04-16 12:52:49 UTC (rev 446) +++ trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/PublishNewsMojo.java 2014-04-16 12:53:14 UTC (rev 447) @@ -46,17 +46,6 @@ /////////////////////////////////////////////////////////////////////////// /** - * Flag to know if anonymous connexion to redmine server is required. - * <p/> - * <b>Note:</b> If set to {@code false}, you should fill {@link #username} - * and {@link #password} properties. - * - * @since 1.1.3 - */ - @Parameter(property = "redmine.anonymous", defaultValue = "false") - protected boolean anonymous; - - /** * The content file of the news. * * @since 1.0.0 @@ -123,20 +112,6 @@ } /////////////////////////////////////////////////////////////////////////// - /// RedmineClientConfiguration - /////////////////////////////////////////////////////////////////////////// - - @Override - public boolean isAnonymous() { - return anonymous; - } - - @Override - public void setAnonymous(boolean anonymous) { - this.anonymous = anonymous; - } - - /////////////////////////////////////////////////////////////////////////// /// DryRunAware /////////////////////////////////////////////////////////////////////////// Modified: trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/UpdateVersionMojo.java =================================================================== --- trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/UpdateVersionMojo.java 2014-04-16 12:52:49 UTC (rev 446) +++ trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/UpdateVersionMojo.java 2014-04-16 12:53:14 UTC (rev 447) @@ -52,17 +52,6 @@ /////////////////////////////////////////////////////////////////////////// /** - * Flag to know if anonymous connexion to redmine server is required. - * <p/> - * <b>Note:</b> If set to {@code false}, you should fill {@link #username} - * and {@link #password} properties. - * - * @since 1.1.3 - */ - @Parameter(property = "redmine.anonymous", defaultValue = "false") - protected boolean anonymous; - - /** * The version description to update to redmine server. * <p/> * Note : if not set, no update of the description will be made. @@ -160,20 +149,6 @@ } /////////////////////////////////////////////////////////////////////////// - /// RedmineClientConfiguration - /////////////////////////////////////////////////////////////////////////// - - @Override - public boolean isAnonymous() { - return anonymous; - } - - @Override - public void setAnonymous(boolean anonymous) { - this.anonymous = anonymous; - } - - /////////////////////////////////////////////////////////////////////////// /// DryRunAware /////////////////////////////////////////////////////////////////////////// @@ -258,7 +233,8 @@ } catch (ParseException e) { throw new MojoExecutionException( "could not parse effectivate date " + effectiveDate + - " for reason " + e.getMessage(), e); + " for reason " + e.getMessage(), e + ); } } else if (closeVersion) { date = new Date(); @@ -278,7 +254,8 @@ "could not parse status " + versionStatus + " for reason " + e.getMessage() + ", should be one of values : " + - Arrays.toString(VersionStatusEnum.values()), e); + Arrays.toString(VersionStatusEnum.values()), e + ); } if (closeVersion) { Modified: trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/announcement/AbstractAnnouncementMojo.java =================================================================== --- trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/announcement/AbstractAnnouncementMojo.java 2014-04-16 12:52:49 UTC (rev 446) +++ trunk/jredmine-maven-plugin/src/main/java/org/nuiton/jredmine/plugin/announcement/AbstractAnnouncementMojo.java 2014-04-16 12:53:14 UTC (rev 447) @@ -52,19 +52,6 @@ /////////////////////////////////////////////////////////////////////////// /** - * Flag to know if anonymous connexion to redmine server is required. - * <p/> - * For this goal, the default value is {@code true} - * <p/> - * <b>Note:</b> If set to {@code false}, you should fill {@link #username} - * and {@link #password} properties. - * - * @since 1.1.3 - */ - @Parameter(property = "redmine.anonymous", defaultValue = "true") - protected boolean anonymous; - - /** * Directory where the template file will be generated. * * @since 1.0.0 @@ -378,20 +365,6 @@ } /////////////////////////////////////////////////////////////////////////// - /// AbstractRedmineMojo - /////////////////////////////////////////////////////////////////////////// - - @Override - public boolean isAnonymous() { - return anonymous; - } - - @Override - public void setAnonymous(boolean anonymous) { - this.anonymous = anonymous; - } - - /////////////////////////////////////////////////////////////////////////// /// AbstractPlugin /////////////////////////////////////////////////////////////////////////// Modified: trunk/jredmine-maven-plugin/src/test/java/org/nuiton/jredmine/RedmineFixtures.java =================================================================== --- trunk/jredmine-maven-plugin/src/test/java/org/nuiton/jredmine/RedmineFixtures.java 2014-04-16 12:52:49 UTC (rev 446) +++ trunk/jredmine-maven-plugin/src/test/java/org/nuiton/jredmine/RedmineFixtures.java 2014-04-16 12:53:14 UTC (rev 447) @@ -25,7 +25,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.nuiton.jredmine.service.DefaultRedmineAnonymousService; import org.nuiton.jredmine.service.DefaultRedmineService; import org.nuiton.jredmine.service.RedmineAnonymousService; import org.nuiton.jredmine.service.RedmineConfigurationUtil; @@ -80,7 +79,7 @@ public RedmineAnonymousService newRedmineAnonymousService(RedmineServiceConfiguration configuration) throws IOException, RedmineServiceException { - RedmineAnonymousService service = new DefaultRedmineAnonymousService(); + RedmineAnonymousService service = new DefaultRedmineService(); service.init(configuration); return service; } Modified: trunk/jredmine-maven-plugin/src/test/java/org/nuiton/jredmine/RedmineLogguedFixtureClassRule.java =================================================================== --- trunk/jredmine-maven-plugin/src/test/java/org/nuiton/jredmine/RedmineLogguedFixtureClassRule.java 2014-04-16 12:52:49 UTC (rev 446) +++ trunk/jredmine-maven-plugin/src/test/java/org/nuiton/jredmine/RedmineLogguedFixtureClassRule.java 2014-04-16 12:53:14 UTC (rev 447) @@ -29,6 +29,7 @@ import org.junit.rules.TestRule; import org.junit.runner.Description; import org.junit.runners.model.Statement; +import org.nuiton.jredmine.service.RedmineConfigurationUtil; import org.nuiton.jredmine.service.RedmineServiceConfiguration; import java.io.IOException; @@ -71,7 +72,7 @@ // configuration must NOT be anonymous - if (conf.isAnonymous()) { + if (!RedmineConfigurationUtil.isLoggued(conf)) { if (log.isWarnEnabled()) { log.warn("A authenticated configuration was required, will skip test " +