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 /quantum-model/src/test/java/com | |
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 'quantum-model/src/test/java/com')
19 files changed, 297 insertions, 545 deletions
diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/BindingTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/BindingTest.java index 22d9735..ed7f85c 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/BindingTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/BindingTest.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.quantum.model.Port.Binding; - import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,25 +35,16 @@ public class BindingTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"binding:host_id\" : \"hostid\"," + EOL - + " \"binding:vif_type\" : \"viftype\"," + EOL - + " \"binding:vnic_type\" : \"vnictype\"," + EOL - + " \"binding:vif_details\" : {" + EOL - + " \"vifdetails-k1\" : \"vifdetails-v1\"," + EOL - + " \"vifdetails-k2\" : \"vifdetails-v2\"" + EOL - + " }," + EOL - + " \"binding:profile\" : {" + EOL - + " \"profile-k1\" : \"profile-v1\"," + EOL - + " \"profile-k2\" : \"profile-v2\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"binding:host_id\" : \"hostid\"," + EOL + " \"binding:vif_type\" : \"viftype\"," + EOL + + " \"binding:vnic_type\" : \"vnictype\"," + EOL + " \"binding:vif_details\" : {" + EOL + + " \"vifdetails-k1\" : \"vifdetails-v1\"," + EOL + " \"vifdetails-k2\" : \"vifdetails-v2\"" + + EOL + " }," + EOL + " \"binding:profile\" : {" + EOL + " \"profile-k1\" : \"profile-v1\"," + + EOL + " \"profile-k2\" : \"profile-v2\"" + 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 { @@ -71,25 +60,25 @@ public class BindingTest { public void testMethods() throws Exception { Binding binding = objectMapper.readValue(JSON_FULL, Binding.class); binding.toString(); - + String vnicType = binding.getVnicType(); Assert.assertNotNull(vnicType); binding.setVnicType(vnicType); - - Map<String,Object> vifDetails = binding.getVifDetails(); + + Map<String, Object> vifDetails = binding.getVifDetails(); Assert.assertNotNull(vifDetails); Assert.assertEquals(2, vifDetails.size()); binding.setVifDetails(vifDetails); - - Map<String,Object> profile = binding.getProfile(); + + Map<String, Object> profile = binding.getProfile(); Assert.assertNotNull(profile); Assert.assertEquals(2, profile.size()); binding.setProfile(profile); - + String hostId = binding.getHostId(); Assert.assertNotNull(hostId); binding.setHostId(hostId); - + String vifType = binding.getVifType(); Assert.assertNotNull(vifType); binding.setVifType(vifType); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/GatewayInfoTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/GatewayInfoTest.java index 92e8692..92c9217 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/GatewayInfoTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/GatewayInfoTest.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,15 +33,11 @@ public class GatewayInfoTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"network_id\" : \"networkid\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"network_id\" : \"networkid\"" + 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 { @@ -58,7 +53,7 @@ public class GatewayInfoTest { public void testMethods() throws Exception { GatewayInfo gatewayinfo = objectMapper.readValue(JSON_FULL, GatewayInfo.class); gatewayinfo.toString(); - + String networkId = gatewayinfo.getNetworkId(); Assert.assertNotNull(networkId); gatewayinfo.setNetworkId(networkId); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/HostRouteTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/HostRouteTest.java index 063014e..519c281 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/HostRouteTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/HostRouteTest.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 HostRouteTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"destination\" : \"destination\"," + EOL - + " \"nexthop\" : \"nexthop\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"destination\" : \"destination\"," + EOL + " \"nexthop\" : \"nexthop\"" + 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 HostRouteTest { public void testMethods() throws Exception { HostRoute hostroute = objectMapper.readValue(JSON_FULL, HostRoute.class); hostroute.toString(); - + String destination = hostroute.getDestination(); Assert.assertNotNull(destination); hostroute.setDestination(destination); - + String nexthop = hostroute.getNexthop(); Assert.assertNotNull(nexthop); hostroute.setNexthop(nexthop); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/IpTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/IpTest.java index 799a0f5..6be8138 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/IpTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/IpTest.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.quantum.model.Port.Ip; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,16 +34,12 @@ public class IpTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"ip_address\" : \"address\"," + EOL - + " \"subnet_id\" : \"subnetid\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"ip_address\" : \"address\"," + EOL + " \"subnet_id\" : \"subnetid\"" + 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,11 +55,11 @@ public class IpTest { public void testMethods() throws Exception { Ip ip = objectMapper.readValue(JSON_FULL, Ip.class); ip.toString(); - + String subnetId = ip.getSubnetId(); Assert.assertNotNull(subnetId); ip.setSubnetId(subnetId); - + String address = ip.getAddress(); Assert.assertNotNull(address); ip.setAddress(address); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/IpVersionTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/IpVersionTest.java index b58aed5..3ea4ddd 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/IpVersionTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/IpVersionTest.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.quantum.model.Subnet.IpVersion; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -36,11 +35,9 @@ public class IpVersionTest { private static final String JSON_FULL = "4"; - 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/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NetworkTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NetworkTest.java index 7a2b2c1..e4f33e6 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NetworkTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NetworkTest.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,35 +34,24 @@ public class NetworkTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"network\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"shared\" : \"shared\"," + EOL - + " \"segments\" : [ {" + EOL - + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL - + " \"provider:network_type\" : \"providernetworktype\"," + EOL - + " \"provider:segmentation_id\" : 92" + EOL - + " }, {" + EOL - + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL - + " \"provider:network_type\" : \"providernetworktype\"," + EOL - + " \"provider:segmentation_id\" : 92" + EOL - + " } ]," + EOL - + " \"admin_state_up\" : false," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL - + " \"provider:network_type\" : \"providernetworktype\"," + EOL - + " \"provider:segmentation_id\" : 92," + EOL - + " \"router:external\" : \"routerexternal\"" + 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 + " \"name\" : \"name\"," + EOL + + " \"shared\" : true," + EOL + " \"segments\" : [ {" + EOL + + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL + + " \"provider:network_type\" : \"providernetworktype\"," + EOL + + " \"provider:segmentation_id\" : 92" + EOL + " }, {" + EOL + + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL + + " \"provider:network_type\" : \"providernetworktype\"," + EOL + + " \"provider:segmentation_id\" : 92" + EOL + " } ]," + EOL + " \"admin_state_up\" : false," + + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL + + " \"provider:network_type\" : \"providernetworktype\"," + EOL + + " \"provider:segmentation_id\" : 92," + EOL + " \"router:external\" : 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 { @@ -80,40 +67,40 @@ public class NetworkTest { public void testMethods() throws Exception { Network network = objectMapper.readValue(JSON_FULL, Network.class); network.toString(); - - String shared = network.getShared(); + + Boolean shared = network.getShared(); Assert.assertNotNull(shared); network.setShared(shared); - + String providerNetworkType = network.getProviderNetworkType(); Assert.assertNotNull(providerNetworkType); network.setProviderNetworkType(providerNetworkType); - - String routerExternal = network.getRouterExternal(); + + Boolean routerExternal = network.getRouterExternal(); Assert.assertNotNull(routerExternal); network.setRouterExternal(routerExternal); - + Integer providerSegmentationId = network.getProviderSegmentationId(); Assert.assertNotNull(providerSegmentationId); network.setProviderSegmentationId(providerSegmentationId); - + List<Segment> segments = network.getSegments(); Assert.assertNotNull(segments); Assert.assertEquals(2, segments.size()); network.setSegments(segments); - + Boolean adminStateUp = network.getAdminStateUp(); Assert.assertNotNull(adminStateUp); network.setAdminStateUp(adminStateUp); - + String tenantId = network.getTenantId(); Assert.assertNotNull(tenantId); network.setTenantId(tenantId); - + String name = network.getName(); Assert.assertNotNull(name); network.setName(name); - + String providerPhysicalNetwork = network.getProviderPhysicalNetwork(); Assert.assertNotNull(providerPhysicalNetwork); network.setProviderPhysicalNetwork(providerPhysicalNetwork); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NetworksTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NetworksTest.java index 9b4dc3b..caa9135 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NetworksTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/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,51 +34,34 @@ public class NetworksTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"networks\" : [ {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"shared\" : \"shared\"," + EOL - + " \"segments\" : [ {" + EOL - + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL - + " \"provider:network_type\" : \"providernetworktype\"," + EOL - + " \"provider:segmentation_id\" : 92" + EOL - + " }, {" + EOL - + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL - + " \"provider:network_type\" : \"providernetworktype\"," + EOL - + " \"provider:segmentation_id\" : 92" + EOL - + " } ]," + EOL - + " \"admin_state_up\" : false," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL - + " \"provider:network_type\" : \"providernetworktype\"," + EOL - + " \"provider:segmentation_id\" : 92," + EOL - + " \"router:external\" : \"routerexternal\"" + EOL - + " }, {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"shared\" : \"shared\"," + EOL - + " \"segments\" : [ {" + EOL - + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL - + " \"provider:network_type\" : \"providernetworktype\"," + EOL - + " \"provider:segmentation_id\" : 92" + EOL - + " }, {" + EOL - + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL - + " \"provider:network_type\" : \"providernetworktype\"," + EOL - + " \"provider:segmentation_id\" : 92" + EOL - + " } ]," + EOL - + " \"admin_state_up\" : false," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL - + " \"provider:network_type\" : \"providernetworktype\"," + EOL - + " \"provider:segmentation_id\" : 92," + EOL - + " \"router:external\" : \"routerexternal\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"networks\" : [ {" + EOL + " \"name\" : \"name\"," + EOL + + " \"shared\" : true," + EOL + " \"segments\" : [ {" + EOL + + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL + + " \"provider:network_type\" : \"providernetworktype\"," + EOL + + " \"provider:segmentation_id\" : 92" + EOL + " }, {" + EOL + + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL + + " \"provider:network_type\" : \"providernetworktype\"," + EOL + + " \"provider:segmentation_id\" : 92" + EOL + " } ]," + EOL + " \"admin_state_up\" : false," + + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL + + " \"provider:network_type\" : \"providernetworktype\"," + EOL + + " \"provider:segmentation_id\" : 92," + EOL + " \"router:external\" : true " + EOL + " }, {" + EOL + + " \"name\" : \"name\"," + EOL + " \"shared\" : true," + EOL + " \"segments\" : [ {" + EOL + + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL + + " \"provider:network_type\" : \"providernetworktype\"," + EOL + + " \"provider:segmentation_id\" : 92" + EOL + " }, {" + EOL + + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL + + " \"provider:network_type\" : \"providernetworktype\"," + EOL + + " \"provider:segmentation_id\" : 92" + EOL + " } ]," + EOL + " \"admin_state_up\" : false," + + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL + + " \"provider:network_type\" : \"providernetworktype\"," + EOL + + " \"provider:segmentation_id\" : 92," + EOL + " \"router:external\" : true" + 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 { @@ -96,14 +77,15 @@ 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()); networks.setList(list); - + int cnt = 0; - for (@SuppressWarnings("unused") Network x : networks) { + for (@SuppressWarnings("unused") + Network x : networks) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NeutronErrorTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NeutronErrorTest.java index e2dc7f5..58a8a04 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NeutronErrorTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/NeutronErrorTest.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,21 +33,13 @@ public class NeutronErrorTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"NeutronError\" : {" + EOL - + " \"type\" : \"type\"," + EOL - + " \"message\" : \"message\"," + EOL - + " \"detail\" : \"detail\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"NeutronError\" : {" + EOL + " \"type\" : \"type\"," + + EOL + " \"message\" : \"message\"," + EOL + " \"detail\" : \"detail\"" + 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,13 +55,13 @@ public class NeutronErrorTest { public void testMethods() throws Exception { NeutronError neutronerror = objectMapper.readValue(JSON_FULL, NeutronError.class); neutronerror.toString(); - + String detail = neutronerror.getDetail(); Assert.assertNotNull(detail); - + String type = neutronerror.getType(); Assert.assertNotNull(type); - + String message = neutronerror.getMessage(); Assert.assertNotNull(message); } diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PoolTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PoolTest.java index ce7574b..8adbffb 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PoolTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PoolTest.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 PoolTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"start\" : \"start\"," + EOL - + " \"end\" : \"end\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"start\" : \"start\"," + EOL + " \"end\" : \"end\"" + 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 PoolTest { public void testMethods() throws Exception { Pool pool = objectMapper.readValue(JSON_FULL, Pool.class); pool.toString(); - + String start = pool.getStart(); Assert.assertNotNull(start); pool.setStart(start); - + String end = pool.getEnd(); Assert.assertNotNull(end); pool.setEnd(end); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PortTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PortTest.java index b8a7a34..7509578 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PortTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PortTest.java @@ -26,9 +26,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.quantum.model.Port.Binding; import com.woorea.openstack.quantum.model.Port.Ip; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -38,44 +36,24 @@ public class PortTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"port\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"binding:host_id\" : \"hostid\"," + EOL - + " \"binding:vif_type\" : \"viftype\"," + EOL - + " \"binding:vnic_type\" : \"vnictype\"," + EOL - + " \"binding:vif_details\" : {" + EOL - + " \"vifdetails-k1\" : \"vifdetails-v1\"," + EOL - + " \"vifdetails-k2\" : \"vifdetails-v2\"" + EOL - + " }," + EOL - + " \"binding:profile\" : {" + EOL - + " \"profile-k1\" : \"profile-v1\"," + EOL - + " \"profile-k2\" : \"profile-v2\"" + EOL - + " }," + EOL - + " \"admin_state_up\" : false," + EOL - + " \"device_id\" : \"deviceid\"," + EOL - + " \"device_owner\" : \"deviceowner\"," + EOL - + " \"fixed_ips\" : [ {" + EOL - + " \"ip_address\" : \"address\"," + EOL - + " \"subnet_id\" : \"subnetid\"" + EOL - + " }, {" + EOL - + " \"ip_address\" : \"address\"," + EOL - + " \"subnet_id\" : \"subnetid\"" + EOL - + " } ]," + EOL - + " \"mac_address\" : \"macaddress\"," + EOL - + " \"network_id\" : \"networkid\"," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"security_groups\" : [ \"securitygroups-v1\", \"securitygroups-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 + " \"port\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"binding:host_id\" : \"hostid\"," + EOL + " \"binding:vif_type\" : \"viftype\"," + EOL + + " \"binding:vnic_type\" : \"vnictype\"," + EOL + " \"binding:vif_details\" : {" + EOL + + " \"vifdetails-k1\" : \"vifdetails-v1\"," + EOL + " \"vifdetails-k2\" : \"vifdetails-v2\"" + EOL + + " }," + EOL + " \"binding:profile\" : {" + EOL + " \"profile-k1\" : \"profile-v1\"," + EOL + + " \"profile-k2\" : \"profile-v2\"" + EOL + " }," + EOL + " \"admin_state_up\" : false," + EOL + + " \"device_id\" : \"deviceid\"," + EOL + " \"device_owner\" : \"deviceowner\"," + EOL + + " \"fixed_ips\" : [ {" + EOL + " \"ip_address\" : \"address\"," + EOL + + " \"subnet_id\" : \"subnetid\"" + EOL + " }, {" + EOL + " \"ip_address\" : \"address\"," + + EOL + " \"subnet_id\" : \"subnetid\"" + EOL + " } ]," + EOL + + " \"mac_address\" : \"macaddress\"," + EOL + " \"network_id\" : \"networkid\"," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"security_groups\" : [ \"securitygroups-v1\", \"securitygroups-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 { @@ -91,45 +69,45 @@ public class PortTest { public void testMethods() throws Exception { Port port = objectMapper.readValue(JSON_FULL, Port.class); port.toString(); - + String deviceOwner = port.getDeviceOwner(); Assert.assertNotNull(deviceOwner); port.setDeviceOwner(deviceOwner); - + Boolean adminStateUp = port.getAdminStateUp(); Assert.assertNotNull(adminStateUp); port.setAdminStateUp(adminStateUp); - + String name = port.getName(); Assert.assertNotNull(name); port.setName(name); - + String tenantId = port.getTenantId(); Assert.assertNotNull(tenantId); port.setTenantId(tenantId); - + Binding binding = port.getBinding(); Assert.assertNotNull(binding); port.setBinding(binding); - + String macAddress = port.getMacAddress(); Assert.assertNotNull(macAddress); port.setMacAddress(macAddress); - + String networkId = port.getNetworkId(); Assert.assertNotNull(networkId); port.setNetworkId(networkId); - + List<Ip> list = port.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); port.setList(list); - + List<String> securityGroups = port.getSecurityGroups(); Assert.assertNotNull(securityGroups); Assert.assertEquals(2, securityGroups.size()); port.setSecurityGroups(securityGroups); - + String deviceId = port.getDeviceId(); Assert.assertNotNull(deviceId); port.setDeviceId(deviceId); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PortsTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PortsTest.java index 62e5c3b..b24b6b8 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PortsTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/PortsTest.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,69 +34,35 @@ public class PortsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"ports\" : [ {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"binding:host_id\" : \"hostid\"," + EOL - + " \"binding:vif_type\" : \"viftype\"," + EOL - + " \"binding:vnic_type\" : \"vnictype\"," + EOL - + " \"binding:vif_details\" : {" + EOL - + " \"vifdetails-k1\" : \"vifdetails-v1\"," + EOL - + " \"vifdetails-k2\" : \"vifdetails-v2\"" + EOL - + " }," + EOL - + " \"binding:profile\" : {" + EOL - + " \"profile-k1\" : \"profile-v1\"," + EOL - + " \"profile-k2\" : \"profile-v2\"" + EOL - + " }," + EOL - + " \"admin_state_up\" : false," + EOL - + " \"device_id\" : \"deviceid\"," + EOL - + " \"device_owner\" : \"deviceowner\"," + EOL - + " \"fixed_ips\" : [ {" + EOL - + " \"ip_address\" : \"address\"," + EOL - + " \"subnet_id\" : \"subnetid\"" + EOL - + " }, {" + EOL - + " \"ip_address\" : \"address\"," + EOL - + " \"subnet_id\" : \"subnetid\"" + EOL - + " } ]," + EOL - + " \"mac_address\" : \"macaddress\"," + EOL - + " \"network_id\" : \"networkid\"," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"security_groups\" : [ \"securitygroups-v1\", \"securitygroups-v2\" ]" + EOL - + " }, {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"binding:host_id\" : \"hostid\"," + EOL - + " \"binding:vif_type\" : \"viftype\"," + EOL - + " \"binding:vnic_type\" : \"vnictype\"," + EOL - + " \"binding:vif_details\" : {" + EOL - + " \"vifdetails-k1\" : \"vifdetails-v1\"," + EOL - + " \"vifdetails-k2\" : \"vifdetails-v2\"" + EOL - + " }," + EOL - + " \"binding:profile\" : {" + EOL - + " \"profile-k1\" : \"profile-v1\"," + EOL - + " \"profile-k2\" : \"profile-v2\"" + EOL - + " }," + EOL - + " \"admin_state_up\" : false," + EOL - + " \"device_id\" : \"deviceid\"," + EOL - + " \"device_owner\" : \"deviceowner\"," + EOL - + " \"fixed_ips\" : [ {" + EOL - + " \"ip_address\" : \"address\"," + EOL - + " \"subnet_id\" : \"subnetid\"" + EOL - + " }, {" + EOL - + " \"ip_address\" : \"address\"," + EOL - + " \"subnet_id\" : \"subnetid\"" + EOL - + " } ]," + EOL - + " \"mac_address\" : \"macaddress\"," + EOL - + " \"network_id\" : \"networkid\"," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"security_groups\" : [ \"securitygroups-v1\", \"securitygroups-v2\" ]" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"ports\" : [ {" + EOL + " \"name\" : \"name\"," + EOL + + " \"binding:host_id\" : \"hostid\"," + EOL + " \"binding:vif_type\" : \"viftype\"," + EOL + + " \"binding:vnic_type\" : \"vnictype\"," + EOL + " \"binding:vif_details\" : {" + EOL + + " \"vifdetails-k1\" : \"vifdetails-v1\"," + EOL + " \"vifdetails-k2\" : \"vifdetails-v2\"" + EOL + + " }," + EOL + " \"binding:profile\" : {" + EOL + " \"profile-k1\" : \"profile-v1\"," + EOL + + " \"profile-k2\" : \"profile-v2\"" + EOL + " }," + EOL + " \"admin_state_up\" : false," + EOL + + " \"device_id\" : \"deviceid\"," + EOL + " \"device_owner\" : \"deviceowner\"," + EOL + + " \"fixed_ips\" : [ {" + EOL + " \"ip_address\" : \"address\"," + EOL + + " \"subnet_id\" : \"subnetid\"" + EOL + " }, {" + EOL + " \"ip_address\" : \"address\"," + + EOL + " \"subnet_id\" : \"subnetid\"" + EOL + " } ]," + EOL + + " \"mac_address\" : \"macaddress\"," + EOL + " \"network_id\" : \"networkid\"," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"security_groups\" : [ \"securitygroups-v1\", \"securitygroups-v2\" ]" + EOL + " }, {" + EOL + + " \"name\" : \"name\"," + EOL + " \"binding:host_id\" : \"hostid\"," + EOL + + " \"binding:vif_type\" : \"viftype\"," + EOL + " \"binding:vnic_type\" : \"vnictype\"," + EOL + + " \"binding:vif_details\" : {" + EOL + " \"vifdetails-k1\" : \"vifdetails-v1\"," + EOL + + " \"vifdetails-k2\" : \"vifdetails-v2\"" + EOL + " }," + EOL + " \"binding:profile\" : {" + EOL + + " \"profile-k1\" : \"profile-v1\"," + EOL + " \"profile-k2\" : \"profile-v2\"" + EOL + " }," + + EOL + " \"admin_state_up\" : false," + EOL + " \"device_id\" : \"deviceid\"," + EOL + + " \"device_owner\" : \"deviceowner\"," + EOL + " \"fixed_ips\" : [ {" + EOL + + " \"ip_address\" : \"address\"," + EOL + " \"subnet_id\" : \"subnetid\"" + EOL + " }, {" + + EOL + " \"ip_address\" : \"address\"," + EOL + " \"subnet_id\" : \"subnetid\"" + EOL + + " } ]," + EOL + " \"mac_address\" : \"macaddress\"," + EOL + " \"network_id\" : \"networkid\"," + + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"security_groups\" : [ \"securitygroups-v1\", \"securitygroups-v2\" ]" + 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 { @@ -114,14 +78,15 @@ public class PortsTest { public void testMethods() throws Exception { Ports ports = objectMapper.readValue(JSON_FULL, Ports.class); ports.toString(); - + List<Port> list = ports.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); ports.setList(list); - + int cnt = 0; - for (@SuppressWarnings("unused") Port x : ports) { + for (@SuppressWarnings("unused") + Port x : ports) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterForAddInterfaceTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterForAddInterfaceTest.java index 270b7a2..65fa321 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterForAddInterfaceTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterForAddInterfaceTest.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 RouterForAddInterfaceTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"routerId\" : \"routerid\"," + EOL - + " \"subnet_id\" : \"subnetid\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"routerId\" : \"routerid\"," + EOL + " \"subnet_id\" : \"subnetid\"" + 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 RouterForAddInterfaceTest { public void testMethods() throws Exception { RouterForAddInterface routerforaddinterface = objectMapper.readValue(JSON_FULL, RouterForAddInterface.class); routerforaddinterface.toString(); - + String subnetId = routerforaddinterface.getSubnetId(); Assert.assertNotNull(subnetId); routerforaddinterface.setSubnetId(subnetId); - + String routerId = routerforaddinterface.getRouterId(); Assert.assertNotNull(routerId); routerforaddinterface.setRouterId(routerId); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterForCreateTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterForCreateTest.java index 31a0373..80dd10b 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterForCreateTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterForCreateTest.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,33 +34,19 @@ public class RouterForCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"router\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"routes\" : [ {" + EOL - + " \"destination\" : \"destination\"," + EOL - + " \"nexthop\" : \"nexthop\"" + EOL - + " }, {" + EOL - + " \"destination\" : \"destination\"," + EOL - + " \"nexthop\" : \"nexthop\"" + EOL - + " } ]," + EOL - + " \"admin_state_up\" : \"admin_state_up\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"id\" : \"id\"," + EOL - + " \"external_gateway_info\" : {" + EOL - + " \"network_id\" : \"networkid\"" + EOL - + " }," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"router\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"routes\" : [ {" + EOL + " \"destination\" : \"destination\"," + EOL + + " \"nexthop\" : \"nexthop\"" + EOL + " }, {" + EOL + " \"destination\" : \"destination\"," + + EOL + " \"nexthop\" : \"nexthop\"" + EOL + " } ]," + EOL + + " \"admin_state_up\" : \"admin_state_up\"," + EOL + " \"status\" : \"status\"," + EOL + + " \"id\" : \"id\"," + EOL + " \"external_gateway_info\" : {" + EOL + + " \"network_id\" : \"networkid\"" + EOL + " }," + EOL + " \"tenant_id\" : \"tenantid\"" + 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,32 +62,32 @@ public class RouterForCreateTest { public void testMethods() throws Exception { RouterForCreate routerforcreate = objectMapper.readValue(JSON_FULL, RouterForCreate.class); routerforcreate.toString(); - + List<HostRoute> routes = routerforcreate.getRoutes(); Assert.assertNotNull(routes); Assert.assertEquals(2, routes.size()); routerforcreate.setRoutes(routes); - + String admin_state_up = routerforcreate.getAdminStateUp(); Assert.assertNotNull(admin_state_up); routerforcreate.setAdminStateUp(admin_state_up); - + String name = routerforcreate.getName(); Assert.assertNotNull(name); routerforcreate.setName(name); - + String tenantId = routerforcreate.getTenantId(); Assert.assertNotNull(tenantId); routerforcreate.setTenantId(tenantId); - + GatewayInfo externalGatewayInfo = routerforcreate.getExternalGatewayInfo(); Assert.assertNotNull(externalGatewayInfo); routerforcreate.setExternalGatewayInfo(externalGatewayInfo); - + String id = routerforcreate.getId(); Assert.assertNotNull(id); routerforcreate.setId(id); - + String status = routerforcreate.getStatus(); Assert.assertNotNull(status); routerforcreate.setStatus(status); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterInterfaceTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterInterfaceTest.java index ee4e08b..b51c562 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterInterfaceTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterInterfaceTest.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,18 +32,12 @@ public class RouterInterfaceTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"id\" : \"id\"," + EOL - + " \"subnet_id\" : \"subnetid\"," + EOL - + " \"port_id\" : \"portid\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"id\" : \"id\"," + EOL + " \"subnet_id\" : \"subnetid\"," + + EOL + " \"port_id\" : \"portid\"," + 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 { diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterTest.java index 81573df..e5d2caa 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RouterTest.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,33 +34,18 @@ public class RouterTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"router\" : {" + EOL - + " \"status\" : \"status\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"admin_state_up\" : \"admin_state_up\"," + EOL - + " \"id\" : \"id\"," + EOL - + " \"routes\" : [ {" + EOL - + " \"destination\" : \"destination\"," + EOL - + " \"nexthop\" : \"nexthop\"" + EOL - + " }, {" + EOL - + " \"destination\" : \"destination\"," + EOL - + " \"nexthop\" : \"nexthop\"" + EOL - + " } ]," + EOL - + " \"external_gateway_info\" : {" + EOL - + " \"network_id\" : \"networkid\"" + EOL - + " }," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"router\" : {" + EOL + " \"status\" : \"status\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"admin_state_up\" : \"admin_state_up\"," + EOL + + " \"id\" : \"id\"," + EOL + " \"routes\" : [ {" + EOL + " \"destination\" : \"destination\"," + + EOL + " \"nexthop\" : \"nexthop\"" + EOL + " }, {" + EOL + + " \"destination\" : \"destination\"," + EOL + " \"nexthop\" : \"nexthop\"" + EOL + " } ]," + + EOL + " \"external_gateway_info\" : {" + EOL + " \"network_id\" : \"networkid\"" + EOL + " }," + + EOL + " \"tenant_id\" : \"tenantid\"" + 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,32 +61,32 @@ public class RouterTest { public void testMethods() throws Exception { Router router = objectMapper.readValue(JSON_FULL, Router.class); router.toString(); - + List<HostRoute> routes = router.getRoutes(); Assert.assertNotNull(routes); Assert.assertEquals(2, routes.size()); router.setRoutes(routes); - + String admin_state_up = router.getAdminStateUp(); Assert.assertNotNull(admin_state_up); router.setAdminStateUp(admin_state_up); - + String name = router.getName(); Assert.assertNotNull(name); router.setName(name); - + String tenantId = router.getTenantId(); Assert.assertNotNull(tenantId); router.setTenantId(tenantId); - + GatewayInfo externalGatewayInfo = router.getExternalGatewayInfo(); Assert.assertNotNull(externalGatewayInfo); router.setExternalGatewayInfo(externalGatewayInfo); - + String id = router.getId(); Assert.assertNotNull(id); router.setId(id); - + String status = router.getStatus(); Assert.assertNotNull(status); router.setStatus(status); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RoutersTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RoutersTest.java index 168dffc..917838a 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RoutersTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/RoutersTest.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,47 +34,23 @@ public class RoutersTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"routers\" : [ {" + EOL - + " \"status\" : \"status\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"admin_state_up\" : \"admin_state_up\"," + EOL - + " \"id\" : \"id\"," + EOL - + " \"routes\" : [ {" + EOL - + " \"destination\" : \"destination\"," + EOL - + " \"nexthop\" : \"nexthop\"" + EOL - + " }, {" + EOL - + " \"destination\" : \"destination\"," + EOL - + " \"nexthop\" : \"nexthop\"" + EOL - + " } ]," + EOL - + " \"external_gateway_info\" : {" + EOL - + " \"network_id\" : \"networkid\"" + EOL - + " }," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }, {" + EOL - + " \"status\" : \"status\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"admin_state_up\" : \"admin_state_up\"," + EOL - + " \"id\" : \"id\"," + EOL - + " \"routes\" : [ {" + EOL - + " \"destination\" : \"destination\"," + EOL - + " \"nexthop\" : \"nexthop\"" + EOL - + " }, {" + EOL - + " \"destination\" : \"destination\"," + EOL - + " \"nexthop\" : \"nexthop\"" + EOL - + " } ]," + EOL - + " \"external_gateway_info\" : {" + EOL - + " \"network_id\" : \"networkid\"" + EOL - + " }," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"routers\" : [ {" + EOL + " \"status\" : \"status\"," + + EOL + " \"name\" : \"name\"," + EOL + " \"admin_state_up\" : \"admin_state_up\"," + EOL + + " \"id\" : \"id\"," + EOL + " \"routes\" : [ {" + EOL + " \"destination\" : \"destination\"," + + EOL + " \"nexthop\" : \"nexthop\"" + EOL + " }, {" + EOL + + " \"destination\" : \"destination\"," + EOL + " \"nexthop\" : \"nexthop\"" + EOL + " } ]," + + EOL + " \"external_gateway_info\" : {" + EOL + " \"network_id\" : \"networkid\"" + EOL + " }," + + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }, {" + EOL + " \"status\" : \"status\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"admin_state_up\" : \"admin_state_up\"," + EOL + + " \"id\" : \"id\"," + EOL + " \"routes\" : [ {" + EOL + " \"destination\" : \"destination\"," + + EOL + " \"nexthop\" : \"nexthop\"" + EOL + " }, {" + EOL + + " \"destination\" : \"destination\"," + EOL + " \"nexthop\" : \"nexthop\"" + EOL + " } ]," + + EOL + " \"external_gateway_info\" : {" + EOL + " \"network_id\" : \"networkid\"" + 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 { @@ -92,14 +66,15 @@ public class RoutersTest { public void testMethods() throws Exception { Routers routers = objectMapper.readValue(JSON_FULL, Routers.class); routers.toString(); - + List<Router> list = routers.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); routers.setList(list); - + int cnt = 0; - for (@SuppressWarnings("unused") Router x : routers) { + for (@SuppressWarnings("unused") + Router x : routers) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SegmentTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SegmentTest.java index 992d5ab..7d41335 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SegmentTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SegmentTest.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,13 @@ public class SegmentTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + EOL - + " \"provider:network_type\" : \"providernetworktype\"," + EOL - + " \"provider:segmentation_id\" : 92" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"provider:physical_network\" : \"providerphysicalnetwork\"," + + EOL + " \"provider:network_type\" : \"providernetworktype\"," + EOL + + " \"provider:segmentation_id\" : 92" + 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,15 +55,15 @@ public class SegmentTest { public void testMethods() throws Exception { Segment segment = objectMapper.readValue(JSON_FULL, Segment.class); segment.toString(); - + String providerNetworkType = segment.getProviderNetworkType(); Assert.assertNotNull(providerNetworkType); segment.setProviderNetworkType(providerNetworkType); - + Integer providerSegmentationId = segment.getProviderSegmentationId(); Assert.assertNotNull(providerSegmentationId); segment.setProviderSegmentationId(providerSegmentationId); - + String providerPhysicalNetwork = segment.getProviderPhysicalNetwork(); Assert.assertNotNull(providerPhysicalNetwork); segment.setProviderPhysicalNetwork(providerPhysicalNetwork); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SubnetTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SubnetTest.java index 9bdd37c..11c178b 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SubnetTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SubnetTest.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.quantum.model.Subnet.IpVersion; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,34 +35,19 @@ public class SubnetTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"subnet\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"cidr\" : \"cidr\"," + EOL - + " \"enable_dhcp\" : true," + EOL - + " \"network_id\" : \"networkid\"," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"dns_nameservers\" : [ \"dnsnames-v1\", \"dnsnames-v2\" ]," + EOL - + " \"allocation_pools\" : [ {" + EOL - + " \"start\" : \"start\"," + EOL - + " \"end\" : \"end\"" + EOL - + " }, {" + EOL - + " \"start\" : \"start\"," + EOL - + " \"end\" : \"end\"" + EOL - + " } ]," + EOL - + " \"host_routes\" : [ \"hostroutes-v1\", \"hostroutes-v2\" ]," + EOL - + " \"ip_version\" : 4," + EOL - + " \"gateway_ip\" : \"gw\"" + 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 + " \"subnet\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"cidr\" : \"cidr\"," + EOL + " \"enable_dhcp\" : true," + EOL + + " \"network_id\" : \"networkid\"," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"dns_nameservers\" : [ \"dnsnames-v1\", \"dnsnames-v2\" ]," + EOL + " \"allocation_pools\" : [ {" + + EOL + " \"start\" : \"start\"," + EOL + " \"end\" : \"end\"" + EOL + " }, {" + EOL + + " \"start\" : \"start\"," + EOL + " \"end\" : \"end\"" + EOL + " } ]," + EOL + + " \"host_routes\" : [ \"hostroutes-v1\", \"hostroutes-v2\" ]," + EOL + " \"ip_version\" : 4," + EOL + + " \"gateway_ip\" : \"gw\"" + 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 { @@ -80,45 +63,45 @@ public class SubnetTest { public void testMethods() throws Exception { Subnet subnet = objectMapper.readValue(JSON_FULL, Subnet.class); subnet.toString(); - + String gw = subnet.getGw(); Assert.assertNotNull(gw); subnet.setGw(gw); - + List<String> dnsNames = subnet.getDnsNames(); Assert.assertNotNull(dnsNames); Assert.assertEquals(2, dnsNames.size()); subnet.setDnsNames(dnsNames); - + List<String> hostRoutes = subnet.getHostRoutes(); Assert.assertNotNull(hostRoutes); Assert.assertEquals(2, hostRoutes.size()); subnet.setHostRoutes(hostRoutes); - + String name = subnet.getName(); Assert.assertNotNull(name); subnet.setName(name); - + String tenantId = subnet.getTenantId(); Assert.assertNotNull(tenantId); subnet.setTenantId(tenantId); - + String cidr = subnet.getCidr(); Assert.assertNotNull(cidr); subnet.setCidr(cidr); - + String networkId = subnet.getNetworkId(); Assert.assertNotNull(networkId); subnet.setNetworkId(networkId); - + Boolean enableDHCP = subnet.getEnableDHCP(); Assert.assertNotNull(enableDHCP); subnet.setEnableDHCP(enableDHCP); - + IpVersion ipversion = subnet.getIpversion(); Assert.assertNotNull(ipversion); subnet.setIpversion(ipversion); - + List<Pool> list = subnet.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); diff --git a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SubnetsTest.java b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SubnetsTest.java index 710f694..02f4c75 100644 --- a/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SubnetsTest.java +++ b/quantum-model/src/test/java/com/woorea/openstack/quantum/model/SubnetsTest.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,49 +34,25 @@ public class SubnetsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"subnets\" : [ {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"cidr\" : \"cidr\"," + EOL - + " \"enable_dhcp\" : true," + EOL - + " \"network_id\" : \"networkid\"," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"dns_nameservers\" : [ \"dnsnames-v1\", \"dnsnames-v2\" ]," + EOL - + " \"allocation_pools\" : [ {" + EOL - + " \"start\" : \"start\"," + EOL - + " \"end\" : \"end\"" + EOL - + " }, {" + EOL - + " \"start\" : \"start\"," + EOL - + " \"end\" : \"end\"" + EOL - + " } ]," + EOL - + " \"host_routes\" : [ \"hostroutes-v1\", \"hostroutes-v2\" ]," + EOL - + " \"ip_version\" : 4," + EOL - + " \"gateway_ip\" : \"gw\"" + EOL - + " }, {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"cidr\" : \"cidr\"," + EOL - + " \"enable_dhcp\" : true," + EOL - + " \"network_id\" : \"networkid\"," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"dns_nameservers\" : [ \"dnsnames-v1\", \"dnsnames-v2\" ]," + EOL - + " \"allocation_pools\" : [ {" + EOL - + " \"start\" : \"start\"," + EOL - + " \"end\" : \"end\"" + EOL - + " }, {" + EOL - + " \"start\" : \"start\"," + EOL - + " \"end\" : \"end\"" + EOL - + " } ]," + EOL - + " \"host_routes\" : [ \"hostroutes-v1\", \"hostroutes-v2\" ]," + EOL - + " \"ip_version\" : 4," + EOL - + " \"gateway_ip\" : \"gw\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"subnets\" : [ {" + EOL + " \"name\" : \"name\"," + EOL + + " \"cidr\" : \"cidr\"," + EOL + " \"enable_dhcp\" : true," + EOL + + " \"network_id\" : \"networkid\"," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"dns_nameservers\" : [ \"dnsnames-v1\", \"dnsnames-v2\" ]," + EOL + " \"allocation_pools\" : [ {" + + EOL + " \"start\" : \"start\"," + EOL + " \"end\" : \"end\"" + EOL + " }, {" + EOL + + " \"start\" : \"start\"," + EOL + " \"end\" : \"end\"" + EOL + " } ]," + EOL + + " \"host_routes\" : [ \"hostroutes-v1\", \"hostroutes-v2\" ]," + EOL + " \"ip_version\" : 4," + EOL + + " \"gateway_ip\" : \"gw\"" + EOL + " }, {" + EOL + " \"name\" : \"name\"," + EOL + + " \"cidr\" : \"cidr\"," + EOL + " \"enable_dhcp\" : true," + EOL + + " \"network_id\" : \"networkid\"," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"dns_nameservers\" : [ \"dnsnames-v1\", \"dnsnames-v2\" ]," + EOL + " \"allocation_pools\" : [ {" + + EOL + " \"start\" : \"start\"," + EOL + " \"end\" : \"end\"" + EOL + " }, {" + EOL + + " \"start\" : \"start\"," + EOL + " \"end\" : \"end\"" + EOL + " } ]," + EOL + + " \"host_routes\" : [ \"hostroutes-v1\", \"hostroutes-v2\" ]," + EOL + " \"ip_version\" : 4," + EOL + + " \"gateway_ip\" : \"gw\"" + 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 { @@ -94,14 +68,15 @@ public class SubnetsTest { public void testMethods() throws Exception { Subnets subnets = objectMapper.readValue(JSON_FULL, Subnets.class); subnets.toString(); - + List<Subnet> list = subnets.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); subnets.setList(list); - + int cnt = 0; - for (@SuppressWarnings("unused") Subnet x : subnets) { + for (@SuppressWarnings("unused") + Subnet x : subnets) { ++cnt; } Assert.assertEquals(2, cnt); |