Author: tchemit Date: 2012-07-13 01:17:10 +0200 (Fri, 13 Jul 2012) New Revision: 273 Url: http://nuiton.org/repositories/revision/jredmine/273 Log: add redmine 1.3.x client Added: trunk/jredmine-client-1.3.x/ trunk/jredmine-client-1.3.x/LICENSE.txt trunk/jredmine-client-1.3.x/README.txt trunk/jredmine-client-1.3.x/changelog.txt trunk/jredmine-client-1.3.x/pom.xml trunk/jredmine-client-1.3.x/src/ trunk/jredmine-client-1.3.x/src/license/ trunk/jredmine-client-1.3.x/src/main/ trunk/jredmine-client-1.3.x/src/main/assembly/ trunk/jredmine-client-1.3.x/src/main/assembly/jredmine_rails-1.3.x.xml trunk/jredmine-client-1.3.x/src/main/java/ trunk/jredmine-client-1.3.x/src/main/java/org/ trunk/jredmine-client-1.3.x/src/main/java/org/nuiton/ trunk/jredmine-client-1.3.x/src/main/java/org/nuiton/jredmine/ trunk/jredmine-client-1.3.x/src/main/java/org/nuiton/jredmine/v1_3_x/ trunk/jredmine-client-1.3.x/src/main/java/org/nuiton/jredmine/v1_3_x/RedmineAnonymousServiceImpl.java trunk/jredmine-client-1.3.x/src/main/java/org/nuiton/jredmine/v1_3_x/RedmineRequestFactoryImpl.java trunk/jredmine-client-1.3.x/src/main/java/org/nuiton/jredmine/v1_3_x/RedmineRestClient.java trunk/jredmine-client-1.3.x/src/main/java/org/nuiton/jredmine/v1_3_x/RedmineServiceImpl.java trunk/jredmine-client-1.3.x/src/main/java/org/nuiton/jredmine/v1_3_x/RedmineServiceImplementorImpl.java trunk/jredmine-client-1.3.x/src/main/redmine/ trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/ trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/README.rdoc trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/app/ trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/app/controllers/ trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/app/controllers/jredmine_controller.rb trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/app/helpers/ trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/app/models/ trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/app/views/ trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/assets/ trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/assets/images/ trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/assets/javascripts/ trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/assets/stylesheets/ trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/config/ trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/config/routes.rb trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/db/ trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/db/migrate/ trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/init.rb trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/lang/ trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/lang/en.yml trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/lib/ trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/lib/tasks/ trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/test/ trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/test/functional/ trunk/jredmine-client-1.3.x/src/main/resources/ trunk/jredmine-client-1.3.x/src/site/ trunk/jredmine-client-1.3.x/src/site/apt/ trunk/jredmine-client-1.3.x/src/site/apt/index.apt trunk/jredmine-client-1.3.x/src/site/apt/rails_api.apt trunk/jredmine-client-1.3.x/src/site/apt/redmine_service.apt trunk/jredmine-client-1.3.x/src/site/site_fr.xml trunk/jredmine-client-1.3.x/src/test/ trunk/jredmine-client-1.3.x/src/test/java/ trunk/jredmine-client-1.3.x/src/test/java/org/ trunk/jredmine-client-1.3.x/src/test/java/org/nuiton/ trunk/jredmine-client-1.3.x/src/test/java/org/nuiton/jredmine/ trunk/jredmine-client-1.3.x/src/test/java/org/nuiton/jredmine/v1_3_x/ trunk/jredmine-client-1.3.x/src/test/java/org/nuiton/jredmine/v1_3_x/RedmineAnonymousServiceTest.java trunk/jredmine-client-1.3.x/src/test/java/org/nuiton/jredmine/v1_3_x/RedmineFixtures.java trunk/jredmine-client-1.3.x/src/test/java/org/nuiton/jredmine/v1_3_x/RedmineServer.java trunk/jredmine-client-1.3.x/src/test/java/org/nuiton/jredmine/v1_3_x/RedmineServiceAsAnonymousTest.java trunk/jredmine-client-1.3.x/src/test/java/org/nuiton/jredmine/v1_3_x/RedmineServiceTest.java trunk/jredmine-client-1.3.x/src/test/resources/ trunk/jredmine-client-1.3.x/src/test/resources/log4j.properties trunk/jredmine-client-1.3.x/src/test/resources/test-config.properties Property changes on: trunk/jredmine-client-1.3.x ___________________________________________________________________ Added: svn:ignore + target *.ipr *.iws *.iml .idea .project .classpath .settings Added: trunk/jredmine-client-1.3.x/LICENSE.txt =================================================================== --- trunk/jredmine-client-1.3.x/LICENSE.txt (rev 0) +++ trunk/jredmine-client-1.3.x/LICENSE.txt 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,166 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. + Property changes on: trunk/jredmine-client-1.3.x/LICENSE.txt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jredmine-client-1.3.x/README.txt =================================================================== --- trunk/jredmine-client-1.3.x/README.txt (rev 0) +++ trunk/jredmine-client-1.3.x/README.txt 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,2 @@ +To deploy new version of pom: mvn deploy +To install localy: mvn install Property changes on: trunk/jredmine-client-1.3.x/README.txt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jredmine-client-1.3.x/changelog.txt =================================================================== --- trunk/jredmine-client-1.3.x/changelog.txt (rev 0) +++ trunk/jredmine-client-1.3.x/changelog.txt 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,5 @@ +maven-redmine-plugin (1.0.0-SNAPSHOT) stable; urgency=low + + * //TODO_FILL_ME + + -- author -- date -R Property changes on: trunk/jredmine-client-1.3.x/changelog.txt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jredmine-client-1.3.x/pom.xml =================================================================== --- trunk/jredmine-client-1.3.x/pom.xml (rev 0) +++ trunk/jredmine-client-1.3.x/pom.xml 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,231 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + JRedmine :: Client + + $HeadURL: http://svn.nuiton.org/svn/jredmine/trunk/jredmine-client/pom.xml $ + %% + Copyright (C) 2009 - 2010 Tony Chemit, 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>. + #L% + --> + +<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"> + + <modelVersion>4.0.0</modelVersion> + + <!-- ************************************************************* --> + <!-- *** POM Relationships *************************************** --> + <!-- ************************************************************* --> + + <parent> + <groupId>org.nuiton</groupId> + <artifactId>jredmine</artifactId> + <version>1.4-SNAPSHOT</version> + </parent> + + <groupId>org.nuiton.jredmine</groupId> + <artifactId>jredmine-client-1.3.x</artifactId> + + <dependencies> + + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>jredmine-domain</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>com.sun.jersey</groupId> + <artifactId>jersey-client</artifactId> + </dependency> + + <dependency> + <groupId>com.sun.jersey.contribs</groupId> + <artifactId>jersey-apache-client4</artifactId> + </dependency> + + <dependency> + <groupId>com.sun.jersey.contribs</groupId> + <artifactId>jersey-multipart</artifactId> + </dependency> + + <dependency> + <groupId>org.nuiton</groupId> + <artifactId>helper-maven-plugin</artifactId> + <scope>compile</scope> + <exclusions> + <exclusion> + <groupId>velocity</groupId> + <artifactId>velocity</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </dependency> + + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + </dependency> + + <dependency> + <groupId>commons-httpclient</groupId> + <artifactId>commons-httpclient</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + </dependency> + + <dependency> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-utils</artifactId> + </dependency> + + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </dependency> + + </dependencies> + + <name>JRedmine :: Client 1.3.x</name> + <description>The JRedmine client for redmine 1.3.x series</description> + + <properties> + <!-- extra files to include in release --> + <redmine.releaseFiles> + target/${project.artifactId}-${project.version}-jredmine_rails-1.3.x.zip, + ${redmine.libReleaseFiles} + </redmine.releaseFiles> + </properties> + + <build> + + <plugins> + <!-- expose new plexus components --> + <plugin> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-component-metadata</artifactId> + <executions> + <execution> + <goals> + <goal>generate-metadata</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + + </build> + + <reporting> + <excludeDefaults>true</excludeDefaults> + </reporting> + + <profiles> + + <profile> + <id>reporting</id> + <activation> + <property> + <name>performRelease</name> + <value>true</value> + </property> + </activation> + + <reporting> + <plugins> + <plugin> + <groupId>org.codehaus.plexus</groupId> + <artifactId>plexus-maven-plugin</artifactId> + <version>${plexusPluginVersion}</version> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>cobertura-maven-plugin</artifactId> + <version>${coberturaPluginVersion}</version> + </plugin> + + </plugins> + </reporting> + + </profile> + <profile> + <id>release-assembly-profile</id> + <activation> + <property> + <name>performRelease</name> + <value>true</value> + </property> + </activation> + <build> + <plugins> + + <!-- launch in a release the assembly, but not attach it to project --> + + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <id>create-assemblies</id> + <phase>verify</phase> + <goals> + <goal>single</goal> + </goals> + </execution> + </executions> + <configuration> + <attach>false</attach> + <descriptorRefs> + <descriptorRef>deps</descriptorRef> + <descriptorRef>full</descriptorRef> + </descriptorRefs> + <descriptors> + <descriptor>src/main/assembly/jredmine_rails-1.3.x.xml + </descriptor> + </descriptors> + </configuration> + </plugin> + + </plugins> + + </build> + </profile> + + </profiles> + +</project> Property changes on: trunk/jredmine-client-1.3.x/pom.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jredmine-client-1.3.x/src/main/assembly/jredmine_rails-1.3.x.xml =================================================================== --- trunk/jredmine-client-1.3.x/src/main/assembly/jredmine_rails-1.3.x.xml (rev 0) +++ trunk/jredmine-client-1.3.x/src/main/assembly/jredmine_rails-1.3.x.xml 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,40 @@ +<!-- + #%L + JRedmine :: Client + + $Id$ + $HeadURL: http://svn.nuiton.org/svn/jredmine/trunk/jredmine-client/src/main/assembly/j... $ + %% + Copyright (C) 2009 - 2010 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>. + #L% + --> +<assembly> + <id>jredmine_rails-1.3.x</id> + <formats> + <format>zip</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + <fileSets> + <fileSet> + <directory>src/main/redmine/jredmine</directory> + <outputDirectory>jredmine</outputDirectory> + <includes> + <include>**/*</include> + </includes> + </fileSet> + </fileSets> +</assembly> \ No newline at end of file Property changes on: trunk/jredmine-client-1.3.x/src/main/assembly/jredmine_rails-1.3.x.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jredmine-client-1.3.x/src/main/java/org/nuiton/jredmine/v1_3_x/RedmineAnonymousServiceImpl.java =================================================================== --- trunk/jredmine-client-1.3.x/src/main/java/org/nuiton/jredmine/v1_3_x/RedmineAnonymousServiceImpl.java (rev 0) +++ trunk/jredmine-client-1.3.x/src/main/java/org/nuiton/jredmine/v1_3_x/RedmineAnonymousServiceImpl.java 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,284 @@ +/* + * #%L + * JRedmine :: Client + * + * $Id: DefaultRedmineAnonymousService.java 257 2012-03-25 15:48:53Z tchemit $ + * $HeadURL: http://svn.nuiton.org/svn/jredmine/trunk/jredmine-client/src/main/java/org/n... $ + * %% + * Copyright (C) 2009 - 2010 Tony Chemit, 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>. + * #L% + */ +package org.nuiton.jredmine.v1_3_x; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.jredmine.RedmineAnonymousService; +import org.nuiton.jredmine.RedmineServiceConfiguration; +import org.nuiton.jredmine.RedmineServiceException; +import org.nuiton.jredmine.RedmineServiceImplementor; +import org.nuiton.jredmine.RedmineServiceLoginException; +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.TimeEntry; +import org.nuiton.jredmine.model.Tracker; +import org.nuiton.jredmine.model.User; +import org.nuiton.jredmine.model.Version; + +/** + * Default implementation of {@link RedmineAnonymousService}. + * <p/> + * This implementation just make sure that the rest client is anonnymous. + * <p/> + * Created: 2 janv. 2010 + * + * @author tchemit <chemit@codelutin.com> + * @plexus.component role="org.nuiton.jredmine.RedmineAnonymousService" role-hint="1.3.x" + * @see RedmineServiceConfiguration#isAnonymous() + * @since 1.0.3 + */ +public class RedmineAnonymousServiceImpl implements RedmineServiceImplementor, RedmineAnonymousService { + + /** Logger. */ + private static final Log log = + LogFactory.getLog(RedmineAnonymousServiceImpl.class); + + /** @plexus.requirement role="org.nuiton.jredmine.RedmineServiceImplementor" role-hint="1.3.x" */ + protected RedmineServiceImplementor delegateImplementor; + + public RedmineAnonymousServiceImpl() { + } + + /////////////////////////////////////////////////////////////////////////// + /// RedmineAnonymousService implementation + /////////////////////////////////////////////////////////////////////////// + + @Override + public IssueStatus[] getIssueStatuses() throws RedmineServiceException { + return getDatas(RedmineRequestFactoryImpl.GET_ISSUE_STATUS_LIST, + IssueStatus.class + ); + } + + @Override + public IssuePriority[] getIssuePriorities() throws RedmineServiceException { + return getDatas(RedmineRequestFactoryImpl.GET_ISSUE_PRIORITY_LIST, + IssuePriority.class + ); + } + + @Override + public Project[] getProjects() throws RedmineServiceException { + return getDatas(RedmineRequestFactoryImpl.GET_PROJECT_LIST, Project.class); + } + + @Override + public IssueCategory[] getIssueCategories(String projectName) throws RedmineServiceException { + return getDatas(RedmineRequestFactoryImpl.GET_ISSUE_CATEGORY_LIST, + IssueCategory.class, + projectName + ); + } + + @Override + public Project getProject(String projectName) throws RedmineServiceException { + return getData(RedmineRequestFactoryImpl.GET_PROJECT, + Project.class, + projectName + ); + } + + @Override + public Tracker[] getTrackers(String projectName) throws RedmineServiceException { + return getDatas(RedmineRequestFactoryImpl.GET_TRACKER_LIST, + Tracker.class, + projectName + ); + } + + @Override + public News[] getNews(String projectName) throws RedmineServiceException { + return getDatas(RedmineRequestFactoryImpl.GET_NEWS_LIST, + News.class, + projectName + ); + } + + @Override + public User[] getProjectMembers(String projectName) throws RedmineServiceException { + return getDatas(RedmineRequestFactoryImpl.GET_USER_LIST, + User.class, + projectName + ); + } + + @Override + public Version[] getVersions(String projectName) throws RedmineServiceException { + return getDatas(RedmineRequestFactoryImpl.GET_VERSION_LIST, + Version.class, + projectName + ); + } + + @Override + public Version getVersion(String projectName, + String versionName) throws RedmineServiceException { + return getData(RedmineRequestFactoryImpl.GET_VERSION, + Version.class, + projectName, + versionName + ); + } + + @Override + public Attachment[] getAttachments(String projectName, + String versionName) throws RedmineServiceException { + return getDatas(RedmineRequestFactoryImpl.GET_ATTACHMENTS_LIST, + Attachment.class, + projectName, + versionName + ); + } + + @Override + public Issue[] getIssues(String projectName, + String versionName) throws RedmineServiceException { + return getDatas(RedmineRequestFactoryImpl.GET_ISSUE_LIST, + Issue.class, + projectName, + versionName + ); + } + + @Override + public TimeEntry[] getIssueTimeEntries(String projectName, + String issueId) throws RedmineServiceException { + return getDatas(RedmineRequestFactoryImpl.GET_ISSUE_TIME_ENTRY_LIST, + TimeEntry.class, + projectName, + issueId + ); + } + + @Override + public Issue[] getIssues(String projectName) throws RedmineServiceException { + Issue[] result = getDatas(RedmineRequestFactoryImpl.GET_PROJECT_ISSUES, + Issue.class, + projectName + ); + return result; + } + + @Override + public Issue[] getOpenedIssues(String projectName) throws RedmineServiceException { + Issue[] result = getDatas(RedmineRequestFactoryImpl.GET_PROJECT_OPENED_ISSUES, + Issue.class, + projectName + ); + return result; + } + + @Override + public Issue[] getClosedIssues(String projectName) throws RedmineServiceException { + Issue[] result = getDatas(RedmineRequestFactoryImpl.GET_PROJECT_CLOSED_ISSUES, + Issue.class, + projectName + ); + return result; + } + + /////////////////////////////////////////////////////////////////////////// + /// RedmineServiceImplementor implementation + /////////////////////////////////////////////////////////////////////////// + @Override + public RedmineServiceImplementor init(RedmineServiceConfiguration configuration) throws RedmineServiceException { + // Force to not be loggued + configuration.setAnonymous(true); + if (log.isDebugEnabled()) { + log.debug("init configuration for " + this); + } + return delegateImplementor.init(configuration); + } + + @Override + public int ping() { + return delegateImplementor.ping(); + } + + @Override + public void login() throws RedmineServiceLoginException { + delegateImplementor.login(); + } + + @Override + public void logout() throws RedmineServiceLoginException { + delegateImplementor.logout(); + } + + @Override + public <T> T getData(String requestName, + Class<T> type, + Object... args) throws RedmineServiceException { + return delegateImplementor.getData(requestName, type, args); + } + + @Override + public <T> T[] getDatas(String requestName, + Class<T> type, + Object... args) throws RedmineServiceException { + return delegateImplementor.getDatas(requestName, type, args); + } + + @Override + public <T> T sendData(String requestName, + Class<T> type, + Object... args) throws RedmineServiceException { + return delegateImplementor.sendData(requestName, type, args); + } + + @Override + public <T> T[] sendDatas(String requestName, + Class<T> type, + Object... args) throws RedmineServiceException { + return delegateImplementor.sendDatas(requestName, type, args); + } + + @Override + public boolean isInit() { + return delegateImplementor.isInit(); + } + + @Override + public boolean isLoggued() { + return delegateImplementor.isLoggued(); + } + + @Override + public void destroy() throws RedmineServiceException { + delegateImplementor.destroy(); + } + + @Override + public void checkLoggued() throws IllegalStateException, RedmineServiceLoginException, NullPointerException { + delegateImplementor.checkLoggued(); + } + +} Added: trunk/jredmine-client-1.3.x/src/main/java/org/nuiton/jredmine/v1_3_x/RedmineRequestFactoryImpl.java =================================================================== --- trunk/jredmine-client-1.3.x/src/main/java/org/nuiton/jredmine/v1_3_x/RedmineRequestFactoryImpl.java (rev 0) +++ trunk/jredmine-client-1.3.x/src/main/java/org/nuiton/jredmine/v1_3_x/RedmineRequestFactoryImpl.java 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,271 @@ +package org.nuiton.jredmine.v1_3_x; + +import com.google.common.base.Strings; +import org.nuiton.io.rest.AbstractRequestFactory; +import org.nuiton.io.rest.RestMethod; +import org.nuiton.io.rest.RestRequest; +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.TimeEntry; +import org.nuiton.jredmine.model.Tracker; +import org.nuiton.jredmine.model.User; +import org.nuiton.jredmine.model.Version; +import org.nuiton.jredmine.model.VersionStatusEnum; +import org.nuiton.jredmine.request.DefaultRedmineRequestBuilder; +import org.nuiton.jredmine.request.IssueScopeRedmineRequestBuilder; +import org.nuiton.jredmine.request.ProjectScopeRedmineRequestBuilder; +import org.nuiton.jredmine.request.VersionScopeRedmineRequestBuilder; + +import java.io.File; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * Factory of {@link RestRequest}. + * + * @author tchemit <chemit@codelutin.com> + * @plexus.component role="org.nuiton.io.rest.RequestFactory" role-hint="1.3.x" + * @since 1.4 + */ +public class RedmineRequestFactoryImpl extends AbstractRequestFactory { + + public static final String GET_ISSUE_LIST = Issue.class.getName() + "list"; + + public static final String GET_ISSUE_STATUS_LIST = IssueStatus.class.getName() + "list"; + + public static final String GET_ISSUE_PRIORITY_LIST = IssuePriority.class.getName() + "list"; + + public static final String GET_ISSUE_CATEGORY_LIST = IssueCategory.class.getName() + "list"; + + public static final String GET_ISSUE_TIME_ENTRY_LIST = TimeEntry.class.getName() + "list"; + + public static final String GET_PROJECT_LIST = Project.class.getName() + "list"; + + public static final String GET_PROJECT_ISSUES = Project.class.getName() + "issues"; + + public static final String GET_PROJECT_OPENED_ISSUES = Project.class.getName() + "opened-issues"; + + public static final String GET_PROJECT_CLOSED_ISSUES = Project.class.getName() + "closed-issues"; + + public static final String GET_USER_PROJECTS = Project.class.getName() + "forUser"; + + public static final String GET_PROJECT = Project.class.getName() + "detail"; + + public static final String GET_VERSION_LIST = Version.class.getName() + "list"; + + public static final String GET_TRACKER_LIST = Tracker.class.getName() + "list"; + + public static final String GET_ATTACHMENTS_LIST = Attachment.class.getName() + "list"; + + public static final String GET_USER_LIST = User.class.getName() + "list"; + + public static final String GET_NEWS_LIST = News.class.getName() + "list"; + + 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 ADD_ISSUE_TIME_ENTRY = TimeEntry.class.getName() + "add"; + + public static final String LOGIN = "login"; + + public static final String LOGOUT = "logout"; + + public static final String PING = "ping"; + + @Override + public void addDefaultRequests() { + + // misc requests + +// addRequestBuilder(new DefaultRedmineRequestBuilder(PING, RestMethod.GET, "jredmine", "ping")); + addRequestBuilder(new DefaultRedmineRequestBuilder(PING, RestMethod.GET, "projects")); + addRequestBuilder(new DefaultRedmineRequestBuilder(LOGOUT, RestMethod.GET, "jredmine", "logout")); + addRequestBuilder(new DefaultRedmineRequestBuilder(LOGIN, RestMethod.POST, "login") { +// addRequestBuilder(new DefaultRedmineRequestBuilder(LOGIN, RestMethod.POST, "jredmine", "login") { + + private static final long serialVersionUID = 1L; + + @Override + public String[] getParameters(Object... args) { + String login = (String) args[0]; + String password = (String) args[1]; + return new String[]{"username", login, "password", password}; + } + }); + + // data with no scope requests + +// addRequestBuilder(new DefaultRedmineRequestBuilder(GET_PROJECT_LIST, "jredmine", "get_projects.xml")); + addRequestBuilder(new DefaultRedmineRequestBuilder(GET_PROJECT_LIST, RestMethod.GET, "projects.xml")); + addRequestBuilder(new DefaultRedmineRequestBuilder(GET_USER_PROJECTS, RestMethod.GET, "jredmine", "get_user_projects.xml")); + addRequestBuilder(new DefaultRedmineRequestBuilder(GET_ISSUE_STATUS_LIST, RestMethod.GET, "jredmine", "get_issue_statuses.xml")); + addRequestBuilder(new DefaultRedmineRequestBuilder(GET_ISSUE_PRIORITY_LIST, RestMethod.GET, "jredmine", "get_issue_priorities.xml")); + + // data with project scope requests + + addRequestBuilder(new ProjectScopeRedmineRequestBuilder(GET_PROJECT, RestMethod.GET, "jredmine", "get_project.xml")); + addRequestBuilder(new ProjectScopeRedmineRequestBuilder(GET_PROJECT_ISSUES, RestMethod.GET, "jredmine", "get_project_issues.xml")); + addRequestBuilder(new ProjectScopeRedmineRequestBuilder(GET_PROJECT_OPENED_ISSUES, RestMethod.GET, "jredmine", "get_project_opened_issues.xml")); + addRequestBuilder(new ProjectScopeRedmineRequestBuilder(GET_PROJECT_CLOSED_ISSUES, RestMethod.GET, "jredmine", "get_project_closed_issues.xml")); + addRequestBuilder(new ProjectScopeRedmineRequestBuilder(GET_VERSION_LIST, RestMethod.GET, "jredmine", "get_project_versions.xml")); + addRequestBuilder(new ProjectScopeRedmineRequestBuilder(GET_ISSUE_CATEGORY_LIST, RestMethod.GET, "jredmine", "get_issue_categories.xml")); + addRequestBuilder(new ProjectScopeRedmineRequestBuilder(GET_TRACKER_LIST, RestMethod.GET, "jredmine", "get_project_trackers.xml")); + addRequestBuilder(new ProjectScopeRedmineRequestBuilder(GET_USER_LIST, RestMethod.GET, "jredmine", "get_project_users.xml")); + addRequestBuilder(new ProjectScopeRedmineRequestBuilder(GET_NEWS_LIST, RestMethod.GET, "jredmine", "get_project_news.xml")); + + addRequestBuilder(new ProjectScopeRedmineRequestBuilder(ADD_VERSION, RestMethod.POST, "jredmine", "add_version.xml") { + private static final long serialVersionUID = 1L; + + @Override + public String[] getParameters(Object... args) { + Version version = (Version) args[1]; + String date = getVersionEffectiveDate(version); + String status = getVersionStatus(version); + return new String[]{ + "version[name]", version.getName(), + "version[description]", version.getDescription(), + "version[effective_date]", date, + "version[status]", status + }; + } + }); + + addRequestBuilder(new ProjectScopeRedmineRequestBuilder(UPDATE_VERSION, RestMethod.POST, "jredmine", "update_version.xml") { + private static final long serialVersionUID = 1L; + + @Override + public String[] getParameters(Object... args) { + Version version = (Version) args[1]; + String date = getVersionEffectiveDate(version); + String status = getVersionStatus(version); + return new String[]{ + "version[name]", version.getName(), + "version[description]", version.getDescription(), + "version[effective_date]", date, + "version[status]", status + }; + } + }); + + addRequestBuilder(new ProjectScopeRedmineRequestBuilder(NEXT_VERSION, RestMethod.POST, "jredmine", "next_version.xml") { + private static final long serialVersionUID = 1L; + + @Override + public String[] getParameters(Object... args) { + + + Version version = (Version) args[1]; + String date = getVersionEffectiveDate(version); + String status = getVersionStatus(version); + String oldVersionName = (String) args[2]; + return new String[]{ + "oldVersionName", oldVersionName, + "version[name]", version.getName(), + "version[description]", version.getDescription(), + "version[effective_date]", date, + "version[status]", status + }; + } + }); + + addRequestBuilder(new ProjectScopeRedmineRequestBuilder(ADD_NEWS, RestMethod.POST, "jredmine", "add_news.xml") { + private static final long serialVersionUID = 1L; + + @Override + 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() + }; + } + }); + + // version scope requests + + addRequestBuilder(new VersionScopeRedmineRequestBuilder(GET_VERSION, RestMethod.GET, "jredmine", "get_version.xml")); + addRequestBuilder(new VersionScopeRedmineRequestBuilder(GET_ISSUE_LIST, RestMethod.GET, "jredmine", "get_version_issues.xml")); + addRequestBuilder(new VersionScopeRedmineRequestBuilder(GET_ATTACHMENTS_LIST, RestMethod.GET, "jredmine", "get_version_attachments.xml")); + addRequestBuilder(new VersionScopeRedmineRequestBuilder(ADD_ATTACHMENT, RestMethod.POST, "jredmine", "add_version_attachment.xml") { + private static final long serialVersionUID = 1L; + + @Override + public String[] getParameters(Object... args) { + String versionId = (String) args[1]; + Attachment attachment = (Attachment) args[2]; + return new String[]{ + "version_name", versionId, + "attachment[description]", attachment.getDescription() + }; + } + + @Override + public Map<String, File> getAttachments(Object... args) { + Map<String, File> upload = new HashMap<String, File>(); + Attachment attachment = (Attachment) args[2]; + upload.put("attachment[file]", attachment.getToUpload()); + return upload; + } + }); + + // issue scope requests + + addRequestBuilder(new IssueScopeRedmineRequestBuilder(GET_ISSUE_TIME_ENTRY_LIST, RestMethod.GET, "jredmine", "get_issue_times.xml")); + + addRequestBuilder(new IssueScopeRedmineRequestBuilder(ADD_ISSUE_TIME_ENTRY, RestMethod.POST, "jredmine", "add_issue_time.xml") { + private static final long serialVersionUID = 1L; + + @Override + public String[] getParameters(Object... args) { + String issueId = (String) args[1]; + TimeEntry timeEntry = (TimeEntry) args[2]; + Date d = timeEntry.getSpentOn(); + if (d == null) { + d = new Date(); + } + String date = DATE_FORMAT.format(d); + return new String[]{ + "issue_id", issueId, + //"timeEntry[issue_id]", issueId, + "time_entry[activity_id]", timeEntry.getActivityId() + "", + "time_entry[spent_on]", date, + "time_entry[hours]", timeEntry.getHours() + "", + "time_entry[comments]", timeEntry.getComments() == null ? "" : timeEntry.getComments() + }; + } + }); + } + + protected static String getVersionStatus(Version version) { + String status = version.getStatus(); + if (Strings.isNullOrEmpty(status)) { + + // use default open status + status = VersionStatusEnum.open.name(); + } + return status; + } + + protected static String getVersionEffectiveDate(Version version) { + return version.getEffectiveDate() == null ? "" : + DATE_FORMAT.format(version.getEffectiveDate()); + } + + +} Added: trunk/jredmine-client-1.3.x/src/main/java/org/nuiton/jredmine/v1_3_x/RedmineRestClient.java =================================================================== --- trunk/jredmine-client-1.3.x/src/main/java/org/nuiton/jredmine/v1_3_x/RedmineRestClient.java (rev 0) +++ trunk/jredmine-client-1.3.x/src/main/java/org/nuiton/jredmine/v1_3_x/RedmineRestClient.java 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,181 @@ +/* + * #%L + * JRedmine :: Client + * + * $Id: RedmineRestClient.java 211 2011-06-04 17:01:31Z tchemit $ + * $HeadURL: http://svn.nuiton.org/svn/jredmine/trunk/jredmine-client/src/main/java/org/n... $ + * %% + * Copyright (C) 2009 - 2010 Tony Chemit, 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>. + * #L% + */ +package org.nuiton.jredmine.v1_3_x; + +import org.apache.commons.httpclient.HttpMethod; +import org.apache.commons.httpclient.HttpStatus; +import org.apache.commons.httpclient.StatusLine; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.codehaus.plexus.util.StringUtils; +import org.nuiton.io.rest.RequestFactory; +import org.nuiton.io.rest.RestClient; +import org.nuiton.io.rest.RestClientConfiguration; +import org.nuiton.io.rest.RestRequest; +import org.nuiton.io.rest.RestSession; +import org.nuiton.jredmine.model.Version; +import org.nuiton.jredmine.model.VersionStatusEnum; + +import java.io.IOException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; + +/** + * Implementation of a {@link RestClient} to access a Redmine server via the + * {@code redmine_rest} rails plugin. + * + * @author tchemit <chemit@codelutin.com> + * @plexus.component role="org.nuiton.io.rest.RestClient" role-hint="1.3.x" + * @since 1.0.0 + */ +public class RedmineRestClient extends RestClient { + + private static final Log log = LogFactory.getLog(RedmineRestClient.class); + + /** + * To obtain redmine requests. + * + * @plexus.requirement role="org.nuiton.io.rest.RequestFactory" role-hint="1.3.x" + * @since 1.4 + */ + protected RequestFactory requestFactory; + + public final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); + + public RedmineRestClient() { + } + + public RedmineRestClient(RestClientConfiguration configuration) { + super(configuration); + } + + @Override + public RequestFactory getRequestFactory() { + return requestFactory; + } + + @Override + protected void open(RestSession session) throws IOException { + + ping(session); + + if (!configuration.isAnonymous()) { + login(session); + } + } + + @Override + protected void close(RestSession session) throws IOException { + + if (session != null) { + + try { + RestRequest request = getRequest(RedmineRequestFactoryImpl.LOGOUT); + session.setOpen(false); + session.doRequest(request); + } finally { + session.close(); + } + } + } + + public int ping(RestSession session) throws IOException { + + try { + + RestRequest request = getRequest(RedmineRequestFactoryImpl.PING); + HttpMethod gm = session.doRequest(request); + + StatusLine sl = gm.getStatusLine(); + int statusCode = sl.getStatusCode(); + if (log.isDebugEnabled()) { + log.debug("status code " + statusCode + " for " + gm.getPath()); + } + + if (statusCode != HttpStatus.SC_OK) { + gm.releaseConnection(); + throw new IOException( + "Got error code <" + statusCode + ":" + + sl.getReasonPhrase() + "> on " + gm.getPath()); + } + +// String content = gm.getResponseBodyAsString(); +// +// boolean ok = "ping".equals(content); +// if (!ok) { +// throw new IOException( +// "can not connect to " + configuration.getRestUrl()); +// } + return statusCode; + } catch (IOException ex) { + throw ex; + } catch (Exception ex) { + throw new IOException( + "could not ping " + configuration.getRestUrl() + + " for reason " + ex.getMessage(), ex); + } + } + + public void login(RestSession session) throws IOException { + + RestRequest request = getRequest(RedmineRequestFactoryImpl.LOGIN, + configuration.getRestUsername(), + configuration.getRestPassword()); + + HttpMethod gm = session.doRequest(request); + + StatusLine sl = gm.getStatusLine(); + int statusCode = sl.getStatusCode(); + if (log.isDebugEnabled()) { + log.debug("status code " + statusCode + " for " + gm.getPath()); + } + + if (statusCode != HttpStatus.SC_OK && + statusCode!= HttpStatus.SC_MOVED_TEMPORARILY) { + gm.releaseConnection(); + throw new IOException( + "Got error code <" + statusCode + ":" + + sl.getReasonPhrase() + "> on " + gm.getPath()); + } + + // ok session is logged in + + } + + protected String getVersionStatus(Version version) { + String status = version.getStatus(); + if (StringUtils.isEmpty(status)) { + + // use default open status + status = VersionStatusEnum.open.name(); + } + return status; + } + + protected String getVersionEffectiveDate(Version version) { + return version.getEffectiveDate() == null ? "" : + DATE_FORMAT.format(version.getEffectiveDate()); + } +} Added: trunk/jredmine-client-1.3.x/src/main/java/org/nuiton/jredmine/v1_3_x/RedmineServiceImpl.java =================================================================== --- trunk/jredmine-client-1.3.x/src/main/java/org/nuiton/jredmine/v1_3_x/RedmineServiceImpl.java (rev 0) +++ trunk/jredmine-client-1.3.x/src/main/java/org/nuiton/jredmine/v1_3_x/RedmineServiceImpl.java 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,152 @@ +/* + * #%L + * JRedmine :: Client + * + * $Id: DefaultRedmineService.java 257 2012-03-25 15:48:53Z tchemit $ + * $HeadURL: http://svn.nuiton.org/svn/jredmine/trunk/jredmine-client/src/main/java/org/n... $ + * %% + * Copyright (C) 2009 - 2010 Tony Chemit, 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>. + * #L% + */ +package org.nuiton.jredmine.v1_3_x; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.io.rest.RestClient; +import org.nuiton.jredmine.RedmineService; +import org.nuiton.jredmine.RedmineServiceConfiguration; +import org.nuiton.jredmine.RedmineServiceException; +import org.nuiton.jredmine.RedmineServiceImplementor; +import org.nuiton.jredmine.model.Attachment; +import org.nuiton.jredmine.model.News; +import org.nuiton.jredmine.model.Project; +import org.nuiton.jredmine.model.TimeEntry; +import org.nuiton.jredmine.model.Version; + +/** + * Default {@link RedmineService} implementation based on a {@link RestClient} + * + * @author tchemit <chemit@codelutin.com> + * @plexus.component role="org.nuiton.jredmine.RedmineService" role-hint="1.3.x" + * @since 1.0.0 + */ +public class RedmineServiceImpl extends RedmineAnonymousServiceImpl implements RedmineService { + + protected static final Log log = LogFactory.getLog(RedmineServiceImpl.class); + + /////////////////////////////////////////////////////////////////////////// + /// RedmineServiceImplementor implementation + /////////////////////////////////////////////////////////////////////////// + + @Override + public RedmineServiceImplementor init(RedmineServiceConfiguration configuration) throws RedmineServiceException { + return delegateImplementor.init(configuration); + } + + /////////////////////////////////////////////////////////////////////////// + /// RedmineLogguedService implementation + /////////////////////////////////////////////////////////////////////////// + + @Override + public Project[] getUserProjects() throws RedmineServiceException { + checkLoggued(); + Project[] result = getDatas(RedmineRequestFactoryImpl.GET_USER_PROJECTS, Project.class); + return result; + } + + @Override + public Version addVersion(String projectName, + Version version) throws RedmineServiceException { + + // send data and obtain created version + Version result = sendData(RedmineRequestFactoryImpl.ADD_VERSION, + Version.class, + projectName, + version + ); + return result; + } + + @Override + public Version updateVersion(String projectName, + Version version) throws RedmineServiceException { + + // send data and obtain updated version + Version result = sendData(RedmineRequestFactoryImpl.UPDATE_VERSION, + Version.class, + projectName, + version + ); + return result; + } + + @Override + public Version nextVersion(String projectName, + String oldVersionName, + Version newVersion) throws RedmineServiceException { + + // send data and obtain updated or created new version + Version result = sendData(RedmineRequestFactoryImpl.NEXT_VERSION, + Version.class, + projectName, + newVersion, + oldVersionName + ); + return result; + } + + @Override + public Attachment addAttachment(String projectName, + String versionName, + Attachment attachement) throws RedmineServiceException { + + // send data and obtain created attachment + Attachment result = sendData(RedmineRequestFactoryImpl.ADD_ATTACHMENT, + Attachment.class, + projectName, + versionName, + attachement + ); + return result; + } + + @Override + public News addNews(String projectName, + News news) throws RedmineServiceException { + // send data and obtain created news + News result = sendData(RedmineRequestFactoryImpl.ADD_NEWS, + News.class, + projectName, + news + ); + return result; + } + + @Override + public TimeEntry addIssueTimeEntry(String projectName, + String issueId, + TimeEntry entry) throws RedmineServiceException { + // send data and obtain updated version + TimeEntry result = sendData(RedmineRequestFactoryImpl.ADD_ISSUE_TIME_ENTRY, + TimeEntry.class, + projectName, + issueId, + entry + ); + return result; + } +} Added: trunk/jredmine-client-1.3.x/src/main/java/org/nuiton/jredmine/v1_3_x/RedmineServiceImplementorImpl.java =================================================================== --- trunk/jredmine-client-1.3.x/src/main/java/org/nuiton/jredmine/v1_3_x/RedmineServiceImplementorImpl.java (rev 0) +++ trunk/jredmine-client-1.3.x/src/main/java/org/nuiton/jredmine/v1_3_x/RedmineServiceImplementorImpl.java 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,321 @@ +/* + * #%L + * JRedmine :: Client + * + * $Id: DefaultRedmineServiceImplementor.java 257 2012-03-25 15:48:53Z tchemit $ + * $HeadURL: http://svn.nuiton.org/svn/jredmine/trunk/jredmine-client/src/main/java/org/n... $ + * %% + * Copyright (C) 2009 - 2010 Tony Chemit, 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>. + * #L% + */ +package org.nuiton.jredmine.v1_3_x; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.io.rest.RestClient; +import org.nuiton.io.rest.RestException; +import org.nuiton.io.rest.RestRequest; +import org.nuiton.jredmine.RedmineServiceConfiguration; +import org.nuiton.jredmine.RedmineServiceException; +import org.nuiton.jredmine.RedmineServiceImplementor; +import org.nuiton.jredmine.RedmineServiceLoginException; +import org.nuiton.jredmine.model.io.xpp3.RedmineXpp3Helper; + +import java.io.IOException; +import java.io.InputStream; + +/** + * Default Redmine technical service implementation. + * <p/> + * Created: 2 janv. 2010 + * + * @author tchemit <chemit@codelutin.com> + * @plexus.component role="org.nuiton.jredmine.RedmineServiceImplementor" role-hint="1.3.x" + * @see RedmineServiceImplementor + * @since 1.0.3 + */ +public class RedmineServiceImplementorImpl implements RedmineServiceImplementor { + + /** Logger */ + private static final Log log = + LogFactory.getLog(RedmineServiceImplementorImpl.class); + + /** + * Client Rest. + * + * @plexus.requirement role="org.nuiton.io.rest.RestClient" role-hint="1.3.x" + */ + protected RedmineRestClient session; + + /** + * xpp3 xpp3Helper to transform xml stream to pojo. + * + * @plexus.requirement role="org.nuiton.jredmine.model.io.xpp3.RedmineXpp3Helper" role-hint="default" + */ + protected RedmineXpp3Helper xpp3Helper; + + /** internal state to known if service was init */ + protected boolean init; + + /** internal state to known if service was opened */ + protected boolean open; + + public RedmineServiceImplementorImpl() { + if (log.isDebugEnabled()) { + log.debug("new " + this); + } + session = new RedmineRestClient(); + } + + /////////////////////////////////////////////////////////////////////////// + /// RedmineServiceImplementor implementation + /////////////////////////////////////////////////////////////////////////// + + @Override + public boolean isInit() { + return init; + } + + @Override + public boolean isLoggued() { + return session.isOpen(); + } + + @Override + public RedmineServiceImplementor init(RedmineServiceConfiguration configuration) throws RedmineServiceException { + session.setConfiguration(configuration); + session.requestFactory.addDefaultRequests(); + RedmineServiceImplementor result = init(session); + return result; + } + + public RedmineServiceImplementor init(RedmineRestClient session) throws RedmineServiceException { + if (open) { + throw new IllegalStateException( + "the client " + this + " was already opened!"); + } + try { + this.session = session; + + if (!session.isOpen()) { + session.open(); + } + + init = true; + } catch (Exception e) { + throw new RedmineServiceException( + "could not init service for reason " + e.getMessage(), e); + } + return this; + } + + @Override + public int ping() { + + try { + return session.ping(session.getSession()); + } catch (IOException e) { + if (log.isErrorEnabled()) { + log.error("Could not ping ", e); + } + return -1; + } + } + + @Override + public void login() { + } + + @Override + public void logout() { + } + + @Override + public void destroy() throws RedmineServiceException { + checkInit(); + try { + if (session.isOpen()) { + try { + session.close(); + } catch (RestException ex) { + throw new RedmineServiceException( + "has problem while closing Rest client " + + ex.getMessage(), ex); + } + } + } finally { + // can't remove the reference since plexus injects it +// if (session != null) { +// session = null; +// } + init = false; + } + } + + @Override + public <T> T getData(String requestName, + Class<T> type, + Object... args) throws RedmineServiceException { + checkInit(); + InputStream stream = askDataStream(requestName, args); + T result = getDataFromStream(type, stream); + return result; + } + + @Override + public <T> T[] getDatas(String requestName, + Class<T> type, + Object... args) throws RedmineServiceException { + checkInit(); + InputStream stream = askDataStream(requestName, args); + T[] result = getDatasFromStream(type, stream); + return result; + } + + @Override + public <T> T sendData(String requestName, + Class<T> type, + Object... args) throws RedmineServiceException { + checkLoggued(); + InputStream stream = sendDataStream(requestName, args); + T result = getDataFromStream(type, stream); + return result; + } + + @Override + public <T> T[] sendDatas(String requestName, + Class<T> type, + Object... args) throws RedmineServiceException { + checkLoggued(); + InputStream stream = sendDataStream(requestName, args); + T[] result = getDatasFromStream(type, stream); + return result; + } + + @Override + public void checkLoggued() throws IllegalStateException, RedmineServiceLoginException, NullPointerException { + checkInit(); + checkSessionNotNull(session); + checkSessionConfigurationNotNull(session); + if (session.getConfiguration().isAnonymous()) { + throw new RedmineServiceLoginException( + "can not access this service in anonymous mode"); + } + } + + protected InputStream askDataStream(String requestName, + Object... args) throws RedmineServiceException { + + RestRequest r = getRequest(requestName, args); + + // obtain data from rest client + try { + + InputStream stream = session.askData(r); + return stream; + } catch (Exception e) { + throw new RedmineServiceException( + "could not obtain data stream for request " + requestName + + " for reason " + e.getMessage(), e); + } + } + + protected InputStream sendDataStream(String requestName, + Object... args) throws RedmineServiceException { + + RestRequest r = getRequest(requestName, args); + + // obtain data from rest client + try { + + InputStream stream = session.sendData(r); + return stream; + } catch (Exception e) { + throw new RedmineServiceException( + "could not send data stream for request " + requestName + + " for reason " + e.getMessage(), e); + } + } + + protected RestRequest getRequest(String requestName, + Object... args) throws RedmineServiceException { + RestRequest r; + try { + r = session.getRequest(requestName, args); + } catch (Exception e) { + throw new RedmineServiceException( + "could not find the request named " + requestName + + " for reason " + e.getMessage(), e); + } + if (r == null) { + throw new RedmineServiceException( + "could not find the request named " + requestName); + } + return r; + } + + protected <T> T getDataFromStream(Class<T> type, + InputStream stream) throws RedmineServiceException { + if (stream == null) { + return null; + } + + try { + T result = xpp3Helper.readObject(type, stream, true); + return result; + } catch (Exception ex) { + throw new RedmineServiceException( + "could not obtain datas of type " + type + " for reason " + + ex.getMessage(), ex); + } + } + + protected <T> T[] getDatasFromStream(Class<T> type, + InputStream stream) throws RedmineServiceException { + if (stream == null) { + return null; + } + try { + T[] result = xpp3Helper.readObjects(type, stream, true); + return result; + } catch (Exception ex) { + throw new RedmineServiceException( + "could not obtain datas of type " + type + " for reason " + + ex.getMessage(), ex); + } + } + + protected void checkInit() throws IllegalStateException { + if (!init) { + throw new IllegalStateException( + "the client " + this + " is not init!"); + } + } + + protected void checkSessionNotNull(RestClient session) { + if (session == null) { + throw new NullPointerException("session can not be null"); + } + } + + protected void checkSessionConfigurationNotNull(RestClient session) { + if (session.getConfiguration() == null) { + throw new NullPointerException( + "session configuration can not be null"); + } + } +} Added: trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/README.rdoc =================================================================== --- trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/README.rdoc (rev 0) +++ trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/README.rdoc 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,38 @@ += rest + +This plugin expose some services via a the REST protocol: + +jredmine/get_projects +jredmine/get_issue_statuses +jredmine/get_issue_priorities + +jredmine/get_project/X + +jredmine/get_project_trackers/X +jredmine/get_project_issue_categories/X +jredmine/get_project_users/X +jredmine/get_project_versions/X + +jredmine/get_version/X?version_name=Y +jredmine/get_version_issues/X?version_name=Y +jredmine/get_version_attachements/X?version_name=Y + +jredmine/add_version/X?version_name=Y +jredmine/update_version/X?version_name=Y + +jredmine/add_news/X?version_name=Y +jredmine/add_attachment/X?version_name=Y + +where X is a project identifier and Y a version name + += install + +To install the plugin, just put it in the vendor/plugins directory and restart the redmine (or apache) + += configure + +Once the plugin is available in the forge, you can configure for each project +if you want to expose jredmine service. + + + Added: trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/app/controllers/jredmine_controller.rb =================================================================== --- trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/app/controllers/jredmine_controller.rb (rev 0) +++ trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/app/controllers/jredmine_controller.rb 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,585 @@ +### +# #%L +# JRedmine :: Client +# +# $Id$ +# $HeadURL: http://svn.nuiton.org/svn/jredmine/trunk/jredmine-client/src/main/redmine/jr... $ +# %% +# Copyright (C) 2009 - 2010 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>. +# #L% +### +class JredmineController < ActionController::Base + + # post request + #before_filter :check_post, :only => [:add_version, :update_version, :next_version, :add_news, :add_attachment, :add_version_attachment, :add_issue_time, :update_issue_time] + before_filter :check_post, :only => [:add_version, :add_news, :add_attachment, :add_version_attachment, :add_issue_time] + + # put request + before_filter :check_post, :only => [:update_version, :next_version, :update_issue_time] + + # find user (after login) + before_filter :find_user, :only => [:get_user_projects, :add_version, :update_version, :next_version, :add_news, :add_attachment, :add_version_attachment, :add_issue_time, :update_issue_time] + + # find project and check permission + before_filter :find_project, :except => [:ping, :login, :logout, :get_projects, :get_user_projects, :get_issue_statuses, :get_issue_priorities, :get_enumeration] + + # find project's version + before_filter :find_version, :only => [:get_version, :get_version_issues, :get_version_opened_issues, :get_version_attachments, :add_version_attachment] + + # check version definition is ok in request + before_filter :check_version_definition, :only => [:add_version, :update_version, :next_version] + + # find project's issue + before_filter :find_issue, :only => [:get_issue_times, :add_issue_time, :update_time_issue] + + # ping service (just to test if service is reachable) + def ping + render :text => "ping", :status => 200 + end + + # Login request and validation + def login + if !request.post? + # Logout user : get method not possible + self.logged_user = nil + render_status 405, "POST method required" + else + # Authenticate user + user = User.try_to_login(params[:username], params[:password]) + if user.nil? + # Invalid credentials + render_status 401, "Invalid credentials" + elsif user.new_record? + # Onthefly creation failed, + render_status 401, "User not activated" + else + # Valid user + self.logged_user = user + # always generate a key and set autologin cookie + token = Token.create(:user => user, :action => 'autologin') + cookies[:autologin] = { :value => token.value, :expires => 1.year.from_now } + render_status 200, "User logged in" + end + end + end + + # Log out current user and redirect to welcome page + def logout + cookies.delete :autologin + Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin']) if User.current.logged? + # user is no more connected + self.logged_user = nil + render_status 200, "User logged out" + end + + # recuperation des projets + def get_projects + @projects = Project.find(:all) + render_array_result @projects, "projects" + end + + # recuperation des projets dont l'utilisateur connecte est membre + def get_user_projects + projectsIds = User.current.memberships.collect{|m| m.project_id} + result = [] + for id in projectsIds + p = @project = Project.find(id) + result << p + end + render_array_result result, "projects" + end + + # recuperation des priorities d'issues + def get_issue_priorities + get_enumeration "IssuePriority" + end + + # recuperation des differentes categories d'issues + def get_issue_categories + @issue_categories = @project.issue_categories.find(:all) + render_array_result @issue_categories, "issue-categories" + end + + # recuperation des differentes statuts d'issues + def get_issue_statuses + @issue_status = IssueStatus.find(:all) + render_array_result @issue_status, "issue-statuses" + end + # recuperation du projet + def get_project + render_result @project + end + + # recuperation de tous les membres d'un projet + def get_project_users + @members = @project.members.find(:all) + @r = [] + for m in @members + u = User.find(m[:user_id]) + u[:role_id] = m[:role_id] + u[:member_id] = m[:id] + #TODO - should remove the hashed password ? + @r << u + end + render_array_result @r, "users" + end + + # recuperation de toutes les annonces d'un projet + def get_project_news + @news = @project.news.find(:all) + render_array_result @news, "news" + end + + # recuperation des trakers d'un projet + def get_project_trackers + @trackers = @project.trackers.find(:all) + render_array_result @trackers, "trackers" + end + + # recuperation des versions d'un projet + def get_project_versions + @versions = @project.versions.find(:all) + render_array_result @versions, "versions" + end + + # recuperation de toutes les issues d'un projet + def get_project_issues + r =@project.issues.find(:all) + render_array_result r, "issues" + end + + # recuperation de toutes les issues ouvertes d'un projet + def get_project_opened_issues + r = [] + for i in @project.issues.find(:all) + if !i.closed? && i.status_id != 3 + r << i + end + end + render_array_result r, "issues" + end + + # recuperation de toutes les issues fermees d'un projet + def get_project_closed_issues + r = [] + for i in @project.issues.find(:all) + if i.closed? || i.status_id == 3 + r << i + end + end + render_array_result r, "issues" + end + + # recuperation des temps d'une issue + def get_issue_times + render_array_result @issue.time_entries, "time-entries" + end + + # recuperation de la version d'un projet + def get_version + render_result @version + end + + # recuperation des issues d'un projet pour une version donnee + def get_version_issues + @issues = @version.fixed_issues.find(:all) + render_array_result @issues, "issues" + end + + # recuperation des issues ouvertes d'un projet pour une version donnee + def get_version_opened_issues + issues = @version.fixed_issues.find(:all) + result = [] + issues.each do |issue| + if !issue.closed? && issue.status_id != 3 + result << issue + end + end + render_array_result result, "issues" + end + + # recuperation des pieces jointes d'un projet pour une version donnee + def get_version_attachments + @files = @version.attachments.find(:all) + render_array_result @files, "attachments" + end + + def show_permissions + allowed_permissions + render_result @allowed_permissions + end + + def show_actions + allowed_actions + render_result @allowed_actions + end + + # add a new version for a given project + def add_version(version = params["version"]) + @version = @project.versions.find_by_name(version[:name]) + if @version + # version already exists + render_status 505, "Version #{@version.name} already exists for project #{@project.name}, can not create it" + return false + end + allowed = User.current.allowed_to?(:manage_versions, @project) + if !allowed + render_status 401, "No permission to add a version in project #{@project.name}" + return false + end + + # create the new version + @version = Version.create(:project => @project, :name => version[:name]) + + # do update the version + if !update_version0(version) + # something was wrong + return false + end + render_result @version + end + + # update a existing version for a given project + def update_version(version=params["version"]) + # get version + @version = @project.versions.find_by_name(version[:name]) + if !@version + render_status 404, "#{version['name']} is not a version for project #{@project.name}" + return false + end + # check permissions + allowed = User.current.allowed_to?({:controller => 'versions', :action => "edit"}, @project) + if !allowed + render_status 401, "No permission to edit a version on project #{@project.name}" + return false + end + # do update the version + if !update_version0(version) + # something was wrong + return false + end + render_result @version + end + + # add or update a new version for a given project and move all opened issue + # to next version from a preivous version + def next_version(version = params["version"],old_version_name=params[:oldVersionName]) + # get version + @version = @project.versions.find_by_name(version[:name]) + if !@version + # version does does exists + allowed = User.current.allowed_to?(:manage_versions, @project) + if !allowed + render_status 401, "No permission to add a version on project #{@project.name}" + return false + end + + # create the new version + @version = Version.create(:project => @project, :name => version[:name]) + end + + # check update permission + allowed = User.current.allowed_to?({:controller => 'versions', :action => "edit"}, @project) + if !allowed + render_status 401, "No permission to edit a version on project #{@project.name}" + return false + end + + # do update the version + if !update_version0(version) + + # something was wrong while updating the version + return false + 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} for project #{@project.name}" + return false + end + old_issues = old_version.fixed_issues.find(:all) + old_issues.each do |issue| + sid = issue.status_id + if !issue.closed? || ( sid == 1 || sid == 2 ) + 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 + + # add a new news for a given project + def add_news(news = params["news"]) + if !request.post? + render_status 405, "POST method required for action add_news" + return false + end + allowed = User.current.allowed_to?({:controller => 'news', :action => "new"}, @project) + if !allowed + msg = "No permission to add a news on project "+ @project.name + render_status 401, msg + else + @news = News.new(:project => @project, :author => User.current) + @news.attributes = news + if @news.save + Mailer.deliver_news_added(@news) if Setting.notified_events.include?('news_added') + render_result @news + else + render_status 505, "Could not add the news..." + end + end + end + + def add_version_attachment + add_attachment + end + + def add_attachment(attachment = params["attachment"]) + if !request.post? + render_status 405, "POST method required for action add_attachment" + return false + end + container = !@version ? @project : @version + if attachment + file = attachment['file'] + next unless file && file.size > 0 + a = Attachment.new(:container => container, + :file => file, + :description => attachment['description'].to_s.strip, + :author => User.current) + end + if a.save + if Setting.notified_events.include?('file_added') + array =[] + array << a + Mailer.deliver_attachments_added(array) + end + else + render_status 505, "Could not save the file " + a + end + render_result a + end + + def add_issue_time(timeEntry = params["time_entry"]) + if !request.post? + render_status 405, "POST method required for action add_issue_time" + return false + end + allowed = User.current.allowed_to?(:log_time, @project) + if !allowed + msg = "No permission to add a issue time entry on project "+ @project.name + render_status 401, msg + end + @notes = params[:notes] + journal = @issue.init_journal(User.current, @notes) + @time_entry = TimeEntry.new(:project => @project, :issue => @issue, :user => User.current, :spent_on => Date.today) + @time_entry.attributes = timeEntry + + call_hook(:controller_issues_edit_before_save, { :params => params, :issue => @issue, :time_entry => @time_entry, :journal => journal}) + + if (@time_entry.hours.nil? || @time_entry.valid?) && @issue.save + # Log spend time + @time_entry.save + else + render_status 505, "Could not save the time entry " + @time_entry + end + if !journal.new_record? + # Only send notification if something was actually changed + Mailer.deliver_issue_edit(journal) if Setting.notified_events.include?('issue_updated') + end + render_result @time_entry + end + + def update_issue_time(timeEntry = params["time_entry"]) + if !request.post? + render_status 405, "POST method required for action update_issue_time" + return false + end + + end + + # recuperation des valeurs d'une enumeration + def get_enumeration(type = params[:type]) + #@result = Enumeration.get_values(type) + @result = Enumeration.find(:all, :conditions =>["type = :sqlParamType", {:sqlParamType => type}]) + render_array_result @result, "enumerations" + end + + private + + # Checks that action is using post method + def check_post + if !request.post? + render_status 405, "POST method required for action #{params[:action]}" + end + end + + # Checks that action is using put method + def check_put + if !request.put? + render_status 405, "PUT method required for action #{params[:action]}" + end + end + + # Checks that action is using delete method + def check_delete + if !request.delete? + render_status 405, "DELETE method required for action #{params[:action]}" + end + end + + # Checks that request has a version[name] attribute + def check_version_definition(version = params[:version]) + if version.nil? + render_status 404, "No version definition in request" + else + if version[:name].nil? + render_status 404, "No version name given in request" + end + end + end + + def find_user + # Check the settings cache for each request + Setting.check_cache + # Find the current user + User.current = find_current_user + if !session[:user_id] + render_status 401, "Not connected" + end + end + + # Returns the current user or nil if no user is logged in + def find_current_user + if session[:user_id] + # existing session + (User.active.find(session[:user_id]) rescue nil) + elsif cookies[:autologin] + # auto-login feature + User.find_by_autologin_key(cookies[:autologin]) + end + end + + def find_project( pid = params[:pid] ) + begin + @project = Project.find(pid) + allowed = User.current.allowed_to?({:controller => 'jredmine', :action => "allow_jredmine"}, @project) + if !allowed + render_status 401, "No permission to access project #{pid} nor jredmine service configured for this project" + end + rescue ActiveRecord::RecordNotFound + render_status 404, "#{pid} is not a project" + return false + end + end + + def check_edit + # check if user can edit the project + allowed = User.current.allowed_to?({:controller => 'projects', :action => "edit"}, @project) + if !allowed + render_status 401, "No permission to edit the project" + end + end + + def find_version(version = params[:version_name]) + if version.nil? + render_status 404, "No version name given in request" + else + @version = @project.versions.find_by_name(version) + if !@version + render_status 404, "#{version} is not a version for project #{@project.name}" + end + end + end + + def find_issue(issue = params[:issue_id]) + @issue = @project.issues.find(issue) + if !@issue + render_status 404, "#{issue} is not an issue for project #{@project.name}" + end + end + + # Update the version with the pa given in parameters. + # To use this method the @project and @version must defined + def update_version0(version) + attributes = version.dup + attributes.delete('sharing') unless @version.allowed_sharings.include?(attributes['sharing']) + begin + valid = @version.update_attributes(attributes) + if !valid + render_status 505, "Could not update the version #{@version.name} on project #{@project.name} for unknown reason..." + end + rescue => msg + valid = false + render_status 505, "Could not update the version #{@version.name} on project #{@project.name} for reason #{msg}" + end + valid + end + + def render_status(code,message) + render :text => message, :status => code + end + + def render_array_result(result,tag) + if !result.any? + respond_to do |format| + format.json { render :text => "[]" } + format.xml { render :text => "<"+tag+"></"+tag+">" } + end + else + respond_to do |format| + format.json { render :text => result.to_json } + format.xml { render :text => result.to_xml } + end + end + end + + def render_result(result) + respond_to do |format| + format.json { render :text => result.to_json } + format.xml { render :text => result.to_xml } + end + end + + def logged_user=(user) + if user && user.is_a?(User) + User.current = user + session[:user_id] = user.id + else + User.current = User.anonymous + session[:user_id] = nil + end + end + + def allowed_permissions + @allowed_permissions ||= begin + module_names = @project.enabled_modules.collect {|m| m.name} + Redmine::AccessControl.modules_permissions(module_names).collect {|p| p.name} + end + end + + def allowed_actions + @allowed_actions ||= allowed_permissions.inject([]) { |actions, permission| actions += Redmine::AccessControl.allowed_actions(permission) }.flatten + end + +end Property changes on: trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/app/controllers/jredmine_controller.rb ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/config/routes.rb =================================================================== --- trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/config/routes.rb (rev 0) +++ trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/config/routes.rb 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,48 @@ +### +# #%L +# JRedmine :: Client +# +# $Id$ +# $HeadURL: http://svn.nuiton.org/svn/jredmine/trunk/jredmine-client/src/main/redmine/jr... $ +# %% +# Copyright (C) 2009 - 2010 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>. +# #L% +### +ActionController::Routing::Routes.draw do |map| + + map.with_options :controller => 'jredmine' do |red| + + # jredmine : actions with no project context + red.connect 'jredmine/:action.xml' , :action => ['get_projects', 'get_user_projects', 'get_issue_statuses', 'get_issue_priorities', 'get_enumeration'], :format => 'xml' + red.connect 'jredmine/:action.json', :action => ['get_projects', 'get_user_projects', 'get_issue_statuses', 'get_issue_priorities', 'get_enumeration'], :format => 'json' + red.connect 'jredmine/:action' , :action => ['ping', 'login', 'logout', 'get_projects', 'get_user_projects', 'get_issue_statuses', 'get_issue_priorities', 'get_enumeration'], :format => 'xml' + + # jredmine/action/:pid : actions with project context + red.connect 'jredmine/:action.xml/:pid' , :pid => /.+/, :format => 'xml' + red.connect 'jredmine/:action.json/:pid', :pid => /.+/, :format => 'json' + red.connect 'jredmine/:action/:pid' , :pid => /.+/, :format => 'xml' + + end + + # jredmine: ping, login , logout, with no project context... + #map.connect 'jredmine/:action', :controller => 'jredmine' ,:action => ['ping', 'login', 'logout', 'get_projects', 'get_issue_statuses', 'get_issue_priorities'] + #map.connect 'jredmine/:action.:format', :controller => 'jredmine' ,:action => ['get_projects', 'get_issue_statuses', 'get_issue_priorities'], :format => ['xml', 'json'] + + # jredmine/action/?? (:project_id) + #map.connect 'jredmine/:action/:project_id', :controller => 'jredmine' + #map.connect 'jredmine/:action.:format/:project_id', :controller => 'jredmine', :format => ['xml', 'json'] +end \ No newline at end of file Property changes on: trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/config/routes.rb ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/init.rb =================================================================== --- trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/init.rb (rev 0) +++ trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/init.rb 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,35 @@ +### +# #%L +# JRedmine :: Client +# +# $Id$ +# $HeadURL: http://svn.nuiton.org/svn/jredmine/trunk/jredmine-client/src/main/redmine/jr... $ +# %% +# Copyright (C) 2009 - 2010 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>. +# #L% +### +require 'redmine' + +Redmine::Plugin.register :jredmine do + name 'JRedmine Rails plugin' + author 'Tony Chemit' + description 'A plugin to expose projects in REST protocol' + version '0.0.1' + project_module :jredmine do + permission :allow_jredmine, :jredmine => :allow_jredmine + end +end Property changes on: trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/init.rb ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/lang/en.yml =================================================================== --- trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/lang/en.yml (rev 0) +++ trunk/jredmine-client-1.3.x/src/main/redmine/jredmine/lang/en.yml 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,2 @@ +# English strings go here +my_label: "My label" Added: trunk/jredmine-client-1.3.x/src/site/apt/index.apt =================================================================== --- trunk/jredmine-client-1.3.x/src/site/apt/index.apt (rev 0) +++ trunk/jredmine-client-1.3.x/src/site/apt/index.apt 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,122 @@ +~~~ +~~ #%L +~~ JRedmine :: Client +~~ +~~ $Id$ +~~ $HeadURL: http://svn.nuiton.org/svn/jredmine/trunk/jredmine-client/src/site/apt/index.... $ +~~ %% +~~ Copyright (C) 2009 - 2010 Tony Chemit, 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>. +~~ #L% +~~~ +---- +JRedmine-client +---- +---- +2009-09-15 +---- + + Ce module contient un plugin <rails> qui permet d'ouvrir l'api de redmine au + protocole <REST>, ainsi q'un client <Java> pour interroger les services <REST>. + + +Plugin <rails> JRedmine + + Le but de ce plugin est de pouvoir accéder aux données d'un serveur Redmine en + utilisant le protocole <REST>, mais aussi d'effectuer des tâches de + maintenance sur le serveur. + + La page {{{./rails_api.html}API}} détaille l'ensemble des services disponibles + depuis le serveur Redmine. + +* Source du plugin + + Les sources du plugin <rails> sont sont dans le répertoire <<src/main/redmine>> + +-------------------------------------------------------------------------------- + +src/main/redmine/ +`-- jredmine + |-- README.rdoc + |-- app + | |-- controllers + | | `-- jredmine_controller.rb + | |-- helpers + | |-- models + | `-- views + |-- assets + | |-- images + | |-- javascripts + | `-- stylesheets + |-- config + | `-- routes.rb + |-- db + | `-- migrate + |-- init.rb + |-- lang + | `-- en.yml + |-- lib + | `-- tasks + `-- test + `-- functional +-------------------------------------------------------------------------------- + +* Récupération d'une version packagée + + Il est possible de récupérer une version zippée du plugin (voir la section des + téléchargements). + +* Installation du plugin sur le serveur Redmine + + * récupération du zip du plugin + + * dézippage dans le répertoire vendor/plugins + + * relancer votre instance de redmine (ou apache). + +* Configuration des permissions du plugin dans le serveur Redmine + + Le plugin est activable par projet et par rôle. + + Pour rendre accessible le plugin pour un projet donné, il faut donc ajouter + le module JRedmine sur le projet dans l'onglet de configuration des modules + du projet. + + Pour rendre accessible le plugin pour un rôle, il faut lui ajouter la + permission <<allow_jredmine>> dans la page des permissions du rôle. + +* Tester le plugin + + Une fois la configuration des permissions réalisées, vous pouvez tester le + plugin dans un navigateur web. + + Pour cela, loggez-vous en web sur redmine, puis lancer (dans un autre onglet) + l'url suivante : (remplacer <XX> par le chemin d'accès à votre redmine + et <YY> par le nom d'un de vos projet). + +-------------------------------------------------------------------------------- +http://XX/jredmine/get_project/YY +-------------------------------------------------------------------------------- + + Vous devez obtenir en retour la description xml du projet demandé. + +Client java + + Le client java qui interroge le plugin rails se base sur l'api du plugin rails + et transforme les données retournées en xml en objets java. + + La {{{./redmine_service.html}page suivante}} détaille les services disponibles + en java. Property changes on: trunk/jredmine-client-1.3.x/src/site/apt/index.apt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jredmine-client-1.3.x/src/site/apt/rails_api.apt =================================================================== --- trunk/jredmine-client-1.3.x/src/site/apt/rails_api.apt (rev 0) +++ trunk/jredmine-client-1.3.x/src/site/apt/rails_api.apt 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,503 @@ +~~~ +~~ #%L +~~ JRedmine :: Client +~~ +~~ $Id$ +~~ $HeadURL: http://svn.nuiton.org/svn/jredmine/trunk/jredmine-client/src/site/apt/rails_... $ +~~ %% +~~ Copyright (C) 2009 - 2010 Tony Chemit, 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>. +~~ #L% +~~~ +---- +API du plugin rails JRedmine +---- +---- +2009-09-20 +---- + +Introduction + + Ce document décrit l'API du plugin rails. + + + Toutes les actions REST sont préfixés par <<jredmine/>>. + + Par exemple, si votre serveur redmine accessible sur <http://myredmine>, + les appels sur redmine seront de type <http://myredmine/jredmine/XXX>. + + On distingue donc trois types d'API : + + * API de login : pour gérer la connexion au serveur Redmine : une connexion + authentifié est requise pour pouvoir récupérer des données ou effectuer des + actions sur le serveur. + + * API de lecture : pour récupérer des données du serveur. + + * API d'actions : pour effecuter des actions de maintenance sur le serveur. + + Toutes les données en sortie du plugin sont au format <xml>, ou <json>. + +API de login + +*-----------*-----------------------------------------------+ +| <action> | <description> | +*-----------*-----------------------------------------------+ +| <<ping>> | un service de ping qui retourne le mot <ping> | +*-----------*-----------------------------------------------+ +| <<login>> | pour connecter l'utilisateur au serveur | +*-----------*-----------------------------------------------+ +| <<logout>>| pour déconnecter l'utilisateur du serveur | +*-----------*-----------------------------------------------+ + +* ping + + Ce service ne requiert pas de paramètre. + + Requète : + +-------------------------------------------------------------------------------- +jredmine/ping +-------------------------------------------------------------------------------- + +* login + + Ce service nécessite deux paramètres : + + * <<username>> + + * <<password>> + + <<Note:>> Cette requête ne peut être exécutée qu'en <<POST>>. + + Requète : + +-------------------------------------------------------------------------------- +jredmine/login +-------------------------------------------------------------------------------- + +* logout + + Ce service ne requiert pas de paramètre. + + Requète : + +-------------------------------------------------------------------------------- +jredmine/logout +-------------------------------------------------------------------------------- + +API de lecture + + On distingue quatre niveaux de données récupérables : + + * les données qui ne dépendent pas d'un projet + + * les données qui dépendent d'un projet + + * les données qui dépendent d'une version d'un projet + + * les données qui dépendent d'une issued'un projet + +* Services des données indépendantes + +*--------------------------*-----------------------------------+ +| <action[.xml\|.json]> | <données récupérées> | +*--------------------------*-----------------------------------+ +| <<get_projects>> | tous les projets | +*--------------------------*-----------------------------------+ +| <<get_user_projects>> | tous les projets dont l'utilisateur connecté est membre | +*--------------------------*-----------------------------------+ +| <<get_issue_statuses>> | tous les status de demandes | +*--------------------------*-----------------------------------+ +| <<get_issue_priorities>> | toutes les prioritiés de demandes | +*--------------------------*-----------------------------------+ + +** get_projects + + Ce service ne requiert pas de paramètre. + + Requètes : + +-------------------------------------------------------------------------------- +jredmine/get_projects.xml +jredmine/get_projects.json +-------------------------------------------------------------------------------- + +** get_user_projects + + Ce service ne requiert pas de paramètre. + + Requètes : + +-------------------------------------------------------------------------------- +jredmine/get_user_projects.xml +jredmine/get_user_projects.json +-------------------------------------------------------------------------------- + +** get_issue_statuses + + Ce service ne requiert pas de paramètre. + + Requètes : + +-------------------------------------------------------------------------------- +jredmine/get_issue_statuses.xml +jredmine/get_issue_statuses.json +-------------------------------------------------------------------------------- + +** get_issue_priorities + + Ce service ne requiert pas de paramètre. + + Requètes : + +-------------------------------------------------------------------------------- +jredmine/get_issue_priorities.xml +jredmine/get_issue_priorities.json +-------------------------------------------------------------------------------- + +* Services des données dépendantes d'un projet + +*-------------------------------*---------------------------------------+ +| <action[.xml\|.json]> | <données récupérées pour un projet> | +*-------------------------------*---------------------------------------+ +| <<get_projet>> | le projet | +*-------------------------------*---------------------------------------+ +| <<get_issue_categories>> | touts les catégories de demande | +*-------------------------------*---------------------------------------+ +| <<get_project_users>> | tous les membres du projet | +*-------------------------------*---------------------------------------+ +| <<get_project_trackers>> | tous les types de tracker | +*-------------------------------*---------------------------------------+ +| <<get_project_versions>> | toutes les versions d'un projet | +*-------------------------------*---------------------------------------+ +| <<get_project_issues>> | toutes les issues d'un projet | +*-------------------------------*---------------------------------------+ +| <<get_project_opened_issues>> | toutes les issues ouvertes d'un projet| +*-------------------------------*---------------------------------------+ +| <<get_project_closed_issues>> | toutes les issues fermées d'un projet | +*-------------------------------*---------------------------------------+ + +** get_projet + + Ce service ne requiert pas de paramètre. + + Requètes : + +-------------------------------------------------------------------------------- +jredmine/get_projet.xml/myProject +jredmine/get_projet.json/myProject +-------------------------------------------------------------------------------- + +** get_issue_categories + + Ce service ne requiert pas de paramètre. + + Requètes : + +-------------------------------------------------------------------------------- +jredmine/get_issue_categories.xml/myProject +jredmine/get_issue_categories.json/myProject +-------------------------------------------------------------------------------- + +** get_project_users + + Ce service ne requiert pas de paramètre. + + Requètes : + +-------------------------------------------------------------------------------- +jredmine/get_project_users.xml/myProject +jredmine/get_project_users.json/myProject +-------------------------------------------------------------------------------- + +** get_project_trackers + + Ce service ne requiert pas de paramètre. + + Requètes : + +-------------------------------------------------------------------------------- +jredmine/get_project_trackers.xml/myProject +jredmine/get_project_trackers.json/myProject +-------------------------------------------------------------------------------- + +** get_project_versions + + Ce service ne requiert pas de paramètre. + + Requètes : + +-------------------------------------------------------------------------------- +jredmine/get_project_versions.xml/myProject +jredmine/get_project_versions.json/myProject +-------------------------------------------------------------------------------- + +** get_issues + + Ce service ne requiert pas de paramètre. + + Requètes : + +-------------------------------------------------------------------------------- +jredmine/get_project_issues.xml/myProject +jredmine/get_project_issues.json/myProject +-------------------------------------------------------------------------------- + +* Services des données dépendantes d'une version d'un projet + +*------------------------------*-----------------------------------------------------+ +| <action[.xml\|.json]> | <données récupérées pour une version d'un projet> | +*------------------------------*-----------------------------------------------------+ +| <<get_version>> | la version | +*------------------------------*-----------------------------------------------------+ +| <<get_version_issues>> | touts les catégories de demande | +*------------------------------*-----------------------------------------------------+ +| <<get_versions_attachments>> | tous les membres du projet | +*------------------------------*-----------------------------------------------------+ + +** get_version + + Ce service requiert un paramètre : + + * <<version_name>> le nom de la version + + Requètes : + +-------------------------------------------------------------------------------- +jredmine/get_version.xml/myProject?version_name=myVersion +jredmine/get_version.json/myProject?version_name=myVersion +-------------------------------------------------------------------------------- + +** get_version_issues + + Ce service requiert un paramètre : + + * <<version_name>> le nom de la version + + Requètes : + +-------------------------------------------------------------------------------- +jredmine/get_version_issues.xml/myProject?version_name=myVersion +jredmine/get_version_issues.json/myProject?version_name=myVersion +-------------------------------------------------------------------------------- + +** get_versions_attachments + + Ce service requiert un paramètre : + + * <<version_name>> le nom de la version + + Requètes : + +-------------------------------------------------------------------------------- +jredmine/get_versions_attachments.xml/myProject?version_name=myVersion +jredmine/get_versions_attachments.json/myProject?version_name=myVersion +-------------------------------------------------------------------------------- + +* Services des données dépendantes d'une issue d'un projet + +*--------------------------*---------------------------------------------------+ +| <action[.xml\|.json]> | <données récupérées pour une issue d'un projet> | +*--------------------------*---------------------------------------------------+ +| <<get_issue_times>> | les temps de l'issue | +*--------------------------*---------------------------------------------------+ + +** get_issue_times + + Ce service requiert un paramètre : + + * <<issue_id>> l'id de l'issue + + Requètes : + +-------------------------------------------------------------------------------- +jredmine/get_issue_time.xml/myProject?issue_id=myIssueId +jredmine/get_issue_time.json/myProject?issue_id=myIssueId +-------------------------------------------------------------------------------- + +API d'actions + +*----------------------------*-----------------------------------------------+ +| <action> | <description> | +*----------------------------*-----------------------------------------------+ +| <<add_version>> | ajouter une version à un projet | +*----------------------------*-----------------------------------------------+ +| <<update_version>> | mettre à jour une version d'un projet | +*----------------------------*-----------------------------------------------+ +| <<next_version>> | préparer la prochaine version d'un projet | +*----------------------------*-----------------------------------------------+ +| <<add_attachment>> | ajouter un fichier à un projet | +*----------------------------*-----------------------------------------------+ +| <<add_version_attachment>> | ajouter un fichier à une version d'un projet | +*----------------------------*-----------------------------------------------+ +| <<add_news>> | ajouter une annonce à un projet | +*----------------------------*-----------------------------------------------+ +| <<add_issue_time>> | ajouter un temps à une issue d'un projet | +*----------------------------*-----------------------------------------------+ +| <<update_issue_time>> | mettre à jour le temps d'une issue d'un projet| +*----------------------------*-----------------------------------------------+ + + <<Note:>> Toutes ces opérations doivent obligatoirement être exécutées + par une méthod http <<POST>> (donc pas réalisable via un navigateur). + +* add_version + + Ce service requiert trois paramètres : + + * <<version[name]>> le nom de la version + + * <<version[description]>> la description de la version + + * <<version[effective_date]>> la date effective de la version + + Requètes : + +-------------------------------------------------------------------------------- +jredmine/add_version.xml/myProject +jredmine/add_version.json/myProject +-------------------------------------------------------------------------------- + +* update_version + + Ce service requiert trois paramètres : + + * <<version[name]>> le nom de la version + + * <<version[description]>> la description de la version + + * <<version[effective_date]>> la date effective de la version + + Requètes : + +-------------------------------------------------------------------------------- +jredmine/update_version.xml/myProject +jredmine/update_version.json/myProject +-------------------------------------------------------------------------------- + +* next_version + + Ce service requiert quatre paramètres : + + * <<previousVersionName>> le nom de la version précédente + + * <<version[name]>> le nom de la version + + * <<version[description]>> la description de la version + + * <<version[effective_date]>> la date effective de la version + + Requètes : + +-------------------------------------------------------------------------------- +jredmine/next_version.xml/myProject +jredmine/next_version.json/myProject +-------------------------------------------------------------------------------- + +* add_attachment + + Ce service requiert deux paramètres : + + * <<attachment[description]>> la description de la pièce jointe + + * <<attachment[file]>> la pièce-jointe + + <<Note:>> La requète est de type <<multi-part>>. + + Requètes : + +-------------------------------------------------------------------------------- +jredmine/add_attachment.xml/myProject +jredmine/add_attachment.json/myProject +-------------------------------------------------------------------------------- + +* add_version_attachment + + Ce service requiert trois paramètres : + + * <<version_name>> le nom de la version + + * <<attachment[description]>> la description de la pièce jointe + + * <<attachment[file]>> la pièce-jointe + + <<Note:>> La requète est de type <<multi-part>>. + + Requètes : + +-------------------------------------------------------------------------------- +jredmine/add_version_attachment.xml/myProject +jredmine/add_version_attachment.json/myProject +-------------------------------------------------------------------------------- + +* add_news + + Ce service requiert trois paramètres : + + * <<news[title]>> le titre de de la version + + * <<news[summary]>> la description de l'annonce + + * <<news[description]>> le contenu de l'annonce + + Requètes : + +-------------------------------------------------------------------------------- +jredmine/add_news.xml/myProject +jredmine/add_news.json/myProject +-------------------------------------------------------------------------------- + +** add_issue_time + + Ce service requiert cinq paramètres : + + * <<issue_id>> l'id de l'issue + + * <<time_entry[activity_id]>> l'id de l'activité du temps à ajouter + + * <<time_entry[hours]>> le nombre d'heures du temps à ajouter + + * <<time_entry[spent_on]>> la date du temps à ajouter (si null, on prend la date du jour) + + * <<time_entry[comments]>> commentaire du temps à ajouter + + Requètes : + +-------------------------------------------------------------------------------- +jredmine/add_issue_time.xml/myProject +jredmine/add_issue_time.json/myProject +-------------------------------------------------------------------------------- + +** update_issue_time + + Ce service requiert cinq paramètres : + + * <<issue_id>> l'id de l'issue + + * <<time_entry[activity_id]>> l'id de l'activité du temps à mettre à jour + + * <<time_entry[hours]>> le nombre d'heures du temps à mettre à jour + + * <<time_entry[spent_on]>> la date du temps à mettre à jour (si null, on prend la date du jour) + + * <<time_entry[comments]>> commentaire du temps à mettre à jour + + Requètes : + +-------------------------------------------------------------------------------- +jredmine/update_issue_time.xml/myProject +jredmine/update_issue_time.json/myProject +-------------------------------------------------------------------------------- Property changes on: trunk/jredmine-client-1.3.x/src/site/apt/rails_api.apt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jredmine-client-1.3.x/src/site/apt/redmine_service.apt =================================================================== --- trunk/jredmine-client-1.3.x/src/site/apt/redmine_service.apt (rev 0) +++ trunk/jredmine-client-1.3.x/src/site/apt/redmine_service.apt 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,71 @@ +~~~ +~~ #%L +~~ JRedmine :: Client +~~ +~~ $Id$ +~~ $HeadURL: http://svn.nuiton.org/svn/jredmine/trunk/jredmine-client/src/site/apt/redmin... $ +~~ %% +~~ Copyright (C) 2009 - 2010 Tony Chemit, 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>. +~~ #L% +~~~ +---- +RedmineService +---- +---- +2009-09-15 +---- + +Les contrats de service + + L'api java sépare depuis la version 1.0.3 les services publiques et privés. + +* org.nuiton.jredmine.RedmineAnonymousService + + Ce contrat permet d'exécuter les services publiques (services anonymes). + +* org.nuiton.jredmine.RedmineLogguedService + + Ce contrat permet d'exécuter les services privés (services avec login). + +* org.nuiton.jredmine.RedmineService + + Ce contrat regroupe les deux précédents et constitue l'ensemble des services + connus par redmine. + + +Les implentations de service + + L'api offre deux implentations de service. + +* org.nuiton.jredmine.DefaultRedmineAnonymousService + + Ce service peut-être appelé pour tout opération publique, la session + sous-jacente au service (RedmineRestClient) n'établiera pas d'authentification + vers les serveur redmine. + +* org.nuiton.jredmine.DefaultRedmineService + + Ce service peut-être appelé pour toute opération vers le serveur redmine. + + Si la configuration requièrt un login (propriété anonymous à false), une + authentification sera effectuée. + + A noter que si on utilise ce service en anonyme et que l'on tente d'appeler + une méthode de service privé, une exception sera remontée indiquant qu'il faut + être authentifié pour effectuer cette opération. + + <Pour plus de détails, consulter la javadoc du module.> Property changes on: trunk/jredmine-client-1.3.x/src/site/apt/redmine_service.apt ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jredmine-client-1.3.x/src/site/site_fr.xml =================================================================== --- trunk/jredmine-client-1.3.x/src/site/site_fr.xml (rev 0) +++ trunk/jredmine-client-1.3.x/src/site/site_fr.xml 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + JRedmine :: Client + + $Id$ + $HeadURL: http://svn.nuiton.org/svn/jredmine/trunk/jredmine-client/src/site/site_fr.xm... $ + %% + Copyright (C) 2009 - 2010 Tony Chemit, 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>. + #L% + --> + +<project name="${project.name}"> + + <bannerLeft> + <name>${project.name}</name> + <href>index.html</href> + </bannerLeft> + + <bannerRight> + <src>http://www.codelutin.com/images/lutinorange-codelutin.png</src> + <href>http://www.codelutin.com</href> + </bannerRight> + + <skin> + <groupId>org.apache.maven.skins</groupId> + <artifactId>maven-fluido-skin</artifactId> + <version>1.2.1</version> + </skin> + + <custom> + <fluidoSkin> + <topBarEnabled>true</topBarEnabled> + <googleSearch/> + <sideBarEnabled>false</sideBarEnabled> + <searchEnabled>true</searchEnabled> + <sourceLineNumbersEnabled>true</sourceLineNumbersEnabled> + </fluidoSkin> + </custom> + + <publishDate position="right" format="dd/MM/yyyy"/> + <version position="right"/> + + <body> + + <breadcrumbs> + <item name="${project.name}" href="index.html"/> + </breadcrumbs> + + <links> + <item name="nuiton.org" href="http://www.nuiton.org"/> + <item name="CodeLutin" href="http://codelutin.com"/> + <item name="Libre-Entreprise" href="http://www.libre-entreprise.org/"/> + </links> + + <menu ref="parent"/> + + <menu name="Utilisateur"> + <item name="Introduction" href="index.html"/> + <item name="JRedmine rails API" href="rails_api.html"/> + <item name="JRedmine java service" href="redmine_service.html"/> + </menu> + + <menu name="Téléchargement"> + <item href="http://nuiton.org/projects/list_files/jredmine" name="Sources bundles"/> + + <item href="${repository.home.url}/org/nuiton/jredmine/jredmine-client/${project.version}/${project.build.finalName}.jar" + name="Librairie (jar)"/> + <item href="${repository.home.url}/org/nuiton/jredmine/jredmine-client/${project.version}/${project.build.finalName}-javadoc.jar" + name="Javadoc (jar)"/> + <item href="${repository.home.url}/org/nuiton/jredmine/jredmine-client/${project.version}/${project.build.finalName}-sources.jar" + name="Sources (jar)"/> + <item href="${repository.home.url}/org/nuiton/jredmine/jredmine-client/${project.version}/${project.build.finalName}-tests.jar" + name="Test Librairie (jar)"/> + <item href="${repository.home.url}/org/nuiton/jredmine/jredmine-client/${project.version}/${project.build.finalName}-test-javadoc.jar" + name="Test Javadoc (jar)"/> + <item href="${repository.home.url}/org/nuiton/jredmine/jredmine-client/${project.version}/${project.build.finalName}-test-sources.jar" + name="Test Sources (jar)"/> + </menu> + + <menu ref="reports"/> + + <footer> + + <script type="text/javascript" + src="http://maven-site.nuiton.org/public/js/maven-site-nuiton.org.js"> + </script> + + <div id='projectMetas' + projectversion='${project.version}' + platform='${project.platform}' + projectid='${project.projectId}' + scm='${project.scm.connection}' + scmwebeditorenabled='${project.scmwebeditorEnabled}' + scmwebeditorurl='${project.scmwebeditorUrl}' + siteSourcesType='${project.siteSourcesType}' + piwikEnabled='${project.piwikEnabled}' + piwikId='${project.piwikId}'> + </div> + </footer> + + </body> +</project> Property changes on: trunk/jredmine-client-1.3.x/src/site/site_fr.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jredmine-client-1.3.x/src/test/java/org/nuiton/jredmine/v1_3_x/RedmineAnonymousServiceTest.java =================================================================== --- trunk/jredmine-client-1.3.x/src/test/java/org/nuiton/jredmine/v1_3_x/RedmineAnonymousServiceTest.java (rev 0) +++ trunk/jredmine-client-1.3.x/src/test/java/org/nuiton/jredmine/v1_3_x/RedmineAnonymousServiceTest.java 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,164 @@ +package org.nuiton.jredmine.v1_3_x; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.nuiton.jredmine.RedmineAnonymousService; +import org.nuiton.jredmine.RedmineServiceConfiguration; +import org.nuiton.jredmine.RedmineServiceException; +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.TimeEntry; +import org.nuiton.jredmine.model.Tracker; +import org.nuiton.jredmine.model.User; +import org.nuiton.jredmine.model.Version; + +import java.io.IOException; + +/** + * Tests the {@link RedmineAnonymousServiceImpl}. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.5 + */ +public class RedmineAnonymousServiceTest { + + protected static final RedmineFixtures fixtures = new RedmineFixtures(); + + @Rule + public final RedmineServer<RedmineAnonymousService> server = createNewServer(fixtures); + + protected RedmineAnonymousService getService() { + return server.getService(); + } + + protected RedmineServer<RedmineAnonymousService> createNewServer(RedmineFixtures fixtures) { + return new RedmineServer<RedmineAnonymousService>(fixtures) { + + @Override + protected RedmineAnonymousService createService( + RedmineFixtures fixture, + RedmineServiceConfiguration configuration) throws IOException, RedmineServiceException { + + return fixture.newRedmineAnonymousService(configuration); + } + + @Override + protected RedmineServiceConfiguration createConfiguration(RedmineFixtures fixture) throws IOException { + RedmineServiceConfiguration conf = fixture.newAnonymousConfiguration(); + conf.setVerbose(true); + return conf; + } + }; + } + + @BeforeClass + public static void beforeClass() { + RedmineServer<RedmineAnonymousService> newServer = + new RedmineAnonymousServiceTest().createNewServer(fixtures); + newServer.checkService(); + } + + @Test + public void getProjects() throws Exception { + Project[] projects = getService().getProjects(); + Assert.assertNotNull(projects); + } + + @Test + public void getIssuePriorities() throws Exception { + IssuePriority[] issuePriorities = getService().getIssuePriorities(); + Assert.assertNotNull(issuePriorities); + } + + @Test + public void getIssueStatuses() throws Exception { + IssueStatus[] issueStatuses = getService().getIssueStatuses(); + Assert.assertNotNull(issueStatuses); + } + + @Test + public void getProject() throws Exception { + Project project = getService().getProject(fixtures.projectName()); + Assert.assertNotNull(project); + } + + @Test + public void getIssueCategories() throws Exception { + IssueCategory[] issueCategories = getService().getIssueCategories(fixtures.projectName()); + Assert.assertNotNull(issueCategories); + } + + @Test + public void getTrackers() throws Exception { + Tracker[] trackers = getService().getTrackers(fixtures.projectName()); + Assert.assertNotNull(trackers); + } + + @Test + public void getNews() throws Exception { + News[] news = getService().getNews(fixtures.projectName()); + Assert.assertNotNull(news); + } + + @Test + public void getProjectMembers() throws Exception { + User[] users = getService().getProjectMembers(fixtures.projectName()); + Assert.assertNotNull(users); + } + + @Test + public void getProjectIssues() throws Exception { + Issue[] issues = getService().getIssues(fixtures.projectName()); + Assert.assertNotNull(issues); + } + + @Test + public void getVersions() throws Exception { + Version[] versions = getService().getVersions(fixtures.projectName()); + Assert.assertNotNull(versions); + } + + @Test + public void getVersion() throws Exception { + Version version = getService().getVersion(fixtures.projectName(), fixtures.versionName()); + Assert.assertNotNull(version); + } + + @Test + public void getVersionIssues() throws Exception { + Issue[] issues = getService().getIssues(fixtures.projectName(), fixtures.versionName()); + Assert.assertNotNull(issues); + } + + @Test + public void getOpenedIssues() throws Exception { + Issue[] issues = getService().getOpenedIssues(fixtures.projectName()); + Assert.assertNotNull(issues); + } + + @Test + public void getClosedIssues() throws Exception { + Issue[] issues = getService().getClosedIssues(fixtures.projectName()); + Assert.assertNotNull(issues); + } + + @Test + public void getIssueTimeEntries() throws Exception { + TimeEntry[] timeEntries = getService().getIssueTimeEntries(fixtures.projectName(), fixtures.issueId()); + Assert.assertNotNull(timeEntries); + } + + @Test + public void getAttachments() throws Exception { + Attachment[] attachments = getService().getAttachments(fixtures.projectName(), fixtures.versionName()); + Assert.assertNotNull(attachments); + } + +} Added: trunk/jredmine-client-1.3.x/src/test/java/org/nuiton/jredmine/v1_3_x/RedmineFixtures.java =================================================================== --- trunk/jredmine-client-1.3.x/src/test/java/org/nuiton/jredmine/v1_3_x/RedmineFixtures.java (rev 0) +++ trunk/jredmine-client-1.3.x/src/test/java/org/nuiton/jredmine/v1_3_x/RedmineFixtures.java 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,811 @@ +package org.nuiton.jredmine.v1_3_x; + +import com.google.common.base.Charsets; +import com.google.common.collect.ArrayListMultimap; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.jredmine.RedmineAnonymousService; +import org.nuiton.jredmine.RedmineService; +import org.nuiton.jredmine.RedmineServiceConfiguration; +import org.nuiton.jredmine.RedmineServiceException; +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.TimeEntry; +import org.nuiton.jredmine.model.Tracker; +import org.nuiton.jredmine.model.User; +import org.nuiton.jredmine.model.Version; +import org.nuiton.jredmine.model.io.xpp3.DefaultRedmineXpp3Helper; +import org.nuiton.jredmine.model.io.xpp3.RedmineDataConverter; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.Date; +import java.util.List; +import java.util.Properties; + +/** + * fixtures of redmine model. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.4 + */ +public class RedmineFixtures { + + /** Logger. */ + private static final Log log = LogFactory.getLog(RedmineFixtures.class); + + public static final String FILE_TO_UPLOAD_CONTENT = "Fichier à uploader"; + + public static final String PROJECT_NAME = "jredmine"; + + public static final String VERSION_NAME = "1.3"; + + public static final String ISSUE_ID = "2030"; + + private Project JRedmineProject; + + private ArrayListMultimap<Class<?>, Object> model; + + private RedmineServiceConfiguration anonymousConfiguration; + + private RedmineServiceConfiguration logguedConfiguration; + + public String projectName() { + return PROJECT_NAME; + } + + public String versionName() { + return VERSION_NAME; + } + + public String issueId() { + return ISSUE_ID; + } + + public RedmineServiceConfiguration newAnonymousConfiguration() + throws IOException { + RedmineServiceConfiguration conf = new FakeRedmineServiceConfiguration(); + copyConfiguration(getAnonymousConfiguration(), conf); + return conf; + } + + public RedmineServiceConfiguration newLogguedConfiguration() + throws IOException { + RedmineServiceConfiguration conf = new FakeRedmineServiceConfiguration(); + copyConfiguration(getLogguedConfiguration(), conf); + return conf; + } + + public RedmineAnonymousService newRedmineAnonymousService(RedmineServiceConfiguration configuration) + throws IOException, RedmineServiceException { + RedmineAnonymousServiceImpl service = new RedmineAnonymousServiceImpl(); + RedmineServiceImplementorImpl implementor = new RedmineServiceImplementorImpl(); + RedmineRestClient restClient = new RedmineRestClient(); + restClient.requestFactory = new RedmineRequestFactoryImpl(); + implementor.xpp3Helper = new DefaultRedmineXpp3Helper(); + implementor.session = restClient; + service.delegateImplementor = implementor; + service.init(configuration); + return service; + } + + public RedmineService newRedmineService(RedmineServiceConfiguration configuration) + throws IOException, RedmineServiceException { + RedmineServiceImpl service = new RedmineServiceImpl(); + RedmineServiceImplementorImpl implementor = new RedmineServiceImplementorImpl(); + RedmineRestClient restClient = new RedmineRestClient(); + restClient.requestFactory = new RedmineRequestFactoryImpl(); + implementor.session = restClient; + implementor.xpp3Helper = new DefaultRedmineXpp3Helper(); + service.delegateImplementor = implementor; + service.init(configuration); + return service; + } + + protected RedmineServiceConfiguration getAnonymousConfiguration() + throws IOException { + if (anonymousConfiguration == null) { + + Properties props = new Properties(); + + InputStream inputStream = null; + try { + String jredmineConfiguration = System.getenv("jredmine-test.properties"); + if (jredmineConfiguration == null) { + if (log.isWarnEnabled()) { + log.warn("Could not find environement variable " + + "'jredmine-test.properties' will use " + + "default test configuration"); + } + + inputStream = getClass().getResourceAsStream("/test-config.properties"); + } else { + + File file = new File(jredmineConfiguration); + + if (!file.exists()) { + throw new IllegalStateException("Could not find " + jredmineConfiguration + + " file"); + } + inputStream = FileUtils.openInputStream(file); + } + props.load(inputStream); + } finally { + if (inputStream != null) { + inputStream.close(); + } + } + anonymousConfiguration = new FakeRedmineServiceConfiguration(); + + String url = props.getProperty("test.redmineUrl"); + anonymousConfiguration.setRestUrl(new URL(url)); + + String e = props.getProperty("test.encoding"); + anonymousConfiguration.setEncoding(e); + + String verbose = props.getProperty("test.verbose"); + if (StringUtils.isNotEmpty(verbose)) { + anonymousConfiguration.setVerbose(Boolean.valueOf(verbose)); + } + anonymousConfiguration.setEncoding(Charsets.UTF_8.name()); + anonymousConfiguration.setAnonymous(true); + + verbose = System.getenv("jredmine-test.verbose"); + if (StringUtils.isNotEmpty(verbose)) { + anonymousConfiguration.setVerbose(Boolean.valueOf(verbose)); + } + + } + return anonymousConfiguration; + } + + protected RedmineServiceConfiguration getLogguedConfiguration() + throws IOException { + if (logguedConfiguration == null) { + + // use anonymous configuration + + RedmineServiceConfiguration anoConf = getAnonymousConfiguration(); + if (anoConf != null) { + logguedConfiguration = new FakeRedmineServiceConfiguration(); + copyConfiguration(anoConf, logguedConfiguration); + + // get system login password from env + String login = System.getenv("jredmine-test.login"); + String password = System.getenv("jredmine-test.password"); + if (!"null".equals(login)) { + logguedConfiguration.setRestUsername(login); + } + if (!"null".equals(password)) { + logguedConfiguration.setRestPassword(password); + } + logguedConfiguration.setAnonymous(false); + } + } + return logguedConfiguration; + } + + protected void copyConfiguration(RedmineServiceConfiguration src, + RedmineServiceConfiguration dst) { + dst.setRestUrl(src.getRestUrl()); + dst.setRestUsername(src.getRestUsername()); + dst.setRestPassword(src.getRestPassword()); + dst.setEncoding(src.getEncoding()); + dst.setVerbose(src.isVerbose()); + dst.setAnonymous(src.isAnonymous()); + } + + public List<Attachment> getAttachments() { + return get(Attachment.class); + } + + public List<Issue> getIssues() { + return get(Issue.class); + } + + public List<Project> getProjects() { + return get(Project.class); + } + + public List<Tracker> getTrackers() { + return get(Tracker.class); + } + + public List<User> getUsers() { + return get(User.class); + } + + public List<Version> getVersions() { + return get(Version.class); + } + + public <T> List<T> get(Class<T> modelType) { + if (model == null) { + try { + loadModel(); + } catch (Exception ex) { + throw new RuntimeException(ex); + } + } + return (List<T>) model.get(modelType); + } + + public <T> T get(Class<T> type, int pos) { + List<T> ts = get(type); + return ts.get(pos); + } + + public Project getJRedmineProject() { + if (JRedmineProject == null) { + JRedmineProject = new Project(); + JRedmineProject.setName("jredmine"); + JRedmineProject.setIdentifier("jredmine"); + JRedmineProject.setIsPublic(true); + JRedmineProject.setHomepage("http://maven-site.nuiton.org/jredmine"); + JRedmineProject.setDescription( + "Permet de communiquer en java avec un serveur " + "redmine qui a installé le plugin rails jredmine"); + JRedmineProject.setId(36); + JRedmineProject.setStatus(1); + } + return JRedmineProject; + } + + + public static final String VERSION_TO_CREATE_NAME = "do_not_use_me"; + + public Version getVersion() { + Version version = new Version(); + version.setName(VERSION_TO_CREATE_NAME); + version.setDescription("Une version créée par les tests de jredmine," + + " ne pas utiliser,et modifiée"); + return version; + } + + private void loadModel() + throws Exception { + model = ArrayListMultimap.create(); + + Attachment tempA; + tempA = new Attachment(); + tempA.setAuthorId((Integer) RedmineDataConverter.Integer.convert("4")); + tempA.setContainerId((Integer) RedmineDataConverter.Integer.convert("1")); + tempA.setId((Integer) RedmineDataConverter.Integer.convert("1")); + tempA.setFilesize((Integer) RedmineDataConverter.Integer.convert("411")); + tempA.setDownloads((Integer) RedmineDataConverter.Integer.convert("0")); + tempA.setCreatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-05T12:56:41+02:00")); + tempA.setContainerType((String) RedmineDataConverter.Text.convert("Version")); + tempA.setContentType((String) RedmineDataConverter.Text.convert("application/json")); + tempA.setDigest((String) RedmineDataConverter.Text.convert("6ea84342c7475c05fb077b4aca832f9a")); + tempA.setDiskFilename((String) RedmineDataConverter.Text.convert("090905125641_get_issue.json")); + tempA.setFilename((String) RedmineDataConverter.Text.convert("get_issue.json")); + model.put(Attachment.class, tempA); + tempA = new Attachment(); + tempA.setAuthorId((Integer) RedmineDataConverter.Integer.convert("4")); + tempA.setContainerId((Integer) RedmineDataConverter.Integer.convert("1")); + tempA.setId((Integer) RedmineDataConverter.Integer.convert("1")); + tempA.setFilesize((Integer) RedmineDataConverter.Integer.convert("411")); + tempA.setDownloads((Integer) RedmineDataConverter.Integer.convert("0")); + tempA.setCreatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-05T12:56:41+02:00")); + tempA.setContainerType((String) RedmineDataConverter.Text.convert("Version")); + tempA.setContentType((String) RedmineDataConverter.Text.convert("application/json")); + tempA.setDigest((String) RedmineDataConverter.Text.convert("6ea84342c7475c05fb077b4aca832f9a")); + tempA.setDiskFilename((String) RedmineDataConverter.Text.convert("090905125641_get_issue.json2")); + tempA.setFilename((String) RedmineDataConverter.Text.convert("get_issue.json2")); + model.put(Attachment.class, tempA); + + Issue tempI; + tempI = new Issue(); + tempI.setAuthorId((Integer) RedmineDataConverter.Integer.convert("5")); + tempI.setCategoryId((Integer) RedmineDataConverter.Integer.convert("2")); + tempI.setDoneRatio((Integer) RedmineDataConverter.Integer.convert("0")); + tempI.setLockVersion((Integer) RedmineDataConverter.Integer.convert("7")); + tempI.setPriorityId((Integer) RedmineDataConverter.Integer.convert("4")); + tempI.setProjectId((Integer) RedmineDataConverter.Integer.convert("1")); + tempI.setStatusId((Integer) RedmineDataConverter.Integer.convert("3")); + tempI.setTrackerId((Integer) RedmineDataConverter.Integer.convert("1")); + tempI.setFixedVersionId((Integer) RedmineDataConverter.Integer.convert("1")); + tempI.setId((Integer) RedmineDataConverter.Integer.convert("3")); + tempI.setParentId((Integer) RedmineDataConverter.Integer.convert("3")); + tempI.setRootId((Integer) RedmineDataConverter.Integer.convert("3")); + tempI.setLft((Integer) RedmineDataConverter.Integer.convert("1")); + tempI.setRgt((Integer) RedmineDataConverter.Integer.convert("2")); + tempI.setCreatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-04T20:11:52+02:00")); + tempI.setUpdatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-06T00:37:40+02:00")); + tempI.setStartDate((Date) RedmineDataConverter.Date.convert("2009-09-04")); + tempI.setDescription((String) RedmineDataConverter.Text.convert("avec une description !")); + tempI.setSubject((String) RedmineDataConverter.Text.convert("yes!")); + model.put(Issue.class, tempI); + tempI = new Issue(); + tempI.setAuthorId((Integer) RedmineDataConverter.Integer.convert("5")); + tempI.setCategoryId((Integer) RedmineDataConverter.Integer.convert("2")); + tempI.setDoneRatio((Integer) RedmineDataConverter.Integer.convert("0")); + tempI.setLockVersion((Integer) RedmineDataConverter.Integer.convert("7")); + tempI.setPriorityId((Integer) RedmineDataConverter.Integer.convert("4")); + tempI.setProjectId((Integer) RedmineDataConverter.Integer.convert("1")); + tempI.setStatusId((Integer) RedmineDataConverter.Integer.convert("3")); + tempI.setTrackerId((Integer) RedmineDataConverter.Integer.convert("1")); + tempI.setFixedVersionId((Integer) RedmineDataConverter.Integer.convert("1")); + tempI.setId((Integer) RedmineDataConverter.Integer.convert("4")); + tempI.setCreatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-04T20:11:52+02:00")); + tempI.setUpdatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-06T00:37:40+02:00")); + tempI.setStartDate((Date) RedmineDataConverter.Date.convert("2009-09-04")); + tempI.setDescription((String) RedmineDataConverter.Text.convert("avec une description !2")); + tempI.setSubject((String) RedmineDataConverter.Text.convert("yes!2")); + model.put(Issue.class, tempI); + + Project tempP; + tempP = new Project(); + tempP.setCreatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-04T18:11:54+02:00")); + tempP.setUpdatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-04T18:11:54+02:00")); + tempP.setIdentifier((String) RedmineDataConverter.Text.convert("one")); + tempP.setName((String) RedmineDataConverter.Text.convert("one")); + tempP.setId((Integer) RedmineDataConverter.Integer.convert("1")); + tempP.setLft((Integer) RedmineDataConverter.Integer.convert("1")); + tempP.setRgt((Integer) RedmineDataConverter.Integer.convert("2")); + tempP.setProjectsCount((Integer) RedmineDataConverter.Integer.convert("0")); + tempP.setStatus((Integer) RedmineDataConverter.Integer.convert("1")); + tempP.setIsPublic((Boolean) RedmineDataConverter.Boolean.convert("true")); + model.put(Project.class, tempP); + tempP = new Project(); + tempP.setCreatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-05T16:22:14+02:00")); + tempP.setUpdatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-05T16:22:29+02:00")); + tempP.setIdentifier((String) RedmineDataConverter.Text.convert("two")); + tempP.setName((String) RedmineDataConverter.Text.convert("two")); + tempP.setId((Integer) RedmineDataConverter.Integer.convert("2")); + tempP.setProjectsCount((Integer) RedmineDataConverter.Integer.convert("0")); + tempP.setStatus((Integer) RedmineDataConverter.Integer.convert("1")); + tempP.setIsPublic((Boolean) RedmineDataConverter.Boolean.convert("false")); + model.put(Project.class, tempP); + + Tracker tempT; + tempT = new Tracker(); + tempT.setId((Integer) RedmineDataConverter.Integer.convert("1")); + tempT.setProjectId((Integer) RedmineDataConverter.Integer.convert("1")); + tempT.setTrackerId((Integer) RedmineDataConverter.Integer.convert("1")); + tempT.setPosition((Integer) RedmineDataConverter.Integer.convert("1")); + tempT.setIsInChlog((Boolean) RedmineDataConverter.Boolean.convert("true")); + tempT.setIsInRoadmap((Boolean) RedmineDataConverter.Boolean.convert("false")); + tempT.setName((String) RedmineDataConverter.Text.convert("Anomalie")); + model.put(Tracker.class, tempT); + tempT = new Tracker(); + tempT.setId((Integer) RedmineDataConverter.Integer.convert("2")); + tempT.setIsInChlog((Boolean) RedmineDataConverter.Boolean.convert("true")); + tempT.setIsInRoadmap((Boolean) RedmineDataConverter.Boolean.convert("true")); + tempT.setName((String) RedmineDataConverter.Text.convert("Evolution")); + tempT.setPosition((Integer) RedmineDataConverter.Integer.convert("2")); + tempT.setProjectId((Integer) RedmineDataConverter.Integer.convert("1")); + tempT.setTrackerId((Integer) RedmineDataConverter.Integer.convert("2")); + model.put(Tracker.class, tempT); + tempT = new Tracker(); + tempT.setId((Integer) RedmineDataConverter.Integer.convert("3")); + tempT.setIsInChlog((Boolean) RedmineDataConverter.Boolean.convert("false")); + tempT.setIsInRoadmap((Boolean) RedmineDataConverter.Boolean.convert("false")); + tempT.setName((String) RedmineDataConverter.Text.convert("Assistance")); + tempT.setPosition((Integer) RedmineDataConverter.Integer.convert("3")); + tempT.setProjectId((Integer) RedmineDataConverter.Integer.convert("1")); + tempT.setTrackerId((Integer) RedmineDataConverter.Integer.convert("3")); + model.put(Tracker.class, tempT); + + User tempU; + tempU = new User(); + tempU.setCreatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-04T17:24:46+02:00")); + tempU.setUpdatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-06T01:23:59+02:00")); + tempU.setLastLoginOn((Date) RedmineDataConverter.Datetime.convert("2009-09-06T01:23:59+02:00")); + tempU.setId((Integer) RedmineDataConverter.Integer.convert("1")); + tempU.setMemberId((Integer) RedmineDataConverter.Integer.convert("5")); + tempU.setRoleId((Integer) RedmineDataConverter.Integer.convert("3")); + tempU.setStatus((Integer) RedmineDataConverter.Integer.convert("1")); + tempU.setAdmin((Boolean) RedmineDataConverter.Boolean.convert("true")); + tempU.setMailNotification((Boolean) RedmineDataConverter.Boolean.convert("true")); + tempU.setFirstname((String) RedmineDataConverter.Text.convert("Redmine")); + tempU.setHashedPassword( + (String) RedmineDataConverter.Text.convert("70c881d4a26984ddce795f6f71817c9cf4480e79")); + tempU.setLanguage((String) RedmineDataConverter.Text.convert("fr")); + tempU.setLastname((String) RedmineDataConverter.Text.convert("Admin")); + tempU.setLogin((String) RedmineDataConverter.Text.convert("admin")); + tempU.setMail((String) RedmineDataConverter.Text.convert("dummy@codelutin.com")); + tempU.setIdentityUrl((String) RedmineDataConverter.Text.convert("yo")); + model.put(User.class, tempU); + tempU = new User(); + tempU.setAdmin((Boolean) RedmineDataConverter.Boolean.convert("true")); + tempU.setCreatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-04T19:49:02+02:00")); + tempU.setFirstname((String) RedmineDataConverter.Text.convert("tony")); + tempU.setHashedPassword( + (String) RedmineDataConverter.Text.convert("8aed1322e5450badb078e1fb60a817a1df25a2ca")); + tempU.setId((Integer) RedmineDataConverter.Integer.convert("5")); + tempU.setLanguage((String) RedmineDataConverter.Text.convert("fr")); + tempU.setLastLoginOn((Date) RedmineDataConverter.Datetime.convert("2009-09-04T19:49:38+02:00")); + tempU.setLastname((String) RedmineDataConverter.Text.convert("chemit2")); + tempU.setLogin((String) RedmineDataConverter.Text.convert("tchemit2")); + tempU.setMail((String) RedmineDataConverter.Text.convert("chemit@codelutin.com")); + tempU.setMailNotification((Boolean) RedmineDataConverter.Boolean.convert("false")); + tempU.setMemberId((Integer) RedmineDataConverter.Integer.convert("4")); + tempU.setRoleId((Integer) RedmineDataConverter.Integer.convert("3")); + tempU.setStatus((Integer) RedmineDataConverter.Integer.convert("1")); + tempU.setUpdatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-04T19:49:38+02:00")); + model.put(User.class, tempU); + tempU = new User(); + tempU.setAdmin((Boolean) RedmineDataConverter.Boolean.convert("false")); + tempU.setCreatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-05T16:24:11+02:00")); + tempU.setFirstname((String) RedmineDataConverter.Text.convert("dev")); + tempU.setHashedPassword( + (String) RedmineDataConverter.Text.convert("70c881d4a26984ddce795f6f71817c9cf4480e79")); + tempU.setId((Integer) RedmineDataConverter.Integer.convert("7")); + tempU.setLanguage((String) RedmineDataConverter.Text.convert("fr")); + tempU.setLastLoginOn((Date) RedmineDataConverter.Datetime.convert("2009-09-06T16:34:39+02:00")); + tempU.setLastname((String) RedmineDataConverter.Text.convert("dev")); + tempU.setLogin((String) RedmineDataConverter.Text.convert("dev")); + tempU.setMail((String) RedmineDataConverter.Text.convert("dev3@ynot-home.info")); + tempU.setMailNotification((Boolean) RedmineDataConverter.Boolean.convert("false")); + tempU.setMemberId((Integer) RedmineDataConverter.Integer.convert("9")); + tempU.setRoleId((Integer) RedmineDataConverter.Integer.convert("4")); + tempU.setStatus((Integer) RedmineDataConverter.Integer.convert("1")); + tempU.setUpdatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-06T16:34:39+02:00")); + model.put(User.class, tempU); + + Version tempV; + tempV = new Version(); + tempV.setCreatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-06T02:47:39+02:00")); + tempV.setDescription((String) RedmineDataConverter.Text.convert("yo")); + tempV.setId((Integer) RedmineDataConverter.Integer.convert("9")); + tempV.setName((String) RedmineDataConverter.Text.convert("yor")); + tempV.setSharing((String) RedmineDataConverter.Text.convert("none")); + tempV.setStatus((String) RedmineDataConverter.Text.convert("open")); + tempV.setProjectId((Integer) RedmineDataConverter.Integer.convert("1")); + tempV.setUpdatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-06T02:50:49+02:00")); + model.put(Version.class, tempV); + tempV = new Version(); + tempV.setCreatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-06T03:05:09+02:00")); + tempV.setDescription((String) RedmineDataConverter.Text.convert("ysssoye")); + tempV.setId((Integer) RedmineDataConverter.Integer.convert("13")); + tempV.setName((String) RedmineDataConverter.Text.convert("rrrrrrrrrouuuuuua")); + tempV.setProjectId((Integer) RedmineDataConverter.Integer.convert("1")); + tempV.setUpdatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-06T03:05:09+02:00")); + model.put(Version.class, tempV); + tempV = new Version(); + tempV.setCreatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-06T03:07:58+02:00")); + tempV.setDescription((String) RedmineDataConverter.Text.convert("ysssoye")); + tempV.setId((Integer) RedmineDataConverter.Integer.convert("15")); + tempV.setName((String) RedmineDataConverter.Text.convert("aaaauuuuuua")); + tempV.setProjectId((Integer) RedmineDataConverter.Integer.convert("1")); + tempV.setUpdatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-06T03:07:58+02:00")); + model.put(Version.class, tempV); + tempV = new Version(); + tempV.setCreatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-06T04:12:25+02:00")); + tempV.setDescription((String) RedmineDataConverter.Text.convert("ysssoyeppppppppppppppppp")); + tempV.setId((Integer) RedmineDataConverter.Integer.convert("16")); + tempV.setName((String) RedmineDataConverter.Text.convert("aaaau")); + tempV.setProjectId((Integer) RedmineDataConverter.Integer.convert("1")); + tempV.setUpdatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-06T04:13:20+02:00")); + model.put(Version.class, tempV); + tempV = new Version(); + tempV.setCreatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-06T03:05:40+02:00")); + tempV.setDescription((String) RedmineDataConverter.Text.convert("ysssoye")); + tempV.setId((Integer) RedmineDataConverter.Integer.convert("14")); + tempV.setName((String) RedmineDataConverter.Text.convert("aaaaaaaaaarrrrrrrrrouuuuuua")); + tempV.setProjectId((Integer) RedmineDataConverter.Integer.convert("1")); + tempV.setUpdatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-06T03:05:40+02:00")); + model.put(Version.class, tempV); + tempV = new Version(); + tempV.setCreatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-05T00:39:15+02:00")); + tempV.setId((Integer) RedmineDataConverter.Integer.convert("5")); + tempV.setName((String) RedmineDataConverter.Text.convert("2")); + tempV.setProjectId((Integer) RedmineDataConverter.Integer.convert("1")); + tempV.setUpdatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-05T00:39:15+02:00")); + model.put(Version.class, tempV); + tempV = new Version(); + tempV.setCreatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-04T18:13:05+02:00")); + tempV.setId((Integer) RedmineDataConverter.Integer.convert("1")); + tempV.setName((String) RedmineDataConverter.Text.convert("1.0.0")); + tempV.setProjectId((Integer) RedmineDataConverter.Integer.convert("1")); + tempV.setUpdatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-04T18:13:05+02:00")); + model.put(Version.class, tempV); + tempV = new Version(); + tempV.setCreatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-06T03:00:12+02:00")); + tempV.setDescription((String) RedmineDataConverter.Text.convert("yoye")); + tempV.setEffectiveDate((Date) RedmineDataConverter.Date.convert("2009-09-06")); + tempV.setId((Integer) RedmineDataConverter.Integer.convert("11")); + tempV.setName((String) RedmineDataConverter.Text.convert("yaouuuuuua")); + tempV.setProjectId((Integer) RedmineDataConverter.Integer.convert("1")); + tempV.setUpdatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-06T03:00:12+02:00")); + model.put(Version.class, tempV); + tempV = new Version(); + tempV.setCreatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-06T02:50:59+02:00")); + tempV.setDescription((String) RedmineDataConverter.Text.convert("yoye")); + tempV.setEffectiveDate((Date) RedmineDataConverter.Date.convert("2009-09-06")); + tempV.setId((Integer) RedmineDataConverter.Integer.convert("10")); + tempV.setName((String) RedmineDataConverter.Text.convert("ya")); + tempV.setProjectId((Integer) RedmineDataConverter.Integer.convert("1")); + tempV.setUpdatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-06T02:54:16+02:00")); + model.put(Version.class, tempV); + tempV = new Version(); + tempV.setCreatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-06T03:00:37+02:00")); + tempV.setDescription((String) RedmineDataConverter.Text.convert("ysssoye")); + tempV.setEffectiveDate((Date) RedmineDataConverter.Date.convert("2009-09-06")); + tempV.setId((Integer) RedmineDataConverter.Integer.convert("12")); + tempV.setName((String) RedmineDataConverter.Text.convert("ouuuuuua")); + tempV.setProjectId((Integer) RedmineDataConverter.Integer.convert("1")); + tempV.setUpdatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-06T03:00:42+02:00")); + model.put(Version.class, tempV); + + IssueStatus tempIS; + tempIS = new IssueStatus(); + tempIS.setId(1); + tempIS.setName("Nouveau"); + tempIS.setPosition(1); + tempIS.setDefaultDoneRatio(10); + tempIS.setIsClosed(false); + tempIS.setIsDefault(true); + model.put(IssueStatus.class, tempIS); + tempIS = new IssueStatus(); + tempIS.setId(2); + tempIS.setName("Assigné"); + tempIS.setPosition(2); + tempIS.setIsClosed(false); + tempIS.setIsDefault(false); + model.put(IssueStatus.class, tempIS); + tempIS = new IssueStatus(); + tempIS.setId(3); + tempIS.setName("Résolu"); + tempIS.setPosition(3); + tempIS.setIsClosed(false); + tempIS.setIsDefault(false); + model.put(IssueStatus.class, tempIS); + tempIS = new IssueStatus(); + tempIS.setId(4); + tempIS.setName("Commentaire"); + tempIS.setPosition(4); + tempIS.setIsClosed(false); + tempIS.setIsDefault(false); + model.put(IssueStatus.class, tempIS); + tempIS = new IssueStatus(); + tempIS.setId(5); + tempIS.setName("Fermé"); + tempIS.setPosition(5); + tempIS.setIsClosed(true); + tempIS.setIsDefault(false); + model.put(IssueStatus.class, tempIS); + tempIS = new IssueStatus(); + tempIS.setId(6); + tempIS.setPosition(6); + tempIS.setName("Rejeté"); + tempIS.setIsClosed(true); + tempIS.setIsDefault(false); + model.put(IssueStatus.class, tempIS); + + IssuePriority tempIP; + tempIP = new IssuePriority(); + tempIP.setId(3); + tempIP.setParentId(1); + tempIP.setProjectId(2); + tempIP.setName("Bas"); + tempIP.setPosition(1); + tempIP.setOpt("IPRI"); + tempIP.setIsDefault(false); + tempIP.setActive(true); + model.put(IssuePriority.class, tempIP); + tempIP = new IssuePriority(); + tempIP.setId(4); + tempIP.setName("Normal"); + tempIP.setPosition(2); + tempIP.setOpt("IPRI"); + tempIP.setIsDefault(true); + model.put(IssuePriority.class, tempIP); + tempIP = new IssuePriority(); + tempIP.setId(5); + tempIP.setName("Haut"); + tempIP.setPosition(3); + tempIP.setOpt("IPRI"); + tempIP.setIsDefault(false); + model.put(IssuePriority.class, tempIP); + tempIP = new IssuePriority(); + tempIP.setId(6); + tempIP.setName("Urgent"); + tempIP.setPosition(4); + tempIP.setOpt("IPRI"); + tempIP.setIsDefault(false); + model.put(IssuePriority.class, tempIP); + tempIP = new IssuePriority(); + tempIP.setId(7); + tempIP.setName("Immédiat"); + tempIP.setPosition(5); + tempIP.setOpt("IPRI"); + tempIP.setIsDefault(false); + model.put(IssuePriority.class, tempIP); + + IssueCategory tempIC; + tempIC = new IssueCategory(); + tempIC.setId(1); + tempIC.setName("categorie one"); + tempIC.setProjectId(1); + model.put(IssueCategory.class, tempIC); + tempIC = new IssueCategory(); + tempIC.setId(2); + tempIC.setName("categorie two"); + tempIC.setProjectId(1); + model.put(IssueCategory.class, tempIC); + + News tempN; + tempN = new News(); + tempN.setId(85); + tempN.setCreatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-17T21:50:26+02:00")); + tempN.setProjectId(1); + tempN.setAuthorId(4); + tempN.setCommentsCount(0); + tempN.setDescription("description"); + tempN.setSummary("summary"); + tempN.setTitle("title"); + model.put(News.class, tempN); + tempN = new News(); + tempN.setId(86); + tempN.setCreatedOn((Date) RedmineDataConverter.Datetime.convert("2009-09-17T21:55:26+02:00")); + tempN.setProjectId(1); + tempN.setAuthorId(4); + tempN.setCommentsCount(0); + tempN.setDescription("description2"); + tempN.setSummary("summary2"); + tempN.setTitle("title2"); + model.put(News.class, tempN); + + TimeEntry tempE; + + tempE = new TimeEntry(); + tempE.setCreatedOn((Date) RedmineDataConverter.Datetime.convert("2009-12-31T23:02:02+01:00")); + tempE.setUpdatedOn((Date) RedmineDataConverter.Datetime.convert("2009-12-31T23:02:02+01:00")); + tempE.setSpentOn((Date) RedmineDataConverter.Date.convert("2009-12-31")); + tempE.setId(1); + tempE.setProjectId(1); + tempE.setUserId(4); + tempE.setIssueId(6); + tempE.setActivityId(8); + + tempE.setHours(1); + tempE.setTmonth(12); + tempE.setTyear(2009); + tempE.setTweek(53); + tempE.setComments("Test"); + model.put(TimeEntry.class, tempE); + + tempE = new TimeEntry(); + tempE.setCreatedOn((Date) RedmineDataConverter.Datetime.convert("2009-12-31T23:10:01+01:00")); + tempE.setUpdatedOn((Date) RedmineDataConverter.Datetime.convert("2009-12-31T23:10:01+01:00")); + tempE.setSpentOn((Date) RedmineDataConverter.Date.convert("2009-12-31")); + tempE.setId(2); + tempE.setProjectId(1); + tempE.setUserId(4); + tempE.setIssueId(6); + tempE.setActivityId(9); + + tempE.setHours(2); + tempE.setTmonth(12); + tempE.setTyear(2009); + tempE.setTweek(53); + tempE.setComments("deuxième temps"); + model.put(TimeEntry.class, tempE); + } + + + public Attachment getAttachment() { + Attachment result = new Attachment(); + File fileToUpload = null; + try { + fileToUpload = File.createTempFile("toupload", ".txt"); + FileUtils.write(fileToUpload, FILE_TO_UPLOAD_CONTENT); + result.setToUpload(fileToUpload); + result.setDescription("attachment description..."); + return result; + } catch (IOException e) { + throw new RuntimeException("Could not create temp file", e); + } + + } + + /** + * Configuration of a redmine service for test purposes. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.4 + */ + public static class FakeRedmineServiceConfiguration implements RedmineServiceConfiguration { + + URL restUrl; + + String restUsername; + + String restPassword; + + boolean verbose; + + boolean anonymous; + + String encoding; + + @Override + public String getEncoding() { + return encoding; + } + + @Override + public void setEncoding(String encoding) { + this.encoding = encoding; + } + + @Override + public String getRestPassword() { + return restPassword; + } + + @Override + public void setRestPassword(String restPassword) { + this.restPassword = restPassword; + } + + @Override + public URL getRestUrl() { + return restUrl; + } + + @Override + public void setRestUrl(URL restUrl) { + this.restUrl = restUrl; + } + + @Override + public String getRestUsername() { + return restUsername; + } + + @Override + public void setRestUsername(String restUsername) { + this.restUsername = restUsername; + } + + @Override + public boolean isVerbose() { + return verbose; + } + + @Override + public void setVerbose(boolean verbose) { + this.verbose = verbose; + } + + @Override + public boolean isAnonymous() { + return anonymous; + } + + @Override + public void setAnonymous(boolean anonymous) { + this.anonymous = anonymous; + } + + @Override + public String toString() { + ToStringBuilder b = new ToStringBuilder(this, + ToStringStyle.MULTI_LINE_STYLE + ); + b.append("redmineUrl", restUrl); + if (anonymous) { + b.append("anonymous", true); + } else { + b.append("redmineUsername", restUsername); + b.append("redminePassword", "***"); + } + b.append("encoding", encoding); + b.append("verbose", verbose); + return b.toString(); + } + } +} Added: trunk/jredmine-client-1.3.x/src/test/java/org/nuiton/jredmine/v1_3_x/RedmineServer.java =================================================================== --- trunk/jredmine-client-1.3.x/src/test/java/org/nuiton/jredmine/v1_3_x/RedmineServer.java (rev 0) +++ trunk/jredmine-client-1.3.x/src/test/java/org/nuiton/jredmine/v1_3_x/RedmineServer.java 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,183 @@ +package org.nuiton.jredmine.v1_3_x; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.codehaus.plexus.util.StringUtils; +import org.junit.Assume; +import org.junit.rules.TestWatcher; +import org.junit.runner.Description; +import org.nuiton.jredmine.RedmineServiceConfiguration; +import org.nuiton.jredmine.RedmineServiceException; +import org.nuiton.jredmine.RedmineServiceImplementor; + +import java.io.IOException; + +/** + * A redmine server usable by tests. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.4 + */ +public abstract class RedmineServer<S> extends TestWatcher { + + /** Logger. */ + private static final Log log = LogFactory.getLog(RedmineServer.class); + + /** + * Fixtures. + * + * @since 1.4 + */ + protected final RedmineFixtures fixtures; + + /** + * Service configuration to use. + * + * @since 1.4 + */ + protected RedmineServiceConfiguration configuration; + + /** + * Current service. + * + * @since 1.4 + */ + protected S service; + + public RedmineServer(RedmineFixtures fixtures) { + this.fixtures = fixtures; + } + + protected abstract S createService(RedmineFixtures fixtures, + RedmineServiceConfiguration configuration) throws IOException, RedmineServiceException; + + protected abstract RedmineServiceConfiguration createConfiguration(RedmineFixtures fixtures) throws IOException; + + public RedmineFixtures getFixtures() { + return fixtures; + } + + public RedmineServiceConfiguration getConfiguration() { + return configuration; + } + + public S getService() { + return service; + } + + @Override + protected void starting(Description description) { + + try { + configuration = createConfiguration(fixtures); + } catch (IOException e) { + + throw new IllegalStateException("Could not create configuration", e); + } + + try { + service = createService(fixtures, configuration); + } catch (Exception e) { + throw new IllegalStateException("Could not create service", e); + } + } + + @Override + protected void finished(Description description) { + + if (service != null) { + try { + ((RedmineServiceImplementor) service).destroy(); + } catch (RedmineServiceException e) { + throw new IllegalStateException("Could not close service ", e); + } + } + } + + protected void checkService() { + + if (log.isInfoEnabled()) { + log.info("Will check service..."); + } + + try { + + try { + configuration = createConfiguration(fixtures); + } catch (IOException e) { + + throw new IllegalStateException("Could not create configuration", e); + } + + boolean anonymous = configuration.isAnonymous(); + try { + configuration.setAnonymous(true); + service = createService(fixtures, configuration); + } catch (Exception e) { + + // could not init service + if (log.isInfoEnabled()) { + log.info("Will skip test " + + RedmineServiceTest.class.getName() + + ", since could not init service", e); + } + Assume.assumeTrue(false); + return; + + } finally { + + //push back initial flag value + configuration.setAnonymous(anonymous); + } + + if (!anonymous) { + + if (StringUtils.isBlank(configuration.getRestUsername())) { + if (log.isInfoEnabled()) { + log.info("Will skip test " + + RedmineServiceTest.class.getName() + + ", since not username was given and loggued service is required"); + } + Assume.assumeTrue(false); + return; + } + + + if (StringUtils.isBlank(configuration.getRestPassword())) { + if (log.isInfoEnabled()) { + log.info("Will skip test " + + RedmineServiceTest.class.getName() + + ", since not password was given and loggued service is required"); + } + Assume.assumeTrue(false); + return; + } + + // recheck service (to test now login) + try { + service = createService(fixtures, configuration); + } catch (Exception e) { + // ping was not ok + if (log.isInfoEnabled()) { + log.info("Will skip test " + + RedmineServiceTest.class.getName() + + ", since login [" + configuration.getRestUsername() + "] was bad : " + e.getMessage(), e); + } + + Assume.assumeTrue(false); + } + } + } finally { + if (log.isInfoEnabled()) { + log.info("Service checked..."); + } + if (service != null) { + try { + ((RedmineServiceImplementor) service).destroy(); + } catch (RedmineServiceException e) { + throw new IllegalStateException("Could not close service", e); + } + } + } + } +} Added: trunk/jredmine-client-1.3.x/src/test/java/org/nuiton/jredmine/v1_3_x/RedmineServiceAsAnonymousTest.java =================================================================== --- trunk/jredmine-client-1.3.x/src/test/java/org/nuiton/jredmine/v1_3_x/RedmineServiceAsAnonymousTest.java (rev 0) +++ trunk/jredmine-client-1.3.x/src/test/java/org/nuiton/jredmine/v1_3_x/RedmineServiceAsAnonymousTest.java 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,201 @@ +package org.nuiton.jredmine.v1_3_x; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.nuiton.jredmine.RedmineService; +import org.nuiton.jredmine.RedmineServiceConfiguration; +import org.nuiton.jredmine.RedmineServiceException; +import org.nuiton.jredmine.RedmineServiceLoginException; +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.TimeEntry; +import org.nuiton.jredmine.model.Tracker; +import org.nuiton.jredmine.model.User; +import org.nuiton.jredmine.model.Version; + +import java.io.IOException; + +/** + * Tests the {@link RedmineAnonymousServiceImpl}. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.5 + */ +public class RedmineServiceAsAnonymousTest { + + protected static final RedmineFixtures fixtures = new RedmineFixtures(); + + @Rule + public final RedmineServer<RedmineService> server = createNewServer(fixtures); + + protected RedmineService getService() { + return server.getService(); + } + + protected RedmineServer<RedmineService> createNewServer(RedmineFixtures fixtures) { + return new RedmineServer<RedmineService>(fixtures) { + + @Override + protected RedmineService createService( + RedmineFixtures fixture, + RedmineServiceConfiguration configuration) throws IOException, RedmineServiceException { + + return fixture.newRedmineService(configuration); + } + + @Override + protected RedmineServiceConfiguration createConfiguration(RedmineFixtures fixture) throws IOException { + RedmineServiceConfiguration conf = fixture.newAnonymousConfiguration(); + conf.setVerbose(true); + return conf; + } + }; + } + + + @BeforeClass + public static void beforeClass() { + RedmineServer<RedmineService> newServer = + new RedmineServiceAsAnonymousTest().createNewServer(fixtures); + newServer.checkService(); + } + + @Test + public void getProjects() throws Exception { + Project[] projects = getService().getProjects(); + Assert.assertNotNull(projects); + } + + @Test + public void getIssuePriorities() throws Exception { + IssuePriority[] issuePriorities = getService().getIssuePriorities(); + Assert.assertNotNull(issuePriorities); + } + + @Test + public void getIssueStatuses() throws Exception { + IssueStatus[] issueStatuses = getService().getIssueStatuses(); + Assert.assertNotNull(issueStatuses); + } + + @Test + public void getProject() throws Exception { + Project project = getService().getProject(fixtures.projectName()); + Assert.assertNotNull(project); + } + + @Test + public void getIssueCategories() throws Exception { + IssueCategory[] issueCategories = getService().getIssueCategories(fixtures.projectName()); + Assert.assertNotNull(issueCategories); + } + + @Test + public void getTrackers() throws Exception { + Tracker[] trackers = getService().getTrackers(fixtures.projectName()); + Assert.assertNotNull(trackers); + } + + @Test + public void getNews() throws Exception { + News[] news = getService().getNews(fixtures.projectName()); + Assert.assertNotNull(news); + } + + @Test + public void getProjectMembers() throws Exception { + User[] users = getService().getProjectMembers(fixtures.projectName()); + Assert.assertNotNull(users); + } + + @Test + public void getProjectIssues() throws Exception { + Issue[] issues = getService().getIssues(fixtures.projectName()); + Assert.assertNotNull(issues); + } + + @Test + public void getVersions() throws Exception { + Version[] versions = getService().getVersions(fixtures.projectName()); + Assert.assertNotNull(versions); + } + + @Test + public void getVersion() throws Exception { + Version version = getService().getVersion(fixtures.projectName(), fixtures.versionName()); + Assert.assertNotNull(version); + } + + @Test + public void getVersionIssues() throws Exception { + Issue[] issues = getService().getIssues(fixtures.projectName(), fixtures.versionName()); + Assert.assertNotNull(issues); + } + + @Test + public void getOpenedIssues() throws Exception { + Issue[] issues = getService().getOpenedIssues(fixtures.projectName()); + Assert.assertNotNull(issues); + } + + @Test + public void getClosedIssues() throws Exception { + Issue[] issues = getService().getClosedIssues(fixtures.projectName()); + Assert.assertNotNull(issues); + } + + @Test + public void getIssueTimeEntries() throws Exception { + TimeEntry[] timeEntries = getService().getIssueTimeEntries(fixtures.projectName(), fixtures.issueId()); + Assert.assertNotNull(timeEntries); + } + + @Test + public void getAttachments() throws Exception { + Attachment[] attachments = getService().getAttachments(fixtures.projectName(), fixtures.versionName()); + Assert.assertNotNull(attachments); + } + + @Test(expected = RedmineServiceLoginException.class) + public void getUserProjects() throws Exception { + getService().getUserProjects(); + } + + @Test(expected = RedmineServiceLoginException.class) + public void addVersion() throws Exception { + getService().addVersion(fixtures.projectName(), new Version()); + } + + @Test(expected = RedmineServiceLoginException.class) + public void addAttachment() throws Exception { + getService().addAttachment(fixtures.projectName(), fixtures.versionName(), new Attachment()); + } + + @Test(expected = RedmineServiceLoginException.class) + public void addNews() throws Exception { + getService().addNews(fixtures.projectName(), new News()); + } + + @Test(expected = RedmineServiceLoginException.class) + public void updateVersion() throws Exception { + getService().updateVersion(fixtures.projectName(), new Version()); + } + + @Test(expected = RedmineServiceLoginException.class) + public void nextVersion() throws Exception { + getService().nextVersion(fixtures.projectName(), fixtures.versionName(), new Version()); + } + + @Test(expected = RedmineServiceLoginException.class) + public void addIssueTime() throws Exception { + getService().addIssueTimeEntry(fixtures.projectName(), fixtures.issueId(), new TimeEntry()); + } + +} Added: trunk/jredmine-client-1.3.x/src/test/java/org/nuiton/jredmine/v1_3_x/RedmineServiceTest.java =================================================================== --- trunk/jredmine-client-1.3.x/src/test/java/org/nuiton/jredmine/v1_3_x/RedmineServiceTest.java (rev 0) +++ trunk/jredmine-client-1.3.x/src/test/java/org/nuiton/jredmine/v1_3_x/RedmineServiceTest.java 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,214 @@ +package org.nuiton.jredmine.v1_3_x; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.nuiton.jredmine.RedmineService; +import org.nuiton.jredmine.RedmineServiceConfiguration; +import org.nuiton.jredmine.RedmineServiceException; +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.TimeEntry; +import org.nuiton.jredmine.model.Tracker; +import org.nuiton.jredmine.model.User; +import org.nuiton.jredmine.model.Version; + +import java.io.IOException; + +/** + * Tests the {@link RedmineAnonymousServiceImpl}. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.5 + */ +public class RedmineServiceTest { + + protected static final RedmineFixtures fixtures = new RedmineFixtures(); + + @Rule + public final RedmineServer<RedmineService> server = createNewServer(fixtures); + + protected RedmineService getService() { + return server.getService(); + } + + + protected RedmineServer<RedmineService> createNewServer(RedmineFixtures fixtures) { + return new RedmineServer<RedmineService>(fixtures) { + + @Override + protected RedmineService createService( + RedmineFixtures fixture, + RedmineServiceConfiguration configuration) throws IOException, RedmineServiceException { + return fixture.newRedmineService(configuration); + } + + @Override + protected RedmineServiceConfiguration createConfiguration(RedmineFixtures fixture) throws IOException { + RedmineServiceConfiguration conf = fixture.newLogguedConfiguration(); + conf.setVerbose(true); + return conf; + } + }; + } + + @BeforeClass + public static void beforeClass() { + RedmineServer<RedmineService> newServer = + new RedmineServiceTest().createNewServer(fixtures); + newServer.checkService(); + } + + @Test + public void getProjects() throws Exception { + Project[] projects = getService().getProjects(); + Assert.assertNotNull(projects); + } + + @Test + public void getIssuePriorities() throws Exception { + IssuePriority[] issuePriorities = getService().getIssuePriorities(); + Assert.assertNotNull(issuePriorities); + } + + @Test + public void getIssueStatuses() throws Exception { + IssueStatus[] issueStatuses = getService().getIssueStatuses(); + Assert.assertNotNull(issueStatuses); + } + + @Test + public void getProject() throws Exception { + Project project = getService().getProject(fixtures.projectName()); + Assert.assertNotNull(project); + } + + @Test + public void getIssueCategories() throws Exception { + IssueCategory[] issueCategories = getService().getIssueCategories(fixtures.projectName()); + Assert.assertNotNull(issueCategories); + } + + @Test + public void getTrackers() throws Exception { + Tracker[] trackers = getService().getTrackers(fixtures.projectName()); + Assert.assertNotNull(trackers); + } + + @Test + public void getNews() throws Exception { + News[] news = getService().getNews(fixtures.projectName()); + Assert.assertNotNull(news); + } + + @Test + public void getProjectMembers() throws Exception { + User[] users = getService().getProjectMembers(fixtures.projectName()); + Assert.assertNotNull(users); + } + + @Test + public void getProjectIssues() throws Exception { + Issue[] issues = getService().getIssues(fixtures.projectName()); + Assert.assertNotNull(issues); + } + + @Test + public void getVersions() throws Exception { + Version[] versions = getService().getVersions(fixtures.projectName()); + Assert.assertNotNull(versions); + } + + @Test + public void getVersion() throws Exception { + Version version = getService().getVersion(fixtures.projectName(), fixtures.versionName()); + Assert.assertNotNull(version); + } + + @Test + public void getVersionIssues() throws Exception { + Issue[] issues = getService().getIssues(fixtures.projectName(), fixtures.versionName()); + Assert.assertNotNull(issues); + } + + @Test + public void getOpenedIssues() throws Exception { + Issue[] issues = getService().getOpenedIssues(fixtures.projectName()); + Assert.assertNotNull(issues); + } + + @Test + public void getClosedIssues() throws Exception { + Issue[] issues = getService().getClosedIssues(fixtures.projectName()); + Assert.assertNotNull(issues); + } + + @Test + public void getIssueTimeEntries() throws Exception { + TimeEntry[] timeEntries = getService().getIssueTimeEntries(fixtures.projectName(), fixtures.issueId()); + Assert.assertNotNull(timeEntries); + } + + @Test + public void getAttachments() throws Exception { + Attachment[] attachments = getService().getAttachments(fixtures.projectName(), fixtures.versionName()); + Assert.assertNotNull(attachments); + } + + @Test + public void getUserProjects() throws Exception { + Project[] userProjects = getService().getUserProjects(); + Assert.assertNotNull(userProjects); + } + + @Ignore + @Test + public void addVersion() throws Exception { + getService().addVersion(fixtures.projectName(), new Version()); + } + + @Ignore + @Test + public void addAttachment() throws Exception { + Version version = fixtures.getVersion(); + Attachment attachment = fixtures.getAttachment(); + Attachment updatedAttachment = getService().addAttachment( + fixtures.projectName(), + version.getName(), + attachment + ); + Assert.assertNotNull(updatedAttachment); + } + + @Ignore + @Test + public void addNews() throws Exception { + getService().addNews(fixtures.projectName(), new News()); + } + + @Ignore + @Test + public void updateVersion() throws Exception { + getService().updateVersion(fixtures.projectName(), new Version()); + } + + @Ignore + @Test + public void nextVersion() throws Exception { + getService().nextVersion(fixtures.projectName(), fixtures.versionName(), new Version()); + } + + @Ignore + @Test + public void addIssueTime() throws Exception { + getService().addIssueTimeEntry(fixtures.projectName(), fixtures.issueId(), new TimeEntry()); + } + +} Added: trunk/jredmine-client-1.3.x/src/test/resources/log4j.properties =================================================================== --- trunk/jredmine-client-1.3.x/src/test/resources/log4j.properties (rev 0) +++ trunk/jredmine-client-1.3.x/src/test/resources/log4j.properties 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,51 @@ +### +# #%L +# JRedmine :: Client +# +# $Id$ +# $HeadURL: http://svn.nuiton.org/svn/jredmine/trunk/jredmine-client/src/test/resources/... $ +# %% +# Copyright (C) 2009 - 2010 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>. +# #L% +### +# 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. + +log4j.rootCategory=WARN, stdout + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=[%p] (%c{1}:%L) - %m%n + +log4j.logger.org.nuiton.jredmine=INFO +log4j.logger.org.nuiton.io.rest=INFO +#log4j.logger.org.nuiton.io.xpp3.Xpp3Helper=DEBUG +log4j.logger.org.apache.commons.httpclient.HttpClient=INFO Property changes on: trunk/jredmine-client-1.3.x/src/test/resources/log4j.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jredmine-client-1.3.x/src/test/resources/test-config.properties =================================================================== --- trunk/jredmine-client-1.3.x/src/test/resources/test-config.properties (rev 0) +++ trunk/jredmine-client-1.3.x/src/test/resources/test-config.properties 2012-07-12 23:17:10 UTC (rev 273) @@ -0,0 +1,28 @@ +### +# #%L +# JRedmine :: Client +# +# $Id$ +# $HeadURL: http://svn.nuiton.org/svn/jredmine/trunk/jredmine-client/src/test/resources/... $ +# %% +# Copyright (C) 2009 - 2010 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>. +# #L% +### +# default values for test configuration +test.redmineUrl=http://nuiton.org +test.encoding=UTF-8 +test.verbose=false Property changes on: trunk/jredmine-client-1.3.x/src/test/resources/test-config.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native