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 | |
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')
38 files changed, 609 insertions, 761 deletions
diff --git a/quantum-model/pom.xml b/quantum-model/pom.xml index 532af1b..9231534 100644 --- a/quantum-model/pom.xml +++ b/quantum-model/pom.xml @@ -1,24 +1,25 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.onap.so.libs</groupId> - <artifactId>openstack-java-sdk</artifactId> - <version>1.4.0-SNAPSHOT</version> - </parent> - <groupId>org.onap.so.libs.openstack-java-sdk</groupId> - <artifactId>quantum-model</artifactId> - <name>OpenStack Quantum Model</name> - <description>OpenStack Quantum Model</description> - <dependencies> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.skyscreamer</groupId> - <artifactId>jsonassert</artifactId> - <scope>test</scope> - </dependency> - </dependencies> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.so.libs</groupId> + <artifactId>openstack-java-sdk</artifactId> + <version>1.4.0-SNAPSHOT</version> + </parent> + <groupId>org.onap.so.libs.openstack-java-sdk</groupId> + <artifactId>quantum-model</artifactId> + <name>OpenStack Quantum Model</name> + <description>OpenStack Quantum Model</description> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.skyscreamer</groupId> + <artifactId>jsonassert</artifactId> + <scope>test</scope> + </dependency> + </dependencies> </project> diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/GatewayInfo.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/GatewayInfo.java index 88fb6a4..84e1a0c 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/GatewayInfo.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/GatewayInfo.java @@ -17,7 +17,6 @@ package com.woorea.openstack.quantum.model; import com.fasterxml.jackson.annotation.JsonProperty; - import java.io.Serializable; public class GatewayInfo implements Serializable { @@ -33,7 +32,8 @@ public class GatewayInfo implements Serializable { this.networkId = id; } - @Override public String toString() { + @Override + public String toString() { return "[networkId=" + networkId + "]"; } } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/HostRoute.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/HostRoute.java index 958a21d..ace3849 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/HostRoute.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/HostRoute.java @@ -26,6 +26,7 @@ public class HostRoute implements Serializable { public String getDestination() { return destination; } + public void setDestination(String destination) { this.destination = destination; } @@ -33,11 +34,13 @@ public class HostRoute implements Serializable { public String getNexthop() { return nexthop; } + public void setNexthop(String nexthop) { this.nexthop = nexthop; } - @Override public String toString() { + @Override + public String toString() { return "[destination=" + destination + ", nexthop=" + nexthop + "]"; } } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Link.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Link.java new file mode 100644 index 0000000..05fa9e9 --- /dev/null +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Link.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * 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.quantum.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Link { + @JsonProperty("href") + private String href; + + @JsonProperty("rel") + private String rel; + + public String getHref() { + return href; + } + + public void setHref(String href) { + this.href = href; + } + + public String getRel() { + return rel; + } + + public void setRel(String rel) { + this.rel = rel; + } + + @Override + public String toString() { + return "Link{" + "href='" + href + '\'' + ", rel='" + rel + '\'' + '}'; + } +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Network.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Network.java index bec7dbf..fbc00fb 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Network.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Network.java @@ -21,19 +21,18 @@ package com.woorea.openstack.quantum.model; */ import java.io.Serializable; +import java.util.Date; import java.util.List; - import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; /** - * Network Extension supporting both Provider networks and Multi-Provider networks. - * The attributes for both of these network extensions are included. - * It is the responsibility of users to populate only one or the other. It is - * also critical that the Mapper is set for serialization inclusion.NON_NULL, or - * both would be sent to Openstack which would cause an error. + * Network Extension supporting both Provider networks and Multi-Provider networks. The attributes for both of these + * network extensions are included. It is the responsibility of users to populate only one or the other. It is also + * critical that the Mapper is set for serialization inclusion.NON_NULL, or both would be sent to Openstack which would + * cause an error. * */ @SuppressWarnings("serial") @@ -41,15 +40,27 @@ import com.fasterxml.jackson.annotation.JsonRootName; @JsonIgnoreProperties(ignoreUnknown = true) public class Network implements Serializable { + @JsonProperty("status") private String status; + @JsonProperty("subnets") private List<String> subnets; + @JsonProperty("availability_zones") + private List<String> availabilityZones; + + @JsonProperty("availability_zone_hints") + private List<String> availabilityZoneHints; + + @JsonProperty("name") private String name; @JsonProperty("admin_state_up") private Boolean adminStateUp; + @JsonProperty("project_id") + private String projectId; + @JsonProperty("tenant_id") private String tenantId; @@ -63,25 +74,57 @@ public class Network implements Serializable { private Integer providerSegmentationId; @JsonProperty("router:external") - private String routerExternal; + private Boolean routerExternal; + + @JsonProperty("ipv6_address_scope") + private String ipv6AddressScope; + + @JsonProperty("ipv4_address_scope") + private String ipv4AddressScope; + + @JsonProperty("revision_number") + private Integer revisionNumber; + + @JsonProperty("port_security_enabled") + private Boolean portSecurityEnabled; + + @JsonProperty("mtu") + private Integer mtu; private String id; - private String shared; - + @JsonProperty("shared") + private Boolean shared; + + @JsonProperty("updated_at") + private Date updatedAt; + + @JsonProperty("created_at") + private Date createdAt; + + @JsonProperty("description") + private String description; + + + + @JsonProperty("is_default") + private Boolean isDefault; + private List<Segment> segments; + @JsonProperty("tags") + private List<String> tags; + /** * @return the status */ - + public String getStatus() { return status; } /** - * @param status - * the status to set + * @param status the status to set */ @JsonProperty public void setStatus(String status) { @@ -91,14 +134,13 @@ public class Network implements Serializable { /** * @return the subnets */ - + public List<String> getSubnets() { return subnets; } /** - * @param subnets - * the subnets to set + * @param subnets the subnets to set */ @JsonProperty public void setSubnets(List<String> subnets) { @@ -113,8 +155,7 @@ public class Network implements Serializable { } /** - * @param name - * the name to set + * @param name the name to set */ public void setName(String name) { this.name = name; @@ -125,18 +166,17 @@ public class Network implements Serializable { * @deprecated */ @Deprecated - + public String getProviderPhyNet() { return getProviderPhysicalNetwork(); } /** - * @param providerPhyNet - * the providerPhyNet to set + * @param providerPhyNet the providerPhyNet to set * @deprecated */ @Deprecated - + public void setProviderPhyNet(String providerPhyNet) { setProviderPhysicalNetwork(providerPhyNet); } @@ -144,7 +184,7 @@ public class Network implements Serializable { /** * @return the adminStateUp */ - + public boolean isAdminStateUp() { return adminStateUp; } @@ -154,8 +194,7 @@ public class Network implements Serializable { } /** - * @param adminStateUp - * the adminStateUp to set + * @param adminStateUp the adminStateUp to set */ public void setAdminStateUp(Boolean adminStateUp) { this.adminStateUp = adminStateUp; @@ -169,8 +208,7 @@ public class Network implements Serializable { } /** - * @param tenantId - * the tenantId to set + * @param tenantId the tenantId to set */ public void setTenantId(String tenantId) { this.tenantId = tenantId; @@ -181,18 +219,17 @@ public class Network implements Serializable { * @deprecated */ @Deprecated - + public String getNetType() { return getProviderNetworkType(); } /** - * @param netType - * the netType to set + * @param netType the netType to set * @deprecated */ @Deprecated - + public void setNetType(String netType) { setProviderNetworkType(netType); } @@ -200,29 +237,27 @@ public class Network implements Serializable { /** * @return the routerExternal */ - public String getRouterExternal() { + public Boolean getRouterExternal() { return routerExternal; } /** - * @param routerExternal - * the routerExternal to set + * @param routerExternal the routerExternal to set */ - public void setRouterExternal(String routerExternal) { + public void setRouterExternal(Boolean routerExternal) { this.routerExternal = routerExternal; } /** * @return the id */ - + public String getId() { return id; } /** - * @param id - * the id to set + * @param id the id to set */ @JsonProperty public void setId(String id) { @@ -232,15 +267,14 @@ public class Network implements Serializable { /** * @return the shared */ - public String getShared() { + public Boolean getShared() { return shared; } /** - * @param shared - * the shared to set + * @param shared the shared to set */ - public void setShared(String shared) { + public void setShared(Boolean shared) { this.shared = shared; } @@ -249,18 +283,17 @@ public class Network implements Serializable { * @deprecated */ @Deprecated - + public String getProviderSegID() { return getProviderSegmentationId() == null ? null : Integer.toString(getProviderSegmentationId()); } /** - * @param providerSegID - * the providerSegID to set + * @param providerSegID the providerSegID to set * @deprecated */ @Deprecated - + public void setProviderSegID(String providerSegID) { setProviderSegmentationId(providerSegID == null ? null : Integer.parseInt(providerSegID)); } @@ -300,10 +333,12 @@ public class Network implements Serializable { /** * Function to detect and return the network type */ - public enum NetworkType { BASIC, PROVIDER, MULTI_PROVIDER }; - - - public NetworkType getNetworkType () { + public enum NetworkType { + BASIC, PROVIDER, MULTI_PROVIDER + }; + + + public NetworkType getNetworkType() { if (segments != null) return NetworkType.MULTI_PROVIDER; else if (providerNetworkType != null) @@ -319,19 +354,18 @@ public class Network implements Serializable { */ @Override public String toString() { - StringBuilder buf = new StringBuilder("Network [id=" + id + ", name=" + name + ", subnets=" - + subnets + ", status=" + status + ", admin_state_up=" + adminStateUp + ", tenant_id=" + - tenantId + ", shared=" + shared + ", router:external=" + routerExternal); + StringBuilder buf = new StringBuilder("Network [id=" + id + ", name=" + name + ", subnets=" + subnets + + ", status=" + status + ", admin_state_up=" + adminStateUp + ", tenant_id=" + tenantId + ", shared=" + + shared + ", router:external=" + routerExternal); if (getNetworkType() == NetworkType.PROVIDER) - buf.append (", provider:physical_network=" + providerPhysicalNetwork + - ", provider:network_type=" + providerNetworkType + - ", provider:segmentation_id=" + providerSegmentationId); + buf.append(", provider:physical_network=" + providerPhysicalNetwork + ", provider:network_type=" + + providerNetworkType + ", provider:segmentation_id=" + providerSegmentationId); if (getNetworkType() == NetworkType.MULTI_PROVIDER) { - buf.append (", segments: "); + buf.append(", segments: "); for (Segment s : segments) - buf.append (s.toString()).append(" "); + buf.append(s.toString()).append(" "); } - buf.append ("]"); + buf.append("]"); return buf.toString(); } } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Networks.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Networks.java index 3bf24c3..f0473a7 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Networks.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Networks.java @@ -19,14 +19,24 @@ package com.woorea.openstack.quantum.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; -public class Networks implements Iterable<Network>, Serializable{ - +public class Networks implements Iterable<Network>, Serializable { + @JsonProperty("networks") private List<Network> list; + @JsonProperty("networks_links") + private List<Link> links; + + public List<Link> getLinks() { + return links; + } + + public void setLinks(List<Link> links) { + this.links = links; + } + /** * @return the list */ @@ -51,5 +61,5 @@ public class Networks implements Iterable<Network>, Serializable{ public Iterator<Network> iterator() { return list.iterator(); } - + } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/NeutronError.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/NeutronError.java index fda8da1..ad5f109 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/NeutronError.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/NeutronError.java @@ -17,18 +17,17 @@ package com.woorea.openstack.quantum.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("NeutronError") public class NeutronError implements Serializable { private String type; - + private String message; private String detail; - + /** * @return the code */ @@ -50,13 +49,14 @@ public class NeutronError implements Serializable { return detail; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "NeutronError [type=" + type + ", title=" + detail + ", message=" - + message + "]"; + return "NeutronError [type=" + type + ", title=" + detail + ", message=" + message + "]"; } - + } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Pool.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Pool.java index a7ce888..2d1b019 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Pool.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Pool.java @@ -18,39 +18,42 @@ package com.woorea.openstack.quantum.model; import java.io.Serializable; -public class Pool implements Serializable{ - +public class Pool implements Serializable { + private String start; private String end; - + /** * @return the start */ public String getStart() { return start; } + /** * @param start the start to set */ public void setStart(String start) { this.start = start; } + /** * @return the end */ public String getEnd() { return end; } + /** * @param end the end to set */ public void setEnd(String end) { this.end = end; } - + @Override public String toString() { return "Allocation_pool [start=" + start + ", end=" + end + "]"; } - + } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Port.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Port.java index 1951a60..2fc6b21 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Port.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Port.java @@ -19,7 +19,6 @@ package com.woorea.openstack.quantum.model; import java.io.Serializable; import java.util.List; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; @@ -47,8 +46,7 @@ public class Port implements Serializable { } /** - * @param address - * the address to set + * @param address the address to set */ public void setAddress(String address) { this.address = address; @@ -62,8 +60,7 @@ public class Port implements Serializable { } /** - * @param subnetId - * the subnetId to set + * @param subnetId the subnetId to set */ public void setSubnetId(String subnetId) { this.subnetId = subnetId; @@ -151,11 +148,8 @@ public class Port implements Serializable { @Override public String toString() { - return "Binding [hostId=" + hostId - + ", vifType=" + vifType + - ", vnicType=" + vnicType + - ", vifDetails=" + vifDetails + - ", profile=" + profile + "]"; + return "Binding [hostId=" + hostId + ", vifType=" + vifType + ", vnicType=" + vnicType + ", vifDetails=" + + vifDetails + ", profile=" + profile + "]"; } } @@ -190,7 +184,7 @@ public class Port implements Serializable { private List<String> securityGroups; @JsonUnwrapped - private Binding binding; + private Binding binding; /** * @return the adminStateUp @@ -200,8 +194,7 @@ public class Port implements Serializable { } /** - * @param adminStateUp - * the adminStateUp to set + * @param adminStateUp the adminStateUp to set */ public void setAdminStateUp(Boolean adminStateUp) { this.adminStateUp = adminStateUp; @@ -215,8 +208,7 @@ public class Port implements Serializable { } /** - * @param deviceId - * the deviceId to set + * @param deviceId the deviceId to set */ public void setDeviceId(String deviceId) { this.deviceId = deviceId; @@ -230,8 +222,7 @@ public class Port implements Serializable { } /** - * @param deviceOwner - * the deviceOwner to set + * @param deviceOwner the deviceOwner to set */ public void setDeviceOwner(String deviceOwner) { this.deviceOwner = deviceOwner; @@ -245,8 +236,7 @@ public class Port implements Serializable { } /** - * @param list - * the list to set + * @param list the list to set */ public void setList(List<Ip> list) { this.list = list; @@ -261,8 +251,7 @@ public class Port implements Serializable { } /** - * @param id - * the id to set + * @param id the id to set */ @JsonProperty public void setId(String id) { @@ -277,8 +266,7 @@ public class Port implements Serializable { } /** - * @param macAddress - * the macAddress to set + * @param macAddress the macAddress to set */ public void setMacAddress(String macAddress) { this.macAddress = macAddress; @@ -292,8 +280,7 @@ public class Port implements Serializable { } /** - * @param name - * the name to set + * @param name the name to set */ public void setName(String name) { this.name = name; @@ -307,8 +294,7 @@ public class Port implements Serializable { } /** - * @param networkId - * the networkId to set + * @param networkId the networkId to set */ public void setNetworkId(String networkId) { this.networkId = networkId; @@ -323,8 +309,7 @@ public class Port implements Serializable { } /** - * @param status - * the status to set + * @param status the status to set */ @JsonProperty public void setStatus(String status) { @@ -339,8 +324,7 @@ public class Port implements Serializable { } /** - * @param tenantId - * the tenantId to set + * @param tenantId the tenantId to set */ public void setTenantId(String tenantId) { this.tenantId = tenantId; @@ -354,8 +338,7 @@ public class Port implements Serializable { } /** - * @param securityGroups - * IDs of security groups to associate to the port + * @param securityGroups IDs of security groups to associate to the port */ public void setSecurityGroups(List<String> securityGroups) { this.securityGroups = securityGroups; @@ -369,8 +352,7 @@ public class Port implements Serializable { } /** - * @param binding - * The port bindings by which the port is bind to network on host + * @param binding The port bindings by which the port is bind to network on host */ public void setBinding(Binding binding) { this.binding = binding; @@ -378,12 +360,9 @@ public class Port implements Serializable { @Override public String toString() { - return "Port [id=" + id + ", name=" + name + ", mac_address=" - + macAddress + ", admin_state_up=" + adminStateUp + ", device_id=" + deviceId - + ", device_owner=" + deviceOwner + ", fixed_ips=" + list - + ", network_id=" + networkId + ", status=" + status - + ", tenant_id=" + tenantId - + ", securityGroups=" + securityGroups + return "Port [id=" + id + ", name=" + name + ", mac_address=" + macAddress + ", admin_state_up=" + adminStateUp + + ", device_id=" + deviceId + ", device_owner=" + deviceOwner + ", fixed_ips=" + list + ", network_id=" + + networkId + ", status=" + status + ", tenant_id=" + tenantId + ", securityGroups=" + securityGroups + ", binding=" + binding + "]"; } -}
\ No newline at end of file +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Ports.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Ports.java index eeb4c64..a32e993 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Ports.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Ports.java @@ -19,7 +19,6 @@ package com.woorea.openstack.quantum.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; @SuppressWarnings("serial") @@ -36,8 +35,7 @@ public class Ports implements Iterable<Port>, Serializable { } /** - * @param list - * the list to set + * @param list the list to set */ public void setList(List<Port> list) { this.list = list; diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Router.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Router.java index d180a12..05c622a 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Router.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Router.java @@ -17,10 +17,8 @@ package com.woorea.openstack.quantum.model; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; - import java.io.Serializable; @JsonRootName("router") @@ -50,45 +48,58 @@ public class Router implements Serializable { public String getName() { return name; } + public void setName(String name) { this.name = name; } + public List<HostRoute> getRoutes() { return routes; } + public void setRoutes(List<HostRoute> routes) { this.routes = routes; } + public String getAdminStateUp() { return adminStateUp; } + public void setAdminStateUp(String adminStateUp) { this.adminStateUp = adminStateUp; } + public String getStatus() { return status; } + public void setStatus(String status) { this.status = status; } + public GatewayInfo getExternalGatewayInfo() { return externalGatewayInfo; } + public void setExternalGatewayInfo(GatewayInfo externalGatewayInfo) { this.externalGatewayInfo = externalGatewayInfo; } + public String getTenantId() { return tenantId; } + public void setTenantId(String tenantId) { this.tenantId = tenantId; } + public String getId() { return id; } + public void setId(String id) { this.id = id; } - + } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForAddInterface.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForAddInterface.java index 04d99cb..9b6f918 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForAddInterface.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForAddInterface.java @@ -17,28 +17,27 @@ package com.woorea.openstack.quantum.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; public class RouterForAddInterface implements Serializable { - @JsonProperty("subnet_id") - String subnetId; - String routerId; + @JsonProperty("subnet_id") + String subnetId; + String routerId; - public String getSubnetId() { - return subnetId; - } + public String getSubnetId() { + return subnetId; + } - public void setSubnetId(String subnetId) { - this.subnetId = subnetId; - } + public void setSubnetId(String subnetId) { + this.subnetId = subnetId; + } - public String getRouterId() { - return routerId; - } + public String getRouterId() { + return routerId; + } - public void setRouterId(String routerId) { - this.routerId = routerId; - } + public void setRouterId(String routerId) { + this.routerId = routerId; } +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForCreate.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForCreate.java index 6f5ddae..ec3bdd4 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForCreate.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterForCreate.java @@ -17,10 +17,8 @@ package com.woorea.openstack.quantum.model; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; - import java.io.Serializable; @JsonRootName("router") @@ -49,15 +47,19 @@ public class RouterForCreate implements Serializable { public String getName() { return name; } + public void setName(String name) { this.name = name; } + public List<HostRoute> getRoutes() { return routes; } + public void setRoutes(List<HostRoute> routes) { this.routes = routes; } + public String getAdminStateUp() { return adminStateUp; } @@ -65,29 +67,37 @@ public class RouterForCreate implements Serializable { public void setAdminStateUp(String adminStateUp) { this.adminStateUp = adminStateUp; } + public String getStatus() { return status; } + public void setStatus(String status) { this.status = status; } + public GatewayInfo getExternalGatewayInfo() { return externalGatewayInfo; } + public void setExternalGatewayInfo(GatewayInfo externalGatewayInfo) { this.externalGatewayInfo = externalGatewayInfo; } + public String getTenantId() { return tenantId; } + public void setTenantId(String tenantId) { this.tenantId = tenantId; } + public String getId() { return id; } + public void setId(String id) { this.id = id; } - + } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterInterface.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterInterface.java index 42cca03..bfa9902 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterInterface.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/RouterInterface.java @@ -17,7 +17,6 @@ package com.woorea.openstack.quantum.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; public class RouterInterface implements Serializable { diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Routers.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Routers.java index 370b77d..13ca024 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Routers.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Routers.java @@ -19,11 +19,10 @@ package com.woorea.openstack.quantum.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; -public class Routers implements Iterable<Router>, Serializable{ - +public class Routers implements Iterable<Router>, Serializable { + @JsonProperty("routers") private List<Router> list; @@ -51,5 +50,5 @@ public class Routers implements Iterable<Router>, Serializable{ public Iterator<Router> iterator() { return list.iterator(); } - + } diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Segment.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Segment.java index 25e27c3..a15a651 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Segment.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Segment.java @@ -17,7 +17,6 @@ package com.woorea.openstack.quantum.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; @@ -65,8 +64,7 @@ public class Segment implements Serializable { */ @Override public String toString() { - return "Segment [ provider:physical_network=" + providerPhysicalNetwork + - ", provider:network_type=" + providerNetworkType + - ", provider:segmentation_id=" + providerSegmentationId + "]"; + return "Segment [ provider:physical_network=" + providerPhysicalNetwork + ", provider:network_type=" + + providerNetworkType + ", provider:segmentation_id=" + providerSegmentationId + "]"; } -}
\ No newline at end of file +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnet.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnet.java index a2319d4..f47f25d 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnet.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnet.java @@ -17,8 +17,8 @@ package com.woorea.openstack.quantum.model; import java.io.Serializable; +import java.util.Date; import java.util.List; - import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @@ -31,6 +31,7 @@ import com.fasterxml.jackson.annotation.JsonValue; @JsonIgnoreProperties(ignoreUnknown = true) public class Subnet implements Serializable { + @JsonProperty("name") private String name; @JsonProperty("enable_dhcp") @@ -42,6 +43,9 @@ public class Subnet implements Serializable { @JsonProperty("tenant_id") private String tenantId; + @JsonProperty("project_id") + private String projectId; + @JsonProperty("dns_nameservers") private List<String> dnsNames; @@ -51,19 +55,35 @@ public class Subnet implements Serializable { @JsonProperty("host_routes") private List<String> hostRoutes; + @JsonProperty("service_types") + private List<String> serviceTypes; + @JsonProperty("ip_version") private IpVersion ipversion; + @JsonProperty("ipv6_address_mode") + private String ipv6AddressMode; + + @JsonProperty("ipv6_ra_mode") + private String ipv6RAMode; + @JsonProperty("gateway_ip") private String gw; + @JsonProperty("cidr") private String cidr; + @JsonProperty("created_at") + private Date createdAt; + + @JsonProperty("updated_at") + private Date updatedAt; + + @JsonProperty("id") private String id; public enum IpVersion implements Serializable { - IPV4(4), - IPV6(6); + IPV4(4), IPV6(6); private int code; IpVersion(int code) { @@ -99,8 +119,7 @@ public class Subnet implements Serializable { } /** - * @param name - * the name to set + * @param name the name to set */ public void setName(String name) { this.name = name; @@ -109,7 +128,6 @@ public class Subnet implements Serializable { /** * @return the enableDHCP */ - @JsonIgnore public boolean isEnableDHCP() { return enableDHCP; } @@ -119,8 +137,7 @@ public class Subnet implements Serializable { } /** - * @param enableDHCP - * the enableDHCP to set + * @param enableDHCP the enableDHCP to set */ public void setEnableDHCP(Boolean enableDHCP) { this.enableDHCP = enableDHCP; @@ -134,8 +151,7 @@ public class Subnet implements Serializable { } /** - * @param networkId - * the networkId to set + * @param networkId the networkId to set */ public void setNetworkId(String networkId) { this.networkId = networkId; @@ -149,8 +165,7 @@ public class Subnet implements Serializable { } /** - * @param tenantId - * the tenantId to set + * @param tenantId the tenantId to set */ public void setTenantId(String tenantId) { this.tenantId = tenantId; @@ -164,8 +179,7 @@ public class Subnet implements Serializable { } /** - * @param dnsNames - * the dnsNames to set + * @param dnsNames the dnsNames to set */ public void setDnsNames(List<String> dnsNames) { this.dnsNames = dnsNames; @@ -179,8 +193,7 @@ public class Subnet implements Serializable { } /** - * @param list - * the list to set + * @param list the list to set */ public void setList(List<Pool> list) { this.list = list; @@ -194,8 +207,7 @@ public class Subnet implements Serializable { } /** - * @param hostRoutes - * the hostRoutes to set + * @param hostRoutes the hostRoutes to set */ public void setHostRoutes(List<String> hostRoutes) { this.hostRoutes = hostRoutes; @@ -209,8 +221,7 @@ public class Subnet implements Serializable { } /** - * @param ipversion - * the ipversion to set + * @param ipversion the ipversion to set */ public void setIpversion(IpVersion ipversion) { this.ipversion = ipversion; @@ -224,8 +235,7 @@ public class Subnet implements Serializable { } /** - * @param gw - * the gw to set + * @param gw the gw to set */ public void setGw(String gw) { this.gw = gw; @@ -239,8 +249,7 @@ public class Subnet implements Serializable { } /** - * @param cidr - * the cidr to set + * @param cidr the cidr to set */ public void setCidr(String cidr) { this.cidr = cidr; @@ -249,14 +258,12 @@ public class Subnet implements Serializable { /** * @return the id */ - @JsonIgnore public String getId() { return id; } /** - * @param id - * the id to set + * @param id the id to set */ @JsonProperty public void setId(String id) { @@ -270,11 +277,9 @@ public class Subnet implements Serializable { */ @Override public String toString() { - return "Subnet [id=" + id + ", name=" + name + ", network_id=" - + networkId + ", tenant_id=" + tenantId + ", allocation_pools=" + list - + ", gateway_ip=" + gw + ", ip_version=" + ipversion - + ", cidr=" + cidr + ", enable_dhcp=" + enableDHCP + ", dns_nameservers=" - + dnsNames + ", host_routes=" + hostRoutes + "]"; + return "Subnet [id=" + id + ", name=" + name + ", network_id=" + networkId + ", tenant_id=" + tenantId + + ", allocation_pools=" + list + ", gateway_ip=" + gw + ", ip_version=" + ipversion + ", cidr=" + cidr + + ", enable_dhcp=" + enableDHCP + ", dns_nameservers=" + dnsNames + ", host_routes=" + hostRoutes + "]"; } -}
\ No newline at end of file +} diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/SubnetForCreate.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/SubnetForCreate.java index 34820aa..f5987a6 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/SubnetForCreate.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/SubnetForCreate.java @@ -21,6 +21,7 @@ import com.fasterxml.jackson.annotation.JsonRootName; /** * Please use {@link Subnet} directly. + * * @Deprecated */ @SuppressWarnings("serial") @@ -39,8 +40,7 @@ public class SubnetForCreate extends Subnet { } /** - * @param ipVersion - * the ipVersion to set + * @param ipVersion the ipVersion to set * @deprecated */ @Deprecated diff --git a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnets.java b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnets.java index 0faef86..e02c224 100644 --- a/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnets.java +++ b/quantum-model/src/main/java/com/woorea/openstack/quantum/model/Subnets.java @@ -19,14 +19,13 @@ package com.woorea.openstack.quantum.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Subnets implements Serializable, Iterable<Subnet> { - + @JsonProperty("subnets") private List<Subnet> list; - + /** * @return the list */ @@ -45,7 +44,7 @@ public class Subnets implements Serializable, Iterable<Subnet> { public String toString() { return "Subnets [list=" + list + "]"; } - + @Override public Iterator<Subnet> iterator() { return list.iterator(); 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); |