diff options
Diffstat (limited to 'nova-model/src/test/java/com/woorea/openstack/nova/model/VolumesTest.java')
-rw-r--r-- | nova-model/src/test/java/com/woorea/openstack/nova/model/VolumesTest.java | 83 |
1 files changed, 28 insertions, 55 deletions
diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumesTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumesTest.java index 6729cc4..ccc28b5 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumesTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumesTest.java @@ -24,9 +24,7 @@ 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.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,57 +34,31 @@ public class VolumesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"volumes\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"availabilityZone\" : \"availabilityzone\"," + EOL - + " \"volumeType\" : \"volumetype\"," + EOL - + " \"snapshotId\" : \"snapshotid\"," + EOL - + " \"attachments\" : [ {" + EOL - + " \"attachments-v1-k1\" : \"attachments-v1-v1\"," + EOL - + " \"attachments-v1-k2\" : \"attachments-v1-v2\"" + EOL - + " }, {" + EOL - + " \"attachments-v2-k1\" : \"attachments-v2-v1\"," + EOL - + " \"attachments-v2-k2\" : \"attachments-v2-v2\"" + EOL - + " } ]," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"createdAt\" : \"createdat\"," + EOL - + " \"size\" : 61," + EOL - + " \"displayName\" : \"name\"," + EOL - + " \"displayDescription\" : \"description\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"availabilityZone\" : \"availabilityzone\"," + EOL - + " \"volumeType\" : \"volumetype\"," + EOL - + " \"snapshotId\" : \"snapshotid\"," + EOL - + " \"attachments\" : [ {" + EOL - + " \"attachments-v1-k1\" : \"attachments-v1-v1\"," + EOL - + " \"attachments-v1-k2\" : \"attachments-v1-v2\"" + EOL - + " }, {" + EOL - + " \"attachments-v2-k1\" : \"attachments-v2-v1\"," + EOL - + " \"attachments-v2-k2\" : \"attachments-v2-v2\"" + EOL - + " } ]," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"createdAt\" : \"createdat\"," + EOL - + " \"size\" : 61," + EOL - + " \"displayName\" : \"name\"," + EOL - + " \"displayDescription\" : \"description\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"volumes\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"availabilityZone\" : \"availabilityzone\"," + EOL + + " \"volumeType\" : \"volumetype\"," + EOL + " \"snapshotId\" : \"snapshotid\"," + EOL + + " \"attachments\" : [ {" + EOL + " \"attachments-v1-k1\" : \"attachments-v1-v1\"," + EOL + + " \"attachments-v1-k2\" : \"attachments-v1-v2\"" + EOL + " }, {" + EOL + + " \"attachments-v2-k1\" : \"attachments-v2-v1\"," + EOL + + " \"attachments-v2-k2\" : \"attachments-v2-v2\"" + EOL + " } ]," + EOL + " \"metadata\" : {" + + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"createdAt\" : \"createdat\"," + EOL + " \"size\" : 61," + EOL + + " \"displayName\" : \"name\"," + EOL + " \"displayDescription\" : \"description\"" + EOL + " }, {" + + EOL + " \"id\" : \"id\"," + EOL + " \"status\" : \"status\"," + EOL + + " \"availabilityZone\" : \"availabilityzone\"," + EOL + " \"volumeType\" : \"volumetype\"," + EOL + + " \"snapshotId\" : \"snapshotid\"," + EOL + " \"attachments\" : [ {" + EOL + + " \"attachments-v1-k1\" : \"attachments-v1-v1\"," + EOL + + " \"attachments-v1-k2\" : \"attachments-v1-v2\"" + EOL + " }, {" + EOL + + " \"attachments-v2-k1\" : \"attachments-v2-v1\"," + EOL + + " \"attachments-v2-k2\" : \"attachments-v2-v2\"" + EOL + " } ]," + EOL + " \"metadata\" : {" + + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"createdAt\" : \"createdat\"," + EOL + " \"size\" : 61," + EOL + + " \"displayName\" : \"name\"," + EOL + " \"displayDescription\" : \"description\"" + EOL + " } ]" + + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -102,13 +74,14 @@ public class VolumesTest { public void testMethods() throws Exception { Volumes volumes = objectMapper.readValue(JSON_FULL, Volumes.class); volumes.toString(); - + List<Volume> list = volumes.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Volume x : volumes) { + for (@SuppressWarnings("unused") + Volume x : volumes) { ++cnt; } Assert.assertEquals(2, cnt); |