diff options
author | Smokowski, Steve (ss835w) <ss835w@us.att.com> | 2019-05-02 09:42:55 -0400 |
---|---|---|
committer | Smokowski, Steve (ss835w) <ss835w@us.att.com> | 2019-05-07 10:02:17 -0400 |
commit | 3f9a0c3183480d150089c0d5a6e507c877f7d121 (patch) | |
tree | b3db04cbe2cef23f81503177a50edc5360ffa486 /nova-model/src/test/java/com/woorea | |
parent | e153f0adfbed711ce1e215748594a4d04fd1edaf (diff) |
Enhance Openstack Client
Update Openstack Client to support additional fields
Updat all formatting issues
Issue-ID: SO-1844
Change-Id: I1369e0c18cc25274db8df7e12855a020b8da38da
Signed-off-by: Smokowski, Steve (ss835w) <ss835w@us.att.com>
Diffstat (limited to 'nova-model/src/test/java/com/woorea')
92 files changed, 1466 insertions, 2745 deletions
diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/AbsoluteLimitTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/AbsoluteLimitTest.java index d24531b..80814df 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/AbsoluteLimitTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/AbsoluteLimitTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Limits.AbsoluteLimit; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,40 +34,22 @@ public class AbsoluteLimitTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"maxServerMeta\" : 30," + EOL - + " \"serverMetaUsed\" : 37," + EOL - + " \"maxPersonality\" : 54," + EOL - + " \"personalityUsed\" : 61," + EOL - + " \"maxImageMeta\" : 82," + EOL - + " \"imageMetaUsed\" : 89," + EOL - + " \"maxPersonalitySize\" : 97," + EOL - + " \"personalitySizeUsed\" : 4," + EOL - + " \"maxTotalCores\" : 32," + EOL - + " \"totalCoresUsed\" : 39," + EOL - + " \"maxTotalInstances\" : 60," + EOL - + " \"totalInstancesUsed\" : 67," + EOL - + " \"maxTotalRAMSize\" : 55," + EOL - + " \"totalRAMUsed\" : 19," + EOL - + " \"maxSecurityGroupRules\" : 44," + EOL - + " \"securityGroupRulesUsed\" : 51," + EOL - + " \"maxTotalKeypairs\" : 64," + EOL - + " \"totalKeyPairsUsed\" : 71," + EOL - + " \"maxTotalVolumes\" : 71," + EOL - + " \"totalVolumesUsed\" : 78," + EOL - + " \"maxSecurityGroups\" : 4," + EOL - + " \"totalSecurityGroupsUsed\" : 59," + EOL - + " \"maxTotalFloatingIps\" : 76," + EOL - + " \"totalFloatingIpsUsed\" : 83," + EOL - + " \"maxTotalVolumeGigabytes\" : 15," + EOL - + " \"totalVolumeGigabytesUsed\" : 22" + 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 static final String JSON_FULL = "{" + EOL + " \"maxServerMeta\" : 30," + EOL + " \"serverMetaUsed\" : 37," + + EOL + " \"maxPersonality\" : 54," + EOL + " \"personalityUsed\" : 61," + EOL + + " \"maxImageMeta\" : 82," + EOL + " \"imageMetaUsed\" : 89," + EOL + " \"maxPersonalitySize\" : 97," + + EOL + " \"personalitySizeUsed\" : 4," + EOL + " \"maxTotalCores\" : 32," + EOL + + " \"totalCoresUsed\" : 39," + EOL + " \"maxTotalInstances\" : 60," + EOL + + " \"totalInstancesUsed\" : 67," + EOL + " \"maxTotalRAMSize\" : 55," + EOL + " \"totalRAMUsed\" : 19," + + EOL + " \"maxSecurityGroupRules\" : 44," + EOL + " \"securityGroupRulesUsed\" : 51," + EOL + + " \"maxTotalKeypairs\" : 64," + EOL + " \"totalKeyPairsUsed\" : 71," + EOL + + " \"maxTotalVolumes\" : 71," + EOL + " \"totalVolumesUsed\" : 78," + EOL + + " \"maxSecurityGroups\" : 4," + EOL + " \"totalSecurityGroupsUsed\" : 59," + EOL + + " \"maxTotalFloatingIps\" : 76," + EOL + " \"totalFloatingIpsUsed\" : 83," + EOL + + " \"maxTotalVolumeGigabytes\" : 15," + EOL + " \"totalVolumeGigabytesUsed\" : 22" + 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); @Test public void testSerialization() throws Exception { @@ -84,82 +65,82 @@ public class AbsoluteLimitTest { public void testMethods() throws Exception { AbsoluteLimit absolutelimit = objectMapper.readValue(JSON_FULL, AbsoluteLimit.class); absolutelimit.toString(); - + Integer maxTotalRAMSize = absolutelimit.getMaxTotalRAMSize(); Assert.assertNotNull(maxTotalRAMSize); - + Integer maxTotalInstances = absolutelimit.getMaxTotalInstances(); Assert.assertNotNull(maxTotalInstances); - + Integer serverMetaUsed = absolutelimit.getServerMetaUsed(); Assert.assertNotNull(serverMetaUsed); - + Integer maxTotalKeypairs = absolutelimit.getMaxTotalKeypairs(); Assert.assertNotNull(maxTotalKeypairs); - + Integer maxTotalVolumeGigabytes = absolutelimit.getMaxTotalVolumeGigabytes(); Assert.assertNotNull(maxTotalVolumeGigabytes); - + Integer totalSecurityGroupsUsed = absolutelimit.getTotalSecurityGroupsUsed(); Assert.assertNotNull(totalSecurityGroupsUsed); - + Integer maxTotalVolumes = absolutelimit.getMaxTotalVolumes(); Assert.assertNotNull(maxTotalVolumes); - + Integer maxImageMeta = absolutelimit.getMaxImageMeta(); Assert.assertNotNull(maxImageMeta); - + Integer imageMetaUsed = absolutelimit.getImageMetaUsed(); Assert.assertNotNull(imageMetaUsed); - + Integer totalVolumeGigabytesUsed = absolutelimit.getTotalVolumeGigabytesUsed(); Assert.assertNotNull(totalVolumeGigabytesUsed); - + Integer maxSecurityGroupRules = absolutelimit.getMaxSecurityGroupRules(); Assert.assertNotNull(maxSecurityGroupRules); - + Integer totalCoresUsed = absolutelimit.getTotalCoresUsed(); Assert.assertNotNull(totalCoresUsed); - + Integer totalVolumesUsed = absolutelimit.getTotalVolumesUsed(); Assert.assertNotNull(totalVolumesUsed); - + Integer maxTotalFloatingIps = absolutelimit.getMaxTotalFloatingIps(); Assert.assertNotNull(maxTotalFloatingIps); - + Integer maxPersonality = absolutelimit.getMaxPersonality(); Assert.assertNotNull(maxPersonality); - + Integer personalityUsed = absolutelimit.getPersonalityUsed(); Assert.assertNotNull(personalityUsed); - + Integer maxSecurityGroups = absolutelimit.getMaxSecurityGroups(); Assert.assertNotNull(maxSecurityGroups); - + Integer securityGroupRulesUsed = absolutelimit.getSecurityGroupRulesUsed(); Assert.assertNotNull(securityGroupRulesUsed); - + Integer maxTotalCores = absolutelimit.getMaxTotalCores(); Assert.assertNotNull(maxTotalCores); - + Integer maxServerMeta = absolutelimit.getMaxServerMeta(); Assert.assertNotNull(maxServerMeta); - + Integer maxPersonalitySize = absolutelimit.getMaxPersonalitySize(); Assert.assertNotNull(maxPersonalitySize); - + Integer personalitySizeUsed = absolutelimit.getPersonalitySizeUsed(); Assert.assertNotNull(personalitySizeUsed); - + Integer totalKeyPairsUsed = absolutelimit.getTotalKeyPairsUsed(); Assert.assertNotNull(totalKeyPairsUsed); - + Integer totalFloatingIpsUsed = absolutelimit.getTotalFloatingIpsUsed(); Assert.assertNotNull(totalFloatingIpsUsed); - + Integer totalInstancesUsed = absolutelimit.getTotalInstancesUsed(); Assert.assertNotNull(totalInstancesUsed); - + Integer totalRAMUsed = absolutelimit.getTotalRAMUsed(); Assert.assertNotNull(totalRAMUsed); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/AddressTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/AddressTest.java index 3d34523..b796f7f 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/AddressTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/AddressTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Server.Addresses.Address; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,18 +34,13 @@ public class AddressTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"version\" : \"version\"," + EOL + " \"addr\" : \"addr\"," + + EOL + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + " \"OS-EXT-IPS:type\" : \"type\"" + 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 { @@ -62,19 +56,19 @@ public class AddressTest { public void testMethods() throws Exception { Address address = objectMapper.readValue(JSON_FULL, Address.class); address.toString(); - + String type = address.getType(); Assert.assertNotNull(type); address.setType(type); - + String addr = address.getAddr(); Assert.assertNotNull(addr); address.setAddr(addr); - + String version = address.getVersion(); Assert.assertNotNull(version); address.setVersion(version); - + String macAddr = address.getMacAddr(); Assert.assertNotNull(macAddr); address.setMacAddr(macAddr); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/AddressesTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/AddressesTest.java index 132537d..12dcc15 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/AddressesTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/AddressesTest.java @@ -26,10 +26,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Server.Addresses; import com.woorea.openstack.nova.model.Server.Addresses.Address; - import java.util.List; import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -39,38 +37,20 @@ public class AddressesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"addresses\" : {" + EOL - + " \"addresses-k1\" : [ {" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"addresses-k2\" : [ {" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + " } ]" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"addresses\" : {" + EOL + " \"addresses-k1\" : [ {" + EOL + + " \"version\" : \"version\"," + EOL + " \"addr\" : \"addr\"," + EOL + + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + " \"OS-EXT-IPS:type\" : \"type\"" + EOL + + " }, {" + EOL + " \"version\" : \"version\"," + EOL + " \"addr\" : \"addr\"," + EOL + + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + " \"OS-EXT-IPS:type\" : \"type\"" + EOL + + " } ]," + EOL + " \"addresses-k2\" : [ {" + EOL + " \"version\" : \"version\"," + EOL + + " \"addr\" : \"addr\"," + EOL + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + + " \"OS-EXT-IPS:type\" : \"type\"" + EOL + " }, {" + EOL + " \"version\" : \"version\"," + EOL + + " \"addr\" : \"addr\"," + EOL + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + + " \"OS-EXT-IPS:type\" : \"type\"" + EOL + " } ]" + 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 { @@ -86,8 +66,8 @@ public class AddressesTest { public void testMethods() throws Exception { Addresses addresses = objectMapper.readValue(JSON_FULL, Addresses.class); addresses.toString(); - - Map<String,List<Address>> addressesProperty = addresses.getAddresses(); + + Map<String, List<Address>> addressesProperty = addresses.getAddresses(); Assert.assertNotNull(addressesProperty); Assert.assertEquals(2, addressesProperty.size()); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/AssociateFloatingIpTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/AssociateFloatingIpTest.java index b93912b..5c494e4 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/AssociateFloatingIpTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/AssociateFloatingIpTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.AssociateFloatingIp; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,19 +34,13 @@ public class AssociateFloatingIpTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"addFloatingIp\" : {" + EOL - + " \"address\" : \"address\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"addFloatingIp\" : {" + EOL + " \"address\" : \"address\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -63,7 +56,7 @@ public class AssociateFloatingIpTest { public void testMethods() throws Exception { AssociateFloatingIp associatefloatingip = objectMapper.readValue(JSON_FULL, AssociateFloatingIp.class); associatefloatingip.toString(); - + String address = associatefloatingip.getAddress(); Assert.assertNotNull(address); associatefloatingip.setAddress(address); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/CertificateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/CertificateTest.java index bb5dd4d..89679f8 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/CertificateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/CertificateTest.java @@ -24,7 +24,6 @@ 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; @@ -34,20 +33,13 @@ public class CertificateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"certificate\" : {" + EOL - + " \"data\" : \"data\"," + EOL - + " \"private_key\" : \"privatekey\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"certificate\" : {" + EOL + " \"data\" : \"data\"," + EOL + + " \"private_key\" : \"privatekey\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -63,10 +55,10 @@ public class CertificateTest { public void testMethods() throws Exception { Certificate certificate = objectMapper.readValue(JSON_FULL, Certificate.class); certificate.toString(); - + String privateKey = certificate.getPrivateKey(); Assert.assertNotNull(privateKey); - + String data = certificate.getData(); Assert.assertNotNull(data); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ChangePasswordTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ChangePasswordTest.java index a52c99e..8e74e41 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ChangePasswordTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ChangePasswordTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.ChangePassword; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,19 +34,13 @@ public class ChangePasswordTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"changePassword\" : {" + EOL - + " \"adminPass\" : \"adminpass\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"changePassword\" : {" + EOL + + " \"adminPass\" : \"adminpass\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -63,7 +56,7 @@ public class ChangePasswordTest { public void testMethods() throws Exception { ChangePassword changepassword = objectMapper.readValue(JSON_FULL, ChangePassword.class); changepassword.toString(); - + String adminPass = changepassword.getAdminPass(); Assert.assertNotNull(adminPass); changepassword.setAdminPass(adminPass); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/CloudpipeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/CloudpipeTest.java index 7552f13..a96edbb 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/CloudpipeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/CloudpipeTest.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.Calendar; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,25 +34,16 @@ public class CloudpipeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"cloudpipe\" : {" + EOL - + " \"projectId\" : \"projectid\"," + EOL - + " \"internalIp\" : \"internalip\"," + EOL - + " \"publicIp\" : \"publicip\"," + EOL - + " \"publicPort\" : \"publicport\"," + EOL - + " \"state\" : \"state\"," + EOL - + " \"instanceId\" : \"instanceid\"," + EOL - + " \"createdAt\" : 1486296000000" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"cloudpipe\" : {" + EOL + + " \"projectId\" : \"projectid\"," + EOL + " \"internalIp\" : \"internalip\"," + EOL + + " \"publicIp\" : \"publicip\"," + EOL + " \"publicPort\" : \"publicport\"," + EOL + + " \"state\" : \"state\"," + EOL + " \"instanceId\" : \"instanceid\"," + EOL + + " \"createdAt\" : 1486296000000" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -70,31 +59,31 @@ public class CloudpipeTest { public void testMethods() throws Exception { Cloudpipe cloudpipe = objectMapper.readValue(JSON_FULL, Cloudpipe.class); cloudpipe.toString(); - + Calendar createdAt = cloudpipe.getCreatedAt(); Assert.assertNotNull(createdAt); cloudpipe.setCreatedAt(createdAt); - + String instanceId = cloudpipe.getInstanceId(); Assert.assertNotNull(instanceId); cloudpipe.setInstanceId(instanceId); - + String publicIp = cloudpipe.getPublicIp(); Assert.assertNotNull(publicIp); cloudpipe.setPublicIp(publicIp); - + String publicPort = cloudpipe.getPublicPort(); Assert.assertNotNull(publicPort); cloudpipe.setPublicPort(publicPort); - + String state = cloudpipe.getState(); Assert.assertNotNull(state); cloudpipe.setState(state); - + String projectId = cloudpipe.getProjectId(); Assert.assertNotNull(projectId); cloudpipe.setProjectId(projectId); - + String internalIp = cloudpipe.getInternalIp(); Assert.assertNotNull(internalIp); cloudpipe.setInternalIp(internalIp); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/CloudpipesTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/CloudpipesTest.java index 491b005..2fccdb3 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/CloudpipesTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/CloudpipesTest.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,31 +34,19 @@ public class CloudpipesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"cloudpipes\" : [ {" + EOL - + " \"projectId\" : \"projectid\"," + EOL - + " \"internalIp\" : \"internalip\"," + EOL - + " \"publicIp\" : \"publicip\"," + EOL - + " \"publicPort\" : \"publicport\"," + EOL - + " \"state\" : \"state\"," + EOL - + " \"instanceId\" : \"instanceid\"," + EOL - + " \"createdAt\" : 1486296000000" + EOL - + " }, {" + EOL - + " \"projectId\" : \"projectid\"," + EOL - + " \"internalIp\" : \"internalip\"," + EOL - + " \"publicIp\" : \"publicip\"," + EOL - + " \"publicPort\" : \"publicport\"," + EOL - + " \"state\" : \"state\"," + EOL - + " \"instanceId\" : \"instanceid\"," + EOL - + " \"createdAt\" : 1486296000000" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"cloudpipes\" : [ {" + EOL + + " \"projectId\" : \"projectid\"," + EOL + " \"internalIp\" : \"internalip\"," + EOL + + " \"publicIp\" : \"publicip\"," + EOL + " \"publicPort\" : \"publicport\"," + EOL + + " \"state\" : \"state\"," + EOL + " \"instanceId\" : \"instanceid\"," + EOL + + " \"createdAt\" : 1486296000000" + EOL + " }, {" + EOL + " \"projectId\" : \"projectid\"," + EOL + + " \"internalIp\" : \"internalip\"," + EOL + " \"publicIp\" : \"publicip\"," + EOL + + " \"publicPort\" : \"publicport\"," + EOL + " \"state\" : \"state\"," + EOL + + " \"instanceId\" : \"instanceid\"," + EOL + " \"createdAt\" : 1486296000000" + 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 { @@ -76,7 +62,7 @@ public class CloudpipesTest { public void testMethods() throws Exception { Cloudpipes cloudpipes = objectMapper.readValue(JSON_FULL, Cloudpipes.class); cloudpipes.toString(); - + List<Cloudpipe> list = cloudpipes.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ConfirmResizeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ConfirmResizeTest.java index f311074..54d18b9 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ConfirmResizeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ConfirmResizeTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.ConfirmResize; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class ConfirmResizeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"confirmResize\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"confirmResize\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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/nova-model/src/test/java/com/woorea/openstack/nova/model/ConsoleOutputTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ConsoleOutputTest.java index 240e11e..b7b98f2 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ConsoleOutputTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ConsoleOutputTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.ConsoleOutput; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,15 +34,11 @@ public class ConsoleOutputTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"output\" : \"output\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"output\" : \"output\"" + 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 { @@ -59,7 +54,7 @@ public class ConsoleOutputTest { public void testMethods() throws Exception { ConsoleOutput consoleoutput = objectMapper.readValue(JSON_FULL, ConsoleOutput.class); consoleoutput.toString(); - + String output = consoleoutput.getOutput(); Assert.assertNotNull(output); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/CreateBackupTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/CreateBackupTest.java index 271cc69..fe39246 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/CreateBackupTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/CreateBackupTest.java @@ -25,9 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.CreateBackup; - import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,25 +35,15 @@ public class CreateBackupTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"createBackup\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"rotation\" : \"rotation\"," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"backup_type\" : \"type\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"createBackup\" : {" + EOL + " \"name\" : \"name\"," + + EOL + " \"rotation\" : \"rotation\"," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"backup_type\" : \"type\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -71,20 +59,20 @@ public class CreateBackupTest { public void testMethods() throws Exception { CreateBackup createbackup = objectMapper.readValue(JSON_FULL, CreateBackup.class); createbackup.toString(); - - Map<String,String> metadata = createbackup.getMetadata(); + + Map<String, String> metadata = createbackup.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); createbackup.setMetadata(metadata); - + String rotation = createbackup.getRotation(); Assert.assertNotNull(rotation); createbackup.setRotation(rotation); - + String name = createbackup.getName(); Assert.assertNotNull(name); createbackup.setName(name); - + String type = createbackup.getType(); Assert.assertNotNull(type); createbackup.setType(type); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/CreateImageTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/CreateImageTest.java index 2c33b27..903a29f 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/CreateImageTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/CreateImageTest.java @@ -25,9 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.CreateImage; - import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,23 +35,14 @@ public class CreateImageTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"createImage\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"createImage\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"metadata\" : {" + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + + " \"metadata-k2\" : \"metadata-v2\"" + EOL + " }" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -69,12 +58,12 @@ public class CreateImageTest { public void testMethods() throws Exception { CreateImage createimage = objectMapper.readValue(JSON_FULL, CreateImage.class); createimage.toString(); - - Map<String,String> metadata = createimage.getMetadata(); + + Map<String, String> metadata = createimage.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); createimage.setMetadata(metadata); - + String name = createimage.getName(); Assert.assertNotNull(name); createimage.setName(name); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/DisassociateFloatingIpTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/DisassociateFloatingIpTest.java index 502e943..525b068 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/DisassociateFloatingIpTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/DisassociateFloatingIpTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,19 +34,13 @@ public class DisassociateFloatingIpTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"removeFloatingIp\" : {" + EOL - + " \"address\" : \"address\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"removeFloatingIp\" : {" + EOL + " \"address\" : \"address\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -63,7 +56,7 @@ public class DisassociateFloatingIpTest { public void testMethods() throws Exception { DisassociateFloatingIp disassociatefloatingip = objectMapper.readValue(JSON_FULL, DisassociateFloatingIp.class); disassociatefloatingip.toString(); - + String address = disassociatefloatingip.getAddress(); Assert.assertNotNull(address); disassociatefloatingip.setAddress(address); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionTest.java index 514ea22..4cc2a44 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionTest.java @@ -24,10 +24,8 @@ 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.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,32 +35,18 @@ public class ExtensionTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"extension\" : {" + EOL - + " \"alias\" : \"alias\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"namespace\" : \"namespace\"," + EOL - + " \"updated\" : 1486468800000," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"extension\" : {" + EOL + " \"alias\" : \"alias\"," + EOL + + " \"description\" : \"description\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"namespace\" : \"namespace\"," + EOL + " \"updated\" : 1486468800000," + EOL + + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " }" + EOL + + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -78,23 +62,23 @@ public class ExtensionTest { public void testMethods() throws Exception { Extension extension = objectMapper.readValue(JSON_FULL, Extension.class); extension.toString(); - + String name = extension.getName(); Assert.assertNotNull(name); - + String namespace = extension.getNamespace(); Assert.assertNotNull(namespace); - + String alias = extension.getAlias(); Assert.assertNotNull(alias); - + String description = extension.getDescription(); Assert.assertNotNull(description); - + List<Link> links = extension.getLinks(); Assert.assertNotNull(links); Assert.assertEquals(2, links.size()); - + Calendar updated = extension.getUpdated(); Assert.assertNotNull(updated); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionsTest.java index 6fe182d..b3f32a3 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionsTest.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,45 +34,22 @@ public class ExtensionsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"extensions\" : [ {" + EOL - + " \"alias\" : \"alias\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"namespace\" : \"namespace\"," + EOL - + " \"updated\" : 1486468800000," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " }, {" + EOL - + " \"alias\" : \"alias\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"namespace\" : \"namespace\"," + EOL - + " \"updated\" : 1486468800000," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"extensions\" : [ {" + EOL + " \"alias\" : \"alias\"," + + EOL + " \"description\" : \"description\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"namespace\" : \"namespace\"," + EOL + " \"updated\" : 1486468800000," + EOL + + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " }, {" + EOL + + " \"alias\" : \"alias\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"namespace\" : \"namespace\"," + EOL + + " \"updated\" : 1486468800000," + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + + " } ]" + 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 { @@ -90,13 +65,14 @@ public class ExtensionsTest { public void testMethods() throws Exception { Extensions extensions = objectMapper.readValue(JSON_FULL, Extensions.class); extensions.toString(); - + List<Extension> list = extensions.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Extension x : extensions) { + for (@SuppressWarnings("unused") + Extension x : extensions) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FaultTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FaultTest.java index a426d8a..a8efda6 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FaultTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FaultTest.java @@ -25,9 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Server.Fault; - import java.util.Calendar; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,18 +35,12 @@ public class FaultTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"code\" : 29," + EOL - + " \"message\" : \"message\"," + EOL - + " \"details\" : \"details\"," + EOL - + " \"created\" : 1485172800000" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"code\" : 29," + EOL + " \"message\" : \"message\"," + EOL + + " \"details\" : \"details\"," + EOL + " \"created\" : 1485172800000" + 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 { @@ -64,16 +56,16 @@ public class FaultTest { public void testMethods() throws Exception { Fault fault = objectMapper.readValue(JSON_FULL, Fault.class); fault.toString(); - + Integer code = fault.getCode(); Assert.assertNotNull(code); - + Calendar created = fault.getCreated(); Assert.assertNotNull(created); - + String details = fault.getDetails(); Assert.assertNotNull(details); - + String message = fault.getMessage(); Assert.assertNotNull(message); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorForCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorForCreateTest.java index 2d6e1a7..195a7b2 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorForCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorForCreateTest.java @@ -24,7 +24,6 @@ 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; @@ -34,26 +33,15 @@ public class FlavorForCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"flavor\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"vcpus\" : \"vcpus\"," + EOL - + " \"ram\" : 38," + EOL - + " \"disk\" : \"disk\"," + EOL - + " \"swap\" : \"swap\"," + EOL - + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL - + " \"rxtx_factor\" : 11.0" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private static final String JSON_FULL = "{" + EOL + " \"flavor\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"vcpus\" : \"vcpus\"," + EOL + " \"ram\" : 38," + EOL + + " \"disk\" : \"disk\"," + EOL + " \"swap\" : \"swap\"," + EOL + + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL + " \"rxtx_factor\" : 11.0" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -69,35 +57,35 @@ public class FlavorForCreateTest { public void testMethods() throws Exception { FlavorForCreate flavorforcreate = objectMapper.readValue(JSON_FULL, FlavorForCreate.class); flavorforcreate.toString(); - + String disk = flavorforcreate.getDisk(); Assert.assertNotNull(disk); flavorforcreate.setDisk(disk); - + String swap = flavorforcreate.getSwap(); Assert.assertNotNull(swap); flavorforcreate.setSwap(swap); - + String name = flavorforcreate.getName(); Assert.assertNotNull(name); flavorforcreate.setName(name); - + Float rxtxFactor = flavorforcreate.getRxtxFactor(); Assert.assertNotNull(rxtxFactor); flavorforcreate.setRxtxFactor(rxtxFactor); - + Integer ephemeral = flavorforcreate.getEphemeral(); Assert.assertNotNull(ephemeral); flavorforcreate.setEphemeral(ephemeral); - + String id = flavorforcreate.getId(); Assert.assertNotNull(id); flavorforcreate.setId(id); - + String vcpus = flavorforcreate.getVcpus(); Assert.assertNotNull(vcpus); flavorforcreate.setVcpus(vcpus); - + Integer ram = flavorforcreate.getRam(); Assert.assertNotNull(ram); flavorforcreate.setRam(ram); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorTest.java index 63fa405..3a1bfca 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorTest.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,40 +34,20 @@ public class FlavorTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"flavor\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"vcpus\" : 79," + EOL - + " \"ram\" : 38," + EOL - + " \"disk\" : 45," + EOL - + " \"swap\" : \"swap\"," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"public\" : false," + EOL - + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL - + " \"rxtx_factor\" : 11.0," + EOL - + " \"OS-FLV-DISABLED:disabled\" : true," + EOL - + " \"rxtx_quota\" : 42," + EOL - + " \"rxtx_cap\" : 96," + EOL - + " \"os-flavor-access:is_public\" : false" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private static final String JSON_FULL = "{" + EOL + " \"flavor\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"vcpus\" : 79," + EOL + " \"ram\" : 38," + EOL + + " \"disk\" : 45," + EOL + " \"swap\" : \"swap\"," + EOL + " \"links\" : [ {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " } ]," + EOL + " \"public\" : false," + EOL + + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL + " \"rxtx_factor\" : 11.0," + EOL + + " \"OS-FLV-DISABLED:disabled\" : true," + EOL + " \"rxtx_quota\" : 42," + EOL + + " \"rxtx_cap\" : 96," + EOL + " \"os-flavor-access:is_public\" : false" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -85,52 +63,52 @@ public class FlavorTest { public void testMethods() throws Exception { Flavor flavor = objectMapper.readValue(JSON_FULL, Flavor.class); flavor.toString(); - + Integer rxtxQuota = flavor.getRxtxQuota(); Assert.assertNotNull(rxtxQuota); flavor.setRxtxQuota(rxtxQuota); - + String swap = flavor.getSwap(); Assert.assertNotNull(swap); flavor.setSwap(swap); - + Float rxtxFactor = flavor.getRxtxFactor(); Assert.assertNotNull(rxtxFactor); flavor.setRxtxFactor(rxtxFactor); - + Integer ephemeral = flavor.getEphemeral(); Assert.assertNotNull(ephemeral); flavor.setEphemeral(ephemeral); - + Integer vcpus = flavor.getVcpus(); Assert.assertNotNull(vcpus); flavor.setVcpus(vcpus); - + Integer rxtxCap = flavor.getRxtxCap(); Assert.assertNotNull(rxtxCap); flavor.setRxtxCap(rxtxCap); - + Integer disk = flavor.getDisk(); Assert.assertNotNull(disk); flavor.setDisk(disk); - + String name = flavor.getName(); Assert.assertNotNull(name); flavor.setName(name); - + List<Link> links = flavor.getLinks(); Assert.assertNotNull(links); Assert.assertEquals(2, links.size()); flavor.setLinks(links); - + Boolean disabled = flavor.getDisabled(); Assert.assertNotNull(disabled); flavor.setDisabled(disabled); - + String id = flavor.getId(); Assert.assertNotNull(id); flavor.setId(id); - + Integer ram = flavor.getRam(); Assert.assertNotNull(ram); flavor.setRam(ram); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorsTest.java index 5316006..664df69 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorsTest.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,61 +34,28 @@ public class FlavorsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"flavors\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"vcpus\" : 79," + EOL - + " \"ram\" : 38," + EOL - + " \"disk\" : 45," + EOL - + " \"swap\" : \"swap\"," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"public\" : false," + EOL - + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL - + " \"rxtx_factor\" : 11.0," + EOL - + " \"OS-FLV-DISABLED:disabled\" : true," + EOL - + " \"rxtx_quota\" : 42," + EOL - + " \"rxtx_cap\" : 96," + EOL - + " \"os-flavor-access:is_public\" : false" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"vcpus\" : 79," + EOL - + " \"ram\" : 38," + EOL - + " \"disk\" : 45," + EOL - + " \"swap\" : \"swap\"," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"public\" : false," + EOL - + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL - + " \"rxtx_factor\" : 11.0," + EOL - + " \"OS-FLV-DISABLED:disabled\" : true," + EOL - + " \"rxtx_quota\" : 42," + EOL - + " \"rxtx_cap\" : 96," + EOL - + " \"os-flavor-access:is_public\" : false" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"flavors\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"vcpus\" : 79," + EOL + " \"ram\" : 38," + EOL + + " \"disk\" : 45," + EOL + " \"swap\" : \"swap\"," + EOL + " \"links\" : [ {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " } ]," + EOL + " \"public\" : false," + EOL + + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL + " \"rxtx_factor\" : 11.0," + EOL + + " \"OS-FLV-DISABLED:disabled\" : true," + EOL + " \"rxtx_quota\" : 42," + EOL + + " \"rxtx_cap\" : 96," + EOL + " \"os-flavor-access:is_public\" : false" + EOL + " }, {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + " \"vcpus\" : 79," + EOL + + " \"ram\" : 38," + EOL + " \"disk\" : 45," + EOL + " \"swap\" : \"swap\"," + EOL + + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL + + " \"public\" : false," + EOL + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL + + " \"rxtx_factor\" : 11.0," + EOL + " \"OS-FLV-DISABLED:disabled\" : true," + EOL + + " \"rxtx_quota\" : 42," + EOL + " \"rxtx_cap\" : 96," + EOL + + " \"os-flavor-access:is_public\" : false" + 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 { @@ -106,13 +71,14 @@ public class FlavorsTest { public void testMethods() throws Exception { Flavors flavors = objectMapper.readValue(JSON_FULL, Flavors.class); flavors.toString(); - + List<Flavor> list = flavors.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Flavor x : flavors) { + for (@SuppressWarnings("unused") + Flavor x : flavors) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpDomainTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpDomainTest.java index dac8a45..c3b5bad 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpDomainTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpDomainTest.java @@ -24,7 +24,6 @@ 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; @@ -34,22 +33,15 @@ public class FloatingIpDomainTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"floating-ip-pool\" : {" + EOL - + " \"domain\" : \"domain\"," + EOL - + " \"scope\" : \"scope\"," + EOL - + " \"project\" : \"project\"," + EOL - + " \"availabilityZone\" : \"availabilityzone\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"floating-ip-pool\" : {" + EOL + " \"domain\" : \"domain\"," + EOL + + " \"scope\" : \"scope\"," + EOL + " \"project\" : \"project\"," + EOL + + " \"availabilityZone\" : \"availabilityzone\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -65,16 +57,16 @@ public class FloatingIpDomainTest { public void testMethods() throws Exception { FloatingIpDomain floatingipdomain = objectMapper.readValue(JSON_FULL, FloatingIpDomain.class); floatingipdomain.toString(); - + String domain = floatingipdomain.getDomain(); Assert.assertNotNull(domain); - + String scope = floatingipdomain.getScope(); Assert.assertNotNull(scope); - + String project = floatingipdomain.getProject(); Assert.assertNotNull(project); - + String availabilityZone = floatingipdomain.getAvailabilityZone(); Assert.assertNotNull(availabilityZone); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpDomainsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpDomainsTest.java index 6cfe54f..c03e741 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpDomainsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpDomainsTest.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,25 +34,16 @@ public class FloatingIpDomainsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"domain_entries\" : [ {" + EOL - + " \"domain\" : \"domain\"," + EOL - + " \"scope\" : \"scope\"," + EOL - + " \"project\" : \"project\"," + EOL - + " \"availabilityZone\" : \"availabilityzone\"" + EOL - + " }, {" + EOL - + " \"domain\" : \"domain\"," + EOL - + " \"scope\" : \"scope\"," + EOL - + " \"project\" : \"project\"," + EOL - + " \"availabilityZone\" : \"availabilityzone\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"domain_entries\" : [ {" + EOL + + " \"domain\" : \"domain\"," + EOL + " \"scope\" : \"scope\"," + EOL + + " \"project\" : \"project\"," + EOL + " \"availabilityZone\" : \"availabilityzone\"" + EOL + + " }, {" + EOL + " \"domain\" : \"domain\"," + EOL + " \"scope\" : \"scope\"," + EOL + + " \"project\" : \"project\"," + EOL + " \"availabilityZone\" : \"availabilityzone\"" + 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 { @@ -70,13 +59,14 @@ public class FloatingIpDomainsTest { public void testMethods() throws Exception { FloatingIpDomains floatingipdomains = objectMapper.readValue(JSON_FULL, FloatingIpDomains.class); floatingipdomains.toString(); - + List<FloatingIpDomain> list = floatingipdomains.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") FloatingIpDomain x : floatingipdomains) { + for (@SuppressWarnings("unused") + FloatingIpDomain x : floatingipdomains) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpPoolTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpPoolTest.java index 7048b63..8ab1ca2 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpPoolTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpPoolTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.FloatingIpPools.FloatingIpPool; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,15 +34,11 @@ public class FloatingIpPoolTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"name\" : \"name\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"name\" : \"name\"" + 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 { @@ -59,7 +54,7 @@ public class FloatingIpPoolTest { public void testMethods() throws Exception { FloatingIpPool floatingippool = objectMapper.readValue(JSON_FULL, FloatingIpPool.class); floatingippool.toString(); - + String name = floatingippool.getName(); Assert.assertNotNull(name); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpPoolsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpPoolsTest.java index 7f5c1c1..b5d50e6 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpPoolsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpPoolsTest.java @@ -25,9 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.FloatingIpPools.FloatingIpPool; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,19 +35,12 @@ public class FloatingIpPoolsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"floating_ip_pools\" : [ {" + EOL - + " \"name\" : \"name\"" + EOL - + " }, {" + EOL - + " \"name\" : \"name\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"floating_ip_pools\" : [ {" + EOL + + " \"name\" : \"name\"" + EOL + " }, {" + EOL + " \"name\" : \"name\"" + 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 { @@ -65,13 +56,14 @@ public class FloatingIpPoolsTest { public void testMethods() throws Exception { FloatingIpPools floatingippools = objectMapper.readValue(JSON_FULL, FloatingIpPools.class); floatingippools.toString(); - + List<FloatingIpPool> list = floatingippools.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") FloatingIpPool x : floatingippools) { + for (@SuppressWarnings("unused") + FloatingIpPool x : floatingippools) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpTest.java index 00d382c..9e506cc 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpTest.java @@ -24,7 +24,6 @@ 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; @@ -34,23 +33,14 @@ public class FloatingIpTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"floating_ip\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"pool\" : \"pool\"," + EOL - + " \"ip\" : \"ip\"," + EOL - + " \"fixed_ip\" : \"fixedip\"," + EOL - + " \"instance_id\" : \"instanceid\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"floating_ip\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"pool\" : \"pool\"," + EOL + " \"ip\" : \"ip\"," + EOL + " \"fixed_ip\" : \"fixedip\"," + EOL + + " \"instance_id\" : \"instanceid\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -66,19 +56,19 @@ public class FloatingIpTest { public void testMethods() throws Exception { FloatingIp floatingip = objectMapper.readValue(JSON_FULL, FloatingIp.class); floatingip.toString(); - + String instanceId = floatingip.getInstanceId(); Assert.assertNotNull(instanceId); - + String ip = floatingip.getIp(); Assert.assertNotNull(ip); - + String pool = floatingip.getPool(); Assert.assertNotNull(pool); - + String fixedIp = floatingip.getFixedIp(); Assert.assertNotNull(fixedIp); - + String id = floatingip.getId(); Assert.assertNotNull(id); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpsTest.java index 4b279df..53fbf44 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpsTest.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,27 +34,15 @@ public class FloatingIpsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"floating_ips\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"pool\" : \"pool\"," + EOL - + " \"ip\" : \"ip\"," + EOL - + " \"fixed_ip\" : \"fixedip\"," + EOL - + " \"instance_id\" : \"instanceid\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"pool\" : \"pool\"," + EOL - + " \"ip\" : \"ip\"," + EOL - + " \"fixed_ip\" : \"fixedip\"," + EOL - + " \"instance_id\" : \"instanceid\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"floating_ips\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"pool\" : \"pool\"," + EOL + " \"ip\" : \"ip\"," + EOL + " \"fixed_ip\" : \"fixedip\"," + EOL + + " \"instance_id\" : \"instanceid\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"pool\" : \"pool\"," + EOL + " \"ip\" : \"ip\"," + EOL + " \"fixed_ip\" : \"fixedip\"," + EOL + + " \"instance_id\" : \"instanceid\"" + 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 { @@ -72,13 +58,14 @@ public class FloatingIpsTest { public void testMethods() throws Exception { FloatingIps floatingips = objectMapper.readValue(JSON_FULL, FloatingIps.class); floatingips.toString(); - + List<FloatingIp> list = floatingips.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") FloatingIp x : floatingips) { + for (@SuppressWarnings("unused") + FloatingIp x : floatingips) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ForceDeleteTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ForceDeleteTest.java index bf26778..4262f45 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ForceDeleteTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ForceDeleteTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.ForceDelete; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class ForceDeleteTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"forceDelete\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"forceDelete\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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/nova-model/src/test/java/com/woorea/openstack/nova/model/GetConsoleOutputTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/GetConsoleOutputTest.java index 8f2ea1e..6420ff5 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/GetConsoleOutputTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/GetConsoleOutputTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.GetConsoleOutput; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,19 +34,13 @@ public class GetConsoleOutputTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"os-getConsoleOutput\" : {" + EOL - + " \"length\" : 60" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"os-getConsoleOutput\" : {" + EOL + " \"length\" : 60" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -63,7 +56,7 @@ public class GetConsoleOutputTest { public void testMethods() throws Exception { GetConsoleOutput getconsoleoutput = objectMapper.readValue(JSON_FULL, GetConsoleOutput.class); getconsoleoutput.toString(); - + Integer length = getconsoleoutput.getLength(); Assert.assertNotNull(length); getconsoleoutput.setLength(length); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/GetVncConsoleTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/GetVncConsoleTest.java index d7ed6c9..924aabe 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/GetVncConsoleTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/GetVncConsoleTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.GetVncConsole; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,19 +34,13 @@ public class GetVncConsoleTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"os-getVNCConsole\" : {" + EOL - + " \"type\" : \"type\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"os-getVNCConsole\" : {" + EOL + " \"type\" : \"type\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -63,7 +56,7 @@ public class GetVncConsoleTest { public void testMethods() throws Exception { GetVncConsole getvncconsole = objectMapper.readValue(JSON_FULL, GetVncConsole.class); getvncconsole.toString(); - + String type = getvncconsole.getType(); Assert.assertNotNull(type); getvncconsole.setType(type); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/GroupTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/GroupTest.java index 561ea9a..7ebcff5 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/GroupTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/GroupTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.SecurityGroup.Rule.Group; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,16 +34,12 @@ public class GroupTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"name\" : \"name\"," + EOL + " \"tenant_id\" : \"tenantid\"" + 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 { @@ -60,10 +55,10 @@ public class GroupTest { public void testMethods() throws Exception { Group group = objectMapper.readValue(JSON_FULL, Group.class); group.toString(); - + String name = group.getName(); Assert.assertNotNull(name); - + String tenantId = group.getTenantId(); Assert.assertNotNull(tenantId); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/HostAggregateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/HostAggregateTest.java index 5631245..29ae8c6 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/HostAggregateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/HostAggregateTest.java @@ -24,10 +24,8 @@ 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 java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,30 +35,18 @@ public class HostAggregateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"aggregate\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"deleted\" : false," + EOL - + " \"hosts\" : [ \"hosts-v1\", \"hosts-v2\" ]," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"availability_zone\" : \"availabilityzone\"," + EOL - + " \"created_at\" : \"createdat\"," + EOL - + " \"updated_at\" : \"updatedat\"," + EOL - + " \"deleted_at\" : \"deletedat\"" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private static final String JSON_FULL = "{" + EOL + " \"aggregate\" : {" + EOL + " \"id\" : 1," + EOL + + " \"name\" : \"name\"," + EOL + " \"deleted\" : false," + EOL + + " \"hosts\" : [ \"hosts-v1\", \"hosts-v2\" ]," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"availability_zone\" : \"availabilityzone\"," + EOL + + " \"created_at\" : \"2013-02-25T02:40:21Z\"," + EOL + " \"updated_at\" : \"2013-02-25T02:40:21Z\"," + + EOL + " \"deleted_at\" : \"2013-02-25T02:40:21Z\"" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -76,33 +62,33 @@ public class HostAggregateTest { public void testMethods() throws Exception { HostAggregate hostaggregate = objectMapper.readValue(JSON_FULL, HostAggregate.class); hostaggregate.toString(); - + String createdAt = hostaggregate.getCreatedAt(); Assert.assertNotNull(createdAt); - - Map<String,String> metadata = hostaggregate.getMetadata(); + + Map<String, String> metadata = hostaggregate.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); - + String deletedAt = hostaggregate.getDeletedAt(); Assert.assertNotNull(deletedAt); - + Boolean deleted = hostaggregate.getDeleted(); Assert.assertNotNull(deleted); - + List<String> hosts = hostaggregate.getHosts(); Assert.assertNotNull(hosts); Assert.assertEquals(2, hosts.size()); - + String name = hostaggregate.getName(); Assert.assertNotNull(name); - - String id = hostaggregate.getId(); + + Integer id = hostaggregate.getId(); Assert.assertNotNull(id); - + String availabilityZone = hostaggregate.getAvailabilityZone(); Assert.assertNotNull(availabilityZone); - + String updatedAt = hostaggregate.getUpdatedAt(); Assert.assertNotNull(updatedAt); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/HostAggregatesTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/HostAggregatesTest.java index 6fba9c2..1bbaa97 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/HostAggregatesTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/HostAggregatesTest.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,41 +34,23 @@ public class HostAggregatesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"aggregates\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"deleted\" : false," + EOL - + " \"hosts\" : [ \"hosts-v1\", \"hosts-v2\" ]," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"availability_zone\" : \"availabilityzone\"," + EOL - + " \"created_at\" : \"createdat\"," + EOL - + " \"updated_at\" : \"updatedat\"," + EOL - + " \"deleted_at\" : \"deletedat\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"deleted\" : false," + EOL - + " \"hosts\" : [ \"hosts-v1\", \"hosts-v2\" ]," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"availability_zone\" : \"availabilityzone\"," + EOL - + " \"created_at\" : \"createdat\"," + EOL - + " \"updated_at\" : \"updatedat\"," + EOL - + " \"deleted_at\" : \"deletedat\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"aggregates\" : [ {" + EOL + " \"id\" : 1," + EOL + + " \"name\" : \"name\"," + EOL + " \"deleted\" : false," + EOL + + " \"hosts\" : [ \"hosts-v1\", \"hosts-v2\" ]," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"availability_zone\" : \"availabilityzone\"," + EOL + + " \"created_at\" : \"createdat\"," + EOL + " \"updated_at\" : \"updatedat\"," + EOL + + " \"deleted_at\" : \"deletedat\"" + EOL + " }, {" + EOL + " \"id\" : 2," + EOL + + " \"name\" : \"name\"," + EOL + " \"deleted\" : false," + EOL + + " \"hosts\" : [ \"hosts-v1\", \"hosts-v2\" ]," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"availability_zone\" : \"availabilityzone\"," + EOL + + " \"created_at\" : \"createdat\"," + EOL + " \"updated_at\" : \"updatedat\"," + EOL + + " \"deleted_at\" : \"deletedat\"" + 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 { @@ -86,13 +66,14 @@ public class HostAggregatesTest { public void testMethods() throws Exception { HostAggregates hostaggregates = objectMapper.readValue(JSON_FULL, HostAggregates.class); hostaggregates.toString(); - + List<HostAggregate> list = hostaggregates.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") HostAggregate x : hostaggregates) { + for (@SuppressWarnings("unused") + HostAggregate x : hostaggregates) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/HostTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/HostTest.java index 99d747c..eac90bc 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/HostTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/HostTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Hosts.Host; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,17 +34,12 @@ public class HostTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"zone\" : \"zone\"," + EOL - + " \"service\" : \"service\"," + EOL - + " \"host_name\" : \"hostname\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"zone\" : \"zone\"," + EOL + " \"service\" : \"service\"," + + EOL + " \"host_name\" : \"hostname\"" + 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 { @@ -61,14 +55,14 @@ public class HostTest { public void testMethods() throws Exception { Host host = objectMapper.readValue(JSON_FULL, Host.class); host.toString(); - + String hostName = host.getHostName(); Assert.assertNotNull(hostName); - + String zone = host.getZone(); Assert.assertNotNull(zone); host.setZone(zone); - + String service = host.getService(); Assert.assertNotNull(service); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/HostsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/HostsTest.java index ad60a69..0eaf6ac 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/HostsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/HostsTest.java @@ -25,9 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Hosts.Host; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,23 +35,14 @@ public class HostsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"hosts\" : [ {" + EOL - + " \"zone\" : \"zone\"," + EOL - + " \"service\" : \"service\"," + EOL - + " \"host_name\" : \"hostname\"" + EOL - + " }, {" + EOL - + " \"zone\" : \"zone\"," + EOL - + " \"service\" : \"service\"," + EOL - + " \"host_name\" : \"hostname\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"hosts\" : [ {" + EOL + " \"zone\" : \"zone\"," + EOL + + " \"service\" : \"service\"," + EOL + " \"host_name\" : \"hostname\"" + EOL + " }, {" + EOL + + " \"zone\" : \"zone\"," + EOL + " \"service\" : \"service\"," + EOL + + " \"host_name\" : \"hostname\"" + 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 { @@ -69,13 +58,14 @@ public class HostsTest { public void testMethods() throws Exception { Hosts hosts = objectMapper.readValue(JSON_FULL, Hosts.class); hosts.toString(); - + List<Host> list = hosts.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Host x : hosts) { + for (@SuppressWarnings("unused") + Host x : hosts) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ImageFromVolumeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ImageFromVolumeTest.java index 4983a55..db8ad55 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ImageFromVolumeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ImageFromVolumeTest.java @@ -24,7 +24,6 @@ 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; @@ -34,28 +33,18 @@ public class ImageFromVolumeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"os-volume_upload_image\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"updates_at\" : \"updates_at\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"display_description\" : \"display_description\"," + EOL - + " \"size\" : \"size\"," + EOL - + " \"volume_type\" : \"volume_type\"," + EOL - + " \"image_id\" : \"image_id\"," + EOL - + " \"container_format\" : \"container_format\"," + EOL - + " \"disk_format\" : \"disk_format\"," + EOL - + " \"image_name\" : \"image_name\"" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private static final String JSON_FULL = "{" + EOL + " \"os-volume_upload_image\" : {" + EOL + + " \"id\" : \"id\"," + EOL + " \"updates_at\" : \"updates_at\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"display_description\" : \"display_description\"," + EOL + + " \"size\" : \"size\"," + EOL + " \"volume_type\" : \"volume_type\"," + EOL + + " \"image_id\" : \"image_id\"," + EOL + " \"container_format\" : \"container_format\"," + EOL + + " \"disk_format\" : \"disk_format\"," + EOL + " \"image_name\" : \"image_name\"" + EOL + " }" + EOL + + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -71,43 +60,43 @@ public class ImageFromVolumeTest { public void testMethods() throws Exception { ImageFromVolume imagefromvolume = objectMapper.readValue(JSON_FULL, ImageFromVolume.class); imagefromvolume.toString(); - + String image_name = imagefromvolume.getImage_name(); Assert.assertNotNull(image_name); imagefromvolume.setImage_name(image_name); - + String display_description = imagefromvolume.getDisplay_description(); Assert.assertNotNull(display_description); imagefromvolume.setDisplay_description(display_description); - + String updates_at = imagefromvolume.getUpdates_at(); Assert.assertNotNull(updates_at); imagefromvolume.setUpdates_at(updates_at); - + String volume_type = imagefromvolume.getVolume_type(); Assert.assertNotNull(volume_type); imagefromvolume.setVolume_type(volume_type); - + String size = imagefromvolume.getSize(); Assert.assertNotNull(size); imagefromvolume.setSize(size); - + String disk_format = imagefromvolume.getDisk_format(); Assert.assertNotNull(disk_format); imagefromvolume.setDisk_format(disk_format); - + String id = imagefromvolume.getId(); Assert.assertNotNull(id); imagefromvolume.setId(id); - + String image_id = imagefromvolume.getImage_id(); Assert.assertNotNull(image_id); imagefromvolume.setImage_id(image_id); - + String container_format = imagefromvolume.getContainer_format(); Assert.assertNotNull(container_format); imagefromvolume.setContainer_format(container_format); - + String status = imagefromvolume.getStatus(); Assert.assertNotNull(status); imagefromvolume.setStatus(status); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ImageTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ImageTest.java index 4fce1d4..ba3f2b8 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ImageTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ImageTest.java @@ -25,11 +25,9 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Image.Server; - import java.util.Calendar; import java.util.List; import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -39,52 +37,24 @@ public class ImageTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"image\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"progress\" : 3," + EOL - + " \"minRam\" : 62," + EOL - + " \"minDisk\" : 69," + EOL - + " \"created\" : 1485172800000," + EOL - + " \"updated\" : 1486468800000," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"server\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " }," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private static final String JSON_FULL = "{" + EOL + " \"image\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"name\" : \"name\"," + EOL + " \"progress\" : 3," + EOL + + " \"minRam\" : 62," + EOL + " \"minDisk\" : 69," + EOL + " \"created\" : 1485172800000," + EOL + + " \"updated\" : 1486468800000," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"server\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"links\" : [ {" + + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " }," + + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL + + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -100,51 +70,51 @@ public class ImageTest { public void testMethods() throws Exception { Image image = objectMapper.readValue(JSON_FULL, Image.class); image.toString(); - + Server server = image.getServer(); Assert.assertNotNull(server); - - Map<String,String> metadata = image.getMetadata(); + + Map<String, String> metadata = image.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); image.setMetadata(metadata); - + Long size = image.getSize(); Assert.assertNotNull(size); - + Calendar created = image.getCreated(); Assert.assertNotNull(created); image.setCreated(created); - + Integer minRam = image.getMinRam(); Assert.assertNotNull(minRam); image.setMinRam(minRam); - + String name = image.getName(); Assert.assertNotNull(name); image.setName(name); - + Integer progress = image.getProgress(); Assert.assertNotNull(progress); image.setProgress(progress); - + List<Link> links = image.getLinks(); Assert.assertNotNull(links); Assert.assertEquals(2, links.size()); image.setLinks(links); - + String id = image.getId(); Assert.assertNotNull(id); image.setId(id); - + Calendar updated = image.getUpdated(); Assert.assertNotNull(updated); image.setUpdated(updated); - + Integer minDisk = image.getMinDisk(); Assert.assertNotNull(minDisk); image.setMinDisk(minDisk); - + String status = image.getStatus(); Assert.assertNotNull(status); image.setStatus(status); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ImagesTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ImagesTest.java index 2b52804..c54e22e 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ImagesTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ImagesTest.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,85 +34,35 @@ public class ImagesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"images\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"progress\" : 3," + EOL - + " \"minRam\" : 62," + EOL - + " \"minDisk\" : 69," + EOL - + " \"created\" : 1485172800000," + EOL - + " \"updated\" : 1486468800000," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"server\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " }," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"progress\" : 3," + EOL - + " \"minRam\" : 62," + EOL - + " \"minDisk\" : 69," + EOL - + " \"created\" : 1485172800000," + EOL - + " \"updated\" : 1486468800000," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"server\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " }," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"images\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"name\" : \"name\"," + EOL + " \"progress\" : 3," + EOL + + " \"minRam\" : 62," + EOL + " \"minDisk\" : 69," + EOL + " \"created\" : 1485172800000," + EOL + + " \"updated\" : 1486468800000," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"server\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"links\" : [ {" + + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " }," + + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL + + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"name\" : \"name\"," + EOL + " \"progress\" : 3," + EOL + + " \"minRam\" : 62," + EOL + " \"minDisk\" : 69," + EOL + " \"created\" : 1485172800000," + EOL + + " \"updated\" : 1486468800000," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"server\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"links\" : [ {" + + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " }," + + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL + + " \"OS-EXT-IMG-SIZE:size\" : 43" + 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 { @@ -130,13 +78,14 @@ public class ImagesTest { public void testMethods() throws Exception { Images images = objectMapper.readValue(JSON_FULL, Images.class); images.toString(); - + List<Image> list = images.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Image x : images) { + for (@SuppressWarnings("unused") + Image x : images) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/IpRangeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/IpRangeTest.java index 0505671..f441499 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/IpRangeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/IpRangeTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.SecurityGroup.Rule.IpRange; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,15 +34,11 @@ public class IpRangeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"cidr\" : \"cidr\"" + 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 { @@ -59,7 +54,7 @@ public class IpRangeTest { public void testMethods() throws Exception { IpRange iprange = objectMapper.readValue(JSON_FULL, IpRange.class); iprange.toString(); - + String cidr = iprange.getCidr(); Assert.assertNotNull(cidr); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairTest.java index c7f564c..0ef3f5d 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairTest.java @@ -24,7 +24,6 @@ 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; @@ -34,23 +33,15 @@ public class KeyPairTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"keypair\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"fingerprint\" : \"fingerprint\"," + EOL - + " \"user_id\" : \"userid\"," + EOL - + " \"public_key\" : \"publickey\"," + EOL - + " \"private_key\" : \"privatekey\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"keypair\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"fingerprint\" : \"fingerprint\"," + EOL + " \"user_id\" : \"userid\"," + EOL + + " \"public_key\" : \"publickey\"," + EOL + " \"private_key\" : \"privatekey\"" + EOL + " }" + EOL + + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -66,21 +57,21 @@ public class KeyPairTest { public void testMethods() throws Exception { KeyPair keypair = objectMapper.readValue(JSON_FULL, KeyPair.class); keypair.toString(); - + String privateKey = keypair.getPrivateKey(); Assert.assertNotNull(privateKey); - + String name = keypair.getName(); Assert.assertNotNull(name); keypair.setName(name); - + String fingerprint = keypair.getFingerprint(); Assert.assertNotNull(fingerprint); - + String publicKey = keypair.getPublicKey(); Assert.assertNotNull(publicKey); keypair.setPublicKey(publicKey); - + String userId = keypair.getUserId(); Assert.assertNotNull(userId); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairWrapperTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairWrapperTest.java index 3ba27d0..302853c 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairWrapperTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairWrapperTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.KeyPairs.KeyPairWrapper; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,21 +33,14 @@ public class KeyPairWrapperTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"keypair\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"fingerprint\" : \"fingerprint\"," + EOL - + " \"user_id\" : \"userid\"," + EOL - + " \"public_key\" : \"publickey\"," + EOL - + " \"private_key\" : \"privatekey\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"keypair\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"fingerprint\" : \"fingerprint\"," + EOL + " \"user_id\" : \"userid\"," + EOL + + " \"public_key\" : \"publickey\"," + EOL + " \"private_key\" : \"privatekey\"" + 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 { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairsTest.java index fe6d090..ed1a258 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairsTest.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.Ignore; import org.junit.Test; @@ -37,34 +35,20 @@ public class KeyPairsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"keypairs\" : [ {" + EOL - + " \"keypair\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"fingerprint\" : \"fingerprint\"," + EOL - + " \"user_id\" : \"userid\"," + EOL - + " \"public_key\" : \"publickey\"," + EOL - + " \"private_key\" : \"privatekey\"" + EOL - + " }" + EOL - + " }, {" + EOL - + " \"keypair\" : { " + EOL - + " \"name\" : \"name\"," + EOL - + " \"fingerprint\" : \"fingerprint\"," + EOL - + " \"user_id\" : \"userid\"," + EOL - + " \"public_key\" : \"publickey\"," + EOL - + " \"private_key\" : \"privatekey\"" + EOL - + " }" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"keypairs\" : [ {" + EOL + " \"keypair\" : {" + EOL + + " \"name\" : \"name\"," + EOL + " \"fingerprint\" : \"fingerprint\"," + EOL + + " \"user_id\" : \"userid\"," + EOL + " \"public_key\" : \"publickey\"," + EOL + + " \"private_key\" : \"privatekey\"" + EOL + " }" + EOL + " }, {" + EOL + " \"keypair\" : { " + + EOL + " \"name\" : \"name\"," + EOL + " \"fingerprint\" : \"fingerprint\"," + EOL + + " \"user_id\" : \"userid\"," + EOL + " \"public_key\" : \"publickey\"," + EOL + + " \"private_key\" : \"privatekey\"" + EOL + " }" + 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); // This is test is ignored because The KeyPairs class does not - // serialize into JSON correctly. It is probably not an operational + // serialize into JSON correctly. It is probably not an operational // issue because KeyPairs is only used to represent the response to // the GET os-keypairs request. @Ignore @@ -87,7 +71,8 @@ public class KeyPairsTest { Assert.assertNotNull(list); int cnt = 0; - for (@SuppressWarnings("unused") KeyPair x : keypairs) { + for (@SuppressWarnings("unused") + KeyPair x : keypairs) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/LimitEntryTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/LimitEntryTest.java index 25f6ab9..22fbc15 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/LimitEntryTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/LimitEntryTest.java @@ -25,9 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Limits.RateLimit.LimitEntry; - import java.util.Calendar; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,20 +35,13 @@ public class LimitEntryTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"unit\" : \"unit\"," + EOL - + " \"verb\" : \"verb\"," + EOL - + " \"remaining\" : 72," + EOL - + " \"available\" : 47," + EOL - + " \"value\" : 59," + EOL - + " \"next-available\" : 1489320000000" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"unit\" : \"unit\"," + EOL + " \"verb\" : \"verb\"," + EOL + + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + " \"value\" : 59," + EOL + + " \"next-available\" : 1489320000000" + 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 { @@ -66,22 +57,22 @@ public class LimitEntryTest { public void testMethods() throws Exception { LimitEntry limitentry = objectMapper.readValue(JSON_FULL, LimitEntry.class); limitentry.toString(); - + String unit = limitentry.getUnit(); Assert.assertNotNull(unit); - + String verb = limitentry.getVerb(); Assert.assertNotNull(verb); - + Integer available = limitentry.getAvailable(); Assert.assertNotNull(available); - + Calendar nextAvailable = limitentry.getNextAvailable(); Assert.assertNotNull(nextAvailable); - + Integer value = limitentry.getValue(); Assert.assertNotNull(value); - + Integer remaining = limitentry.getRemaining(); Assert.assertNotNull(remaining); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/LimitsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/LimitsTest.java index ec450d3..bd23ae9 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/LimitsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/LimitsTest.java @@ -26,9 +26,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Limits.AbsoluteLimit; import com.woorea.openstack.nova.model.Limits.RateLimit; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -38,83 +36,40 @@ public class LimitsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"limits\" : {" + EOL - + " \"rate\" : [ {" + EOL - + " \"regex\" : \"regex\"," + EOL - + " \"uri\" : \"uri\"," + EOL - + " \"limit\" : [ {" + EOL - + " \"unit\" : \"unit\"," + EOL - + " \"verb\" : \"verb\"," + EOL - + " \"remaining\" : 72," + EOL - + " \"available\" : 47," + EOL - + " \"value\" : 59," + EOL - + " \"next-available\" : 1489320000000" + EOL - + " }, {" + EOL - + " \"unit\" : \"unit\"," + EOL - + " \"verb\" : \"verb\"," + EOL - + " \"remaining\" : 72," + EOL - + " \"available\" : 47," + EOL - + " \"value\" : 59," + EOL - + " \"next-available\" : 1489320000000" + EOL - + " } ]" + EOL - + " }, {" + EOL - + " \"regex\" : \"regex\"," + EOL - + " \"uri\" : \"uri\"," + EOL - + " \"limit\" : [ {" + EOL - + " \"unit\" : \"unit\"," + EOL - + " \"verb\" : \"verb\"," + EOL - + " \"remaining\" : 72," + EOL - + " \"available\" : 47," + EOL - + " \"value\" : 59," + EOL - + " \"next-available\" : 1489320000000" + EOL - + " }, {" + EOL - + " \"unit\" : \"unit\"," + EOL - + " \"verb\" : \"verb\"," + EOL - + " \"remaining\" : 72," + EOL - + " \"available\" : 47," + EOL - + " \"value\" : 59," + EOL - + " \"next-available\" : 1489320000000" + EOL - + " } ]" + EOL - + " } ]," + EOL - + " \"absolute\" : {" + EOL - + " \"maxServerMeta\" : 30," + EOL - + " \"serverMetaUsed\" : 37," + EOL - + " \"maxPersonality\" : 54," + EOL - + " \"personalityUsed\" : 61," + EOL - + " \"maxImageMeta\" : 82," + EOL - + " \"imageMetaUsed\" : 89," + EOL - + " \"maxPersonalitySize\" : 97," + EOL - + " \"personalitySizeUsed\" : 4," + EOL - + " \"maxTotalCores\" : 32," + EOL - + " \"totalCoresUsed\" : 39," + EOL - + " \"maxTotalInstances\" : 60," + EOL - + " \"totalInstancesUsed\" : 67," + EOL - + " \"maxTotalRAMSize\" : 55," + EOL - + " \"totalRAMUsed\" : 19," + EOL - + " \"maxSecurityGroupRules\" : 44," + EOL - + " \"securityGroupRulesUsed\" : 51," + EOL - + " \"maxTotalKeypairs\" : 64," + EOL - + " \"totalKeyPairsUsed\" : 71," + EOL - + " \"maxTotalVolumes\" : 71," + EOL - + " \"totalVolumesUsed\" : 78," + EOL - + " \"maxSecurityGroups\" : 4," + EOL - + " \"totalSecurityGroupsUsed\" : 59," + EOL - + " \"maxTotalFloatingIps\" : 76," + EOL - + " \"totalFloatingIpsUsed\" : 83," + EOL - + " \"maxTotalVolumeGigabytes\" : 15," + EOL - + " \"totalVolumeGigabytesUsed\" : 22" + EOL - + " }" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"limits\" : {" + EOL + " \"rate\" : [ {" + EOL + + " \"regex\" : \"regex\"," + EOL + " \"uri\" : \"uri\"," + EOL + " \"limit\" : [ {" + EOL + + " \"unit\" : \"unit\"," + EOL + " \"verb\" : \"verb\"," + EOL + + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + " \"value\" : 59," + + EOL + " \"next-available\" : 1489320000000" + EOL + " }, {" + EOL + + " \"unit\" : \"unit\"," + EOL + " \"verb\" : \"verb\"," + EOL + + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + " \"value\" : 59," + + EOL + " \"next-available\" : 1489320000000" + EOL + " } ]" + EOL + " }, {" + EOL + + " \"regex\" : \"regex\"," + EOL + " \"uri\" : \"uri\"," + EOL + " \"limit\" : [ {" + EOL + + " \"unit\" : \"unit\"," + EOL + " \"verb\" : \"verb\"," + EOL + + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + " \"value\" : 59," + + EOL + " \"next-available\" : 1489320000000" + EOL + " }, {" + EOL + + " \"unit\" : \"unit\"," + EOL + " \"verb\" : \"verb\"," + EOL + + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + " \"value\" : 59," + + EOL + " \"next-available\" : 1489320000000" + EOL + " } ]" + EOL + " } ]," + EOL + + " \"absolute\" : {" + EOL + " \"maxServerMeta\" : 30," + EOL + " \"serverMetaUsed\" : 37," + + EOL + " \"maxPersonality\" : 54," + EOL + " \"personalityUsed\" : 61," + EOL + + " \"maxImageMeta\" : 82," + EOL + " \"imageMetaUsed\" : 89," + EOL + + " \"maxPersonalitySize\" : 97," + EOL + " \"personalitySizeUsed\" : 4," + EOL + + " \"maxTotalCores\" : 32," + EOL + " \"totalCoresUsed\" : 39," + EOL + + " \"maxTotalInstances\" : 60," + EOL + " \"totalInstancesUsed\" : 67," + EOL + + " \"maxTotalRAMSize\" : 55," + EOL + " \"totalRAMUsed\" : 19," + EOL + + " \"maxSecurityGroupRules\" : 44," + EOL + " \"securityGroupRulesUsed\" : 51," + EOL + + " \"maxTotalKeypairs\" : 64," + EOL + " \"totalKeyPairsUsed\" : 71," + EOL + + " \"maxTotalVolumes\" : 71," + EOL + " \"totalVolumesUsed\" : 78," + EOL + + " \"maxSecurityGroups\" : 4," + EOL + " \"totalSecurityGroupsUsed\" : 59," + EOL + + " \"maxTotalFloatingIps\" : 76," + EOL + " \"totalFloatingIpsUsed\" : 83," + EOL + + " \"maxTotalVolumeGigabytes\" : 15," + EOL + " \"totalVolumeGigabytesUsed\" : 22" + EOL + + " }" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -130,11 +85,11 @@ public class LimitsTest { public void testMethods() throws Exception { Limits limits = objectMapper.readValue(JSON_FULL, Limits.class); limits.toString(); - + List<RateLimit> rate = limits.getRate(); Assert.assertNotNull(rate); Assert.assertEquals(2, rate.size()); - + AbsoluteLimit absolute = limits.getAbsolute(); Assert.assertNotNull(absolute); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/LinkTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/LinkTest.java index c2fae01..965220d 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/LinkTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/LinkTest.java @@ -24,7 +24,6 @@ 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; @@ -34,17 +33,12 @@ public class LinkTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + 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 { @@ -60,13 +54,13 @@ public class LinkTest { public void testMethods() throws Exception { Link link = objectMapper.readValue(JSON_FULL, Link.class); link.toString(); - + String rel = link.getRel(); Assert.assertNotNull(rel); - + String href = link.getHref(); Assert.assertNotNull(href); - + String type = link.getType(); Assert.assertNotNull(type); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/LockTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/LockTest.java index 1c017de..37e9295 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/LockTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/LockTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Lock; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class LockTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"lock\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"lock\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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/nova-model/src/test/java/com/woorea/openstack/nova/model/MetadataTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/MetadataTest.java index b1c65f6..a0f8482 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/MetadataTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/MetadataTest.java @@ -21,9 +21,7 @@ package com.woorea.openstack.nova.model; import org.junit.Test; - import java.util.Collections; - import static org.junit.Assert.*; public class MetadataTest { @@ -39,4 +37,4 @@ public class MetadataTest { public void setMetadata() { metadata.setMetadata(Collections.<String, String>emptyMap()); } -}
\ No newline at end of file +} diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworkForCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworkForCreateTest.java index aae0c7f..ed2fa55 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworkForCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworkForCreateTest.java @@ -24,7 +24,6 @@ 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; @@ -34,16 +33,12 @@ public class NetworkForCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"uuid\" : \"id\"," + EOL - + " \"fixed_ip\" : \"fixedip\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"uuid\" : \"id\"," + EOL + " \"fixed_ip\" : \"fixedip\"" + 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 { @@ -59,11 +54,11 @@ public class NetworkForCreateTest { public void testMethods() throws Exception { NetworkForCreate networkforcreate = objectMapper.readValue(JSON_FULL, NetworkForCreate.class); networkforcreate.toString(); - + String fixedIp = networkforcreate.getFixedIp(); Assert.assertNotNull(fixedIp); networkforcreate.setFixedIp(fixedIp); - + String id = networkforcreate.getId(); Assert.assertNotNull(id); networkforcreate.setId(id); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworkTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworkTest.java index 73b871d..54e2f8b 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworkTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworkTest.java @@ -24,7 +24,6 @@ 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; @@ -34,46 +33,26 @@ public class NetworkTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"network\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"bridge\" : \"bridge\"," + EOL - + " \"deleted\" : false," + EOL - + " \"vlan\" : \"vlan\"," + EOL - + " \"broadcast\" : \"broadcast\"," + EOL - + " \"netmask\" : \"netmask\"," + EOL - + " \"injected\" : true," + EOL - + " \"host\" : \"host\"," + EOL - + " \"cidr\" : \"cidr\"," + EOL - + " \"gateway\" : \"gateway\"," + EOL - + " \"dns1\" : \"dns1\"," + EOL - + " \"dns2\" : \"dns2\"," + EOL - + " \"label\" : \"label\"," + EOL - + " \"priority\" : \"priority\"," + EOL - + " \"vpn_public_address\" : \"vpnpublicaddress\"," + EOL - + " \"vpn_private_address\" : \"vpnprivateaddress\"," + EOL - + " \"vpn_public_port\" : \"vpnpublicport\"," + EOL - + " \"dhcp_start\" : \"dhcpstart\"," + EOL - + " \"bridge_interface\" : \"bridgeinterface\"," + EOL - + " \"updated_at\" : \"updatedat\"," + EOL - + " \"multi_host\" : false," + EOL - + " \"created_at\" : \"createdat\"," + EOL - + " \"deleted_at\" : \"deletedat\"," + EOL - + " \"cidr_v6\" : \"cidrv6\"," + EOL - + " \"gateway_v6\" : \"gatewayv6\"," + EOL - + " \"netmask_v6\" : \"netmaskv6\"," + EOL - + " \"project_id\" : \"projectid\"," + EOL - + " \"rxtx_base\" : \"rxtxbase\"" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private static final String JSON_FULL = "{" + EOL + " \"network\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"bridge\" : \"bridge\"," + EOL + " \"deleted\" : false," + EOL + " \"vlan\" : \"vlan\"," + EOL + + " \"broadcast\" : \"broadcast\"," + EOL + " \"netmask\" : \"netmask\"," + EOL + + " \"injected\" : true," + EOL + " \"host\" : \"host\"," + EOL + " \"cidr\" : \"cidr\"," + EOL + + " \"gateway\" : \"gateway\"," + EOL + " \"dns1\" : \"dns1\"," + EOL + " \"dns2\" : \"dns2\"," + + EOL + " \"label\" : \"label\"," + EOL + " \"priority\" : \"priority\"," + EOL + + " \"vpn_public_address\" : \"vpnpublicaddress\"," + EOL + + " \"vpn_private_address\" : \"vpnprivateaddress\"," + EOL + + " \"vpn_public_port\" : \"vpnpublicport\"," + EOL + " \"dhcp_start\" : \"dhcpstart\"," + EOL + + " \"bridge_interface\" : \"bridgeinterface\"," + EOL + " \"updated_at\" : \"updatedat\"," + EOL + + " \"multi_host\" : false," + EOL + " \"created_at\" : \"createdat\"," + EOL + + " \"deleted_at\" : \"deletedat\"," + EOL + " \"cidr_v6\" : \"cidrv6\"," + EOL + + " \"gateway_v6\" : \"gatewayv6\"," + EOL + " \"netmask_v6\" : \"netmaskv6\"," + EOL + + " \"project_id\" : \"projectid\"," + EOL + " \"rxtx_base\" : \"rxtxbase\"" + EOL + " }" + EOL + + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -89,85 +68,85 @@ public class NetworkTest { public void testMethods() throws Exception { Network network = objectMapper.readValue(JSON_FULL, Network.class); network.toString(); - + String broadcast = network.getBroadcast(); Assert.assertNotNull(broadcast); - + String gatewayV6 = network.getGatewayV6(); Assert.assertNotNull(gatewayV6); - + String dns2 = network.getDns2(); Assert.assertNotNull(dns2); - + String bridgeInterface = network.getBridgeInterface(); Assert.assertNotNull(bridgeInterface); - + String dns1 = network.getDns1(); Assert.assertNotNull(dns1); - + String cidrV6 = network.getCidrV6(); Assert.assertNotNull(cidrV6); - + String deletedAt = network.getDeletedAt(); Assert.assertNotNull(deletedAt); - + String vlan = network.getVlan(); Assert.assertNotNull(vlan); - + String netmask = network.getNetmask(); Assert.assertNotNull(netmask); - + String netmaskV6 = network.getNetmaskV6(); Assert.assertNotNull(netmaskV6); - + Boolean injected = network.getInjected(); Assert.assertNotNull(injected); - + String host = network.getHost(); Assert.assertNotNull(host); - + String cidr = network.getCidr(); Assert.assertNotNull(cidr); - + String id = network.getId(); Assert.assertNotNull(id); - + String projectId = network.getProjectId(); Assert.assertNotNull(projectId); - + String vpnPublicAddress = network.getVpnPublicAddress(); Assert.assertNotNull(vpnPublicAddress); - + String label = network.getLabel(); Assert.assertNotNull(label); - + String priority = network.getPriority(); Assert.assertNotNull(priority); - + String vpnPublicPort = network.getVpnPublicPort(); Assert.assertNotNull(vpnPublicPort); - + String createdAt = network.getCreatedAt(); Assert.assertNotNull(createdAt); - + Boolean deleted = network.getDeleted(); Assert.assertNotNull(deleted); - + String rxtxBase = network.getRxtxBase(); Assert.assertNotNull(rxtxBase); - + String dhcpStart = network.getDhcpStart(); Assert.assertNotNull(dhcpStart); - + Boolean multiHost = network.getMultiHost(); Assert.assertNotNull(multiHost); - + String bridge = network.getBridge(); Assert.assertNotNull(bridge); - + String gateway = network.getGateway(); Assert.assertNotNull(gateway); - + String updatedAt = network.getUpdatedAt(); Assert.assertNotNull(updatedAt); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworksTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworksTest.java index 3e4272c..bbebe26 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworksTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworksTest.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,73 +34,38 @@ public class NetworksTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"networks\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"bridge\" : \"bridge\"," + EOL - + " \"deleted\" : false," + EOL - + " \"vlan\" : \"vlan\"," + EOL - + " \"broadcast\" : \"broadcast\"," + EOL - + " \"netmask\" : \"netmask\"," + EOL - + " \"injected\" : true," + EOL - + " \"host\" : \"host\"," + EOL - + " \"cidr\" : \"cidr\"," + EOL - + " \"gateway\" : \"gateway\"," + EOL - + " \"dns1\" : \"dns1\"," + EOL - + " \"dns2\" : \"dns2\"," + EOL - + " \"label\" : \"label\"," + EOL - + " \"priority\" : \"priority\"," + EOL - + " \"vpn_public_address\" : \"vpnpublicaddress\"," + EOL - + " \"vpn_private_address\" : \"vpnprivateaddress\"," + EOL - + " \"vpn_public_port\" : \"vpnpublicport\"," + EOL - + " \"dhcp_start\" : \"dhcpstart\"," + EOL - + " \"bridge_interface\" : \"bridgeinterface\"," + EOL - + " \"updated_at\" : \"updatedat\"," + EOL - + " \"multi_host\" : false," + EOL - + " \"created_at\" : \"createdat\"," + EOL - + " \"deleted_at\" : \"deletedat\"," + EOL - + " \"cidr_v6\" : \"cidrv6\"," + EOL - + " \"gateway_v6\" : \"gatewayv6\"," + EOL - + " \"netmask_v6\" : \"netmaskv6\"," + EOL - + " \"project_id\" : \"projectid\"," + EOL - + " \"rxtx_base\" : \"rxtxbase\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"bridge\" : \"bridge\"," + EOL - + " \"deleted\" : false," + EOL - + " \"vlan\" : \"vlan\"," + EOL - + " \"broadcast\" : \"broadcast\"," + EOL - + " \"netmask\" : \"netmask\"," + EOL - + " \"injected\" : true," + EOL - + " \"host\" : \"host\"," + EOL - + " \"cidr\" : \"cidr\"," + EOL - + " \"gateway\" : \"gateway\"," + EOL - + " \"dns1\" : \"dns1\"," + EOL - + " \"dns2\" : \"dns2\"," + EOL - + " \"label\" : \"label\"," + EOL - + " \"priority\" : \"priority\"," + EOL - + " \"vpn_public_address\" : \"vpnpublicaddress\"," + EOL - + " \"vpn_private_address\" : \"vpnprivateaddress\"," + EOL - + " \"vpn_public_port\" : \"vpnpublicport\"," + EOL - + " \"dhcp_start\" : \"dhcpstart\"," + EOL - + " \"bridge_interface\" : \"bridgeinterface\"," + EOL - + " \"updated_at\" : \"updatedat\"," + EOL - + " \"multi_host\" : false," + EOL - + " \"created_at\" : \"createdat\"," + EOL - + " \"deleted_at\" : \"deletedat\"," + EOL - + " \"cidr_v6\" : \"cidrv6\"," + EOL - + " \"gateway_v6\" : \"gatewayv6\"," + EOL - + " \"netmask_v6\" : \"netmaskv6\"," + EOL - + " \"project_id\" : \"projectid\"," + EOL - + " \"rxtx_base\" : \"rxtxbase\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"networks\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"bridge\" : \"bridge\"," + EOL + " \"deleted\" : false," + EOL + " \"vlan\" : \"vlan\"," + EOL + + " \"broadcast\" : \"broadcast\"," + EOL + " \"netmask\" : \"netmask\"," + EOL + + " \"injected\" : true," + EOL + " \"host\" : \"host\"," + EOL + " \"cidr\" : \"cidr\"," + EOL + + " \"gateway\" : \"gateway\"," + EOL + " \"dns1\" : \"dns1\"," + EOL + " \"dns2\" : \"dns2\"," + + EOL + " \"label\" : \"label\"," + EOL + " \"priority\" : \"priority\"," + EOL + + " \"vpn_public_address\" : \"vpnpublicaddress\"," + EOL + + " \"vpn_private_address\" : \"vpnprivateaddress\"," + EOL + + " \"vpn_public_port\" : \"vpnpublicport\"," + EOL + " \"dhcp_start\" : \"dhcpstart\"," + EOL + + " \"bridge_interface\" : \"bridgeinterface\"," + EOL + " \"updated_at\" : \"updatedat\"," + EOL + + " \"multi_host\" : false," + EOL + " \"created_at\" : \"createdat\"," + EOL + + " \"deleted_at\" : \"deletedat\"," + EOL + " \"cidr_v6\" : \"cidrv6\"," + EOL + + " \"gateway_v6\" : \"gatewayv6\"," + EOL + " \"netmask_v6\" : \"netmaskv6\"," + EOL + + " \"project_id\" : \"projectid\"," + EOL + " \"rxtx_base\" : \"rxtxbase\"" + EOL + " }, {" + EOL + + " \"id\" : \"id\"," + EOL + " \"bridge\" : \"bridge\"," + EOL + " \"deleted\" : false," + EOL + + " \"vlan\" : \"vlan\"," + EOL + " \"broadcast\" : \"broadcast\"," + EOL + + " \"netmask\" : \"netmask\"," + EOL + " \"injected\" : true," + EOL + " \"host\" : \"host\"," + + EOL + " \"cidr\" : \"cidr\"," + EOL + " \"gateway\" : \"gateway\"," + EOL + + " \"dns1\" : \"dns1\"," + EOL + " \"dns2\" : \"dns2\"," + EOL + " \"label\" : \"label\"," + EOL + + " \"priority\" : \"priority\"," + EOL + " \"vpn_public_address\" : \"vpnpublicaddress\"," + EOL + + " \"vpn_private_address\" : \"vpnprivateaddress\"," + EOL + + " \"vpn_public_port\" : \"vpnpublicport\"," + EOL + " \"dhcp_start\" : \"dhcpstart\"," + EOL + + " \"bridge_interface\" : \"bridgeinterface\"," + EOL + " \"updated_at\" : \"updatedat\"," + EOL + + " \"multi_host\" : false," + EOL + " \"created_at\" : \"createdat\"," + EOL + + " \"deleted_at\" : \"deletedat\"," + EOL + " \"cidr_v6\" : \"cidrv6\"," + EOL + + " \"gateway_v6\" : \"gatewayv6\"," + EOL + " \"netmask_v6\" : \"netmaskv6\"," + EOL + + " \"project_id\" : \"projectid\"," + EOL + " \"rxtx_base\" : \"rxtxbase\"" + 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 { @@ -118,13 +81,14 @@ public class NetworksTest { public void testMethods() throws Exception { Networks networks = objectMapper.readValue(JSON_FULL, Networks.class); networks.toString(); - + List<Network> list = networks.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Network x : networks) { + for (@SuppressWarnings("unused") + Network x : networks) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/PauseTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/PauseTest.java index c14cc40..5c54d38 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/PauseTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/PauseTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Pause; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class PauseTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"pause\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"pause\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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/nova-model/src/test/java/com/woorea/openstack/nova/model/PersonalityFileTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/PersonalityFileTest.java index 6e113cb..142bfa8 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/PersonalityFileTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/PersonalityFileTest.java @@ -24,7 +24,6 @@ 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; @@ -34,16 +33,12 @@ public class PersonalityFileTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"path\" : \"path\"," + EOL - + " \"contents\" : \"contents\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"path\" : \"path\"," + EOL + " \"contents\" : \"contents\"" + 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 { @@ -59,11 +54,11 @@ public class PersonalityFileTest { public void testMethods() throws Exception { PersonalityFile personalityfile = objectMapper.readValue(JSON_FULL, PersonalityFile.class); personalityfile.toString(); - + String path = personalityfile.getPath(); Assert.assertNotNull(path); personalityfile.setPath(path); - + String contents = personalityfile.getContents(); Assert.assertNotNull(contents); personalityfile.setContents(contents); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/QuotaSetTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/QuotaSetTest.java index c26a3a1..200b1f5 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/QuotaSetTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/QuotaSetTest.java @@ -24,7 +24,6 @@ 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; @@ -34,32 +33,18 @@ public class QuotaSetTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"quota_set\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"gigabytes\" : 77," + EOL - + " \"ram\" : 38," + EOL - + " \"instances\" : 86," + EOL - + " \"volumes\" : 97," + EOL - + " \"cores\" : 58," + EOL - + " \"metadata_items\" : 97," + EOL - + " \"injected_file_content_bytes\" : 86," + EOL - + " \"injected_files\" : 87," + EOL - + " \"floating_ips\" : 2," + EOL - + " \"security_groups\" : 78," + EOL - + " \"security_group_rules\" : 18," + EOL - + " \"injected_file_path_bytes\" : 52," + EOL - + " \"key_pairs\" : 90" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private static final String JSON_FULL = "{" + EOL + " \"quota_set\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"gigabytes\" : 77," + EOL + " \"ram\" : 38," + EOL + " \"instances\" : 86," + EOL + + " \"volumes\" : 97," + EOL + " \"cores\" : 58," + EOL + " \"metadata_items\" : 97," + EOL + + " \"injected_file_content_bytes\" : 86," + EOL + " \"injected_files\" : 87," + EOL + + " \"floating_ips\" : 2," + EOL + " \"security_groups\" : 78," + EOL + + " \"security_group_rules\" : 18," + EOL + " \"injected_file_path_bytes\" : 52," + EOL + + " \"key_pairs\" : 90" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -75,59 +60,59 @@ public class QuotaSetTest { public void testMethods() throws Exception { QuotaSet quotaset = objectMapper.readValue(JSON_FULL, QuotaSet.class); quotaset.toString(); - + Integer injectedFileContentBytes = quotaset.getInjectedFileContentBytes(); Assert.assertNotNull(injectedFileContentBytes); quotaset.setInjectedFileContentBytes(injectedFileContentBytes); - + Integer injectedFiles = quotaset.getInjectedFiles(); Assert.assertNotNull(injectedFiles); quotaset.setInjectedFiles(injectedFiles); - + Integer instances = quotaset.getInstances(); Assert.assertNotNull(instances); quotaset.setInstances(instances); - + Integer gigabytes = quotaset.getGigabytes(); Assert.assertNotNull(gigabytes); quotaset.setGigabytes(gigabytes); - + Integer metadataItems = quotaset.getMetadataItems(); Assert.assertNotNull(metadataItems); quotaset.setMetadataItems(metadataItems); - + Integer volumes = quotaset.getVolumes(); Assert.assertNotNull(volumes); quotaset.setVolumes(volumes); - + Integer injectedFilePathBytes = quotaset.getInjectedFilePathBytes(); Assert.assertNotNull(injectedFilePathBytes); quotaset.setInjectedFilePathBytes(injectedFilePathBytes); - + Integer securityGroupRules = quotaset.getSecurityGroupRules(); Assert.assertNotNull(securityGroupRules); quotaset.setSecurityGroupRules(securityGroupRules); - + Integer floatingIps = quotaset.getFloatingIps(); Assert.assertNotNull(floatingIps); quotaset.setFloatingIps(floatingIps); - + Integer cores = quotaset.getCores(); Assert.assertNotNull(cores); quotaset.setCores(cores); - + String id = quotaset.getId(); Assert.assertNotNull(id); quotaset.setId(id); - + Integer securityGroups = quotaset.getSecurityGroups(); Assert.assertNotNull(securityGroups); quotaset.setSecurityGroups(securityGroups); - + Integer ram = quotaset.getRam(); Assert.assertNotNull(ram); quotaset.setRam(ram); - + Integer keyPairs = quotaset.getKeyPairs(); Assert.assertNotNull(keyPairs); quotaset.setKeyPairs(keyPairs); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/RateLimitTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/RateLimitTest.java index ef2e98a..b742174 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/RateLimitTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/RateLimitTest.java @@ -26,9 +26,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Limits.RateLimit; import com.woorea.openstack.nova.model.Limits.RateLimit.LimitEntry; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -38,31 +36,16 @@ public class RateLimitTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"regex\" : \"regex\"," + EOL - + " \"uri\" : \"uri\"," + EOL - + " \"limit\" : [ {" + EOL - + " \"unit\" : \"unit\"," + EOL - + " \"verb\" : \"verb\"," + EOL - + " \"remaining\" : 72," + EOL - + " \"available\" : 47," + EOL - + " \"value\" : 59," + EOL - + " \"next-available\" : 1489320000000" + EOL - + " }, {" + EOL - + " \"unit\" : \"unit\"," + EOL - + " \"verb\" : \"verb\"," + EOL - + " \"remaining\" : 72," + EOL - + " \"available\" : 47," + EOL - + " \"value\" : 59," + EOL - + " \"next-available\" : 1489320000000" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"regex\" : \"regex\"," + EOL + " \"uri\" : \"uri\"," + EOL + + " \"limit\" : [ {" + EOL + " \"unit\" : \"unit\"," + EOL + " \"verb\" : \"verb\"," + EOL + + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + " \"value\" : 59," + EOL + + " \"next-available\" : 1489320000000" + EOL + " }, {" + EOL + " \"unit\" : \"unit\"," + EOL + + " \"verb\" : \"verb\"," + EOL + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + + " \"value\" : 59," + EOL + " \"next-available\" : 1489320000000" + 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 { @@ -78,14 +61,14 @@ public class RateLimitTest { public void testMethods() throws Exception { RateLimit ratelimit = objectMapper.readValue(JSON_FULL, RateLimit.class); ratelimit.toString(); - + String regex = ratelimit.getRegex(); Assert.assertNotNull(regex); - + List<LimitEntry> limit = ratelimit.getLimit(); Assert.assertNotNull(limit); Assert.assertEquals(2, limit.size()); - + String uri = ratelimit.getUri(); Assert.assertNotNull(uri); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/RebootTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/RebootTest.java index 494b088..b4e105b 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/RebootTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/RebootTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Reboot; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,19 +34,13 @@ public class RebootTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"reboot\" : {" + EOL - + " \"type\" : \"type\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"reboot\" : {" + EOL + " \"type\" : \"type\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -63,7 +56,7 @@ public class RebootTest { public void testMethods() throws Exception { Reboot reboot = objectMapper.readValue(JSON_FULL, Reboot.class); reboot.toString(); - + String type = reboot.getType(); Assert.assertNotNull(type); reboot.setType(type); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/RebuildTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/RebuildTest.java index b3fb845..501f68d 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/RebuildTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/RebuildTest.java @@ -25,10 +25,8 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Rebuild; - import java.util.List; import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -38,35 +36,19 @@ public class RebuildTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"rebuild\" : {" + EOL - + " \"imageRef\" : \"imageref\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"adminPass\" : \"adminpass\"," + EOL - + " \"accessIPv4\" : \"accessipv4\"," + EOL - + " \"accessIPv6\" : \"accessipv6\"," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"personality\" : [ {" + EOL - + " \"path\" : \"path\"," + EOL - + " \"contents\" : \"contents\"" + EOL - + " }, {" + EOL - + " \"path\" : \"path\"," + EOL - + " \"contents\" : \"contents\"" + EOL - + " } ]," + EOL - + " \"OS-DCF:diskConfig\" : \"diskconfig\"" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private static final String JSON_FULL = "{" + EOL + " \"rebuild\" : {" + EOL + " \"imageRef\" : \"imageref\"," + + EOL + " \"name\" : \"name\"," + EOL + " \"adminPass\" : \"adminpass\"," + EOL + + " \"accessIPv4\" : \"accessipv4\"," + EOL + " \"accessIPv6\" : \"accessipv6\"," + EOL + + " \"metadata\" : {" + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + + " \"metadata-k2\" : \"metadata-v2\"" + EOL + " }," + EOL + " \"personality\" : [ {" + EOL + + " \"path\" : \"path\"," + EOL + " \"contents\" : \"contents\"" + EOL + " }, {" + EOL + + " \"path\" : \"path\"," + EOL + " \"contents\" : \"contents\"" + EOL + " } ]," + EOL + + " \"OS-DCF:diskConfig\" : \"diskconfig\"" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -82,37 +64,37 @@ public class RebuildTest { public void testMethods() throws Exception { Rebuild rebuild = objectMapper.readValue(JSON_FULL, Rebuild.class); rebuild.toString(); - - Map<String,String> metadata = rebuild.getMetadata(); + + Map<String, String> metadata = rebuild.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); rebuild.setMetadata(metadata); - + List<PersonalityFile> personality = rebuild.getPersonality(); Assert.assertNotNull(personality); Assert.assertEquals(2, personality.size()); rebuild.setPersonality(personality); - + String name = rebuild.getName(); Assert.assertNotNull(name); rebuild.setName(name); - + String adminPass = rebuild.getAdminPass(); Assert.assertNotNull(adminPass); rebuild.setAdminPass(adminPass); - + String imageRef = rebuild.getImageRef(); Assert.assertNotNull(imageRef); rebuild.setImageRef(imageRef); - + String accessIPv6 = rebuild.getAccessIPv6(); Assert.assertNotNull(accessIPv6); rebuild.setAccessIPv6(accessIPv6); - + String diskConfig = rebuild.getDiskConfig(); Assert.assertNotNull(diskConfig); rebuild.setDiskConfig(diskConfig); - + String accessIPv4 = rebuild.getAccessIPv4(); Assert.assertNotNull(accessIPv4); rebuild.setAccessIPv4(accessIPv4); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/RescueResponseTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/RescueResponseTest.java index 3cbee04..4486034 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/RescueResponseTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/RescueResponseTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.RescueResponse; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,15 +34,11 @@ public class RescueResponseTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"adminPass\" : \"adminpass\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"adminPass\" : \"adminpass\"" + 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 { @@ -59,7 +54,7 @@ public class RescueResponseTest { public void testMethods() throws Exception { RescueResponse rescueresponse = objectMapper.readValue(JSON_FULL, RescueResponse.class); rescueresponse.toString(); - + String adminPass = rescueresponse.getAdminPass(); Assert.assertNotNull(adminPass); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/RescueTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/RescueTest.java index 6c68207..6a7afb6 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/RescueTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/RescueTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Rescue; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,19 +34,13 @@ public class RescueTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"rescue\" : {" + EOL - + " \"adminPass\" : \"adminpass\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"rescue\" : {" + EOL + " \"adminPass\" : \"adminpass\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -63,7 +56,7 @@ public class RescueTest { public void testMethods() throws Exception { Rescue rescue = objectMapper.readValue(JSON_FULL, Rescue.class); rescue.toString(); - + String adminPass = rescue.getAdminPass(); Assert.assertNotNull(adminPass); rescue.setAdminPass(adminPass); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ResizeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ResizeTest.java index 520b9fb..7dfcc42 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ResizeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ResizeTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Resize; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,20 +34,13 @@ public class ResizeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"resize\" : {" + EOL - + " \"flavorRef\" : \"flavorref\"," + EOL - + " \"OS-DCF:diskConfig\" : \"diskconfig\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"resize\" : {" + EOL + " \"flavorRef\" : \"flavorref\"," + + EOL + " \"OS-DCF:diskConfig\" : \"diskconfig\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -64,11 +56,11 @@ public class ResizeTest { public void testMethods() throws Exception { Resize resize = objectMapper.readValue(JSON_FULL, Resize.class); resize.toString(); - + String flavorRef = resize.getFlavorRef(); Assert.assertNotNull(flavorRef); resize.setFlavorRef(flavorRef); - + String diskConfig = resize.getDiskConfig(); Assert.assertNotNull(diskConfig); resize.setDiskConfig(diskConfig); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ResourceTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ResourceTest.java index e48cb62..a4f75ec 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ResourceTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ResourceTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Host.ResourceWrapper.Resource; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,19 +34,12 @@ public class ResourceTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"project\" : \"project\"," + EOL - + " \"host\" : \"host\"," + EOL - + " \"cpu\" : 46," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"disk_gb\" : 46" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"project\" : \"project\"," + EOL + " \"host\" : \"host\"," + + EOL + " \"cpu\" : 46," + EOL + " \"memory_mb\" : 90," + EOL + " \"disk_gb\" : 46" + 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 { @@ -63,19 +55,19 @@ public class ResourceTest { public void testMethods() throws Exception { Resource resource = objectMapper.readValue(JSON_FULL, Resource.class); resource.toString(); - + Integer memoryMb = resource.getMemoryMb(); Assert.assertNotNull(memoryMb); - + String host = resource.getHost(); Assert.assertNotNull(host); - + String project = resource.getProject(); Assert.assertNotNull(project); - + Integer cpu = resource.getCpu(); Assert.assertNotNull(cpu); - + Integer diskGb = resource.getDiskGb(); Assert.assertNotNull(diskGb); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ResourceWrapperTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ResourceWrapperTest.java index 3616551..c1be9db 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ResourceWrapperTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ResourceWrapperTest.java @@ -26,7 +26,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Host.ResourceWrapper; import com.woorea.openstack.nova.model.Host.ResourceWrapper.Resource; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,21 +35,13 @@ public class ResourceWrapperTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"resource\" : {" + EOL - + " \"project\" : \"project\"," + EOL - + " \"host\" : \"host\"," + EOL - + " \"cpu\" : 46," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"disk_gb\" : 46" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"resource\" : {" + EOL + " \"project\" : \"project\"," + + EOL + " \"host\" : \"host\"," + EOL + " \"cpu\" : 46," + EOL + " \"memory_mb\" : 90," + EOL + + " \"disk_gb\" : 46" + 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 { @@ -66,7 +57,7 @@ public class ResourceWrapperTest { public void testMethods() throws Exception { ResourceWrapper resourcewrapper = objectMapper.readValue(JSON_FULL, ResourceWrapper.class); resourcewrapper.toString(); - + Resource resource = resourcewrapper.getResource(); Assert.assertNotNull(resource); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/RestoreTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/RestoreTest.java index c601a3f..fa059c3 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/RestoreTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/RestoreTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Restore; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class RestoreTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"restore\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"restore\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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/nova-model/src/test/java/com/woorea/openstack/nova/model/ResumeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ResumeTest.java index db84968..33cc515 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ResumeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ResumeTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Resume; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class ResumeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"resume\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"resume\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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/nova-model/src/test/java/com/woorea/openstack/nova/model/RevertResizeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/RevertResizeTest.java index 9aca582..5b4dfb4 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/RevertResizeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/RevertResizeTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.RevertResize; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class RevertResizeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"revertResize\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"revertResize\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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/nova-model/src/test/java/com/woorea/openstack/nova/model/RuleTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/RuleTest.java index 65ecb6c..489662c 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/RuleTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/RuleTest.java @@ -27,7 +27,6 @@ import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.SecurityGroup.Rule; import com.woorea.openstack.nova.model.SecurityGroup.Rule.Group; import com.woorea.openstack.nova.model.SecurityGroup.Rule.IpRange; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,31 +36,17 @@ public class RuleTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"security_group_rule\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private static final String JSON_FULL = "{" + EOL + " \"security_group_rule\" : {" + EOL + " \"id\" : \"id\"," + + EOL + " \"name\" : \"name\"," + EOL + " \"group\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL + + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + " \"ip_range\" : {" + + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -77,28 +62,28 @@ public class RuleTest { public void testMethods() throws Exception { Rule rule = objectMapper.readValue(JSON_FULL, Rule.class); rule.toString(); - + String parentGroupId = rule.getParentGroupId(); Assert.assertNotNull(parentGroupId); - + String ipProtocol = rule.getIpProtocol(); Assert.assertNotNull(ipProtocol); - + IpRange ipRange = rule.getIpRange(); Assert.assertNotNull(ipRange); - + Integer fromPort = rule.getFromPort(); Assert.assertNotNull(fromPort); - + String name = rule.getName(); Assert.assertNotNull(name); - + String id = rule.getId(); Assert.assertNotNull(id); - + Integer toPort = rule.getToPort(); Assert.assertNotNull(toPort); - + Group group = rule.getGroup(); Assert.assertNotNull(group); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupForCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupForCreateTest.java index 0c995d1..7cd3048 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupForCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupForCreateTest.java @@ -24,7 +24,6 @@ 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; @@ -34,20 +33,13 @@ public class SecurityGroupForCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"security_group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"security_group\" : {" + EOL + " \"name\" : \"name\"," + + EOL + " \"description\" : \"description\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -63,11 +55,11 @@ public class SecurityGroupForCreateTest { public void testMethods() throws Exception { SecurityGroupForCreate securitygroupforcreate = objectMapper.readValue(JSON_FULL, SecurityGroupForCreate.class); securitygroupforcreate.toString(); - + String name = securitygroupforcreate.getName(); Assert.assertNotNull(name); securitygroupforcreate.setName(name); - + String description = securitygroupforcreate.getDescription(); Assert.assertNotNull(description); securitygroupforcreate.setDescription(description); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreateTest.java index fc5cf69..c87e52f 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreateTest.java @@ -24,7 +24,6 @@ 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; @@ -34,30 +33,22 @@ public class SecurityGroupRuleForCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"security_group_rule\" : {" + EOL - + " \"cidr\" : \"cidr\"," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"group_id\" : \"groupid\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"security_group_rule\" : {" + EOL + + " \"cidr\" : \"cidr\"," + EOL + " \"parent_group_id\" : \"parentgroupid\"," + EOL + + " \"ip_protocol\" : \"ipprotocol\"," + EOL + " \"from_port\" : 7," + EOL + " \"to_port\" : 98," + + EOL + " \"group_id\" : \"groupid\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { System.out.println("CLASS: " + SecurityGroupRuleForCreate.class.getName()); System.out.println("TEST JSON: " + JSON_FULL); - SecurityGroupRuleForCreate securitygroupruleforcreate = objectMapper.readValue(JSON_FULL, SecurityGroupRuleForCreate.class); + SecurityGroupRuleForCreate securitygroupruleforcreate = + objectMapper.readValue(JSON_FULL, SecurityGroupRuleForCreate.class); String json = objectMapper.writeValueAsString(securitygroupruleforcreate); System.out.println("RE-SERIALIZED OBJECT: " + json); JSONAssert.assertEquals(JSON_FULL, json, JSONCompareMode.LENIENT); @@ -65,29 +56,30 @@ public class SecurityGroupRuleForCreateTest { @Test public void testMethods() throws Exception { - SecurityGroupRuleForCreate securitygroupruleforcreate = objectMapper.readValue(JSON_FULL, SecurityGroupRuleForCreate.class); + SecurityGroupRuleForCreate securitygroupruleforcreate = + objectMapper.readValue(JSON_FULL, SecurityGroupRuleForCreate.class); securitygroupruleforcreate.toString(); - + String parentGroupId = securitygroupruleforcreate.getParentGroupId(); Assert.assertNotNull(parentGroupId); securitygroupruleforcreate.setParentGroupId(parentGroupId); - + String ipProtocol = securitygroupruleforcreate.getIpProtocol(); Assert.assertNotNull(ipProtocol); securitygroupruleforcreate.setIpProtocol(ipProtocol); - + String groupId = securitygroupruleforcreate.getGroupId(); Assert.assertNotNull(groupId); securitygroupruleforcreate.setGroupId(groupId); - + Integer fromPort = securitygroupruleforcreate.getFromPort(); Assert.assertNotNull(fromPort); securitygroupruleforcreate.setFromPort(fromPort); - + String cidr = securitygroupruleforcreate.getCidr(); Assert.assertNotNull(cidr); securitygroupruleforcreate.setCidr(cidr); - + Integer toPort = securitygroupruleforcreate.getToPort(); Assert.assertNotNull(toPort); securitygroupruleforcreate.setToPort(toPort); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupTest.java index b68e503..5abf0df 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerForCreate.SecurityGroup; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,15 +34,11 @@ public class SecurityGroupTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"name\" : \"name\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"name\" : \"name\"" + 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 { @@ -59,7 +54,7 @@ public class SecurityGroupTest { public void testMethods() throws Exception { SecurityGroup securitygroup = objectMapper.readValue(JSON_FULL, SecurityGroup.class); securitygroup.toString(); - + String name = securitygroup.getName(); Assert.assertNotNull(name); securitygroup.setName(name); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupsTest.java index 2ee2faa..3ff73f4 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupsTest.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,101 +34,42 @@ public class SecurityGroupsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"security_groups\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"rules\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " } ]," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"rules\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " } ]," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"security_groups\" : [ {" + EOL + " \"id\" : \"id\"," + + EOL + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"rules\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"group\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL + + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + " }, {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + " \"group\" : {" + EOL + + " \"name\" : \"name\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL + + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + " } ]," + EOL + + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL + + " \"tenant_id\" : \"tenantid\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + " \"rules\" : [ {" + + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + " \"group\" : {" + EOL + + " \"name\" : \"name\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL + + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + " }, {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + " \"group\" : {" + EOL + + " \"name\" : \"name\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL + + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + " } ]," + EOL + + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL + + " \"tenant_id\" : \"tenantid\"" + 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 { @@ -146,13 +85,14 @@ public class SecurityGroupsTest { public void testMethods() throws Exception { SecurityGroups securitygroups = objectMapper.readValue(JSON_FULL, SecurityGroups.class); securitygroups.toString(); - + List<SecurityGroup> list = securitygroups.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") SecurityGroup x : securitygroups) { + for (@SuppressWarnings("unused") + SecurityGroup x : securitygroups) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerActionTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerActionTest.java index 2f638ee..28a56cf 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerActionTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerActionTest.java @@ -1,78 +1,76 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Huawei Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed 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.
- * ============LICENSE_END=========================================================
- */
-
-package com.woorea.openstack.nova.model;
-
-import com.woorea.openstack.nova.model.ServerAction.ChangePassword;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-
-public class ServerActionTest {
- private ChangePassword testObj = new ServerAction.ChangePassword();
-
- @Test
- public void testSetAdminPass(){
-
- try {
-
- testObj.setAdminPass("sai");
- assertEquals( testObj.getAdminPass(), "sai");
-
- } catch (Exception e) {
-
- fail("Exception in test obj");
- }
-
- }
-
- @Test
- public void testChangePasswdConstructor(){
-
- try {
- ServerAction.ChangePassword test = new ServerAction.ChangePassword("sai");
- assertEquals( test.getAdminPass(), "sai");
-
- } catch (Exception e) {
-
- fail("Exception in test obj");
- }
-
- }
-
- private ServerAction.Reboot testObj1 = new ServerAction.Reboot();
-
- @Test
- public void testSetType(){
- testObj1.setType("sai");
- assertEquals("sai", testObj1.getType());
- }
-
- private ServerAction.Rebuild testRebuild = new ServerAction.Rebuild();
-
- @Test
- public void testRebuild()
- {
- testRebuild.setAccessIPv4("1.1.1.1");
- assertEquals(testRebuild.getAccessIPv4(),"1.1.1.1");
- }
-}
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed 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. + * ============LICENSE_END========================================================= + */ + +package com.woorea.openstack.nova.model; + +import com.woorea.openstack.nova.model.ServerAction.ChangePassword; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + + +public class ServerActionTest { + private ChangePassword testObj = new ServerAction.ChangePassword(); + + @Test + public void testSetAdminPass() { + + try { + + testObj.setAdminPass("sai"); + assertEquals(testObj.getAdminPass(), "sai"); + + } catch (Exception e) { + + fail("Exception in test obj"); + } + + } + + @Test + public void testChangePasswdConstructor() { + + try { + ServerAction.ChangePassword test = new ServerAction.ChangePassword("sai"); + assertEquals(test.getAdminPass(), "sai"); + + } catch (Exception e) { + + fail("Exception in test obj"); + } + + } + + private ServerAction.Reboot testObj1 = new ServerAction.Reboot(); + + @Test + public void testSetType() { + testObj1.setType("sai"); + assertEquals("sai", testObj1.getType()); + } + + private ServerAction.Rebuild testRebuild = new ServerAction.Rebuild(); + + @Test + public void testRebuild() { + testRebuild.setAccessIPv4("1.1.1.1"); + assertEquals(testRebuild.getAccessIPv4(), "1.1.1.1"); + } +} diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerForCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerForCreateTest.java index 7b5d165..8d865bb 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerForCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerForCreateTest.java @@ -25,10 +25,8 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerForCreate.SecurityGroup; - import java.util.List; import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -38,54 +36,26 @@ public class ServerForCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"server\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"adminPass\" : \"adminpass\"," + EOL - + " \"imageRef\" : \"imageref\"," + EOL - + " \"flavorRef\" : \"flavorref\"," + EOL - + " \"accessIPv4\" : \"accessipv4\"," + EOL - + " \"accessIPv6\" : \"accessipv6\"," + EOL - + " \"min\" : 42," + EOL - + " \"max\" : 44," + EOL - + " \"diskConfig\" : \"diskconfig\"," + EOL - + " \"personality\" : [ {" + EOL - + " \"path\" : \"path\"," + EOL - + " \"contents\" : \"contents\"" + EOL - + " }, {" + EOL - + " \"path\" : \"path\"," + EOL - + " \"contents\" : \"contents\"" + EOL - + " } ]," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"networks\" : [ {" + EOL - + " \"uuid\" : \"id\"," + EOL - + " \"fixed_ip\" : \"fixedip\"" + EOL - + " }, {" + EOL - + " \"uuid\" : \"id\"," + EOL - + " \"fixed_ip\" : \"fixedip\"" + EOL - + " } ]," + EOL - + " \"key_name\" : \"keyname\"," + EOL - + " \"security_groups\" : [ {" + EOL - + " \"name\" : \"name\"" + EOL - + " }, {" + EOL - + " \"name\" : \"name\"" + EOL - + " } ]," + EOL - + " \"user_data\" : \"userdata\"," + EOL - + " \"availability_zone\" : \"availabilityzone\"," + EOL - + " \"config_drive\" : true" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private static final String JSON_FULL = "{" + EOL + " \"server\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"adminPass\" : \"adminpass\"," + EOL + " \"imageRef\" : \"imageref\"," + EOL + + " \"flavorRef\" : \"flavorref\"," + EOL + " \"accessIPv4\" : \"accessipv4\"," + EOL + + " \"accessIPv6\" : \"accessipv6\"," + EOL + " \"min\" : 42," + EOL + " \"max\" : 44," + EOL + + " \"diskConfig\" : \"diskconfig\"," + EOL + " \"personality\" : [ {" + EOL + + " \"path\" : \"path\"," + EOL + " \"contents\" : \"contents\"" + EOL + " }, {" + EOL + + " \"path\" : \"path\"," + EOL + " \"contents\" : \"contents\"" + EOL + " } ]," + EOL + + " \"metadata\" : {" + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + + " \"metadata-k2\" : \"metadata-v2\"" + EOL + " }," + EOL + " \"networks\" : [ {" + EOL + + " \"uuid\" : \"id\"," + EOL + " \"fixed_ip\" : \"fixedip\"" + EOL + " }, {" + EOL + + " \"uuid\" : \"id\"," + EOL + " \"fixed_ip\" : \"fixedip\"" + EOL + " } ]," + EOL + + " \"key_name\" : \"keyname\"," + EOL + " \"security_groups\" : [ {" + EOL + + " \"name\" : \"name\"" + EOL + " }, {" + EOL + " \"name\" : \"name\"" + EOL + " } ]," + + EOL + " \"user_data\" : \"userdata\"," + EOL + " \"availability_zone\" : \"availabilityzone\"," + + EOL + " \"config_drive\" : true" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -101,70 +71,70 @@ public class ServerForCreateTest { public void testMethods() throws Exception { ServerForCreate serverforcreate = objectMapper.readValue(JSON_FULL, ServerForCreate.class); serverforcreate.toString(); - - Map<String,String> metadata = serverforcreate.getMetadata(); + + Map<String, String> metadata = serverforcreate.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); serverforcreate.setMetadata(metadata); - + Integer max = serverforcreate.getMax(); Assert.assertNotNull(max); serverforcreate.setMax(max); - + List<NetworkForCreate> networks = serverforcreate.getNetworks(); Assert.assertNotNull(networks); Assert.assertEquals(2, networks.size()); serverforcreate.setNetworks(networks); - + String userData = serverforcreate.getUserData(); Assert.assertNotNull(userData); serverforcreate.setUserData(userData); - + Integer min = serverforcreate.getMin(); Assert.assertNotNull(min); serverforcreate.setMin(min); - + List<PersonalityFile> personality = serverforcreate.getPersonality(); Assert.assertNotNull(personality); Assert.assertEquals(2, personality.size()); serverforcreate.setPersonality(personality); - + String name = serverforcreate.getName(); Assert.assertNotNull(name); serverforcreate.setName(name); - + String flavorRef = serverforcreate.getFlavorRef(); Assert.assertNotNull(flavorRef); serverforcreate.setFlavorRef(flavorRef); - + String keyName = serverforcreate.getKeyName(); Assert.assertNotNull(keyName); serverforcreate.setKeyName(keyName); - + String adminPass = serverforcreate.getAdminPass(); Assert.assertNotNull(adminPass); serverforcreate.setAdminPass(adminPass); - + String imageRef = serverforcreate.getImageRef(); Assert.assertNotNull(imageRef); serverforcreate.setImageRef(imageRef); - + String accessIPv6 = serverforcreate.getAccessIPv6(); Assert.assertNotNull(accessIPv6); serverforcreate.setAccessIPv6(accessIPv6); - + String diskConfig = serverforcreate.getDiskConfig(); Assert.assertNotNull(diskConfig); serverforcreate.setDiskConfig(diskConfig); - + List<SecurityGroup> securityGroups = serverforcreate.getSecurityGroups(); Assert.assertNotNull(securityGroups); Assert.assertEquals(2, securityGroups.size()); - + String availabilityZone = serverforcreate.getAvailabilityZone(); Assert.assertNotNull(availabilityZone); serverforcreate.setAvailabilityZone(availabilityZone); - + String accessIPv4 = serverforcreate.getAccessIPv4(); Assert.assertNotNull(accessIPv4); serverforcreate.setAccessIPv4(accessIPv4); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerTest.java index 27ba42d..290f4a5 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerTest.java @@ -26,10 +26,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Server.Addresses; import com.woorea.openstack.nova.model.Server.Fault; - import java.util.List; import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -39,236 +37,104 @@ public class ServerTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"server\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"addresses\" : {" + EOL - + " \"addresses\" : {" + EOL - + " \"addresses-k1\" : [ {" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"addresses-k2\" : [ {" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + " } ]" + EOL - + " }" + EOL - + " }," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"image\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"progress\" : 3," + EOL - + " \"minRam\" : 62," + EOL - + " \"minDisk\" : 69," + EOL - + " \"created\" : 1485172800000," + EOL - + " \"updated\" : 1486468800000," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"server\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " }," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL - + " }," + EOL - + " \"flavor\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"vcpus\" : 79," + EOL - + " \"ram\" : 38," + EOL - + " \"disk\" : 45," + EOL - + " \"swap\" : \"swap\"," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"public\" : false," + EOL - + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL - + " \"rxtx_factor\" : 11.0," + EOL - + " \"OS-FLV-DISABLED:disabled\" : true," + EOL - + " \"rxtx_quota\" : 42," + EOL - + " \"rxtx_cap\" : 96," + EOL - + " \"os-flavor-access:is_public\" : false" + EOL - + " }," + EOL - + " \"accessIPv4\" : \"accessipv4\"," + EOL - + " \"accessIPv6\" : \"accessipv6\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"progress\" : 3," + EOL - + " \"fault\" : {" + EOL - + " \"code\" : 29," + EOL - + " \"message\" : \"message\"," + EOL - + " \"details\" : \"details\"," + EOL - + " \"created\" : 1485172800000" + EOL - + " }," + EOL - + " \"hostId\" : \"hostid\"," + EOL - + " \"updated\" : \"updated\"," + EOL - + " \"created\" : \"created\"," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"uuid\" : \"uuid\"," + EOL - + " \"adminPass\" : \"adminpass\"," + EOL - + " \"config_drive\" : \"configdrive\"," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"user_id\" : \"userid\"," + EOL - + " \"key_name\" : \"keyname\"," + EOL - + " \"security_groups\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"rules\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " } ]," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"rules\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " } ]," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " } ]," + EOL - + " \"OS-EXT-STS:task_state\" : \"taskstate\"," + EOL - + " \"OS-EXT-STS:power_state\" : \"powerstate\"," + EOL - + " \"OS-EXT-STS:vm_state\" : \"vmstate\"," + EOL - + " \"OS-EXT-SRV-ATTR:host\" : \"host\"," + EOL - + " \"OS-EXT-SRV-ATTR:instance_name\" : \"instancename\"," + EOL - + " \"OS-EXT-SRV-ATTR:hypervisor_hostname\" : \"hypervisorhostname\"," + EOL - + " \"OS-DCF:diskConfig\" : \"diskconfig\"," + EOL - + " \"OS-EXT-AZ:availability_zone\" : \"availabilityzone\"," + EOL - + " \"OS-SRV-USG:launched_at\" : \"launchedat\"," + EOL - + " \"OS-SRV-USG:terminated_at\" : \"terminatedat\"," + EOL - + " \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private static final String JSON_FULL = "{" + EOL + " \"server\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"addresses\" : {" + EOL + " \"addresses\" : {" + EOL + + " \"addresses-k1\" : [ {" + EOL + " \"version\" : \"version\"," + EOL + + " \"addr\" : \"addr\"," + EOL + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + + " \"OS-EXT-IPS:type\" : \"type\"" + EOL + " }, {" + EOL + + " \"version\" : \"version\"," + EOL + " \"addr\" : \"addr\"," + EOL + + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + " \"OS-EXT-IPS:type\" : \"type\"" + + EOL + " } ]," + EOL + " \"addresses-k2\" : [ {" + EOL + + " \"version\" : \"version\"," + EOL + " \"addr\" : \"addr\"," + EOL + + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + " \"OS-EXT-IPS:type\" : \"type\"" + + EOL + " }, {" + EOL + " \"version\" : \"version\"," + EOL + + " \"addr\" : \"addr\"," + EOL + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + + " \"OS-EXT-IPS:type\" : \"type\"" + EOL + " } ]" + EOL + " }" + EOL + " }," + EOL + + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL + + " \"image\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"status\" : \"status\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"progress\" : 3," + EOL + " \"minRam\" : 62," + EOL + + " \"minDisk\" : 69," + EOL + " \"created\" : 1485172800000," + EOL + + " \"updated\" : 1486468800000," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"server\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + + " }," + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + + EOL + " } ]," + EOL + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL + " }," + EOL + + " \"flavor\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"vcpus\" : 79," + EOL + " \"ram\" : 38," + EOL + " \"disk\" : 45," + EOL + + " \"swap\" : \"swap\"," + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + + EOL + " } ]," + EOL + " \"public\" : false," + EOL + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + + EOL + " \"rxtx_factor\" : 11.0," + EOL + " \"OS-FLV-DISABLED:disabled\" : true," + EOL + + " \"rxtx_quota\" : 42," + EOL + " \"rxtx_cap\" : 96," + EOL + + " \"os-flavor-access:is_public\" : false" + EOL + " }," + EOL + + " \"accessIPv4\" : \"accessipv4\"," + EOL + " \"accessIPv6\" : \"accessipv6\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"progress\" : 3," + EOL + " \"fault\" : {" + EOL + + " \"code\" : 29," + EOL + " \"message\" : \"message\"," + EOL + + " \"details\" : \"details\"," + EOL + " \"created\" : 1485172800000" + EOL + " }," + EOL + + " \"hostId\" : \"hostid\"," + EOL + " \"updated\" : \"updated\"," + EOL + + " \"created\" : \"created\"," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"uuid\" : \"uuid\"," + EOL + " \"adminPass\" : \"adminpass\"," + EOL + + " \"config_drive\" : \"configdrive\"," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"user_id\" : \"userid\"," + EOL + " \"key_name\" : \"keyname\"," + EOL + + " \"security_groups\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + + EOL + " \"description\" : \"description\"," + EOL + " \"rules\" : [ {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + " \"group\" : {" + EOL + + " \"name\" : \"name\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + + EOL + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + + " }, {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"group\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL + + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + + " } ]," + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + + EOL + " } ]," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }, {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"description\" : \"description\"," + EOL + " \"rules\" : [ {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + " \"group\" : {" + EOL + + " \"name\" : \"name\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + + EOL + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + + " }, {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"group\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL + + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + + " } ]," + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + + EOL + " } ]," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " } ]," + EOL + + " \"OS-EXT-STS:task_state\" : \"taskstate\"," + EOL + + " \"OS-EXT-STS:power_state\" : \"powerstate\"," + EOL + " \"OS-EXT-STS:vm_state\" : \"vmstate\"," + + EOL + " \"OS-EXT-SRV-ATTR:host\" : \"host\"," + EOL + + " \"OS-EXT-SRV-ATTR:instance_name\" : \"instancename\"," + EOL + + " \"OS-EXT-SRV-ATTR:hypervisor_hostname\" : \"hypervisorhostname\"," + EOL + + " \"OS-DCF:diskConfig\" : \"diskconfig\"," + EOL + + " \"OS-EXT-AZ:availability_zone\" : \"availabilityzone\"," + EOL + + " \"OS-SRV-USG:launched_at\" : \"launchedat\"," + EOL + + " \"OS-SRV-USG:terminated_at\" : \"terminatedat\"," + EOL + + " \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]" + + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -284,109 +150,109 @@ public class ServerTest { public void testMethods() throws Exception { Server server = objectMapper.readValue(JSON_FULL, Server.class); server.toString(); - + Addresses addresses = server.getAddresses(); Assert.assertNotNull(addresses); - - Map<String,String> metadata = server.getMetadata(); + + Map<String, String> metadata = server.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); - + String hostId = server.getHostId(); Assert.assertNotNull(hostId); - + String uuid = server.getUuid(); Assert.assertNotNull(uuid); - + String userId = server.getUserId(); Assert.assertNotNull(userId); - + String taskState = server.getTaskState(); Assert.assertNotNull(taskState); - + String powerState = server.getPowerState(); Assert.assertNotNull(powerState); - + String vmState = server.getVmState(); Assert.assertNotNull(vmState); - + String tenantId = server.getTenantId(); Assert.assertNotNull(tenantId); - + String configDrive = server.getConfigDrive(); Assert.assertNotNull(configDrive); - + String host = server.getHost(); Assert.assertNotNull(host); - + String keyName = server.getKeyName(); Assert.assertNotNull(keyName); - + List<Link> links = server.getLinks(); Assert.assertNotNull(links); Assert.assertEquals(2, links.size()); - + String id = server.getId(); Assert.assertNotNull(id); - + String launchedAt = server.getLaunchedAt(); Assert.assertNotNull(launchedAt); - + Image image = server.getImage(); Assert.assertNotNull(image); server.setImage(image); - + String terminatedAt = server.getTerminatedAt(); Assert.assertNotNull(terminatedAt); - + String created = server.getCreated(); Assert.assertNotNull(created); - + Fault fault = server.getFault(); Assert.assertNotNull(fault); - + String hypervisorHostname = server.getHypervisorHostname(); Assert.assertNotNull(hypervisorHostname); - + Flavor flavor = server.getFlavor(); Assert.assertNotNull(flavor); server.setFlavor(flavor); - + String instanceName = server.getInstanceName(); Assert.assertNotNull(instanceName); - + List<String> osExtendedVolumesAttached = server.getOsExtendedVolumesAttached(); Assert.assertNotNull(osExtendedVolumesAttached); Assert.assertEquals(2, osExtendedVolumesAttached.size()); - + String name = server.getName(); Assert.assertNotNull(name); - + Integer progress = server.getProgress(); Assert.assertNotNull(progress); - + String adminPass = server.getAdminPass(); Assert.assertNotNull(adminPass); - + String accessIPv6 = server.getAccessIPv6(); Assert.assertNotNull(accessIPv6); - + String diskConfig = server.getDiskConfig(); Assert.assertNotNull(diskConfig); - + List<SecurityGroup> securityGroups = server.getSecurityGroups(); Assert.assertNotNull(securityGroups); Assert.assertEquals(2, securityGroups.size()); - + String updated = server.getUpdated(); Assert.assertNotNull(updated); - + String availabilityZone = server.getAvailabilityZone(); Assert.assertNotNull(availabilityZone); - + String accessIPv4 = server.getAccessIPv4(); Assert.assertNotNull(accessIPv4); - + String status = server.getStatus(); Assert.assertNotNull(status); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerUsageTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerUsageTest.java index cfec1f7..6cd37cd 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerUsageTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerUsageTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.SimpleTenantUsage.ServerUsage; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,26 +34,16 @@ public class ServerUsageTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"uptime\" : 78," + EOL - + " \"state\" : \"state\"," + EOL - + " \"hours\" : 64.0," + EOL - + " \"vcpus\" : 79," + EOL - + " \"flavor\" : \"flavor\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"instance_id\" : \"instanceid\"," + EOL - + " \"started_at\" : \"startedat\"," + EOL - + " \"ended_at\" : \"endedat\"," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"local_gb\" : 11" + 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 static final String JSON_FULL = + "{" + EOL + " \"uptime\" : 78," + EOL + " \"state\" : \"state\"," + EOL + " \"hours\" : 64.0," + EOL + + " \"vcpus\" : 79," + EOL + " \"flavor\" : \"flavor\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"instance_id\" : \"instanceid\"," + EOL + " \"started_at\" : \"startedat\"," + EOL + + " \"ended_at\" : \"endedat\"," + EOL + " \"memory_mb\" : 90," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + " \"local_gb\" : 11" + 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); @Test public void testSerialization() throws Exception { @@ -70,40 +59,40 @@ public class ServerUsageTest { public void testMethods() throws Exception { ServerUsage serverusage = objectMapper.readValue(JSON_FULL, ServerUsage.class); serverusage.toString(); - + String flavor = serverusage.getFlavor(); Assert.assertNotNull(flavor); - + Integer memoryMb = serverusage.getMemoryMb(); Assert.assertNotNull(memoryMb); - + Double hours = serverusage.getHours(); Assert.assertNotNull(hours); - + String instanceId = serverusage.getInstanceId(); Assert.assertNotNull(instanceId); - + Integer localDiskSize = serverusage.getLocalDiskSize(); Assert.assertNotNull(localDiskSize); - + String endedAt = serverusage.getEndedAt(); Assert.assertNotNull(endedAt); - + String name = serverusage.getName(); Assert.assertNotNull(name); - + String tenantId = serverusage.getTenantId(); Assert.assertNotNull(tenantId); - + String startedAt = serverusage.getStartedAt(); Assert.assertNotNull(startedAt); - + String state = serverusage.getState(); Assert.assertNotNull(state); - + Integer vcpus = serverusage.getVcpus(); Assert.assertNotNull(vcpus); - + Integer uptime = serverusage.getUptime(); Assert.assertNotNull(uptime); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServersTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServersTest.java index ecd5394..bbf80ff 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServersTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServersTest.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; @@ -261,7 +259,9 @@ public class ServersTest { sb.append(" \"OS-EXT-AZ:availability_zone\" : \"availabilityzone\"," + EOL); sb.append(" \"OS-SRV-USG:launched_at\" : \"launchedat\"," + EOL); sb.append(" \"OS-SRV-USG:terminated_at\" : \"terminatedat\"," + EOL); - sb.append(" \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]" + EOL); + sb.append( + " \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]" + + EOL); sb.append(" }, {" + EOL); sb.append(" \"id\" : \"id\"," + EOL); sb.append(" \"name\" : \"name\"," + EOL); @@ -480,17 +480,17 @@ public class ServersTest { sb.append(" \"OS-EXT-AZ:availability_zone\" : \"availabilityzone\"," + EOL); sb.append(" \"OS-SRV-USG:launched_at\" : \"launchedat\"," + EOL); sb.append(" \"OS-SRV-USG:terminated_at\" : \"terminatedat\"," + EOL); - sb.append(" \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]" + EOL); + sb.append( + " \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]" + + EOL); sb.append(" } ]" + EOL); sb.append("}"); JSON_FULL = sb.toString(); } - 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 { @@ -506,13 +506,14 @@ public class ServersTest { public void testMethods() throws Exception { Servers servers = objectMapper.readValue(JSON_FULL, Servers.class); servers.toString(); - + List<Server> list = servers.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Server x : servers) { + for (@SuppressWarnings("unused") + Server x : servers) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SimpleTenantUsageTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SimpleTenantUsageTest.java index da2208f..ce8d0cb 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SimpleTenantUsageTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SimpleTenantUsageTest.java @@ -25,10 +25,8 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.SimpleTenantUsage.ServerUsage; - import java.math.BigDecimal; import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -38,52 +36,27 @@ public class SimpleTenantUsageTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"tenant_usage\" : {" + EOL - + " \"start\" : \"start\"," + EOL - + " \"stop\" : \"stop\"," + EOL - + " \"total_memory_mb_usage\" : 14," + EOL - + " \"total_vcpus_usage\" : 3," + EOL - + " \"total_local_gb_usage\" : 66," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"total_hours\" : \"totalhours\"," + EOL - + " \"server_usages\" : [ {" + EOL - + " \"uptime\" : 78," + EOL - + " \"state\" : \"state\"," + EOL - + " \"hours\" : 64.0," + EOL - + " \"vcpus\" : 79," + EOL - + " \"flavor\" : \"flavor\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"instance_id\" : \"instanceid\"," + EOL - + " \"started_at\" : \"startedat\"," + EOL - + " \"ended_at\" : \"endedat\"," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"local_gb\" : 11" + EOL - + " }, {" + EOL - + " \"uptime\" : 78," + EOL - + " \"state\" : \"state\"," + EOL - + " \"hours\" : 64.0," + EOL - + " \"vcpus\" : 79," + EOL - + " \"flavor\" : \"flavor\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"instance_id\" : \"instanceid\"," + EOL - + " \"started_at\" : \"startedat\"," + EOL - + " \"ended_at\" : \"endedat\"," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"local_gb\" : 11" + EOL - + " } ]" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private static final String JSON_FULL = "{" + EOL + " \"tenant_usage\" : {" + EOL + " \"start\" : \"start\"," + + EOL + " \"stop\" : \"stop\"," + EOL + " \"total_memory_mb_usage\" : 14," + EOL + + " \"total_vcpus_usage\" : 3," + EOL + " \"total_local_gb_usage\" : 66," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + " \"total_hours\" : \"totalhours\"," + EOL + + " \"server_usages\" : [ {" + EOL + " \"uptime\" : 78," + EOL + " \"state\" : \"state\"," + + EOL + " \"hours\" : 64.0," + EOL + " \"vcpus\" : 79," + EOL + " \"flavor\" : \"flavor\"," + + EOL + " \"name\" : \"name\"," + EOL + " \"instance_id\" : \"instanceid\"," + EOL + + " \"started_at\" : \"startedat\"," + EOL + " \"ended_at\" : \"endedat\"," + EOL + + " \"memory_mb\" : 90," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"local_gb\" : 11" + EOL + " }, {" + EOL + " \"uptime\" : 78," + EOL + + " \"state\" : \"state\"," + EOL + " \"hours\" : 64.0," + EOL + " \"vcpus\" : 79," + EOL + + " \"flavor\" : \"flavor\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"instance_id\" : \"instanceid\"," + EOL + " \"started_at\" : \"startedat\"," + EOL + + " \"ended_at\" : \"endedat\"," + EOL + " \"memory_mb\" : 90," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + " \"local_gb\" : 11" + EOL + " } ]" + EOL + " }" + + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -99,36 +72,36 @@ public class SimpleTenantUsageTest { public void testMethods() throws Exception { SimpleTenantUsage simpletenantusage = objectMapper.readValue(JSON_FULL, SimpleTenantUsage.class); simpletenantusage.toString(); - + BigDecimal totalMemoryMbUsage = simpletenantusage.getTotalMemoryMbUsage(); Assert.assertNotNull(totalMemoryMbUsage); simpletenantusage.setTotalMemoryMbUsage(totalMemoryMbUsage); - + String stop = simpletenantusage.getStop(); Assert.assertNotNull(stop); simpletenantusage.setStop(stop); - + BigDecimal totalVcpusUsage = simpletenantusage.getTotalVcpusUsage(); Assert.assertNotNull(totalVcpusUsage); simpletenantusage.setTotalVcpusUsage(totalVcpusUsage); - + String tenantId = simpletenantusage.getTenantId(); Assert.assertNotNull(tenantId); simpletenantusage.setTenantId(tenantId); - + String start = simpletenantusage.getStart(); Assert.assertNotNull(start); simpletenantusage.setStart(start); - + List<ServerUsage> serverUsages = simpletenantusage.getServerUsages(); Assert.assertNotNull(serverUsages); Assert.assertEquals(2, serverUsages.size()); simpletenantusage.setServerUsages(serverUsages); - + BigDecimal totalLocalGbUsage = simpletenantusage.getTotalLocalGbUsage(); Assert.assertNotNull(totalLocalGbUsage); simpletenantusage.setTotalLocalGbUsage(totalLocalGbUsage); - + String totalHours = simpletenantusage.getTotalHours(); Assert.assertNotNull(totalHours); simpletenantusage.setTotalHours(totalHours); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SimpleTenantUsagesTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SimpleTenantUsagesTest.java index ee4598c..49bb979 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SimpleTenantUsagesTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SimpleTenantUsagesTest.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,85 +34,40 @@ public class SimpleTenantUsagesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"tenant_usages\" : [ {" + EOL - + " \"start\" : \"start\"," + EOL - + " \"stop\" : \"stop\"," + EOL - + " \"total_memory_mb_usage\" : 14," + EOL - + " \"total_vcpus_usage\" : 3," + EOL - + " \"total_local_gb_usage\" : 66," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"total_hours\" : \"totalhours\"," + EOL - + " \"server_usages\" : [ {" + EOL - + " \"uptime\" : 78," + EOL - + " \"state\" : \"state\"," + EOL - + " \"hours\" : 64.0," + EOL - + " \"vcpus\" : 79," + EOL - + " \"flavor\" : \"flavor\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"instance_id\" : \"instanceid\"," + EOL - + " \"started_at\" : \"startedat\"," + EOL - + " \"ended_at\" : \"endedat\"," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"local_gb\" : 11" + EOL - + " }, {" + EOL - + " \"uptime\" : 78," + EOL - + " \"state\" : \"state\"," + EOL - + " \"hours\" : 64.0," + EOL - + " \"vcpus\" : 79," + EOL - + " \"flavor\" : \"flavor\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"instance_id\" : \"instanceid\"," + EOL - + " \"started_at\" : \"startedat\"," + EOL - + " \"ended_at\" : \"endedat\"," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"local_gb\" : 11" + EOL - + " } ]" + EOL - + " }, {" + EOL - + " \"start\" : \"start\"," + EOL - + " \"stop\" : \"stop\"," + EOL - + " \"total_memory_mb_usage\" : 14," + EOL - + " \"total_vcpus_usage\" : 3," + EOL - + " \"total_local_gb_usage\" : 66," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"total_hours\" : \"totalhours\"," + EOL - + " \"server_usages\" : [ {" + EOL - + " \"uptime\" : 78," + EOL - + " \"state\" : \"state\"," + EOL - + " \"hours\" : 64.0," + EOL - + " \"vcpus\" : 79," + EOL - + " \"flavor\" : \"flavor\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"instance_id\" : \"instanceid\"," + EOL - + " \"started_at\" : \"startedat\"," + EOL - + " \"ended_at\" : \"endedat\"," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"local_gb\" : 11" + EOL - + " }, {" + EOL - + " \"uptime\" : 78," + EOL - + " \"state\" : \"state\"," + EOL - + " \"hours\" : 64.0," + EOL - + " \"vcpus\" : 79," + EOL - + " \"flavor\" : \"flavor\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"instance_id\" : \"instanceid\"," + EOL - + " \"started_at\" : \"startedat\"," + EOL - + " \"ended_at\" : \"endedat\"," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"local_gb\" : 11" + EOL - + " } ]" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"tenant_usages\" : [ {" + EOL + " \"start\" : \"start\"," + + EOL + " \"stop\" : \"stop\"," + EOL + " \"total_memory_mb_usage\" : 14," + EOL + + " \"total_vcpus_usage\" : 3," + EOL + " \"total_local_gb_usage\" : 66," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + " \"total_hours\" : \"totalhours\"," + EOL + + " \"server_usages\" : [ {" + EOL + " \"uptime\" : 78," + EOL + " \"state\" : \"state\"," + + EOL + " \"hours\" : 64.0," + EOL + " \"vcpus\" : 79," + EOL + " \"flavor\" : \"flavor\"," + + EOL + " \"name\" : \"name\"," + EOL + " \"instance_id\" : \"instanceid\"," + EOL + + " \"started_at\" : \"startedat\"," + EOL + " \"ended_at\" : \"endedat\"," + EOL + + " \"memory_mb\" : 90," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"local_gb\" : 11" + EOL + " }, {" + EOL + " \"uptime\" : 78," + EOL + + " \"state\" : \"state\"," + EOL + " \"hours\" : 64.0," + EOL + " \"vcpus\" : 79," + EOL + + " \"flavor\" : \"flavor\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"instance_id\" : \"instanceid\"," + EOL + " \"started_at\" : \"startedat\"," + EOL + + " \"ended_at\" : \"endedat\"," + EOL + " \"memory_mb\" : 90," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + " \"local_gb\" : 11" + EOL + " } ]" + EOL + " }, {" + + EOL + " \"start\" : \"start\"," + EOL + " \"stop\" : \"stop\"," + EOL + + " \"total_memory_mb_usage\" : 14," + EOL + " \"total_vcpus_usage\" : 3," + EOL + + " \"total_local_gb_usage\" : 66," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"total_hours\" : \"totalhours\"," + EOL + " \"server_usages\" : [ {" + EOL + + " \"uptime\" : 78," + EOL + " \"state\" : \"state\"," + EOL + " \"hours\" : 64.0," + EOL + + " \"vcpus\" : 79," + EOL + " \"flavor\" : \"flavor\"," + EOL + " \"name\" : \"name\"," + + EOL + " \"instance_id\" : \"instanceid\"," + EOL + " \"started_at\" : \"startedat\"," + EOL + + " \"ended_at\" : \"endedat\"," + EOL + " \"memory_mb\" : 90," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + " \"local_gb\" : 11" + EOL + " }, {" + EOL + + " \"uptime\" : 78," + EOL + " \"state\" : \"state\"," + EOL + " \"hours\" : 64.0," + EOL + + " \"vcpus\" : 79," + EOL + " \"flavor\" : \"flavor\"," + EOL + " \"name\" : \"name\"," + + EOL + " \"instance_id\" : \"instanceid\"," + EOL + " \"started_at\" : \"startedat\"," + EOL + + " \"ended_at\" : \"endedat\"," + EOL + " \"memory_mb\" : 90," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + " \"local_gb\" : 11" + EOL + " } ]" + 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 { @@ -130,13 +83,14 @@ public class SimpleTenantUsagesTest { public void testMethods() throws Exception { SimpleTenantUsages simpletenantusages = objectMapper.readValue(JSON_FULL, SimpleTenantUsages.class); simpletenantusages.toString(); - + List<SimpleTenantUsage> list = simpletenantusages.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") SimpleTenantUsage x : simpletenantusages) { + for (@SuppressWarnings("unused") + SimpleTenantUsage x : simpletenantusages) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotForCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotForCreateTest.java index e894375..635eabd 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotForCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotForCreateTest.java @@ -24,7 +24,6 @@ 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; @@ -34,22 +33,14 @@ public class SnapshotForCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"snapshot\" : {" + EOL - + " \"force\" : false," + EOL - + " \"volume_id\" : \"volumeid\"," + EOL - + " \"display_name\" : \"name\"," + EOL - + " \"display_description\" : \"description\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"snapshot\" : {" + EOL + " \"force\" : false," + EOL + + " \"volume_id\" : \"volumeid\"," + EOL + " \"display_name\" : \"name\"," + EOL + + " \"display_description\" : \"description\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -65,19 +56,19 @@ public class SnapshotForCreateTest { public void testMethods() throws Exception { SnapshotForCreate snapshotforcreate = objectMapper.readValue(JSON_FULL, SnapshotForCreate.class); snapshotforcreate.toString(); - + String name = snapshotforcreate.getName(); Assert.assertNotNull(name); snapshotforcreate.setName(name); - + String volumeId = snapshotforcreate.getVolumeId(); Assert.assertNotNull(volumeId); snapshotforcreate.setVolumeId(volumeId); - + String description = snapshotforcreate.getDescription(); Assert.assertNotNull(description); snapshotforcreate.setDescription(description); - + Boolean force = snapshotforcreate.getForce(); Assert.assertNotNull(force); snapshotforcreate.setForce(force); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotTest.java index 23e152c..d177c2e 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotTest.java @@ -24,7 +24,6 @@ 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; @@ -34,25 +33,15 @@ public class SnapshotTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"snapshot\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"volumeId\" : \"volumeid\"," + EOL - + " \"size\" : 61," + EOL - + " \"createdAt\" : \"createdat\"," + EOL - + " \"displayName\" : \"name\"," + EOL - + " \"displayDescription\" : \"description\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"snapshot\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"volumeId\" : \"volumeid\"," + EOL + " \"size\" : 61," + + EOL + " \"createdAt\" : \"createdat\"," + EOL + " \"displayName\" : \"name\"," + EOL + + " \"displayDescription\" : \"description\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -68,25 +57,25 @@ public class SnapshotTest { public void testMethods() throws Exception { Snapshot snapshot = objectMapper.readValue(JSON_FULL, Snapshot.class); snapshot.toString(); - + String createdAt = snapshot.getCreatedAt(); Assert.assertNotNull(createdAt); - + Integer size = snapshot.getSize(); Assert.assertNotNull(size); - + String name = snapshot.getName(); Assert.assertNotNull(name); - + String volumeId = snapshot.getVolumeId(); Assert.assertNotNull(volumeId); - + String description = snapshot.getDescription(); Assert.assertNotNull(description); - + String id = snapshot.getId(); Assert.assertNotNull(id); - + String status = snapshot.getStatus(); Assert.assertNotNull(status); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotsTest.java index c4e56b5..1b248b2 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotsTest.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,31 +34,17 @@ public class SnapshotsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"snapshots\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"volumeId\" : \"volumeid\"," + EOL - + " \"size\" : 61," + EOL - + " \"createdAt\" : \"createdat\"," + EOL - + " \"displayName\" : \"name\"," + EOL - + " \"displayDescription\" : \"description\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"volumeId\" : \"volumeid\"," + EOL - + " \"size\" : 61," + EOL - + " \"createdAt\" : \"createdat\"," + EOL - + " \"displayName\" : \"name\"," + EOL - + " \"displayDescription\" : \"description\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"snapshots\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"volumeId\" : \"volumeid\"," + EOL + " \"size\" : 61," + + EOL + " \"createdAt\" : \"createdat\"," + EOL + " \"displayName\" : \"name\"," + EOL + + " \"displayDescription\" : \"description\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"volumeId\" : \"volumeid\"," + EOL + " \"size\" : 61," + + EOL + " \"createdAt\" : \"createdat\"," + 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 { @@ -76,13 +60,14 @@ public class SnapshotsTest { public void testMethods() throws Exception { Snapshots snapshots = objectMapper.readValue(JSON_FULL, Snapshots.class); snapshots.toString(); - + List<Snapshot> list = snapshots.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Snapshot x : snapshots) { + for (@SuppressWarnings("unused") + Snapshot x : snapshots) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/StartTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/StartTest.java index 3b433a4..e7f2199 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/StartTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/StartTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Start; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class StartTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"os-start\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"os-start\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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/nova-model/src/test/java/com/woorea/openstack/nova/model/StopTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/StopTest.java index b9989b8..6af28ea 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/StopTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/StopTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Stop; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class StopTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"os-stop\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"os-stop\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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/nova-model/src/test/java/com/woorea/openstack/nova/model/SuspendTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SuspendTest.java index b885ffe..57f43f8 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SuspendTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SuspendTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Suspend; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class SuspendTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"suspend\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"suspend\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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/nova-model/src/test/java/com/woorea/openstack/nova/model/UnlockTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/UnlockTest.java index e6f8a05..9f050a0 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/UnlockTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/UnlockTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Unlock; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class UnlockTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"unlock\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"unlock\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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/nova-model/src/test/java/com/woorea/openstack/nova/model/UnpauseTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/UnpauseTest.java index 924eb2a..d348db8 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/UnpauseTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/UnpauseTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Unpause; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class UnpauseTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"unpause\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"unpause\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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/nova-model/src/test/java/com/woorea/openstack/nova/model/UnrescueTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/UnrescueTest.java index 2945ee5..d634ce3 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/UnrescueTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/UnrescueTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Unrescue; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class UnrescueTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"unrescue\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"unrescue\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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/nova-model/src/test/java/com/woorea/openstack/nova/model/VncConsoleTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VncConsoleTest.java index 36cf35a..6835fa7 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VncConsoleTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VncConsoleTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.VncConsole; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,20 +34,13 @@ public class VncConsoleTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"console\" : {" + EOL - + " \"type\" : \"type\"," + EOL - + " \"url\" : \"url\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"console\" : {" + EOL + " \"type\" : \"type\"," + EOL + + " \"url\" : \"url\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -64,10 +56,10 @@ public class VncConsoleTest { public void testMethods() throws Exception { VncConsole vncconsole = objectMapper.readValue(JSON_FULL, VncConsole.class); vncconsole.toString(); - + String type = vncconsole.getType(); Assert.assertNotNull(type); - + String url = vncconsole.getUrl(); Assert.assertNotNull(url); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeAttachmentTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeAttachmentTest.java index b051d52..37dfd64 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeAttachmentTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeAttachmentTest.java @@ -24,7 +24,6 @@ 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; @@ -34,22 +33,14 @@ public class VolumeAttachmentTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"volumeAttachment\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"volumeId\" : \"volumeid\"," + EOL - + " \"serverId\" : \"serverid\"," + EOL - + " \"device\" : \"device\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"volumeAttachment\" : {" + EOL + " \"id\" : \"id\"," + + EOL + " \"volumeId\" : \"volumeid\"," + EOL + " \"serverId\" : \"serverid\"," + EOL + + " \"device\" : \"device\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -65,19 +56,19 @@ public class VolumeAttachmentTest { public void testMethods() throws Exception { VolumeAttachment volumeattachment = objectMapper.readValue(JSON_FULL, VolumeAttachment.class); volumeattachment.toString(); - + String volumeId = volumeattachment.getVolumeId(); Assert.assertNotNull(volumeId); volumeattachment.setVolumeId(volumeId); - + String id = volumeattachment.getId(); Assert.assertNotNull(id); volumeattachment.setId(id); - + String device = volumeattachment.getDevice(); Assert.assertNotNull(device); volumeattachment.setDevice(device); - + String serverId = volumeattachment.getServerId(); Assert.assertNotNull(serverId); volumeattachment.setServerId(serverId); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeAttachmentsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeAttachmentsTest.java index f409aa2..441d498 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeAttachmentsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeAttachmentsTest.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,25 +34,15 @@ public class VolumeAttachmentsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"volumeAttachments\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"volumeId\" : \"volumeid\"," + EOL - + " \"serverId\" : \"serverid\"," + EOL - + " \"device\" : \"device\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"volumeId\" : \"volumeid\"," + EOL - + " \"serverId\" : \"serverid\"," + EOL - + " \"device\" : \"device\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"volumeAttachments\" : [ {" + EOL + " \"id\" : \"id\"," + + EOL + " \"volumeId\" : \"volumeid\"," + EOL + " \"serverId\" : \"serverid\"," + EOL + + " \"device\" : \"device\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"volumeId\" : \"volumeid\"," + EOL + " \"serverId\" : \"serverid\"," + EOL + + " \"device\" : \"device\"" + 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 { @@ -70,13 +58,14 @@ public class VolumeAttachmentsTest { public void testMethods() throws Exception { VolumeAttachments volumeattachments = objectMapper.readValue(JSON_FULL, VolumeAttachments.class); volumeattachments.toString(); - + List<VolumeAttachment> list = volumeattachments.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") VolumeAttachment x : volumeattachments) { + for (@SuppressWarnings("unused") + VolumeAttachment x : volumeattachments) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeForCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeForCreateTest.java index 7654cef..0c7dab7 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeForCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeForCreateTest.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.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,27 +34,17 @@ public class VolumeForCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"volume\" : {" + EOL - + " \"size\" : 61," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"availability_zone\" : \"availabilityzone\"," + EOL - + " \"display_name\" : \"name\"," + EOL - + " \"display_description\" : \"description\"," + EOL - + " \"snapshot_id\" : 3" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"volume\" : {" + EOL + " \"size\" : 61," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"availability_zone\" : \"availabilityzone\"," + EOL + + " \"display_name\" : \"name\"," + EOL + " \"display_description\" : \"description\"," + EOL + + " \"snapshot_id\" : 3" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -72,28 +60,28 @@ public class VolumeForCreateTest { public void testMethods() throws Exception { VolumeForCreate volumeforcreate = objectMapper.readValue(JSON_FULL, VolumeForCreate.class); volumeforcreate.toString(); - - Map<String,String> metadata = volumeforcreate.getMetadata(); + + Map<String, String> metadata = volumeforcreate.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); volumeforcreate.setMetadata(metadata); - + Integer snapshotId = volumeforcreate.getSnapshotId(); Assert.assertNotNull(snapshotId); volumeforcreate.setSnapshotId(snapshotId); - + Integer size = volumeforcreate.getSize(); Assert.assertNotNull(size); volumeforcreate.setSize(size); - + String name = volumeforcreate.getName(); Assert.assertNotNull(name); volumeforcreate.setName(name); - + String description = volumeforcreate.getDescription(); Assert.assertNotNull(description); volumeforcreate.setDescription(description); - + String availabilityZone = volumeforcreate.getAvailabilityZone(); Assert.assertNotNull(availabilityZone); volumeforcreate.setAvailabilityZone(availabilityZone); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeForImageCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeForImageCreateTest.java index 98a3e1a..b9be30d 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeForImageCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeForImageCreateTest.java @@ -24,7 +24,6 @@ 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; @@ -34,24 +33,16 @@ public class VolumeForImageCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"os-volume_upload_image\" : {" + EOL - + " \"volumeId\" : \"volumeid\"," + EOL - + " \"tenantId\" : \"tenantid\"," + EOL - + " \"force\" : false," + EOL - + " \"container_format\" : \"container_format\"," + EOL - + " \"disk_format\" : \"disk_format\"," + EOL - + " \"image_name\" : \"image_name\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"os-volume_upload_image\" : {" + EOL + + " \"volumeId\" : \"volumeid\"," + EOL + " \"tenantId\" : \"tenantid\"," + EOL + + " \"force\" : false," + EOL + " \"container_format\" : \"container_format\"," + EOL + + " \"disk_format\" : \"disk_format\"," + EOL + " \"image_name\" : \"image_name\"" + EOL + " }" + EOL + + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private ObjectMapper objectMapper = new ObjectMapper().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 { @@ -67,27 +58,27 @@ public class VolumeForImageCreateTest { public void testMethods() throws Exception { VolumeForImageCreate volumeforimagecreate = objectMapper.readValue(JSON_FULL, VolumeForImageCreate.class); volumeforimagecreate.toString(); - + String image_name = volumeforimagecreate.getImage_name(); Assert.assertNotNull(image_name); volumeforimagecreate.setImage_name(image_name); - + String tenantId = volumeforimagecreate.getTenantId(); Assert.assertNotNull(tenantId); volumeforimagecreate.setTenantId(tenantId); - + String volumeId = volumeforimagecreate.getVolumeId(); Assert.assertNotNull(volumeId); volumeforimagecreate.setVolumeId(volumeId); - + String disk_format = volumeforimagecreate.getDisk_format(); Assert.assertNotNull(disk_format); volumeforimagecreate.setDisk_format(disk_format); - + Boolean force = volumeforimagecreate.getForce(); Assert.assertNotNull(force); volumeforimagecreate.setForce(force); - + String container_format = volumeforimagecreate.getContainer_format(); Assert.assertNotNull(container_format); volumeforimagecreate.setContainer_format(container_format); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTest.java index bf1a7e1..053821c 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTest.java @@ -24,10 +24,9 @@ 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.Date; import java.util.List; import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,38 +36,22 @@ public class VolumeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"volume\" : {" + 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(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"volume\" : {" + 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(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 { @@ -84,39 +67,39 @@ public class VolumeTest { public void testMethods() throws Exception { Volume volume = objectMapper.readValue(JSON_FULL, Volume.class); volume.toString(); - + String volumeType = volume.getVolumeType(); Assert.assertNotNull(volumeType); - + String createdAt = volume.getCreatedAt(); Assert.assertNotNull(createdAt); - - Map<String,String> metadata = volume.getMetadata(); + + Map<String, String> metadata = volume.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); - - List<Map<String,Object>> attachments = volume.getAttachments(); + + List<Map<String, Object>> attachments = volume.getAttachments(); Assert.assertNotNull(attachments); Assert.assertEquals(2, attachments.size()); - + String snapshotId = volume.getSnapshotId(); Assert.assertNotNull(snapshotId); - + Integer size = volume.getSize(); Assert.assertNotNull(size); - + String name = volume.getName(); Assert.assertNotNull(name); - + String description = volume.getDescription(); Assert.assertNotNull(description); - + String id = volume.getId(); Assert.assertNotNull(id); - + String availabilityZone = volume.getAvailabilityZone(); Assert.assertNotNull(availabilityZone); - + String status = volume.getStatus(); Assert.assertNotNull(status); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTypeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTypeTest.java index 9033b9e..a2f78f1 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTypeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTypeTest.java @@ -24,7 +24,6 @@ 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; @@ -33,17 +32,12 @@ public class VolumeTypeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"volume-type\" : { }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .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); + private static final String JSON_FULL = "{" + EOL + " \"volume-type\" : { }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().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/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTypesTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTypesTest.java index 73f84b2..0e07453 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTypesTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTypesTest.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,15 +34,11 @@ public class VolumeTypesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"volume-types\" : [ { }, { } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"volume-types\" : [ { }, { } ]" + 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 { @@ -60,13 +54,14 @@ public class VolumeTypesTest { public void testMethods() throws Exception { VolumeTypes volumetypes = objectMapper.readValue(JSON_FULL, VolumeTypes.class); volumetypes.toString(); - + List<VolumeType> list = volumetypes.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") VolumeType x : volumetypes) { + for (@SuppressWarnings("unused") + VolumeType x : volumetypes) { ++cnt; } Assert.assertEquals(2, cnt); 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); |