diff options
Diffstat (limited to 'glance-model/src/test/java/com/woorea')
6 files changed, 62 insertions, 58 deletions
diff --git a/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageMemberTest.java b/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageMemberTest.java index 155aac0..e8323d9 100644 --- a/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageMemberTest.java +++ b/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageMemberTest.java @@ -20,11 +20,11 @@ package com.woorea.openstack.glance.model; -import com.woorea.openstack.glance.model.ImageMember; -import org.codehaus.jackson.map.DeserializationConfig; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -40,9 +40,10 @@ public class ImageMemberTest { + "}"; private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Inclusion.NON_NULL) - .enable(SerializationConfig.Feature.INDENT_OUTPUT) - .enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + .setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT) + .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageMembersTest.java b/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageMembersTest.java index 0b9e94c..513791a 100644 --- a/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageMembersTest.java +++ b/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageMembersTest.java @@ -20,13 +20,13 @@ package com.woorea.openstack.glance.model; -import com.woorea.openstack.glance.model.ImageMember; -import com.woorea.openstack.glance.model.ImageMembers; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + import java.util.List; -import org.codehaus.jackson.map.DeserializationConfig; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; + import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -47,9 +47,10 @@ public class ImageMembersTest { + "}"; private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Inclusion.NON_NULL) - .enable(SerializationConfig.Feature.INDENT_OUTPUT) - .enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + .setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT) + .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageTest.java b/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageTest.java index 4e54413..8e8914c 100644 --- a/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageTest.java +++ b/glance-model/src/test/java/com/woorea/openstack/glance/model/ImageTest.java @@ -20,13 +20,14 @@ package com.woorea.openstack.glance.model; -import com.woorea.openstack.glance.model.Image; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + import java.util.Calendar; import java.util.Map; -import org.codehaus.jackson.map.DeserializationConfig; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; + import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -65,11 +66,12 @@ public class ImageTest { + "}"; private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Inclusion.NON_NULL) - .enable(SerializationConfig.Feature.INDENT_OUTPUT) - .enable(SerializationConfig.Feature.WRAP_ROOT_VALUE) - .enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE) - .enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + .setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT) + .enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) + .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/glance-model/src/test/java/com/woorea/openstack/glance/model/ImagesTest.java b/glance-model/src/test/java/com/woorea/openstack/glance/model/ImagesTest.java index 913fa01..1ba0907 100644 --- a/glance-model/src/test/java/com/woorea/openstack/glance/model/ImagesTest.java +++ b/glance-model/src/test/java/com/woorea/openstack/glance/model/ImagesTest.java @@ -20,13 +20,13 @@ package com.woorea.openstack.glance.model; -import com.woorea.openstack.glance.model.Image; -import com.woorea.openstack.glance.model.Images; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + import java.util.List; -import org.codehaus.jackson.map.DeserializationConfig; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; + import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -89,9 +89,10 @@ public class ImagesTest { + "}"; private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Inclusion.NON_NULL) - .enable(SerializationConfig.Feature.INDENT_OUTPUT) - .enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + .setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT) + .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/glance-model/src/test/java/com/woorea/openstack/glance/model/SharedImageTest.java b/glance-model/src/test/java/com/woorea/openstack/glance/model/SharedImageTest.java index f1348ee..41805cb 100644 --- a/glance-model/src/test/java/com/woorea/openstack/glance/model/SharedImageTest.java +++ b/glance-model/src/test/java/com/woorea/openstack/glance/model/SharedImageTest.java @@ -20,28 +20,26 @@ package com.woorea.openstack.glance.model; -import com.woorea.openstack.glance.model.SharedImage; -import org.codehaus.jackson.map.DeserializationConfig; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; -import org.junit.Assert; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; public class SharedImageTest { - private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{ }"; // FAIL_ON_EMPTY_BEANS set to false to conform to legacy behavior private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Inclusion.NON_NULL) - .enable(SerializationConfig.Feature.INDENT_OUTPUT) - .disable(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) - .enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + .setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT) + .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/glance-model/src/test/java/com/woorea/openstack/glance/model/SharedImagesTest.java b/glance-model/src/test/java/com/woorea/openstack/glance/model/SharedImagesTest.java index f888fb2..7695f54 100644 --- a/glance-model/src/test/java/com/woorea/openstack/glance/model/SharedImagesTest.java +++ b/glance-model/src/test/java/com/woorea/openstack/glance/model/SharedImagesTest.java @@ -20,13 +20,13 @@ package com.woorea.openstack.glance.model; -import com.woorea.openstack.glance.model.SharedImage; -import com.woorea.openstack.glance.model.SharedImages; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + import java.util.List; -import org.codehaus.jackson.map.DeserializationConfig; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; + import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -42,10 +42,11 @@ public class SharedImagesTest { // FAIL_ON_EMPTY_BEANS set to false to conform to legacy behavior private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Inclusion.NON_NULL) - .enable(SerializationConfig.Feature.INDENT_OUTPUT) - .disable(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) - .enable(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + .setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT) + .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .disable(SerializationFeature.FAIL_ON_EMPTY_BEANS) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { |