r3850 - in trunk: . pollen-rest-api pollen-rest-api/src/main/java/org/chorem/pollen/rest/api pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1 pollen-rest-api/src/main/resources pollen-rest-api/src/test/java/org/chorem/pollen/rest/api pollen-rest-api/src/test/resources
Author: tchemit Date: 2013-07-06 12:58:10 +0200 (Sat, 06 Jul 2013) New Revision: 3850 Url: http://chorem.org/projects/pollen/repository/revisions/3850 Log: - make first TU works on rest api - fix some rest api + mapping Modified: trunk/pollen-rest-api/pom.xml trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenApplicationContext.java trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoterListService.java trunk/pollen-rest-api/src/main/resources/mapping trunk/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/AbstractPollenRestApiTest.java trunk/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/PollenUserServiceTest.java trunk/pollen-rest-api/src/test/resources/log4j.properties trunk/pom.xml Modified: trunk/pollen-rest-api/pom.xml =================================================================== --- trunk/pollen-rest-api/pom.xml 2013-07-05 17:21:56 UTC (rev 3849) +++ trunk/pollen-rest-api/pom.xml 2013-07-06 10:58:10 UTC (rev 3850) @@ -77,6 +77,10 @@ <groupId>org.apache.httpcomponents</groupId> <artifactId>fluent-hc</artifactId> </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpcore</artifactId> + </dependency> <dependency> <groupId>com.google.guava</groupId> Modified: trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenApplicationContext.java =================================================================== --- trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenApplicationContext.java 2013-07-05 17:21:56 UTC (rev 3849) +++ trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenApplicationContext.java 2013-07-06 10:58:10 UTC (rev 3850) @@ -99,7 +99,7 @@ if (entityManagerFactory != null && entityManagerFactory.isOpen()) { if (log.isInfoEnabled()) { - log.info("stopping magalie, will close entity manager factory"); + log.info("stopping Pollen, will close entity manager factory"); } entityManagerFactory.close(); Modified: trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoterListService.java =================================================================== --- trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoterListService.java 2013-07-05 17:21:56 UTC (rev 3849) +++ trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/VoterListService.java 2013-07-06 10:58:10 UTC (rev 3850) @@ -57,7 +57,7 @@ return context.getVoterListService().getVoterList(pollId, voterListId); } - public VoterList addVoterList(PollenServiceContext context, String pollId, VoterList voterList) throws EntityNotFoundException, InvalidVoterListFormException { + public VoterList createVoterList(PollenServiceContext context, String pollId, VoterList voterList) throws EntityNotFoundException, InvalidVoterListFormException { context.getSecurityService().prepareSubject(pollId); return context.getVoterListService().addVoterList(pollId, voterList); } Modified: trunk/pollen-rest-api/src/main/resources/mapping =================================================================== --- trunk/pollen-rest-api/src/main/resources/mapping 2013-07-05 17:21:56 UTC (rev 3849) +++ trunk/pollen-rest-api/src/main/resources/mapping 2013-07-06 10:58:10 UTC (rev 3850) @@ -15,7 +15,14 @@ org.chorem.pollen.services.exception.EntityNotFoundException ErrorAction.on404 org.chorem.pollen.services.exception.UserInvalidPasswordException ErrorAction.on500 org.chorem.pollen.services.exception.UserInvalidEmailActivationTokenException ErrorAction.on500 -org.chorem.pollen.services.exception.AbstractInvalidFormException ErrorAction.on500Form +org.chorem.pollen.services.exception.InvalidChoiceFormException ErrorAction.on500Form +org.chorem.pollen.services.exception.InvalidPollenUserFormException ErrorAction.on500Form +org.chorem.pollen.services.exception.InvalidFavoriteListFormException ErrorAction.on500Form +org.chorem.pollen.services.exception.InvalidFavoriteListMemberFormException ErrorAction.on500Form +org.chorem.pollen.services.exception.InvalidVoterListFormException ErrorAction.on500Form +org.chorem.pollen.services.exception.InvalidVoterListMemberFormException ErrorAction.on500Form +org.chorem.pollen.services.exception.InvalidVoteFormException ErrorAction.on500Form +org.chorem.pollen.services.exception.InvalidPollFormException ErrorAction.on500Form [actions] @@ -45,8 +52,8 @@ GET /v1/favoriteLists FavoriteListService.getFavoriteLists GET /v1/favoriteLists/{flId} FavoriteListService.getFavoriteList -POST /v1/favoriteLists/{flId}/importCsv FavoriteListService.importFavoriteListMemberFromCsv -POST /v1/favoriteLists/{flId}/importLdap FavoriteListService.importFavoriteListMemberFromLdap +POST /v1/favoriteLists/{flId}/importCsv FavoriteListService.importFavoriteListMembersFromCsv +POST /v1/favoriteLists/{flId}/importLdap FavoriteListService.importFavoriteListMembersFromLdap POST /v1/favoriteLists FavoriteListService.createFavoriteList PUT /v1/favoriteLists/{flId} FavoriteListService.editFavoriteList DELETE /v1/favoriteLists/{flId} FavoriteListService.deleteFavoriteList Modified: trunk/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/AbstractPollenRestApiTest.java =================================================================== --- trunk/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/AbstractPollenRestApiTest.java 2013-07-05 17:21:56 UTC (rev 3849) +++ trunk/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/AbstractPollenRestApiTest.java 2013-07-06 10:58:10 UTC (rev 3850) @@ -24,9 +24,9 @@ */ import org.chorem.pollen.persistence.JpaPollenPersistenceContext; -import org.chorem.pollen.services.service.FixturesService; import org.chorem.pollen.services.PollenFixtures; import org.chorem.pollen.services.PollenServiceContext; +import org.chorem.pollen.services.service.FixturesService; import org.debux.webmotion.unittest.WebMotionJUnit; import org.junit.Rule; import org.nuiton.jpa.junit.JpaEntityManagerRule; @@ -52,11 +52,8 @@ if (applicationContext == null) { applicationContext = new PollenApplicationContext() { - @Override - public EntityManager newEntityManager() { - return getJpaEntityManagerRule().getEntityManager(); - } + @Override public PollenServiceContext newServiceContext(EntityManager entityManager) { @@ -92,7 +89,7 @@ protected PollenServiceContext getServiceContext() { - EntityManager entityManager = getJpaEntityManagerRule().getEntityManager(); + EntityManager entityManager = getJpaEntityManagerRule().newEntityManager(); PollenServiceContext result = applicationContext.newServiceContext(entityManager); return result; Modified: trunk/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/PollenUserServiceTest.java =================================================================== --- trunk/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/PollenUserServiceTest.java 2013-07-05 17:21:56 UTC (rev 3849) +++ trunk/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/PollenUserServiceTest.java 2013-07-06 10:58:10 UTC (rev 3850) @@ -25,7 +25,6 @@ import org.apache.http.client.fluent.Request; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import static org.junit.Assert.assertTrue; @@ -36,7 +35,6 @@ * @author tchemit <chemit@codelutin.com> * @since 2.0 */ -@Ignore public class PollenUserServiceTest extends AbstractPollenRestApiTest { @@ -49,7 +47,7 @@ @Test public void testGetUsers() throws Exception { - Request request = createRequest("/users").Get(); + Request request = createRequest("/v1/users").Get(); String result = request.execute().returnContent().asString(); assertTrue(result.contains("email")); Modified: trunk/pollen-rest-api/src/test/resources/log4j.properties =================================================================== --- trunk/pollen-rest-api/src/test/resources/log4j.properties 2013-07-05 17:21:56 UTC (rev 3849) +++ trunk/pollen-rest-api/src/test/resources/log4j.properties 2013-07-06 10:58:10 UTC (rev 3850) @@ -20,13 +20,13 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # #L% ### -log4j.rootCategory=DEBUG, console +log4j.rootCategory=ERROR, console log4j.appender.console=org.apache.log4j.ConsoleAppender log4j.appender.console.layout=org.apache.log4j.PatternLayout log4j.appender.console.layout.ConversionPattern=%d{hh:mm:ss} %5p (%F:%L) %m%n log4j.logger.org.chorem.pollen=TRACE -log4j.logger.org.debux=TRACE +log4j.logger.org.debux=INFO # log4j.logger.org.hibernate.tool.hbm2ddl.SchemaExport=FATAL Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2013-07-05 17:21:56 UTC (rev 3849) +++ trunk/pom.xml 2013-07-06 10:58:10 UTC (rev 3850) @@ -162,7 +162,6 @@ <nuitonJpaVersion>1.0-SNAPSHOT</nuitonJpaVersion> <webmotionVersion>2.4-SNAPSHOT</webmotionVersion> - <!--<topiaVersion>2.8</topiaVersion>--> <eugenePluginVersion>2.6.3</eugenePluginVersion> <nuitonI18nVersion>2.5.1</nuitonI18nVersion> @@ -170,17 +169,13 @@ <nuitonUtilsVersion>2.6.13-SNAPSHOT</nuitonUtilsVersion> <h2Version>1.3.172</h2Version> <postgresqlVersion>9.1-901-1.jdbc4</postgresqlVersion> - <!--<struts2Version>2.3.14.2</struts2Version>--> - <!--<jqueryPluginVersion>3.5.0</jqueryPluginVersion>--> <shiroVersion>1.2.2</shiroVersion> <slf4jVersion>1.7.5</slf4jVersion> <jettyVersion>9.0.3.v20130506</jettyVersion> - <!--jettyVersion>${jettyPluginVersion}</jettyVersion--> - <!--<hibernateVersion>4.2.2.Final</hibernateVersion>--> <hibernateVersion>4.3.0.Beta3</hibernateVersion> <seleniumVersion>2.33.0</seleniumVersion> <mockitoVersion>1.9.5</mockitoVersion> - <httpCommonsHttpclientVersion>4.3-beta2</httpCommonsHttpclientVersion> + <httpCommonsHttpclientVersion>4.2.3</httpCommonsHttpclientVersion> <pollenI18nBundle>pollen-i18n</pollenI18nBundle> <!-- license to use --> @@ -423,6 +418,12 @@ </dependency> <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpcore</artifactId> + <version>${httpCommonsHttpclientVersion}</version> + </dependency> + + <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.2.4</version>
participants (1)
-
tchemit@users.chorem.org