Skip to content
Browse files

Added jackson-datatype-joda to properly handle joda classes.

  • Loading branch information...
1 parent f85d951 commit a4ab3ec76750b6094188a7e35a0f5b6cca86ce58 @pgelinas pgelinas committed May 11, 2012
View
4 org.ektorp/pom.xml
@@ -14,6 +14,10 @@
<dependencies>
<dependency>
+ <groupId>com.fasterxml.jackson.datatype</groupId>
+ <artifactId>jackson-datatype-joda</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
View
2 org.ektorp/src/main/java/org/ektorp/impl/StdObjectMapperFactory.java
@@ -4,7 +4,7 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize.Inclusion;
+
import org.ektorp.CouchDbConnector;
import org.ektorp.impl.jackson.EktorpJacksonModule;
import org.ektorp.util.Assert;
View
14 org.ektorp/src/test/java/org/ektorp/impl/StdCouchDbConnectorTest.java
@@ -17,6 +17,8 @@
import java.util.*;
import org.apache.commons.io.IOUtils;
+import com.fasterxml.jackson.datatype.joda.JodaModule;
+
import org.ektorp.*;
import org.ektorp.http.HttpResponse;
import org.ektorp.http.StdHttpClient;
@@ -38,14 +40,22 @@
private static final String OK_RESPONSE_WITH_ID_AND_REV = "{\"ok\":true,\"id\":\"some_id\",\"rev\":\"123D123\"}";
private static final String TEST_DB_PATH = "/test_db/";
- StdCouchDbConnector dbCon;
+ CouchDbConnector dbCon;
StdHttpClient httpClient;
TestDoc td = new TestDoc();
@Before
public void setUp() throws Exception {
httpClient = mock(StdHttpClient.class);
- dbCon = new StdCouchDbConnector("test_db/", new StdCouchDbInstance(httpClient));
+ StdCouchDbInstance dbInstance = new StdCouchDbInstance(httpClient, new StdObjectMapperFactory(){
+ @Override
+ public ObjectMapper createObjectMapper(CouchDbConnector connector) {
+ ObjectMapper mapper = super.createObjectMapper(connector);
+ mapper.registerModule(new JodaModule());
+ return mapper;
+ }
+ });
+ dbCon = dbInstance.createConnector("test_db/",false);
td.name = "nisse";
td.age = 12;
View
6 pom.xml
@@ -68,6 +68,12 @@
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.datatype</groupId>
+ <artifactId>jackson-datatype-joda</artifactId>
+ <version>${jackson.version}</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>

0 comments on commit a4ab3ec

Please sign in to comment.
Something went wrong with that request. Please try again.