diff options
author | Smokowski, Steve (ss835w) <ss835w@us.att.com> | 2019-05-02 09:42:55 -0400 |
---|---|---|
committer | Smokowski, Steve (ss835w) <ss835w@us.att.com> | 2019-05-07 10:02:17 -0400 |
commit | 3f9a0c3183480d150089c0d5a6e507c877f7d121 (patch) | |
tree | b3db04cbe2cef23f81503177a50edc5360ffa486 /nova-model | |
parent | e153f0adfbed711ce1e215748594a4d04fd1edaf (diff) |
Enhance Openstack Client
Update Openstack Client to support additional fields
Updat all formatting issues
Issue-ID: SO-1844
Change-Id: I1369e0c18cc25274db8df7e12855a020b8da38da
Signed-off-by: Smokowski, Steve (ss835w) <ss835w@us.att.com>
Diffstat (limited to 'nova-model')
143 files changed, 2144 insertions, 3373 deletions
diff --git a/nova-model/pom.xml b/nova-model/pom.xml index 216b507..1de4ff3 100644 --- a/nova-model/pom.xml +++ b/nova-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>nova-model</artifactId> - <name>OpenStack Nova Model</name> - <description>OpenStack Nova 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>nova-model</artifactId> + <name>OpenStack Nova Model</name> + <description>OpenStack Nova 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/nova-model/src/main/java/com/woorea/openstack/nova/model/Certificate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Certificate.java index 5ff1a2b..41a1d81 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Certificate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Certificate.java @@ -23,7 +23,7 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class Certificate { private String data; - + @JsonProperty("private_key") private String privateKey; @@ -41,12 +41,14 @@ public class Certificate { return privateKey; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { return "Certificate [data=" + data + ", privateKey=" + privateKey + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipe.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipe.java index 205816f..5da3ffb 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipe.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipe.java @@ -18,24 +18,23 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Calendar; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("cloudpipe") public class Cloudpipe implements Serializable { - + private String projectId; - + private String internalIp; - + private String publicIp; - + private String publicPort; - + private String state; - + private String instanceId; - + private Calendar createdAt; /** @@ -136,15 +135,16 @@ public class Cloudpipe implements Serializable { this.createdAt = createdAt; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "CloudPipe [projectId=" + projectId + ", internalIp=" - + internalIp + ", publicIp=" + publicIp + ", publicPort=" - + publicPort + ", state=" + state + ", instanceId=" - + instanceId + ", createdAt=" + createdAt + "]"; + return "CloudPipe [projectId=" + projectId + ", internalIp=" + internalIp + ", publicIp=" + publicIp + + ", publicPort=" + publicPort + ", state=" + state + ", instanceId=" + instanceId + ", createdAt=" + + createdAt + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipes.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipes.java index 09e02e0..4218a88 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipes.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Cloudpipes.java @@ -18,7 +18,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Cloudpipes implements Serializable { @@ -32,13 +31,15 @@ public class Cloudpipes implements Serializable { public List<Cloudpipe> getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { return "Flavors [list=" + list + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Extension.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Extension.java index 89b1121..8f9b653 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Extension.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Extension.java @@ -19,22 +19,21 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Calendar; import java.util.List; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("extension") public class Extension implements Serializable { private String alias; - + private String description; - + private String name; - + private String namespace; - + private Calendar updated; - + private List<Link> links; /** @@ -79,13 +78,15 @@ public class Extension implements Serializable { return links; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Extension [alias=" + alias + ", description=" + description - + ", name=" + name + ", namespace=" + namespace + "]"; + return "Extension [alias=" + alias + ", description=" + description + ", name=" + name + ", namespace=" + + namespace + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Extensions.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Extensions.java index ce13b14..d904ad3 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Extensions.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Extensions.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Extensions implements Iterable<Extension>, Serializable { @@ -33,13 +32,15 @@ public class Extensions implements Iterable<Extension>, Serializable { public List<Extension> getList() { return list; } - + @Override public Iterator<Extension> iterator() { return list.iterator(); } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavor.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavor.java index 00740f4..4b42d62 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavor.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavor.java @@ -18,42 +18,47 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("flavor") public class Flavor implements Serializable { + @JsonProperty("id") private String id; - + + @JsonProperty("name") private String name; - + + @JsonProperty("vcpus") private Integer vcpus; - + + @JsonProperty("ram") private Integer ram; - + + @JsonProperty("disk") private Integer disk; - + @JsonProperty("OS-FLV-EXT-DATA:ephemeral") private Integer ephemeral; - + + @JsonProperty("swap") private String swap; - + @JsonProperty("rxtx_factor") private Float rxtxFactor; - + @JsonProperty("OS-FLV-DISABLED:disabled") private Boolean disabled; - + @JsonProperty("rxtx_quota") private Integer rxtxQuota; - + @JsonProperty("rxtx_cap") private Integer rxtxCap; - + private List<Link> links; - + @JsonProperty("os-flavor-access:is_public") private Boolean isPublic; @@ -210,7 +215,7 @@ public class Flavor implements Serializable { public void setDisabled(Boolean disabled) { this.disabled = disabled; } - + /** * @return the isPublic */ @@ -239,17 +244,17 @@ public class Flavor implements Serializable { this.links = links; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Flavor [id=" + id + ", name=" + name + ", vcpus=" + vcpus - + ", ram=" + ram + ", disk=" + disk + ", ephemeral=" - + ephemeral + ", swap=" + swap + ", rxtxFactor=" + rxtxFactor - + ", disabled=" + disabled + ", rxtxQuota=" + rxtxQuota - + ", rxtxCap=" + rxtxCap + ", links=" + links + ", isPublic=" + return "Flavor [id=" + id + ", name=" + name + ", vcpus=" + vcpus + ", ram=" + ram + ", disk=" + disk + + ", ephemeral=" + ephemeral + ", swap=" + swap + ", rxtxFactor=" + rxtxFactor + ", disabled=" + + disabled + ", rxtxQuota=" + rxtxQuota + ", rxtxCap=" + rxtxCap + ", links=" + links + ", isPublic=" + isPublic + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/FlavorForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/FlavorForCreate.java index a971f6f..b0fd8a1 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/FlavorForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/FlavorForCreate.java @@ -22,22 +22,22 @@ import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("flavor") public class FlavorForCreate implements Serializable { - + private String id; - + private String name; - + private String vcpus; - + private Integer ram; - + private String disk; - + @JsonProperty("OS-FLV-EXT-DATA:ephemeral") private Integer ephemeral; - + private String swap; - + @JsonProperty("rxtx_factor") private Float rxtxFactor; @@ -152,5 +152,5 @@ public class FlavorForCreate implements Serializable { public void setRxtxFactor(Float rxtxFactor) { this.rxtxFactor = rxtxFactor; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavors.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavors.java index 95decf4..e02a0d5 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavors.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Flavors.java @@ -19,27 +19,32 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; + public class Flavors implements Iterable<Flavor>, Serializable { @JsonProperty("flavors") private List<Flavor> list; + @JsonProperty("flavors_links") + private List<Link> links; + /** * @return the list */ public List<Flavor> getList() { return list; } - + @Override public Iterator<Flavor> iterator() { return list.iterator(); } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIp.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIp.java index 990b980..d319385 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIp.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIp.java @@ -17,7 +17,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -25,14 +24,14 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class FloatingIp implements Serializable { private String id; - + private String pool; - + private String ip; - + @JsonProperty("fixed_ip") private String fixedIp; - + @JsonProperty("instance_id") private String instanceId; @@ -71,13 +70,15 @@ public class FloatingIp implements Serializable { return instanceId; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "FloatingIp [id=" + id + ", pool=" + pool + ", ip=" + ip - + ", fixedIp=" + fixedIp + ", instanceId=" + instanceId + "]"; + return "FloatingIp [id=" + id + ", pool=" + pool + ", ip=" + ip + ", fixedIp=" + fixedIp + ", instanceId=" + + instanceId + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomain.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomain.java index 5f134c2..71f1860 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomain.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomain.java @@ -17,7 +17,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -25,11 +24,11 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class FloatingIpDomain implements Serializable { private String domain; - + private String scope; - + private String project; - + @JsonProperty("availabilityZone") private String availabilityZone; @@ -61,14 +60,15 @@ public class FloatingIpDomain implements Serializable { return availabilityZone; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "FloatingIpDomain [domain=" + domain + ", scope=" + scope - + ", project=" + project + ", availabilityZone=" - + availabilityZone + "]"; + return "FloatingIpDomain [domain=" + domain + ", scope=" + scope + ", project=" + project + + ", availabilityZone=" + availabilityZone + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomains.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomains.java index 45c7f6e..d156dd0 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomains.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpDomains.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class FloatingIpDomains implements Iterable<FloatingIpDomain>, Serializable { @@ -39,12 +38,14 @@ public class FloatingIpDomains implements Iterable<FloatingIpDomain>, Serializab return list.iterator(); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { return "FloatingIpDomains [list=" + list + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpPools.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpPools.java index 451bd03..9a0eb90 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpPools.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIpPools.java @@ -19,12 +19,11 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; import com.woorea.openstack.nova.model.FloatingIpPools.FloatingIpPool; public class FloatingIpPools implements Iterable<FloatingIpPool>, Serializable { - + public static class FloatingIpPool implements Serializable { private String name; @@ -36,14 +35,16 @@ public class FloatingIpPools implements Iterable<FloatingIpPool>, Serializable { return name; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { return "FloatingIpPool [name=" + name + "]"; } - + } @JsonProperty("floating_ip_pools") @@ -55,13 +56,15 @@ public class FloatingIpPools implements Iterable<FloatingIpPool>, Serializable { public List<FloatingIpPool> getList() { return list; } - + @Override public Iterator<FloatingIpPool> iterator() { return list.iterator(); } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIps.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIps.java index 58eb173..6ac0c71 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIps.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/FloatingIps.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class FloatingIps implements Iterable<FloatingIp>, Serializable { @@ -33,8 +32,10 @@ public class FloatingIps implements Iterable<FloatingIp>, Serializable { public List<FloatingIp> getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class FloatingIps implements Iterable<FloatingIp>, Serializable { public Iterator<FloatingIp> iterator() { return list.iterator(); } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Host.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Host.java index c41eb65..812d02e 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Host.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Host.java @@ -18,24 +18,23 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Host implements Serializable { - + public static final class ResourceWrapper implements Serializable { - + public static final class Resource implements Serializable { - + private String project; - + @JsonProperty("memory_mb") private Integer memoryMb; - + private String host; - + private Integer cpu; - + @JsonProperty("disk_gb") private Integer diskGb; @@ -74,18 +73,19 @@ public class Host implements Serializable { return diskGb; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Resource [project=" + project + ", memoryMb=" - + memoryMb + ", host=" + host + ", cpu=" + cpu + return "Resource [project=" + project + ", memoryMb=" + memoryMb + ", host=" + host + ", cpu=" + cpu + ", diskGb=" + diskGb + "]"; } - + } - + private Resource resource; /** @@ -95,14 +95,16 @@ public class Host implements Serializable { return resource; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { return "ResourceWrapper [resource=" + resource + "]"; } - + } private List<ResourceWrapper> host; @@ -114,12 +116,14 @@ public class Host implements Serializable { return host; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { return "Host [host=" + host + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregate.java index d08c7f0..341f283 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregate.java @@ -19,39 +19,40 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.List; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("aggregate") public class HostAggregate implements Serializable { - - private String id; + @JsonProperty("id") + private Integer id; + + @JsonProperty("name") private String name; - + @JsonProperty("availability_zone") private String availabilityZone; - + @JsonProperty("created_at") private String createdAt; - + @JsonProperty("updated_at") private String updatedAt; - + @JsonProperty("deleted_at") private String deletedAt; - + private Boolean deleted; - + private List<String> hosts; - + private Map<String, String> metadata; /** * @return the id */ - public String getId() { + public Integer getId() { return id; } @@ -111,16 +112,16 @@ public class HostAggregate implements Serializable { return metadata; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "HostAggregate [id=" + id + ", name=" + name - + ", availabilityZone=" + availabilityZone + ", createdAt=" - + createdAt + ", updatedAt=" + updatedAt + ", deletedAt=" - + deletedAt + ", deleted=" + deleted + ", hosts=" + hosts - + ", metadata=" + metadata + "]"; + return "HostAggregate [id=" + id + ", name=" + name + ", availabilityZone=" + availabilityZone + ", createdAt=" + + createdAt + ", updatedAt=" + updatedAt + ", deletedAt=" + deletedAt + ", deleted=" + deleted + + ", hosts=" + hosts + ", metadata=" + metadata + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregates.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregates.java index fd83d16..5dc88b3 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregates.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/HostAggregates.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class HostAggregates implements Iterable<HostAggregate>, Serializable { @@ -33,13 +32,15 @@ public class HostAggregates implements Iterable<HostAggregate>, Serializable { public List<HostAggregate> getList() { return list; } - + @Override public Iterator<HostAggregate> iterator() { return list.iterator(); } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Hosts.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Hosts.java index 1cdf0ae..67d78c8 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Hosts.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Hosts.java @@ -19,18 +19,17 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Hosts implements Iterable<Hosts.Host>, Serializable { - + public static final class Host { - + private String zone; - + @JsonProperty("host_name") private String hostName; - + private String service; /** @@ -46,7 +45,7 @@ public class Hosts implements Iterable<Hosts.Host>, Serializable { public String getService() { return service; } - + public String getZone() { return zone; } @@ -55,14 +54,16 @@ public class Hosts implements Iterable<Hosts.Host>, Serializable { this.zone = zone; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { return "Host [hostName=" + hostName + ", service=" + service + "]"; } - + } @JsonProperty("hosts") @@ -74,13 +75,15 @@ public class Hosts implements Iterable<Hosts.Host>, Serializable { public List<Host> getList() { return list; } - + @Override public Iterator<Hosts.Host> iterator() { return list.iterator(); } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -88,6 +91,6 @@ public class Hosts implements Iterable<Hosts.Host>, Serializable { return "Hosts [list=" + list + "]"; } - - + + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Image.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Image.java index e29f961..7aac87c 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Image.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Image.java @@ -20,63 +20,62 @@ import java.io.Serializable; import java.util.Calendar; import java.util.List; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("image") public class Image implements Serializable { - + public static final class Server implements Serializable { - + private String id; - + private List<Link> links; - + /** * @return the id */ public String getId() { return id; } - + /** * @return the links */ public List<Link> getLinks() { return links; } - + @Override public String toString() { return "Server [id=" + id + ", links=" + links + "]"; } - + } private String id; - + private String status; - + private String name; - + private Integer progress; - + private Integer minRam; - + private Integer minDisk; - + private Calendar created; - + private Calendar updated; - + @JsonProperty("OS-EXT-IMG-SIZE:size") private Long size; - + private Map<String, String> metadata; - + private Server server; - + private List<Link> links; /** @@ -211,7 +210,7 @@ public class Image implements Serializable { public void setMetadata(Map<String, String> metadata) { this.metadata = metadata; } - + /** * @return the server */ @@ -233,16 +232,17 @@ public class Image implements Serializable { this.links = links; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Image [id=" + id + ", status=" + status + ", name=" + name - + ", progress=" + progress + ", minRam=" + minRam - + ", minDisk=" + minDisk + ", created=" + (created != null ? created.getTime() : null) + return "Image [id=" + id + ", status=" + status + ", name=" + name + ", progress=" + progress + ", minRam=" + + minRam + ", minDisk=" + minDisk + ", created=" + (created != null ? created.getTime() : null) + ", updated=" + (updated != null ? updated.getTime() : null) + ", size=" + size + ", metadata=" - + metadata + ", server="+server+", links=" + links + "]"; + + metadata + ", server=" + server + ", links=" + links + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/ImageFromVolume.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/ImageFromVolume.java index 9191fa3..38cba08 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/ImageFromVolume.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/ImageFromVolume.java @@ -17,7 +17,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Images.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Images.java index 2d2ec5d..912f9d7 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Images.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Images.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Images implements Iterable<Image>, Serializable { @@ -33,14 +32,16 @@ public class Images implements Iterable<Image>, Serializable { public List<Image> getList() { return list; } - + @Override public Iterator<Image> iterator() { return list.iterator(); } - - - /* (non-Javadoc) + + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPair.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPair.java index fb1a1e1..2824850 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPair.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPair.java @@ -17,7 +17,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -25,26 +24,26 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class KeyPair implements Serializable { private String name; - + @JsonProperty("user_id") private String userId; - + @JsonProperty("public_key") private String publicKey; - + @JsonProperty("private_key") private String privateKey; - + private String fingerprint; public KeyPair() { super(); } - + public KeyPair(String name) { this.name = name; } - + public KeyPair(String name, String publicKey) { this(name); this.publicKey = publicKey; @@ -99,16 +98,17 @@ public class KeyPair implements Serializable { return fingerprint; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "KeyPair [name=" + name + ", userId=" + userId + ", publicKey=" - + publicKey + ", privateKey=" + privateKey + ", fingerprint=" - + fingerprint + "]"; + return "KeyPair [name=" + name + ", userId=" + userId + ", publicKey=" + publicKey + ", privateKey=" + + privateKey + ", fingerprint=" + fingerprint + "]"; } - - + + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPairs.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPairs.java index 2095a73..a6e78f2 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPairs.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/KeyPairs.java @@ -20,16 +20,15 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class KeyPairs implements Iterable<KeyPair>, Serializable { - + public static final class KeyPairWrapper implements Serializable { - + @JsonProperty private KeyPair keypair; - + } @JsonProperty("keypairs") @@ -40,18 +39,20 @@ public class KeyPairs implements Iterable<KeyPair>, Serializable { */ public List<KeyPair> getList() { List<KeyPair> keyPairList = new ArrayList<>(); - for(KeyPairWrapper wrapper : this.list) { + for (KeyPairWrapper wrapper : this.list) { keyPairList.add(wrapper.keypair); } return keyPairList; } - + @Override public Iterator<KeyPair> iterator() { return getList().iterator(); } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Limits.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Limits.java index fd1d113..a5177c4 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Limits.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Limits.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Calendar; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -92,9 +91,8 @@ public class Limits implements Serializable { */ @Override public String toString() { - return "LimitEntry [nextAvailable=" + nextAvailable + ", unit=" - + unit + ", verb=" + verb + ", remaining=" + remaining - + ", available=" + available + ", value=" + value + "]"; + return "LimitEntry [nextAvailable=" + nextAvailable + ", unit=" + unit + ", verb=" + verb + + ", remaining=" + remaining + ", available=" + available + ", value=" + value + "]"; } } @@ -133,8 +131,7 @@ public class Limits implements Serializable { */ @Override public String toString() { - return "RateLimit [regex=" + regex + ", uri=" + uri + ", limit=" - + limit + "]"; + return "RateLimit [regex=" + regex + ", uri=" + uri + ", limit=" + limit + "]"; } } @@ -242,7 +239,7 @@ public class Limits implements Serializable { public Integer getMaxSecurityGroupRules() { return maxSecurityGroupRules; } - + /** * @return the maxTotalKeypairs */ @@ -284,7 +281,7 @@ public class Limits implements Serializable { public Integer getMaxSecurityGroups() { return maxSecurityGroups; } - + /** * @return the totalVolumeGigabytesUsed */ @@ -369,11 +366,9 @@ public class Limits implements Serializable { */ @Override public String toString() { - return "AbsoluteLimit [maxServerMeta=" + maxServerMeta - + ", maxPersonality=" + maxPersonality + ", maxImageMeta=" - + maxImageMeta + ", maxPersonalitySize=" - + maxPersonalitySize + ", maxTotalCores=" + maxTotalCores - + ", maxTotalInstances=" + maxTotalInstances + return "AbsoluteLimit [maxServerMeta=" + maxServerMeta + ", maxPersonality=" + maxPersonality + + ", maxImageMeta=" + maxImageMeta + ", maxPersonalitySize=" + maxPersonalitySize + + ", maxTotalCores=" + maxTotalCores + ", maxTotalInstances=" + maxTotalInstances + ", maxTotalRAMSize=" + maxTotalRAMSize + "]"; } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Link.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Link.java index 129896c..48bf500 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Link.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Link.java @@ -21,9 +21,9 @@ import java.io.Serializable; public class Link implements Serializable { private String rel; - + private String href; - + private String type; /** @@ -47,12 +47,14 @@ public class Link implements Serializable { return type; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { return "Link [rel=" + rel + ", href=" + href + ", type=" + type + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Metadata.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Metadata.java index d254e18..59c117d 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Metadata.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Metadata.java @@ -31,12 +31,13 @@ public class Metadata { /** * Set the metadata + * * @param metadata */ public void setMetadata(Map<String, String> metadata) { this.metadata = metadata; } - - + + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Network.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Network.java index 67bfba6..9fdf5e1 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Network.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Network.java @@ -17,7 +17,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -25,73 +24,73 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class Network implements Serializable { private String id; - + @JsonProperty("vpn_public_address") private String vpnPublicAddress; - + @JsonProperty("vpn_private_address") private String vpnPrivateAddress; - + @JsonProperty("vpn_public_port") private String vpnPublicPort; - + @JsonProperty("dhcp_start") private String dhcpStart; - + private String bridge; - + @JsonProperty("bridge_interface") private String bridgeInterface; - + @JsonProperty("updated_at") private String updatedAt; private Boolean deleted; - + private String vlan; - + private String broadcast; - + private String netmask; - + private Boolean injected; - + private String host; - + @JsonProperty("multi_host") private Boolean multiHost; - + @JsonProperty("created_at") private String createdAt; - + @JsonProperty("deleted_at") private String deletedAt; - + private String cidr; - + @JsonProperty("cidr_v6") private String cidrV6; - + private String gateway; - + @JsonProperty("gateway_v6") private String gatewayV6; - + @JsonProperty("netmask_v6") private String netmaskV6; - + @JsonProperty("project_id") private String projectId; - + @JsonProperty("rxtx_base") private String rxtxBase; - + private String dns1; - + private String dns2; - + private String label; - + private String priority; /** @@ -283,24 +282,21 @@ public class Network implements Serializable { return priority; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Network [id=" + id + ", vpnPublicAddress=" + vpnPublicAddress - + ", vpnPublicPort=" + vpnPublicPort + ", dhcpStart=" - + dhcpStart + ", bridge=" + bridge + ", bridgeInterface=" - + bridgeInterface + ", updatedAt=" + updatedAt + ", deleted=" - + deleted + ", vlan=" + vlan + ", broadcast=" + broadcast - + ", netmask=" + netmask + ", injected=" + injected + ", host=" - + host + ", multiHost=" + multiHost + ", createdAt=" - + createdAt + ", deletedAt=" + deletedAt + ", cidr=" + cidr - + ", cidrV6=" + cidrV6 + ", gateway=" + gateway - + ", gatewayV6=" + gatewayV6 + ", netmaskV6=" + netmaskV6 - + ", projectId=" + projectId + ", rxtxBase=" + rxtxBase - + ", dns1=" + dns1 + ", dns2=" + dns2 + ", label=" + label + return "Network [id=" + id + ", vpnPublicAddress=" + vpnPublicAddress + ", vpnPublicPort=" + vpnPublicPort + + ", dhcpStart=" + dhcpStart + ", bridge=" + bridge + ", bridgeInterface=" + bridgeInterface + + ", updatedAt=" + updatedAt + ", deleted=" + deleted + ", vlan=" + vlan + ", broadcast=" + broadcast + + ", netmask=" + netmask + ", injected=" + injected + ", host=" + host + ", multiHost=" + multiHost + + ", createdAt=" + createdAt + ", deletedAt=" + deletedAt + ", cidr=" + cidr + ", cidrV6=" + cidrV6 + + ", gateway=" + gateway + ", gatewayV6=" + gatewayV6 + ", netmaskV6=" + netmaskV6 + ", projectId=" + + projectId + ", rxtxBase=" + rxtxBase + ", dns1=" + dns1 + ", dns2=" + dns2 + ", label=" + label + ", priority=" + priority + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Networks.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Networks.java index 3f86d4f..6011c73 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Networks.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Networks.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.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 { @@ -33,8 +32,10 @@ public class Networks implements Iterable<Network>, Serializable { public List<Network> getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Networks implements Iterable<Network>, Serializable { public Iterator<Network> iterator() { return list.iterator(); } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/PersonalityFile.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/PersonalityFile.java index 0d619df..a9e9826 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/PersonalityFile.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/PersonalityFile.java @@ -19,9 +19,9 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; public final class PersonalityFile implements Serializable { - + private String path; - + private String contents; /** @@ -51,5 +51,5 @@ public final class PersonalityFile implements Serializable { public void setContents(String contents) { this.contents = contents; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/QuotaSet.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/QuotaSet.java index d03bea0..2ee31c3 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/QuotaSet.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/QuotaSet.java @@ -23,32 +23,32 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class QuotaSet { private String id; - + @JsonProperty("metadata_items") private Integer metadataItems; - + @JsonProperty("injected_file_content_bytes") private Integer injectedFileContentBytes; - + @JsonProperty("injected_files") private Integer injectedFiles; - + private Integer gigabytes; - + private Integer ram; - + @JsonProperty("floating_ips") private Integer floatingIps; - + private Integer instances; - + private Integer volumes; - + private Integer cores; - + @JsonProperty("security_groups") private Integer securityGroups; - + @JsonProperty("security_group_rules") private Integer securityGroupRules; @@ -58,6 +58,15 @@ public class QuotaSet { @JsonProperty("key_pairs") private Integer keyPairs; + @JsonProperty("fixed_ips") + private Integer fixedIps; + + @JsonProperty("server_group_members") + private Integer serverGroupMembers; + + @JsonProperty("server_groups") + private Integer serverGroups; + public String getId() { return id; } @@ -66,6 +75,30 @@ public class QuotaSet { this.id = id; } + public Integer getFixedIps() { + return fixedIps; + } + + public void setFixedIps(Integer fixedIps) { + this.fixedIps = fixedIps; + } + + public Integer getServerGroupMembers() { + return serverGroupMembers; + } + + public void setServerGroupMembers(Integer serverGroupMembers) { + this.serverGroupMembers = serverGroupMembers; + } + + public Integer getServerGroups() { + return serverGroups; + } + + public void setServerGroups(Integer serverGroups) { + this.serverGroups = serverGroups; + } + public Integer getMetadataItems() { return metadataItems; } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroup.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroup.java index de1ac85..eb359ac 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroup.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroup.java @@ -18,16 +18,15 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("security_group") public class SecurityGroup implements Serializable { - + @JsonRootName("security_group_rule") public static final class Rule implements Serializable { - + public static final class Group implements Serializable { private String name; @@ -38,7 +37,7 @@ public class SecurityGroup implements Serializable { public String getName() { return name; } - + public String getTenantId() { return tenantId; } @@ -142,30 +141,31 @@ public class SecurityGroup implements Serializable { return group; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Rule [id=" + id + ", name=" + name + ", parentGroupId=" - + parentGroupId + ", fromPort=" + fromPort + ", toPort=" - + toPort + ", ipProtocol=" + ipProtocol + ", ipRange=" - + ipRange + ", group=" + group + "]"; + return "Rule [id=" + id + ", name=" + name + ", parentGroupId=" + parentGroupId + ", fromPort=" + fromPort + + ", toPort=" + toPort + ", ipProtocol=" + ipProtocol + ", ipRange=" + ipRange + ", group=" + group + + "]"; } - + } private String id; - + private String name; - + private String description; - + @JsonProperty("tenant_id") private String tenantId; - + private List<Rule> rules; - + private List<Link> links; /** @@ -210,14 +210,15 @@ public class SecurityGroup implements Serializable { return links; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "SecurityGroup [id=" + id + ", name=" + name + ", description=" - + description + ", tenantId=" + tenantId + ", rules=" + rules - + ", links=" + links + "]"; + return "SecurityGroup [id=" + id + ", name=" + name + ", description=" + description + ", tenantId=" + tenantId + + ", rules=" + rules + ", links=" + links + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupForCreate.java index ca4ebbe..f99d070 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupForCreate.java @@ -17,20 +17,19 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("security_group") public class SecurityGroupForCreate implements Serializable { - + private String name; - + private String description; public SecurityGroupForCreate() { super(); } - + public SecurityGroupForCreate(String name) { this.name = name; } @@ -68,13 +67,14 @@ public class SecurityGroupForCreate implements Serializable { this.description = description; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "SecurityGroupForCreate [name=" + name + ", description=" - + description + "]"; + return "SecurityGroupForCreate [name=" + name + ", description=" + description + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreate.java index 6ddba5f..f998114 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreate.java @@ -17,9 +17,7 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; - import javax.xml.bind.annotation.XmlElement; - import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -29,7 +27,7 @@ public class SecurityGroupRuleForCreate implements Serializable { @JsonProperty("parent_group_id") private String parentGroupId; - + @JsonProperty("ip_protocol") private String ipProtocol; @@ -38,17 +36,17 @@ public class SecurityGroupRuleForCreate implements Serializable { @JsonProperty("to_port") private Integer toPort; - + @XmlElement private String cidr; @JsonProperty("group_id") private String groupId; - + public SecurityGroupRuleForCreate() { - + } - + /** * * @param parentSecurityGroupId @@ -56,16 +54,19 @@ public class SecurityGroupRuleForCreate implements Serializable { * @param fromPort * @param toPort * @param cidr - * @deprecated Ids in some installs have shown to use strings .Use {@link #SecurityGroupRuleForCreate(String, String, Integer, Integer, String)} + * @deprecated Ids in some installs have shown to use strings .Use + * {@link #SecurityGroupRuleForCreate(String, String, Integer, Integer, String)} */ @Deprecated - public SecurityGroupRuleForCreate(Integer parentSecurityGroupId, String ipProtocol, Integer fromPort,Integer toPort, String cidr) { + public SecurityGroupRuleForCreate(Integer parentSecurityGroupId, String ipProtocol, Integer fromPort, + Integer toPort, String cidr) { this.parentGroupId = String.valueOf(parentSecurityGroupId); this.ipProtocol = ipProtocol; this.fromPort = fromPort; this.toPort = toPort; this.cidr = cidr; } + /** * * @param parentSecurityGroupId @@ -73,26 +74,30 @@ public class SecurityGroupRuleForCreate implements Serializable { * @param fromPort * @param toPort * @param cidr - * @deprecated Ids in some installs have shown to use strings .Use {@link #SecurityGroupRuleForCreate(String, String, String, Integer, Integer)} + * @deprecated Ids in some installs have shown to use strings .Use + * {@link #SecurityGroupRuleForCreate(String, String, String, Integer, Integer)} */ @Deprecated - public SecurityGroupRuleForCreate(Integer parentGroupId, String ipProtocol, Integer fromPort,Integer toPort, Integer sourceGroupId) { + public SecurityGroupRuleForCreate(Integer parentGroupId, String ipProtocol, Integer fromPort, Integer toPort, + Integer sourceGroupId) { this.parentGroupId = String.valueOf(parentGroupId); this.ipProtocol = ipProtocol; this.fromPort = fromPort; this.toPort = toPort; this.groupId = String.valueOf(sourceGroupId); } - - public SecurityGroupRuleForCreate(String parentSecurityGroupId, String ipProtocol, Integer fromPort,Integer toPort, String cidr) { + + public SecurityGroupRuleForCreate(String parentSecurityGroupId, String ipProtocol, Integer fromPort, Integer toPort, + String cidr) { this.parentGroupId = parentSecurityGroupId; this.ipProtocol = ipProtocol; this.fromPort = fromPort; this.toPort = toPort; this.cidr = cidr; } - - public SecurityGroupRuleForCreate(String parentGroupId, String sourceGroupId, String ipProtocol, Integer fromPort,Integer toPort) { + + public SecurityGroupRuleForCreate(String parentGroupId, String sourceGroupId, String ipProtocol, Integer fromPort, + Integer toPort) { this.parentGroupId = parentGroupId; this.ipProtocol = ipProtocol; this.fromPort = fromPort; @@ -106,8 +111,8 @@ public class SecurityGroupRuleForCreate implements Serializable { public String getParentGroupId() { return parentGroupId; } - - + + /** * @param parentGroupId the parentGroupId to set * @deprecated Use {@link #setParentGroupId(String)} @@ -117,7 +122,7 @@ public class SecurityGroupRuleForCreate implements Serializable { public void setParentGroupId(Integer parentGroupId) { this.parentGroupId = String.valueOf(parentGroupId); } - + /** * @param parentGroupId the parentGroupId to set */ @@ -197,7 +202,7 @@ public class SecurityGroupRuleForCreate implements Serializable { public void setGroupId(Integer groupId) { this.groupId = String.valueOf(groupId); } - + /** * @param groupId the groupId to set */ @@ -205,15 +210,15 @@ public class SecurityGroupRuleForCreate implements Serializable { this.groupId = groupId; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "SecurityGroupRuleForCreate [parentGroupId=" + parentGroupId - + ", fromPort=" + fromPort + ", toPort=" + toPort - + ", ipProtocol=" + ipProtocol + ", cidr=" + cidr - + ", groupId=" + groupId + "]"; + return "SecurityGroupRuleForCreate [parentGroupId=" + parentGroupId + ", fromPort=" + fromPort + ", toPort=" + + toPort + ", ipProtocol=" + ipProtocol + ", cidr=" + cidr + ", groupId=" + groupId + "]"; } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroups.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroups.java index 705432b..10a70c2 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroups.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SecurityGroups.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class SecurityGroups implements Iterable<SecurityGroup>, Serializable { @@ -33,8 +32,10 @@ public class SecurityGroups implements Iterable<SecurityGroup>, Serializable { public List<SecurityGroup> getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class SecurityGroups implements Iterable<SecurityGroup>, Serializable { public Iterator<SecurityGroup> iterator() { return list.iterator(); } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Server.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Server.java index 4dd6dfa..70b7f88 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Server.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Server.java @@ -21,31 +21,30 @@ import java.util.Calendar; import java.util.HashMap; import java.util.List; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("server") public class Server implements Serializable { - + public static final class Addresses implements Serializable { - + public static final class Address implements Serializable { - + @JsonProperty("OS-EXT-IPS-MAC:mac_addr") private String macAddr; private String version; - + private String addr; - + @JsonProperty("OS-EXT-IPS:type") private String type; - /** - * @return the macAddr - */ + /** + * @return the macAddr + */ public String getMacAddr() { return macAddr; } @@ -63,7 +62,7 @@ public class Server implements Serializable { public String getAddr() { return addr; } - + /** * @return the type @@ -97,7 +96,7 @@ public class Server implements Serializable { * @param macAddr the mac addr to set */ public void setMacAddr(String macAddr) { - this.macAddr= macAddr; + this.macAddr = macAddr; } } @@ -107,6 +106,7 @@ public class Server implements Serializable { public void add(String key, List<Address> value) { addresses.put(key, value); } + /** * @return the ip address List Map */ @@ -114,24 +114,26 @@ public class Server implements Serializable { return addresses; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { return "Addresses List Map [" + addresses + "]"; } - + } - + public static final class Fault { - + private Integer code; - + private String message; - + private String details; - + private Calendar created; /** @@ -162,85 +164,87 @@ public class Server implements Serializable { return created; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Fault [code=" + code + ", message=" + message - + ", details=" + details + ", created=" + created + "]"; + return "Fault [code=" + code + ", message=" + message + ", details=" + details + ", created=" + created + + "]"; } - - + + } - + private String id; - + private String name; - + private Addresses addresses; - + private List<Link> links; - + private Image image; - + private Flavor flavor; - + private String accessIPv4; - + private String accessIPv6; - + @JsonProperty("config_drive") private String configDrive; - + private String status; - + private Integer progress; - + private Fault fault; - + @JsonProperty("tenant_id") private String tenantId; - + @JsonProperty("user_id") private String userId; - + @JsonProperty("key_name") private String keyName; - + private String hostId; - + private String updated; - + private String created; - + private Map<String, String> metadata; - + @JsonProperty("security_groups") private List<SecurityGroup> securityGroups; - + @JsonProperty("OS-EXT-STS:task_state") private String taskState; - + @JsonProperty("OS-EXT-STS:power_state") private String powerState; - + @JsonProperty("OS-EXT-STS:vm_state") private String vmState; - + @JsonProperty("OS-EXT-SRV-ATTR:host") private String host; - + @JsonProperty("OS-EXT-SRV-ATTR:instance_name") private String instanceName; - + @JsonProperty("OS-EXT-SRV-ATTR:hypervisor_hostname") private String hypervisorHostname; - + @JsonProperty("OS-DCF:diskConfig") private String diskConfig; - + @JsonProperty("OS-EXT-AZ:availability_zone") private String availabilityZone; @@ -252,9 +256,9 @@ public class Server implements Serializable { @JsonProperty("os-extended-volumes:volumes_attached") private List<String> osExtendedVolumesAttached; - + private String uuid; - + private String adminPass; /** @@ -305,7 +309,7 @@ public class Server implements Serializable { public Flavor getFlavor() { return flavor; } - + /** * @param flavor the flavor to set */ @@ -502,28 +506,23 @@ public class Server implements Serializable { return adminPass; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Server [id=" + id + ", name=" + name + ", addresses=" - + addresses + ", links=" + links + ", image=" + image - + ", flavor=" + flavor + ", accessIPv4=" + accessIPv4 - + ", accessIPv6=" + accessIPv6 + ", configDrive=" + configDrive - + ", status=" + status + ", progress=" + progress + ", fault=" - + fault + ", tenantId=" + tenantId + ", userId=" + userId - + ", keyName=" + keyName + ", hostId=" + hostId + ", updated=" - + updated + ", created=" + created + ", metadata=" + metadata - + ", securityGroups=" + securityGroups + ", taskState=" - + taskState + ", powerState=" + powerState + ", vmState=" - + vmState + ", host=" + host + ", instanceName=" + instanceName - + ", hypervisorHostname=" + hypervisorHostname - + ", diskConfig=" + diskConfig + ", availabilityZone=" - + availabilityZone + ", launchedAt=" + launchedAt + ", terminatedAt=" - + ", " + "osExtendedVolumesAttached=" + osExtendedVolumesAttached - + ", uuid=" + uuid + ", adminPass=" - + adminPass + "]"; + return "Server [id=" + id + ", name=" + name + ", addresses=" + addresses + ", links=" + links + ", image=" + + image + ", flavor=" + flavor + ", accessIPv4=" + accessIPv4 + ", accessIPv6=" + accessIPv6 + + ", configDrive=" + configDrive + ", status=" + status + ", progress=" + progress + ", fault=" + fault + + ", tenantId=" + tenantId + ", userId=" + userId + ", keyName=" + keyName + ", hostId=" + hostId + + ", updated=" + updated + ", created=" + created + ", metadata=" + metadata + ", securityGroups=" + + securityGroups + ", taskState=" + taskState + ", powerState=" + powerState + ", vmState=" + vmState + + ", host=" + host + ", instanceName=" + instanceName + ", hypervisorHostname=" + hypervisorHostname + + ", diskConfig=" + diskConfig + ", availabilityZone=" + availabilityZone + ", launchedAt=" + launchedAt + + ", terminatedAt=" + ", " + "osExtendedVolumesAttached=" + osExtendedVolumesAttached + ", uuid=" + uuid + + ", adminPass=" + adminPass + "]"; } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerAction.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerAction.java index c536372..80f31ee 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerAction.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerAction.java @@ -21,15 +21,14 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; public interface ServerAction extends Serializable { - + @JsonRootName("changePassword") public static final class ChangePassword implements ServerAction { - + private String adminPass; public ChangePassword() { @@ -53,12 +52,12 @@ public interface ServerAction extends Serializable { public void setAdminPass(String adminPass) { this.adminPass = adminPass; } - + } - + @JsonRootName("reboot") public static final class Reboot implements ServerAction { - + private String type; /** @@ -74,26 +73,26 @@ public interface ServerAction extends Serializable { public void setType(String type) { this.type = type; } - + } - + @JsonRootName("rebuild") public static final class Rebuild implements ServerAction { - + private String imageRef; - + private String name; - + private String adminPass; - + private String accessIPv4; - + private String accessIPv6; - + private Map<String, String> metadata = new HashMap<>(); - + private List<PersonalityFile> personality = new ArrayList<>(); - + @JsonProperty("OS-DCF:diskConfig") private String diskConfig; @@ -208,14 +207,14 @@ public interface ServerAction extends Serializable { public void setDiskConfig(String diskConfig) { this.diskConfig = diskConfig; } - + } - + @JsonRootName("resize") public static final class Resize implements ServerAction { - + private String flavorRef; - + @JsonProperty("OS-DCF:diskConfig") private String diskConfig; @@ -246,24 +245,24 @@ public interface ServerAction extends Serializable { public void setDiskConfig(String diskConfig) { this.diskConfig = diskConfig; } - + } - + @JsonRootName("confirmResize") public static final class ConfirmResize implements ServerAction { - + } - + @JsonRootName("revertResize") public static final class RevertResize implements ServerAction { - + } - + @JsonRootName("createImage") public static final class CreateImage implements ServerAction { - + private String name; - + private Map<String, String> metadata; /** @@ -293,18 +292,18 @@ public interface ServerAction extends Serializable { public void setMetadata(Map<String, String> metadata) { this.metadata = metadata; } - + } - + @JsonRootName("rescue") public static final class Rescue implements ServerAction { - + private String adminPass; public Rescue() { - + } - + public Rescue(String adminPass) { this.adminPass = adminPass; } @@ -322,11 +321,11 @@ public interface ServerAction extends Serializable { public void setAdminPass(String adminPass) { this.adminPass = adminPass; } - + } - + public static final class RescueResponse implements ServerAction { - + private String adminPass; /** @@ -335,51 +334,51 @@ public interface ServerAction extends Serializable { public String getAdminPass() { return adminPass; } - + } @JsonRootName("unrescue") public static final class Unrescue implements ServerAction { - + } - + @JsonRootName("unpause") public static final class Unpause implements ServerAction { - + } @JsonRootName("pause") public static final class Pause implements ServerAction { - + } - + @JsonRootName("suspend") public static final class Suspend implements ServerAction { - + } @JsonRootName("resume") public static final class Resume implements ServerAction { - + } - + @JsonRootName("lock") public static final class Lock implements ServerAction { - + } @JsonRootName("unlock") public static final class Unlock implements ServerAction { - + } - + @JsonRootName("os-getConsoleOutput") public static final class GetConsoleOutput implements ServerAction { - + private Integer length; - + public GetConsoleOutput() { - + } public GetConsoleOutput(Integer length) { @@ -399,11 +398,11 @@ public interface ServerAction extends Serializable { public void setLength(Integer length) { this.length = length; } - + } - + public static final class ConsoleOutput implements ServerAction { - + private String output; /** @@ -412,18 +411,18 @@ public interface ServerAction extends Serializable { public String getOutput() { return output; } - + } - + @JsonRootName("os-getVNCConsole") public static final class GetVncConsole implements ServerAction { - + private String type; public GetVncConsole() { super(); } - + public GetVncConsole(String type) { super(); @@ -443,14 +442,14 @@ public interface ServerAction extends Serializable { public void setType(String type) { this.type = type; } - + } - + @JsonRootName("console") public static final class VncConsole implements ServerAction { - + private String type; - + private String url; /** @@ -466,32 +465,32 @@ public interface ServerAction extends Serializable { public String getUrl() { return url; } - + } - + @JsonRootName("os-start") public static final class Start implements ServerAction { - + } @JsonRootName("os-stop") public static final class Stop implements ServerAction { - + } - + @JsonRootName("forceDelete") public static final class ForceDelete implements ServerAction { - + } @JsonRootName("restore") public static final class Restore implements ServerAction { - + } - + @JsonRootName("addFloatingIp") public static final class AssociateFloatingIp implements ServerAction { - + private String address; public AssociateFloatingIp() { @@ -516,14 +515,14 @@ public interface ServerAction extends Serializable { public void setAddress(String address) { this.address = address; } - + } - + @JsonRootName("removeFloatingIp") public static final class DisassociateFloatingIp implements ServerAction { - + private String address; - + public DisassociateFloatingIp() { super(); } @@ -546,12 +545,12 @@ public interface ServerAction extends Serializable { public void setAddress(String address) { this.address = address; } - + } - + @JsonRootName("createBackup") public static final class CreateBackup implements ServerAction { - + private String name; @JsonProperty("backup_type") @@ -616,7 +615,7 @@ public interface ServerAction extends Serializable { public void setMetadata(Map<String, String> metadata) { this.metadata = metadata; } - + } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerForCreate.java index f5fe889..97feed9 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerForCreate.java @@ -21,7 +21,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -32,8 +31,7 @@ public class ServerForCreate implements Serializable { private String name; - public SecurityGroup() { - } + public SecurityGroup() {} public SecurityGroup(String name) { this.name = name; @@ -47,8 +45,7 @@ public class ServerForCreate implements Serializable { } /** - * @param name - * the name to set + * @param name the name to set */ public void setName(String name) { this.name = name; @@ -104,8 +101,7 @@ public class ServerForCreate implements Serializable { } /** - * @param name - * the name to set + * @param name the name to set */ public void setName(String name) { this.name = name; @@ -119,8 +115,7 @@ public class ServerForCreate implements Serializable { } /** - * @param adminPass - * the adminPass to set + * @param adminPass the adminPass to set */ public void setAdminPass(String adminPass) { this.adminPass = adminPass; @@ -134,8 +129,7 @@ public class ServerForCreate implements Serializable { } /** - * @param imageRef - * the imageRef to set + * @param imageRef the imageRef to set */ public void setImageRef(String imageRef) { this.imageRef = imageRef; @@ -149,8 +143,7 @@ public class ServerForCreate implements Serializable { } /** - * @param flavorRef - * the flavorRef to set + * @param flavorRef the flavorRef to set */ public void setFlavorRef(String flavorRef) { this.flavorRef = flavorRef; @@ -164,8 +157,7 @@ public class ServerForCreate implements Serializable { } /** - * @param accessIPv4 - * the accessIPv4 to set + * @param accessIPv4 the accessIPv4 to set */ public void setAccessIPv4(String accessIPv4) { this.accessIPv4 = accessIPv4; @@ -179,8 +171,7 @@ public class ServerForCreate implements Serializable { } /** - * @param accessIPv6 - * the accessIPv6 to set + * @param accessIPv6 the accessIPv6 to set */ public void setAccessIPv6(String accessIPv6) { this.accessIPv6 = accessIPv6; @@ -194,8 +185,7 @@ public class ServerForCreate implements Serializable { } /** - * @param min - * the min to set + * @param min the min to set */ public void setMin(Integer min) { this.min = min; @@ -209,8 +199,7 @@ public class ServerForCreate implements Serializable { } /** - * @param max - * the max to set + * @param max the max to set */ public void setMax(Integer max) { this.max = max; @@ -224,8 +213,7 @@ public class ServerForCreate implements Serializable { } /** - * @param diskConfig - * the diskConfig to set + * @param diskConfig the diskConfig to set */ public void setDiskConfig(String diskConfig) { this.diskConfig = diskConfig; @@ -239,8 +227,7 @@ public class ServerForCreate implements Serializable { } /** - * @param keyName - * the keyName to set + * @param keyName the keyName to set */ public void setKeyName(String keyName) { this.keyName = keyName; @@ -254,8 +241,7 @@ public class ServerForCreate implements Serializable { } /** - * @param personality - * the personality to set + * @param personality the personality to set */ public void setPersonality(List<PersonalityFile> personality) { this.personality = personality; @@ -269,8 +255,7 @@ public class ServerForCreate implements Serializable { } /** - * @param metadata - * the metadata to set + * @param metadata the metadata to set */ public void setMetadata(Map<String, String> metadata) { this.metadata = metadata; @@ -294,8 +279,7 @@ public class ServerForCreate implements Serializable { } /** - * @param userData - * the userData to set + * @param userData the userData to set */ public void setUserData(String userData) { this.userData = userData; @@ -309,8 +293,7 @@ public class ServerForCreate implements Serializable { } /** - * @param availabilityZone - * the availabilityZone to set + * @param availabilityZone the availabilityZone to set */ public void setAvailabilityZone(String availabilityZone) { this.availabilityZone = availabilityZone; diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Servers.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Servers.java index 772c1fb..fd0b1f2 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Servers.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Servers.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Servers implements Iterable<Server>, Serializable { @@ -33,13 +32,15 @@ public class Servers implements Iterable<Server>, Serializable { public List<Server> getList() { return list; } - + @Override public Iterator<Server> iterator() { return list.iterator(); } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsage.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsage.java index bed84dc..8eca842 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsage.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsage.java @@ -19,29 +19,28 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.math.BigDecimal; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("tenant_usage") public class SimpleTenantUsage implements Serializable { - + @JsonProperty("total_memory_mb_usage") private BigDecimal totalMemoryMbUsage; - + @JsonProperty("total_vcpus_usage") private BigDecimal totalVcpusUsage; - + @JsonProperty("total_local_gb_usage") private BigDecimal totalLocalGbUsage; private String start; - + private String stop; - + @JsonProperty("tenant_id") private String tenantId; - + @JsonProperty("total_hours") private String totalHours; @@ -154,16 +153,16 @@ public class SimpleTenantUsage implements Serializable { this.serverUsages = serverUsages; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "SimpleTenantUsage [totalMemoryMbUsage=" + totalMemoryMbUsage - + ", totalVcpusUsage=" + totalVcpusUsage - + ", totalLocalGbUsage=" + totalLocalGbUsage + ", start=" - + start + ", stop=" + stop + ", tenantId=" + tenantId - + ", totalHours=" + totalHours + "]"; + return "SimpleTenantUsage [totalMemoryMbUsage=" + totalMemoryMbUsage + ", totalVcpusUsage=" + totalVcpusUsage + + ", totalLocalGbUsage=" + totalLocalGbUsage + ", start=" + start + ", stop=" + stop + ", tenantId=" + + tenantId + ", totalHours=" + totalHours + "]"; } public static final class ServerUsage implements Serializable { @@ -174,7 +173,7 @@ public class SimpleTenantUsage implements Serializable { @JsonProperty("started_at") private String startedAt; - + @JsonProperty("ended_at") private String endedAt; diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsages.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsages.java index 20db05e..aa5d844 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsages.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SimpleTenantUsages.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class SimpleTenantUsages implements Iterable<SimpleTenantUsage>, Serializable { @@ -34,7 +33,9 @@ public class SimpleTenantUsages implements Iterable<SimpleTenantUsage>, Serializ return list; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class SimpleTenantUsages implements Iterable<SimpleTenantUsage>, Serializ public Iterator<SimpleTenantUsage> iterator() { return list.iterator(); } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshot.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshot.java index 9216854..066c381 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshot.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshot.java @@ -17,7 +17,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -25,19 +24,19 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class Snapshot implements Serializable { private String id; - + private String status; - + @JsonProperty("displayName") private String name; - + @JsonProperty("displayDescription") private String description; - + private String volumeId; - + private Integer size; - + private String createdAt; /** @@ -89,15 +88,15 @@ public class Snapshot implements Serializable { return createdAt; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Snapshot [id=" + id + ", status=" + status + ", displayName=" - + name + ", displayDescription=" + description - + ", volumeId=" + volumeId + ", size=" + size + ", createdAt=" - + createdAt + "]"; + return "Snapshot [id=" + id + ", status=" + status + ", displayName=" + name + ", displayDescription=" + + description + ", volumeId=" + volumeId + ", size=" + size + ", createdAt=" + createdAt + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/SnapshotForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/SnapshotForCreate.java index 5fcd76e..00f3137 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/SnapshotForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/SnapshotForCreate.java @@ -17,18 +17,17 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("snapshot") public class SnapshotForCreate implements Serializable { - + @JsonProperty("volume_id") private String volumeId; - + private Boolean force; - + @JsonProperty("display_name") private String name; @@ -91,13 +90,15 @@ public class SnapshotForCreate implements Serializable { this.description = description; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "SnapshotForCreate [volumeId=" + volumeId + ", force=" + force - + ", name=" + name + ", description=" + description + "]"; + return "SnapshotForCreate [volumeId=" + volumeId + ", force=" + force + ", name=" + name + ", description=" + + description + "]"; } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshots.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshots.java index 060ca48..21cc297 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshots.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Snapshots.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Snapshots implements Iterable<Snapshot>, Serializable { @@ -33,8 +32,10 @@ public class Snapshots implements Iterable<Snapshot>, Serializable { public List<Snapshot> getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Snapshots implements Iterable<Snapshot>, Serializable { public Iterator<Snapshot> iterator() { return list.iterator(); } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Volume.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Volume.java index 841d5b5..fdb934d 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Volume.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Volume.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.List; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -27,27 +26,27 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class Volume implements Serializable { private String id; - + private String status; - + @JsonProperty("displayName") private String name; - + @JsonProperty("displayDescription") private String description; - + private String availabilityZone; private String volumeType; - + private String snapshotId; - + private List<Map<String, Object>> attachments; - + private Map<String, String> metadata; - + private String createdAt; - + private Integer size; /** @@ -127,6 +126,6 @@ public class Volume implements Serializable { return size; } - - + + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachment.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachment.java index 76b0d31..db91e7a 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachment.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachment.java @@ -17,7 +17,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("volumeAttachment") @@ -63,13 +62,15 @@ public class VolumeAttachment implements Serializable { this.device = device; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "VolumeAttachment [id=" + id + ", volumeId=" + volumeId - + ", serverId=" + serverId + ", device=" + device + "]"; + return "VolumeAttachment [id=" + id + ", volumeId=" + volumeId + ", serverId=" + serverId + ", device=" + device + + "]"; } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachments.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachments.java index 7c8355c..f80d60d 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachments.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeAttachments.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class VolumeAttachments implements Iterable<VolumeAttachment>, Serializable { @@ -38,8 +37,10 @@ public class VolumeAttachments implements Iterable<VolumeAttachment>, Serializab public Iterator<VolumeAttachment> iterator() { return list.iterator(); } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForCreate.java index 49feab7..2c2055e 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForCreate.java @@ -18,7 +18,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -125,15 +124,15 @@ public class VolumeForCreate implements Serializable { this.metadata = metadata; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "VolumeForCreate [size=" + size + ", availabilityZone=" - + availabilityZone + ", name=" + name + ", description=" - + description + ", snapshotId=" + snapshotId + ", metadata=" - + metadata + "]"; + return "VolumeForCreate [size=" + size + ", availabilityZone=" + availabilityZone + ", name=" + name + + ", description=" + description + ", snapshotId=" + snapshotId + ", metadata=" + metadata + "]"; } } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForImageCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForImageCreate.java index 95abf39..d003285 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForImageCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeForImageCreate.java @@ -17,7 +17,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeType.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeType.java index 28390d3..2aabef7 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeType.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeType.java @@ -17,7 +17,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("volume-type") diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeTypes.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeTypes.java index 351a92a..3b1f71a 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeTypes.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/VolumeTypes.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class VolumeTypes implements Iterable<VolumeType>, Serializable { @@ -38,13 +37,15 @@ public class VolumeTypes implements Iterable<VolumeType>, Serializable { public Iterator<VolumeType> iterator() { return list.iterator(); } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { return "VolumeTypes [list=" + list + "]"; } - + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Volumes.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Volumes.java index 4266e63..5a31968 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Volumes.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Volumes.java @@ -19,7 +19,6 @@ package com.woorea.openstack.nova.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Volumes implements Iterable<Volume>, Serializable { @@ -33,8 +32,10 @@ public class Volumes implements Iterable<Volume>, Serializable { public List<Volume> getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Volumes implements Iterable<Volume>, Serializable { public Iterator<Volume> iterator() { return list.iterator(); } - + } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/AbsoluteLimitTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/AbsoluteLimitTest.java index d24531b..80814df 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/AbsoluteLimitTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/AbsoluteLimitTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Limits.AbsoluteLimit; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,40 +34,22 @@ public class AbsoluteLimitTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"maxServerMeta\" : 30," + EOL - + " \"serverMetaUsed\" : 37," + EOL - + " \"maxPersonality\" : 54," + EOL - + " \"personalityUsed\" : 61," + EOL - + " \"maxImageMeta\" : 82," + EOL - + " \"imageMetaUsed\" : 89," + EOL - + " \"maxPersonalitySize\" : 97," + EOL - + " \"personalitySizeUsed\" : 4," + EOL - + " \"maxTotalCores\" : 32," + EOL - + " \"totalCoresUsed\" : 39," + EOL - + " \"maxTotalInstances\" : 60," + EOL - + " \"totalInstancesUsed\" : 67," + EOL - + " \"maxTotalRAMSize\" : 55," + EOL - + " \"totalRAMUsed\" : 19," + EOL - + " \"maxSecurityGroupRules\" : 44," + EOL - + " \"securityGroupRulesUsed\" : 51," + EOL - + " \"maxTotalKeypairs\" : 64," + EOL - + " \"totalKeyPairsUsed\" : 71," + EOL - + " \"maxTotalVolumes\" : 71," + EOL - + " \"totalVolumesUsed\" : 78," + EOL - + " \"maxSecurityGroups\" : 4," + EOL - + " \"totalSecurityGroupsUsed\" : 59," + EOL - + " \"maxTotalFloatingIps\" : 76," + EOL - + " \"totalFloatingIpsUsed\" : 83," + EOL - + " \"maxTotalVolumeGigabytes\" : 15," + EOL - + " \"totalVolumeGigabytesUsed\" : 22" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"maxServerMeta\" : 30," + EOL + " \"serverMetaUsed\" : 37," + + EOL + " \"maxPersonality\" : 54," + EOL + " \"personalityUsed\" : 61," + EOL + + " \"maxImageMeta\" : 82," + EOL + " \"imageMetaUsed\" : 89," + EOL + " \"maxPersonalitySize\" : 97," + + EOL + " \"personalitySizeUsed\" : 4," + EOL + " \"maxTotalCores\" : 32," + EOL + + " \"totalCoresUsed\" : 39," + EOL + " \"maxTotalInstances\" : 60," + EOL + + " \"totalInstancesUsed\" : 67," + EOL + " \"maxTotalRAMSize\" : 55," + EOL + " \"totalRAMUsed\" : 19," + + EOL + " \"maxSecurityGroupRules\" : 44," + EOL + " \"securityGroupRulesUsed\" : 51," + EOL + + " \"maxTotalKeypairs\" : 64," + EOL + " \"totalKeyPairsUsed\" : 71," + EOL + + " \"maxTotalVolumes\" : 71," + EOL + " \"totalVolumesUsed\" : 78," + EOL + + " \"maxSecurityGroups\" : 4," + EOL + " \"totalSecurityGroupsUsed\" : 59," + EOL + + " \"maxTotalFloatingIps\" : 76," + EOL + " \"totalFloatingIpsUsed\" : 83," + EOL + + " \"maxTotalVolumeGigabytes\" : 15," + EOL + " \"totalVolumeGigabytesUsed\" : 22" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -84,82 +65,82 @@ public class AbsoluteLimitTest { public void testMethods() throws Exception { AbsoluteLimit absolutelimit = objectMapper.readValue(JSON_FULL, AbsoluteLimit.class); absolutelimit.toString(); - + Integer maxTotalRAMSize = absolutelimit.getMaxTotalRAMSize(); Assert.assertNotNull(maxTotalRAMSize); - + Integer maxTotalInstances = absolutelimit.getMaxTotalInstances(); Assert.assertNotNull(maxTotalInstances); - + Integer serverMetaUsed = absolutelimit.getServerMetaUsed(); Assert.assertNotNull(serverMetaUsed); - + Integer maxTotalKeypairs = absolutelimit.getMaxTotalKeypairs(); Assert.assertNotNull(maxTotalKeypairs); - + Integer maxTotalVolumeGigabytes = absolutelimit.getMaxTotalVolumeGigabytes(); Assert.assertNotNull(maxTotalVolumeGigabytes); - + Integer totalSecurityGroupsUsed = absolutelimit.getTotalSecurityGroupsUsed(); Assert.assertNotNull(totalSecurityGroupsUsed); - + Integer maxTotalVolumes = absolutelimit.getMaxTotalVolumes(); Assert.assertNotNull(maxTotalVolumes); - + Integer maxImageMeta = absolutelimit.getMaxImageMeta(); Assert.assertNotNull(maxImageMeta); - + Integer imageMetaUsed = absolutelimit.getImageMetaUsed(); Assert.assertNotNull(imageMetaUsed); - + Integer totalVolumeGigabytesUsed = absolutelimit.getTotalVolumeGigabytesUsed(); Assert.assertNotNull(totalVolumeGigabytesUsed); - + Integer maxSecurityGroupRules = absolutelimit.getMaxSecurityGroupRules(); Assert.assertNotNull(maxSecurityGroupRules); - + Integer totalCoresUsed = absolutelimit.getTotalCoresUsed(); Assert.assertNotNull(totalCoresUsed); - + Integer totalVolumesUsed = absolutelimit.getTotalVolumesUsed(); Assert.assertNotNull(totalVolumesUsed); - + Integer maxTotalFloatingIps = absolutelimit.getMaxTotalFloatingIps(); Assert.assertNotNull(maxTotalFloatingIps); - + Integer maxPersonality = absolutelimit.getMaxPersonality(); Assert.assertNotNull(maxPersonality); - + Integer personalityUsed = absolutelimit.getPersonalityUsed(); Assert.assertNotNull(personalityUsed); - + Integer maxSecurityGroups = absolutelimit.getMaxSecurityGroups(); Assert.assertNotNull(maxSecurityGroups); - + Integer securityGroupRulesUsed = absolutelimit.getSecurityGroupRulesUsed(); Assert.assertNotNull(securityGroupRulesUsed); - + Integer maxTotalCores = absolutelimit.getMaxTotalCores(); Assert.assertNotNull(maxTotalCores); - + Integer maxServerMeta = absolutelimit.getMaxServerMeta(); Assert.assertNotNull(maxServerMeta); - + Integer maxPersonalitySize = absolutelimit.getMaxPersonalitySize(); Assert.assertNotNull(maxPersonalitySize); - + Integer personalitySizeUsed = absolutelimit.getPersonalitySizeUsed(); Assert.assertNotNull(personalitySizeUsed); - + Integer totalKeyPairsUsed = absolutelimit.getTotalKeyPairsUsed(); Assert.assertNotNull(totalKeyPairsUsed); - + Integer totalFloatingIpsUsed = absolutelimit.getTotalFloatingIpsUsed(); Assert.assertNotNull(totalFloatingIpsUsed); - + Integer totalInstancesUsed = absolutelimit.getTotalInstancesUsed(); Assert.assertNotNull(totalInstancesUsed); - + Integer totalRAMUsed = absolutelimit.getTotalRAMUsed(); Assert.assertNotNull(totalRAMUsed); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/AddressTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/AddressTest.java index 3d34523..b796f7f 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/AddressTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/AddressTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Server.Addresses.Address; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,18 +34,13 @@ public class AddressTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"version\" : \"version\"," + EOL + " \"addr\" : \"addr\"," + + EOL + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + " \"OS-EXT-IPS:type\" : \"type\"" + EOL + + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -62,19 +56,19 @@ public class AddressTest { public void testMethods() throws Exception { Address address = objectMapper.readValue(JSON_FULL, Address.class); address.toString(); - + String type = address.getType(); Assert.assertNotNull(type); address.setType(type); - + String addr = address.getAddr(); Assert.assertNotNull(addr); address.setAddr(addr); - + String version = address.getVersion(); Assert.assertNotNull(version); address.setVersion(version); - + String macAddr = address.getMacAddr(); Assert.assertNotNull(macAddr); address.setMacAddr(macAddr); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/AddressesTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/AddressesTest.java index 132537d..12dcc15 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/AddressesTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/AddressesTest.java @@ -26,10 +26,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Server.Addresses; import com.woorea.openstack.nova.model.Server.Addresses.Address; - import java.util.List; import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -39,38 +37,20 @@ public class AddressesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"addresses\" : {" + EOL - + " \"addresses-k1\" : [ {" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"addresses-k2\" : [ {" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + " } ]" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"addresses\" : {" + EOL + " \"addresses-k1\" : [ {" + EOL + + " \"version\" : \"version\"," + EOL + " \"addr\" : \"addr\"," + EOL + + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + " \"OS-EXT-IPS:type\" : \"type\"" + EOL + + " }, {" + EOL + " \"version\" : \"version\"," + EOL + " \"addr\" : \"addr\"," + EOL + + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + " \"OS-EXT-IPS:type\" : \"type\"" + EOL + + " } ]," + EOL + " \"addresses-k2\" : [ {" + EOL + " \"version\" : \"version\"," + EOL + + " \"addr\" : \"addr\"," + EOL + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + + " \"OS-EXT-IPS:type\" : \"type\"" + EOL + " }, {" + EOL + " \"version\" : \"version\"," + EOL + + " \"addr\" : \"addr\"," + EOL + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + + " \"OS-EXT-IPS:type\" : \"type\"" + EOL + " } ]" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -86,8 +66,8 @@ public class AddressesTest { public void testMethods() throws Exception { Addresses addresses = objectMapper.readValue(JSON_FULL, Addresses.class); addresses.toString(); - - Map<String,List<Address>> addressesProperty = addresses.getAddresses(); + + Map<String, List<Address>> addressesProperty = addresses.getAddresses(); Assert.assertNotNull(addressesProperty); Assert.assertEquals(2, addressesProperty.size()); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/AssociateFloatingIpTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/AssociateFloatingIpTest.java index b93912b..5c494e4 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/AssociateFloatingIpTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/AssociateFloatingIpTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.AssociateFloatingIp; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,19 +34,13 @@ public class AssociateFloatingIpTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"addFloatingIp\" : {" + EOL - + " \"address\" : \"address\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"addFloatingIp\" : {" + EOL + " \"address\" : \"address\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -63,7 +56,7 @@ public class AssociateFloatingIpTest { public void testMethods() throws Exception { AssociateFloatingIp associatefloatingip = objectMapper.readValue(JSON_FULL, AssociateFloatingIp.class); associatefloatingip.toString(); - + String address = associatefloatingip.getAddress(); Assert.assertNotNull(address); associatefloatingip.setAddress(address); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/CertificateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/CertificateTest.java index bb5dd4d..89679f8 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/CertificateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/CertificateTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,20 +33,13 @@ public class CertificateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"certificate\" : {" + EOL - + " \"data\" : \"data\"," + EOL - + " \"private_key\" : \"privatekey\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"certificate\" : {" + EOL + " \"data\" : \"data\"," + EOL + + " \"private_key\" : \"privatekey\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -63,10 +55,10 @@ public class CertificateTest { public void testMethods() throws Exception { Certificate certificate = objectMapper.readValue(JSON_FULL, Certificate.class); certificate.toString(); - + String privateKey = certificate.getPrivateKey(); Assert.assertNotNull(privateKey); - + String data = certificate.getData(); Assert.assertNotNull(data); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ChangePasswordTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ChangePasswordTest.java index a52c99e..8e74e41 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ChangePasswordTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ChangePasswordTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.ChangePassword; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,19 +34,13 @@ public class ChangePasswordTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"changePassword\" : {" + EOL - + " \"adminPass\" : \"adminpass\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"changePassword\" : {" + EOL + + " \"adminPass\" : \"adminpass\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -63,7 +56,7 @@ public class ChangePasswordTest { public void testMethods() throws Exception { ChangePassword changepassword = objectMapper.readValue(JSON_FULL, ChangePassword.class); changepassword.toString(); - + String adminPass = changepassword.getAdminPass(); Assert.assertNotNull(adminPass); changepassword.setAdminPass(adminPass); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/CloudpipeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/CloudpipeTest.java index 7552f13..a96edbb 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/CloudpipeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/CloudpipeTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.Calendar; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,25 +34,16 @@ public class CloudpipeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"cloudpipe\" : {" + EOL - + " \"projectId\" : \"projectid\"," + EOL - + " \"internalIp\" : \"internalip\"," + EOL - + " \"publicIp\" : \"publicip\"," + EOL - + " \"publicPort\" : \"publicport\"," + EOL - + " \"state\" : \"state\"," + EOL - + " \"instanceId\" : \"instanceid\"," + EOL - + " \"createdAt\" : 1486296000000" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"cloudpipe\" : {" + EOL + + " \"projectId\" : \"projectid\"," + EOL + " \"internalIp\" : \"internalip\"," + EOL + + " \"publicIp\" : \"publicip\"," + EOL + " \"publicPort\" : \"publicport\"," + EOL + + " \"state\" : \"state\"," + EOL + " \"instanceId\" : \"instanceid\"," + EOL + + " \"createdAt\" : 1486296000000" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -70,31 +59,31 @@ public class CloudpipeTest { public void testMethods() throws Exception { Cloudpipe cloudpipe = objectMapper.readValue(JSON_FULL, Cloudpipe.class); cloudpipe.toString(); - + Calendar createdAt = cloudpipe.getCreatedAt(); Assert.assertNotNull(createdAt); cloudpipe.setCreatedAt(createdAt); - + String instanceId = cloudpipe.getInstanceId(); Assert.assertNotNull(instanceId); cloudpipe.setInstanceId(instanceId); - + String publicIp = cloudpipe.getPublicIp(); Assert.assertNotNull(publicIp); cloudpipe.setPublicIp(publicIp); - + String publicPort = cloudpipe.getPublicPort(); Assert.assertNotNull(publicPort); cloudpipe.setPublicPort(publicPort); - + String state = cloudpipe.getState(); Assert.assertNotNull(state); cloudpipe.setState(state); - + String projectId = cloudpipe.getProjectId(); Assert.assertNotNull(projectId); cloudpipe.setProjectId(projectId); - + String internalIp = cloudpipe.getInternalIp(); Assert.assertNotNull(internalIp); cloudpipe.setInternalIp(internalIp); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/CloudpipesTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/CloudpipesTest.java index 491b005..2fccdb3 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/CloudpipesTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/CloudpipesTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,31 +34,19 @@ public class CloudpipesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"cloudpipes\" : [ {" + EOL - + " \"projectId\" : \"projectid\"," + EOL - + " \"internalIp\" : \"internalip\"," + EOL - + " \"publicIp\" : \"publicip\"," + EOL - + " \"publicPort\" : \"publicport\"," + EOL - + " \"state\" : \"state\"," + EOL - + " \"instanceId\" : \"instanceid\"," + EOL - + " \"createdAt\" : 1486296000000" + EOL - + " }, {" + EOL - + " \"projectId\" : \"projectid\"," + EOL - + " \"internalIp\" : \"internalip\"," + EOL - + " \"publicIp\" : \"publicip\"," + EOL - + " \"publicPort\" : \"publicport\"," + EOL - + " \"state\" : \"state\"," + EOL - + " \"instanceId\" : \"instanceid\"," + EOL - + " \"createdAt\" : 1486296000000" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"cloudpipes\" : [ {" + EOL + + " \"projectId\" : \"projectid\"," + EOL + " \"internalIp\" : \"internalip\"," + EOL + + " \"publicIp\" : \"publicip\"," + EOL + " \"publicPort\" : \"publicport\"," + EOL + + " \"state\" : \"state\"," + EOL + " \"instanceId\" : \"instanceid\"," + EOL + + " \"createdAt\" : 1486296000000" + EOL + " }, {" + EOL + " \"projectId\" : \"projectid\"," + EOL + + " \"internalIp\" : \"internalip\"," + EOL + " \"publicIp\" : \"publicip\"," + EOL + + " \"publicPort\" : \"publicport\"," + EOL + " \"state\" : \"state\"," + EOL + + " \"instanceId\" : \"instanceid\"," + EOL + " \"createdAt\" : 1486296000000" + EOL + " } ]" + EOL + + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -76,7 +62,7 @@ public class CloudpipesTest { public void testMethods() throws Exception { Cloudpipes cloudpipes = objectMapper.readValue(JSON_FULL, Cloudpipes.class); cloudpipes.toString(); - + List<Cloudpipe> list = cloudpipes.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ConfirmResizeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ConfirmResizeTest.java index f311074..54d18b9 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ConfirmResizeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ConfirmResizeTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.ConfirmResize; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class ConfirmResizeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"confirmResize\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"confirmResize\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ConsoleOutputTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ConsoleOutputTest.java index 240e11e..b7b98f2 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ConsoleOutputTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ConsoleOutputTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.ConsoleOutput; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,15 +34,11 @@ public class ConsoleOutputTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"output\" : \"output\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"output\" : \"output\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -59,7 +54,7 @@ public class ConsoleOutputTest { public void testMethods() throws Exception { ConsoleOutput consoleoutput = objectMapper.readValue(JSON_FULL, ConsoleOutput.class); consoleoutput.toString(); - + String output = consoleoutput.getOutput(); Assert.assertNotNull(output); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/CreateBackupTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/CreateBackupTest.java index 271cc69..fe39246 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/CreateBackupTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/CreateBackupTest.java @@ -25,9 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.CreateBackup; - import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,25 +35,15 @@ public class CreateBackupTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"createBackup\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"rotation\" : \"rotation\"," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"backup_type\" : \"type\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"createBackup\" : {" + EOL + " \"name\" : \"name\"," + + EOL + " \"rotation\" : \"rotation\"," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"backup_type\" : \"type\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -71,20 +59,20 @@ public class CreateBackupTest { public void testMethods() throws Exception { CreateBackup createbackup = objectMapper.readValue(JSON_FULL, CreateBackup.class); createbackup.toString(); - - Map<String,String> metadata = createbackup.getMetadata(); + + Map<String, String> metadata = createbackup.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); createbackup.setMetadata(metadata); - + String rotation = createbackup.getRotation(); Assert.assertNotNull(rotation); createbackup.setRotation(rotation); - + String name = createbackup.getName(); Assert.assertNotNull(name); createbackup.setName(name); - + String type = createbackup.getType(); Assert.assertNotNull(type); createbackup.setType(type); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/CreateImageTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/CreateImageTest.java index 2c33b27..903a29f 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/CreateImageTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/CreateImageTest.java @@ -25,9 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.CreateImage; - import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,23 +35,14 @@ public class CreateImageTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"createImage\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"createImage\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"metadata\" : {" + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + + " \"metadata-k2\" : \"metadata-v2\"" + EOL + " }" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -69,12 +58,12 @@ public class CreateImageTest { public void testMethods() throws Exception { CreateImage createimage = objectMapper.readValue(JSON_FULL, CreateImage.class); createimage.toString(); - - Map<String,String> metadata = createimage.getMetadata(); + + Map<String, String> metadata = createimage.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); createimage.setMetadata(metadata); - + String name = createimage.getName(); Assert.assertNotNull(name); createimage.setName(name); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/DisassociateFloatingIpTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/DisassociateFloatingIpTest.java index 502e943..525b068 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/DisassociateFloatingIpTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/DisassociateFloatingIpTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.DisassociateFloatingIp; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,19 +34,13 @@ public class DisassociateFloatingIpTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"removeFloatingIp\" : {" + EOL - + " \"address\" : \"address\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"removeFloatingIp\" : {" + EOL + " \"address\" : \"address\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -63,7 +56,7 @@ public class DisassociateFloatingIpTest { public void testMethods() throws Exception { DisassociateFloatingIp disassociatefloatingip = objectMapper.readValue(JSON_FULL, DisassociateFloatingIp.class); disassociatefloatingip.toString(); - + String address = disassociatefloatingip.getAddress(); Assert.assertNotNull(address); disassociatefloatingip.setAddress(address); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionTest.java index 514ea22..4cc2a44 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionTest.java @@ -24,10 +24,8 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.Calendar; import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,32 +35,18 @@ public class ExtensionTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"extension\" : {" + EOL - + " \"alias\" : \"alias\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"namespace\" : \"namespace\"," + EOL - + " \"updated\" : 1486468800000," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"extension\" : {" + EOL + " \"alias\" : \"alias\"," + EOL + + " \"description\" : \"description\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"namespace\" : \"namespace\"," + EOL + " \"updated\" : 1486468800000," + EOL + + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " }" + EOL + + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -78,23 +62,23 @@ public class ExtensionTest { public void testMethods() throws Exception { Extension extension = objectMapper.readValue(JSON_FULL, Extension.class); extension.toString(); - + String name = extension.getName(); Assert.assertNotNull(name); - + String namespace = extension.getNamespace(); Assert.assertNotNull(namespace); - + String alias = extension.getAlias(); Assert.assertNotNull(alias); - + String description = extension.getDescription(); Assert.assertNotNull(description); - + List<Link> links = extension.getLinks(); Assert.assertNotNull(links); Assert.assertEquals(2, links.size()); - + Calendar updated = extension.getUpdated(); Assert.assertNotNull(updated); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionsTest.java index 6fe182d..b3f32a3 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ExtensionsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,45 +34,22 @@ public class ExtensionsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"extensions\" : [ {" + EOL - + " \"alias\" : \"alias\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"namespace\" : \"namespace\"," + EOL - + " \"updated\" : 1486468800000," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " }, {" + EOL - + " \"alias\" : \"alias\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"namespace\" : \"namespace\"," + EOL - + " \"updated\" : 1486468800000," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"extensions\" : [ {" + EOL + " \"alias\" : \"alias\"," + + EOL + " \"description\" : \"description\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"namespace\" : \"namespace\"," + EOL + " \"updated\" : 1486468800000," + EOL + + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " }, {" + EOL + + " \"alias\" : \"alias\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"namespace\" : \"namespace\"," + EOL + + " \"updated\" : 1486468800000," + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + + " } ]" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -90,13 +65,14 @@ public class ExtensionsTest { public void testMethods() throws Exception { Extensions extensions = objectMapper.readValue(JSON_FULL, Extensions.class); extensions.toString(); - + List<Extension> list = extensions.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Extension x : extensions) { + for (@SuppressWarnings("unused") + Extension x : extensions) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FaultTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FaultTest.java index a426d8a..a8efda6 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FaultTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FaultTest.java @@ -25,9 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Server.Fault; - import java.util.Calendar; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,18 +35,12 @@ public class FaultTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"code\" : 29," + EOL - + " \"message\" : \"message\"," + EOL - + " \"details\" : \"details\"," + EOL - + " \"created\" : 1485172800000" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"code\" : 29," + EOL + " \"message\" : \"message\"," + EOL + + " \"details\" : \"details\"," + EOL + " \"created\" : 1485172800000" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -64,16 +56,16 @@ public class FaultTest { public void testMethods() throws Exception { Fault fault = objectMapper.readValue(JSON_FULL, Fault.class); fault.toString(); - + Integer code = fault.getCode(); Assert.assertNotNull(code); - + Calendar created = fault.getCreated(); Assert.assertNotNull(created); - + String details = fault.getDetails(); Assert.assertNotNull(details); - + String message = fault.getMessage(); Assert.assertNotNull(message); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorForCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorForCreateTest.java index 2d6e1a7..195a7b2 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorForCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorForCreateTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,26 +33,15 @@ public class FlavorForCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"flavor\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"vcpus\" : \"vcpus\"," + EOL - + " \"ram\" : 38," + EOL - + " \"disk\" : \"disk\"," + EOL - + " \"swap\" : \"swap\"," + EOL - + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL - + " \"rxtx_factor\" : 11.0" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"flavor\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"vcpus\" : \"vcpus\"," + EOL + " \"ram\" : 38," + EOL + + " \"disk\" : \"disk\"," + EOL + " \"swap\" : \"swap\"," + EOL + + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL + " \"rxtx_factor\" : 11.0" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -69,35 +57,35 @@ public class FlavorForCreateTest { public void testMethods() throws Exception { FlavorForCreate flavorforcreate = objectMapper.readValue(JSON_FULL, FlavorForCreate.class); flavorforcreate.toString(); - + String disk = flavorforcreate.getDisk(); Assert.assertNotNull(disk); flavorforcreate.setDisk(disk); - + String swap = flavorforcreate.getSwap(); Assert.assertNotNull(swap); flavorforcreate.setSwap(swap); - + String name = flavorforcreate.getName(); Assert.assertNotNull(name); flavorforcreate.setName(name); - + Float rxtxFactor = flavorforcreate.getRxtxFactor(); Assert.assertNotNull(rxtxFactor); flavorforcreate.setRxtxFactor(rxtxFactor); - + Integer ephemeral = flavorforcreate.getEphemeral(); Assert.assertNotNull(ephemeral); flavorforcreate.setEphemeral(ephemeral); - + String id = flavorforcreate.getId(); Assert.assertNotNull(id); flavorforcreate.setId(id); - + String vcpus = flavorforcreate.getVcpus(); Assert.assertNotNull(vcpus); flavorforcreate.setVcpus(vcpus); - + Integer ram = flavorforcreate.getRam(); Assert.assertNotNull(ram); flavorforcreate.setRam(ram); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorTest.java index 63fa405..3a1bfca 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,40 +34,20 @@ public class FlavorTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"flavor\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"vcpus\" : 79," + EOL - + " \"ram\" : 38," + EOL - + " \"disk\" : 45," + EOL - + " \"swap\" : \"swap\"," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"public\" : false," + EOL - + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL - + " \"rxtx_factor\" : 11.0," + EOL - + " \"OS-FLV-DISABLED:disabled\" : true," + EOL - + " \"rxtx_quota\" : 42," + EOL - + " \"rxtx_cap\" : 96," + EOL - + " \"os-flavor-access:is_public\" : false" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"flavor\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"vcpus\" : 79," + EOL + " \"ram\" : 38," + EOL + + " \"disk\" : 45," + EOL + " \"swap\" : \"swap\"," + EOL + " \"links\" : [ {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " } ]," + EOL + " \"public\" : false," + EOL + + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL + " \"rxtx_factor\" : 11.0," + EOL + + " \"OS-FLV-DISABLED:disabled\" : true," + EOL + " \"rxtx_quota\" : 42," + EOL + + " \"rxtx_cap\" : 96," + EOL + " \"os-flavor-access:is_public\" : false" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -85,52 +63,52 @@ public class FlavorTest { public void testMethods() throws Exception { Flavor flavor = objectMapper.readValue(JSON_FULL, Flavor.class); flavor.toString(); - + Integer rxtxQuota = flavor.getRxtxQuota(); Assert.assertNotNull(rxtxQuota); flavor.setRxtxQuota(rxtxQuota); - + String swap = flavor.getSwap(); Assert.assertNotNull(swap); flavor.setSwap(swap); - + Float rxtxFactor = flavor.getRxtxFactor(); Assert.assertNotNull(rxtxFactor); flavor.setRxtxFactor(rxtxFactor); - + Integer ephemeral = flavor.getEphemeral(); Assert.assertNotNull(ephemeral); flavor.setEphemeral(ephemeral); - + Integer vcpus = flavor.getVcpus(); Assert.assertNotNull(vcpus); flavor.setVcpus(vcpus); - + Integer rxtxCap = flavor.getRxtxCap(); Assert.assertNotNull(rxtxCap); flavor.setRxtxCap(rxtxCap); - + Integer disk = flavor.getDisk(); Assert.assertNotNull(disk); flavor.setDisk(disk); - + String name = flavor.getName(); Assert.assertNotNull(name); flavor.setName(name); - + List<Link> links = flavor.getLinks(); Assert.assertNotNull(links); Assert.assertEquals(2, links.size()); flavor.setLinks(links); - + Boolean disabled = flavor.getDisabled(); Assert.assertNotNull(disabled); flavor.setDisabled(disabled); - + String id = flavor.getId(); Assert.assertNotNull(id); flavor.setId(id); - + Integer ram = flavor.getRam(); Assert.assertNotNull(ram); flavor.setRam(ram); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorsTest.java index 5316006..664df69 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FlavorsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,61 +34,28 @@ public class FlavorsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"flavors\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"vcpus\" : 79," + EOL - + " \"ram\" : 38," + EOL - + " \"disk\" : 45," + EOL - + " \"swap\" : \"swap\"," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"public\" : false," + EOL - + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL - + " \"rxtx_factor\" : 11.0," + EOL - + " \"OS-FLV-DISABLED:disabled\" : true," + EOL - + " \"rxtx_quota\" : 42," + EOL - + " \"rxtx_cap\" : 96," + EOL - + " \"os-flavor-access:is_public\" : false" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"vcpus\" : 79," + EOL - + " \"ram\" : 38," + EOL - + " \"disk\" : 45," + EOL - + " \"swap\" : \"swap\"," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"public\" : false," + EOL - + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL - + " \"rxtx_factor\" : 11.0," + EOL - + " \"OS-FLV-DISABLED:disabled\" : true," + EOL - + " \"rxtx_quota\" : 42," + EOL - + " \"rxtx_cap\" : 96," + EOL - + " \"os-flavor-access:is_public\" : false" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"flavors\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"vcpus\" : 79," + EOL + " \"ram\" : 38," + EOL + + " \"disk\" : 45," + EOL + " \"swap\" : \"swap\"," + EOL + " \"links\" : [ {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " } ]," + EOL + " \"public\" : false," + EOL + + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL + " \"rxtx_factor\" : 11.0," + EOL + + " \"OS-FLV-DISABLED:disabled\" : true," + EOL + " \"rxtx_quota\" : 42," + EOL + + " \"rxtx_cap\" : 96," + EOL + " \"os-flavor-access:is_public\" : false" + EOL + " }, {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + " \"vcpus\" : 79," + EOL + + " \"ram\" : 38," + EOL + " \"disk\" : 45," + EOL + " \"swap\" : \"swap\"," + EOL + + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL + + " \"public\" : false," + EOL + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL + + " \"rxtx_factor\" : 11.0," + EOL + " \"OS-FLV-DISABLED:disabled\" : true," + EOL + + " \"rxtx_quota\" : 42," + EOL + " \"rxtx_cap\" : 96," + EOL + + " \"os-flavor-access:is_public\" : false" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -106,13 +71,14 @@ public class FlavorsTest { public void testMethods() throws Exception { Flavors flavors = objectMapper.readValue(JSON_FULL, Flavors.class); flavors.toString(); - + List<Flavor> list = flavors.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Flavor x : flavors) { + for (@SuppressWarnings("unused") + Flavor x : flavors) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpDomainTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpDomainTest.java index dac8a45..c3b5bad 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpDomainTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpDomainTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,22 +33,15 @@ public class FloatingIpDomainTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"floating-ip-pool\" : {" + EOL - + " \"domain\" : \"domain\"," + EOL - + " \"scope\" : \"scope\"," + EOL - + " \"project\" : \"project\"," + EOL - + " \"availabilityZone\" : \"availabilityzone\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"floating-ip-pool\" : {" + EOL + " \"domain\" : \"domain\"," + EOL + + " \"scope\" : \"scope\"," + EOL + " \"project\" : \"project\"," + EOL + + " \"availabilityZone\" : \"availabilityzone\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -65,16 +57,16 @@ public class FloatingIpDomainTest { public void testMethods() throws Exception { FloatingIpDomain floatingipdomain = objectMapper.readValue(JSON_FULL, FloatingIpDomain.class); floatingipdomain.toString(); - + String domain = floatingipdomain.getDomain(); Assert.assertNotNull(domain); - + String scope = floatingipdomain.getScope(); Assert.assertNotNull(scope); - + String project = floatingipdomain.getProject(); Assert.assertNotNull(project); - + String availabilityZone = floatingipdomain.getAvailabilityZone(); Assert.assertNotNull(availabilityZone); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpDomainsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpDomainsTest.java index 6cfe54f..c03e741 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpDomainsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpDomainsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,25 +34,16 @@ public class FloatingIpDomainsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"domain_entries\" : [ {" + EOL - + " \"domain\" : \"domain\"," + EOL - + " \"scope\" : \"scope\"," + EOL - + " \"project\" : \"project\"," + EOL - + " \"availabilityZone\" : \"availabilityzone\"" + EOL - + " }, {" + EOL - + " \"domain\" : \"domain\"," + EOL - + " \"scope\" : \"scope\"," + EOL - + " \"project\" : \"project\"," + EOL - + " \"availabilityZone\" : \"availabilityzone\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"domain_entries\" : [ {" + EOL + + " \"domain\" : \"domain\"," + EOL + " \"scope\" : \"scope\"," + EOL + + " \"project\" : \"project\"," + EOL + " \"availabilityZone\" : \"availabilityzone\"" + EOL + + " }, {" + EOL + " \"domain\" : \"domain\"," + EOL + " \"scope\" : \"scope\"," + EOL + + " \"project\" : \"project\"," + EOL + " \"availabilityZone\" : \"availabilityzone\"" + EOL + " } ]" + + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -70,13 +59,14 @@ public class FloatingIpDomainsTest { public void testMethods() throws Exception { FloatingIpDomains floatingipdomains = objectMapper.readValue(JSON_FULL, FloatingIpDomains.class); floatingipdomains.toString(); - + List<FloatingIpDomain> list = floatingipdomains.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") FloatingIpDomain x : floatingipdomains) { + for (@SuppressWarnings("unused") + FloatingIpDomain x : floatingipdomains) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpPoolTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpPoolTest.java index 7048b63..8ab1ca2 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpPoolTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpPoolTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.FloatingIpPools.FloatingIpPool; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,15 +34,11 @@ public class FloatingIpPoolTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"name\" : \"name\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"name\" : \"name\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -59,7 +54,7 @@ public class FloatingIpPoolTest { public void testMethods() throws Exception { FloatingIpPool floatingippool = objectMapper.readValue(JSON_FULL, FloatingIpPool.class); floatingippool.toString(); - + String name = floatingippool.getName(); Assert.assertNotNull(name); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpPoolsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpPoolsTest.java index 7f5c1c1..b5d50e6 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpPoolsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpPoolsTest.java @@ -25,9 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.FloatingIpPools.FloatingIpPool; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,19 +35,12 @@ public class FloatingIpPoolsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"floating_ip_pools\" : [ {" + EOL - + " \"name\" : \"name\"" + EOL - + " }, {" + EOL - + " \"name\" : \"name\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"floating_ip_pools\" : [ {" + EOL + + " \"name\" : \"name\"" + EOL + " }, {" + EOL + " \"name\" : \"name\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -65,13 +56,14 @@ public class FloatingIpPoolsTest { public void testMethods() throws Exception { FloatingIpPools floatingippools = objectMapper.readValue(JSON_FULL, FloatingIpPools.class); floatingippools.toString(); - + List<FloatingIpPool> list = floatingippools.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") FloatingIpPool x : floatingippools) { + for (@SuppressWarnings("unused") + FloatingIpPool x : floatingippools) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpTest.java index 00d382c..9e506cc 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,23 +33,14 @@ public class FloatingIpTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"floating_ip\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"pool\" : \"pool\"," + EOL - + " \"ip\" : \"ip\"," + EOL - + " \"fixed_ip\" : \"fixedip\"," + EOL - + " \"instance_id\" : \"instanceid\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"floating_ip\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"pool\" : \"pool\"," + EOL + " \"ip\" : \"ip\"," + EOL + " \"fixed_ip\" : \"fixedip\"," + EOL + + " \"instance_id\" : \"instanceid\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -66,19 +56,19 @@ public class FloatingIpTest { public void testMethods() throws Exception { FloatingIp floatingip = objectMapper.readValue(JSON_FULL, FloatingIp.class); floatingip.toString(); - + String instanceId = floatingip.getInstanceId(); Assert.assertNotNull(instanceId); - + String ip = floatingip.getIp(); Assert.assertNotNull(ip); - + String pool = floatingip.getPool(); Assert.assertNotNull(pool); - + String fixedIp = floatingip.getFixedIp(); Assert.assertNotNull(fixedIp); - + String id = floatingip.getId(); Assert.assertNotNull(id); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpsTest.java index 4b279df..53fbf44 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/FloatingIpsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,27 +34,15 @@ public class FloatingIpsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"floating_ips\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"pool\" : \"pool\"," + EOL - + " \"ip\" : \"ip\"," + EOL - + " \"fixed_ip\" : \"fixedip\"," + EOL - + " \"instance_id\" : \"instanceid\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"pool\" : \"pool\"," + EOL - + " \"ip\" : \"ip\"," + EOL - + " \"fixed_ip\" : \"fixedip\"," + EOL - + " \"instance_id\" : \"instanceid\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"floating_ips\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"pool\" : \"pool\"," + EOL + " \"ip\" : \"ip\"," + EOL + " \"fixed_ip\" : \"fixedip\"," + EOL + + " \"instance_id\" : \"instanceid\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"pool\" : \"pool\"," + EOL + " \"ip\" : \"ip\"," + EOL + " \"fixed_ip\" : \"fixedip\"," + EOL + + " \"instance_id\" : \"instanceid\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -72,13 +58,14 @@ public class FloatingIpsTest { public void testMethods() throws Exception { FloatingIps floatingips = objectMapper.readValue(JSON_FULL, FloatingIps.class); floatingips.toString(); - + List<FloatingIp> list = floatingips.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") FloatingIp x : floatingips) { + for (@SuppressWarnings("unused") + FloatingIp x : floatingips) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ForceDeleteTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ForceDeleteTest.java index bf26778..4262f45 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ForceDeleteTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ForceDeleteTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.ForceDelete; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class ForceDeleteTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"forceDelete\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"forceDelete\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/GetConsoleOutputTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/GetConsoleOutputTest.java index 8f2ea1e..6420ff5 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/GetConsoleOutputTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/GetConsoleOutputTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.GetConsoleOutput; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,19 +34,13 @@ public class GetConsoleOutputTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"os-getConsoleOutput\" : {" + EOL - + " \"length\" : 60" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"os-getConsoleOutput\" : {" + EOL + " \"length\" : 60" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -63,7 +56,7 @@ public class GetConsoleOutputTest { public void testMethods() throws Exception { GetConsoleOutput getconsoleoutput = objectMapper.readValue(JSON_FULL, GetConsoleOutput.class); getconsoleoutput.toString(); - + Integer length = getconsoleoutput.getLength(); Assert.assertNotNull(length); getconsoleoutput.setLength(length); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/GetVncConsoleTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/GetVncConsoleTest.java index d7ed6c9..924aabe 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/GetVncConsoleTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/GetVncConsoleTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.GetVncConsole; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,19 +34,13 @@ public class GetVncConsoleTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"os-getVNCConsole\" : {" + EOL - + " \"type\" : \"type\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"os-getVNCConsole\" : {" + EOL + " \"type\" : \"type\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -63,7 +56,7 @@ public class GetVncConsoleTest { public void testMethods() throws Exception { GetVncConsole getvncconsole = objectMapper.readValue(JSON_FULL, GetVncConsole.class); getvncconsole.toString(); - + String type = getvncconsole.getType(); Assert.assertNotNull(type); getvncconsole.setType(type); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/GroupTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/GroupTest.java index 561ea9a..7ebcff5 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/GroupTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/GroupTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.SecurityGroup.Rule.Group; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,16 +34,12 @@ public class GroupTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"name\" : \"name\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -60,10 +55,10 @@ public class GroupTest { public void testMethods() throws Exception { Group group = objectMapper.readValue(JSON_FULL, Group.class); group.toString(); - + String name = group.getName(); Assert.assertNotNull(name); - + String tenantId = group.getTenantId(); Assert.assertNotNull(tenantId); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/HostAggregateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/HostAggregateTest.java index 5631245..29ae8c6 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/HostAggregateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/HostAggregateTest.java @@ -24,10 +24,8 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,30 +35,18 @@ public class HostAggregateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"aggregate\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"deleted\" : false," + EOL - + " \"hosts\" : [ \"hosts-v1\", \"hosts-v2\" ]," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"availability_zone\" : \"availabilityzone\"," + EOL - + " \"created_at\" : \"createdat\"," + EOL - + " \"updated_at\" : \"updatedat\"," + EOL - + " \"deleted_at\" : \"deletedat\"" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"aggregate\" : {" + EOL + " \"id\" : 1," + EOL + + " \"name\" : \"name\"," + EOL + " \"deleted\" : false," + EOL + + " \"hosts\" : [ \"hosts-v1\", \"hosts-v2\" ]," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"availability_zone\" : \"availabilityzone\"," + EOL + + " \"created_at\" : \"2013-02-25T02:40:21Z\"," + EOL + " \"updated_at\" : \"2013-02-25T02:40:21Z\"," + + EOL + " \"deleted_at\" : \"2013-02-25T02:40:21Z\"" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -76,33 +62,33 @@ public class HostAggregateTest { public void testMethods() throws Exception { HostAggregate hostaggregate = objectMapper.readValue(JSON_FULL, HostAggregate.class); hostaggregate.toString(); - + String createdAt = hostaggregate.getCreatedAt(); Assert.assertNotNull(createdAt); - - Map<String,String> metadata = hostaggregate.getMetadata(); + + Map<String, String> metadata = hostaggregate.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); - + String deletedAt = hostaggregate.getDeletedAt(); Assert.assertNotNull(deletedAt); - + Boolean deleted = hostaggregate.getDeleted(); Assert.assertNotNull(deleted); - + List<String> hosts = hostaggregate.getHosts(); Assert.assertNotNull(hosts); Assert.assertEquals(2, hosts.size()); - + String name = hostaggregate.getName(); Assert.assertNotNull(name); - - String id = hostaggregate.getId(); + + Integer id = hostaggregate.getId(); Assert.assertNotNull(id); - + String availabilityZone = hostaggregate.getAvailabilityZone(); Assert.assertNotNull(availabilityZone); - + String updatedAt = hostaggregate.getUpdatedAt(); Assert.assertNotNull(updatedAt); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/HostAggregatesTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/HostAggregatesTest.java index 6fba9c2..1bbaa97 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/HostAggregatesTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/HostAggregatesTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,41 +34,23 @@ public class HostAggregatesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"aggregates\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"deleted\" : false," + EOL - + " \"hosts\" : [ \"hosts-v1\", \"hosts-v2\" ]," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"availability_zone\" : \"availabilityzone\"," + EOL - + " \"created_at\" : \"createdat\"," + EOL - + " \"updated_at\" : \"updatedat\"," + EOL - + " \"deleted_at\" : \"deletedat\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"deleted\" : false," + EOL - + " \"hosts\" : [ \"hosts-v1\", \"hosts-v2\" ]," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"availability_zone\" : \"availabilityzone\"," + EOL - + " \"created_at\" : \"createdat\"," + EOL - + " \"updated_at\" : \"updatedat\"," + EOL - + " \"deleted_at\" : \"deletedat\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"aggregates\" : [ {" + EOL + " \"id\" : 1," + EOL + + " \"name\" : \"name\"," + EOL + " \"deleted\" : false," + EOL + + " \"hosts\" : [ \"hosts-v1\", \"hosts-v2\" ]," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"availability_zone\" : \"availabilityzone\"," + EOL + + " \"created_at\" : \"createdat\"," + EOL + " \"updated_at\" : \"updatedat\"," + EOL + + " \"deleted_at\" : \"deletedat\"" + EOL + " }, {" + EOL + " \"id\" : 2," + EOL + + " \"name\" : \"name\"," + EOL + " \"deleted\" : false," + EOL + + " \"hosts\" : [ \"hosts-v1\", \"hosts-v2\" ]," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"availability_zone\" : \"availabilityzone\"," + EOL + + " \"created_at\" : \"createdat\"," + EOL + " \"updated_at\" : \"updatedat\"," + EOL + + " \"deleted_at\" : \"deletedat\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -86,13 +66,14 @@ public class HostAggregatesTest { public void testMethods() throws Exception { HostAggregates hostaggregates = objectMapper.readValue(JSON_FULL, HostAggregates.class); hostaggregates.toString(); - + List<HostAggregate> list = hostaggregates.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") HostAggregate x : hostaggregates) { + for (@SuppressWarnings("unused") + HostAggregate x : hostaggregates) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/HostTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/HostTest.java index 99d747c..eac90bc 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/HostTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/HostTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Hosts.Host; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,17 +34,12 @@ public class HostTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"zone\" : \"zone\"," + EOL - + " \"service\" : \"service\"," + EOL - + " \"host_name\" : \"hostname\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"zone\" : \"zone\"," + EOL + " \"service\" : \"service\"," + + EOL + " \"host_name\" : \"hostname\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -61,14 +55,14 @@ public class HostTest { public void testMethods() throws Exception { Host host = objectMapper.readValue(JSON_FULL, Host.class); host.toString(); - + String hostName = host.getHostName(); Assert.assertNotNull(hostName); - + String zone = host.getZone(); Assert.assertNotNull(zone); host.setZone(zone); - + String service = host.getService(); Assert.assertNotNull(service); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/HostsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/HostsTest.java index ad60a69..0eaf6ac 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/HostsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/HostsTest.java @@ -25,9 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Hosts.Host; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,23 +35,14 @@ public class HostsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"hosts\" : [ {" + EOL - + " \"zone\" : \"zone\"," + EOL - + " \"service\" : \"service\"," + EOL - + " \"host_name\" : \"hostname\"" + EOL - + " }, {" + EOL - + " \"zone\" : \"zone\"," + EOL - + " \"service\" : \"service\"," + EOL - + " \"host_name\" : \"hostname\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"hosts\" : [ {" + EOL + " \"zone\" : \"zone\"," + EOL + + " \"service\" : \"service\"," + EOL + " \"host_name\" : \"hostname\"" + EOL + " }, {" + EOL + + " \"zone\" : \"zone\"," + EOL + " \"service\" : \"service\"," + EOL + + " \"host_name\" : \"hostname\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -69,13 +58,14 @@ public class HostsTest { public void testMethods() throws Exception { Hosts hosts = objectMapper.readValue(JSON_FULL, Hosts.class); hosts.toString(); - + List<Host> list = hosts.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Host x : hosts) { + for (@SuppressWarnings("unused") + Host x : hosts) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ImageFromVolumeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ImageFromVolumeTest.java index 4983a55..db8ad55 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ImageFromVolumeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ImageFromVolumeTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,28 +33,18 @@ public class ImageFromVolumeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"os-volume_upload_image\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"updates_at\" : \"updates_at\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"display_description\" : \"display_description\"," + EOL - + " \"size\" : \"size\"," + EOL - + " \"volume_type\" : \"volume_type\"," + EOL - + " \"image_id\" : \"image_id\"," + EOL - + " \"container_format\" : \"container_format\"," + EOL - + " \"disk_format\" : \"disk_format\"," + EOL - + " \"image_name\" : \"image_name\"" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"os-volume_upload_image\" : {" + EOL + + " \"id\" : \"id\"," + EOL + " \"updates_at\" : \"updates_at\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"display_description\" : \"display_description\"," + EOL + + " \"size\" : \"size\"," + EOL + " \"volume_type\" : \"volume_type\"," + EOL + + " \"image_id\" : \"image_id\"," + EOL + " \"container_format\" : \"container_format\"," + EOL + + " \"disk_format\" : \"disk_format\"," + EOL + " \"image_name\" : \"image_name\"" + EOL + " }" + EOL + + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -71,43 +60,43 @@ public class ImageFromVolumeTest { public void testMethods() throws Exception { ImageFromVolume imagefromvolume = objectMapper.readValue(JSON_FULL, ImageFromVolume.class); imagefromvolume.toString(); - + String image_name = imagefromvolume.getImage_name(); Assert.assertNotNull(image_name); imagefromvolume.setImage_name(image_name); - + String display_description = imagefromvolume.getDisplay_description(); Assert.assertNotNull(display_description); imagefromvolume.setDisplay_description(display_description); - + String updates_at = imagefromvolume.getUpdates_at(); Assert.assertNotNull(updates_at); imagefromvolume.setUpdates_at(updates_at); - + String volume_type = imagefromvolume.getVolume_type(); Assert.assertNotNull(volume_type); imagefromvolume.setVolume_type(volume_type); - + String size = imagefromvolume.getSize(); Assert.assertNotNull(size); imagefromvolume.setSize(size); - + String disk_format = imagefromvolume.getDisk_format(); Assert.assertNotNull(disk_format); imagefromvolume.setDisk_format(disk_format); - + String id = imagefromvolume.getId(); Assert.assertNotNull(id); imagefromvolume.setId(id); - + String image_id = imagefromvolume.getImage_id(); Assert.assertNotNull(image_id); imagefromvolume.setImage_id(image_id); - + String container_format = imagefromvolume.getContainer_format(); Assert.assertNotNull(container_format); imagefromvolume.setContainer_format(container_format); - + String status = imagefromvolume.getStatus(); Assert.assertNotNull(status); imagefromvolume.setStatus(status); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ImageTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ImageTest.java index 4fce1d4..ba3f2b8 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ImageTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ImageTest.java @@ -25,11 +25,9 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Image.Server; - import java.util.Calendar; import java.util.List; import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -39,52 +37,24 @@ public class ImageTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"image\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"progress\" : 3," + EOL - + " \"minRam\" : 62," + EOL - + " \"minDisk\" : 69," + EOL - + " \"created\" : 1485172800000," + EOL - + " \"updated\" : 1486468800000," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"server\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " }," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"image\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"name\" : \"name\"," + EOL + " \"progress\" : 3," + EOL + + " \"minRam\" : 62," + EOL + " \"minDisk\" : 69," + EOL + " \"created\" : 1485172800000," + EOL + + " \"updated\" : 1486468800000," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"server\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"links\" : [ {" + + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " }," + + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL + + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -100,51 +70,51 @@ public class ImageTest { public void testMethods() throws Exception { Image image = objectMapper.readValue(JSON_FULL, Image.class); image.toString(); - + Server server = image.getServer(); Assert.assertNotNull(server); - - Map<String,String> metadata = image.getMetadata(); + + Map<String, String> metadata = image.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); image.setMetadata(metadata); - + Long size = image.getSize(); Assert.assertNotNull(size); - + Calendar created = image.getCreated(); Assert.assertNotNull(created); image.setCreated(created); - + Integer minRam = image.getMinRam(); Assert.assertNotNull(minRam); image.setMinRam(minRam); - + String name = image.getName(); Assert.assertNotNull(name); image.setName(name); - + Integer progress = image.getProgress(); Assert.assertNotNull(progress); image.setProgress(progress); - + List<Link> links = image.getLinks(); Assert.assertNotNull(links); Assert.assertEquals(2, links.size()); image.setLinks(links); - + String id = image.getId(); Assert.assertNotNull(id); image.setId(id); - + Calendar updated = image.getUpdated(); Assert.assertNotNull(updated); image.setUpdated(updated); - + Integer minDisk = image.getMinDisk(); Assert.assertNotNull(minDisk); image.setMinDisk(minDisk); - + String status = image.getStatus(); Assert.assertNotNull(status); image.setStatus(status); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ImagesTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ImagesTest.java index 2b52804..c54e22e 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ImagesTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ImagesTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,85 +34,35 @@ public class ImagesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"images\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"progress\" : 3," + EOL - + " \"minRam\" : 62," + EOL - + " \"minDisk\" : 69," + EOL - + " \"created\" : 1485172800000," + EOL - + " \"updated\" : 1486468800000," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"server\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " }," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"progress\" : 3," + EOL - + " \"minRam\" : 62," + EOL - + " \"minDisk\" : 69," + EOL - + " \"created\" : 1485172800000," + EOL - + " \"updated\" : 1486468800000," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"server\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " }," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"images\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"name\" : \"name\"," + EOL + " \"progress\" : 3," + EOL + + " \"minRam\" : 62," + EOL + " \"minDisk\" : 69," + EOL + " \"created\" : 1485172800000," + EOL + + " \"updated\" : 1486468800000," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"server\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"links\" : [ {" + + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " }," + + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL + + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"name\" : \"name\"," + EOL + " \"progress\" : 3," + EOL + + " \"minRam\" : 62," + EOL + " \"minDisk\" : 69," + EOL + " \"created\" : 1485172800000," + EOL + + " \"updated\" : 1486468800000," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"server\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"links\" : [ {" + + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " }," + + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL + + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -130,13 +78,14 @@ public class ImagesTest { public void testMethods() throws Exception { Images images = objectMapper.readValue(JSON_FULL, Images.class); images.toString(); - + List<Image> list = images.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Image x : images) { + for (@SuppressWarnings("unused") + Image x : images) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/IpRangeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/IpRangeTest.java index 0505671..f441499 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/IpRangeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/IpRangeTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.SecurityGroup.Rule.IpRange; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,15 +34,11 @@ public class IpRangeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"cidr\" : \"cidr\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -59,7 +54,7 @@ public class IpRangeTest { public void testMethods() throws Exception { IpRange iprange = objectMapper.readValue(JSON_FULL, IpRange.class); iprange.toString(); - + String cidr = iprange.getCidr(); Assert.assertNotNull(cidr); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairTest.java index c7f564c..0ef3f5d 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,23 +33,15 @@ public class KeyPairTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"keypair\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"fingerprint\" : \"fingerprint\"," + EOL - + " \"user_id\" : \"userid\"," + EOL - + " \"public_key\" : \"publickey\"," + EOL - + " \"private_key\" : \"privatekey\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"keypair\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"fingerprint\" : \"fingerprint\"," + EOL + " \"user_id\" : \"userid\"," + EOL + + " \"public_key\" : \"publickey\"," + EOL + " \"private_key\" : \"privatekey\"" + EOL + " }" + EOL + + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -66,21 +57,21 @@ public class KeyPairTest { public void testMethods() throws Exception { KeyPair keypair = objectMapper.readValue(JSON_FULL, KeyPair.class); keypair.toString(); - + String privateKey = keypair.getPrivateKey(); Assert.assertNotNull(privateKey); - + String name = keypair.getName(); Assert.assertNotNull(name); keypair.setName(name); - + String fingerprint = keypair.getFingerprint(); Assert.assertNotNull(fingerprint); - + String publicKey = keypair.getPublicKey(); Assert.assertNotNull(publicKey); keypair.setPublicKey(publicKey); - + String userId = keypair.getUserId(); Assert.assertNotNull(userId); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairWrapperTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairWrapperTest.java index 3ba27d0..302853c 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairWrapperTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairWrapperTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.KeyPairs.KeyPairWrapper; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,21 +33,14 @@ public class KeyPairWrapperTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"keypair\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"fingerprint\" : \"fingerprint\"," + EOL - + " \"user_id\" : \"userid\"," + EOL - + " \"public_key\" : \"publickey\"," + EOL - + " \"private_key\" : \"privatekey\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"keypair\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"fingerprint\" : \"fingerprint\"," + EOL + " \"user_id\" : \"userid\"," + EOL + + " \"public_key\" : \"publickey\"," + EOL + " \"private_key\" : \"privatekey\"" + EOL + " }" + EOL + + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairsTest.java index fe6d090..ed1a258 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/KeyPairsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; @@ -37,34 +35,20 @@ public class KeyPairsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"keypairs\" : [ {" + EOL - + " \"keypair\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"fingerprint\" : \"fingerprint\"," + EOL - + " \"user_id\" : \"userid\"," + EOL - + " \"public_key\" : \"publickey\"," + EOL - + " \"private_key\" : \"privatekey\"" + EOL - + " }" + EOL - + " }, {" + EOL - + " \"keypair\" : { " + EOL - + " \"name\" : \"name\"," + EOL - + " \"fingerprint\" : \"fingerprint\"," + EOL - + " \"user_id\" : \"userid\"," + EOL - + " \"public_key\" : \"publickey\"," + EOL - + " \"private_key\" : \"privatekey\"" + EOL - + " }" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"keypairs\" : [ {" + EOL + " \"keypair\" : {" + EOL + + " \"name\" : \"name\"," + EOL + " \"fingerprint\" : \"fingerprint\"," + EOL + + " \"user_id\" : \"userid\"," + EOL + " \"public_key\" : \"publickey\"," + EOL + + " \"private_key\" : \"privatekey\"" + EOL + " }" + EOL + " }, {" + EOL + " \"keypair\" : { " + + EOL + " \"name\" : \"name\"," + EOL + " \"fingerprint\" : \"fingerprint\"," + EOL + + " \"user_id\" : \"userid\"," + EOL + " \"public_key\" : \"publickey\"," + EOL + + " \"private_key\" : \"privatekey\"" + EOL + " }" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); // This is test is ignored because The KeyPairs class does not - // serialize into JSON correctly. It is probably not an operational + // serialize into JSON correctly. It is probably not an operational // issue because KeyPairs is only used to represent the response to // the GET os-keypairs request. @Ignore @@ -87,7 +71,8 @@ public class KeyPairsTest { Assert.assertNotNull(list); int cnt = 0; - for (@SuppressWarnings("unused") KeyPair x : keypairs) { + for (@SuppressWarnings("unused") + KeyPair x : keypairs) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/LimitEntryTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/LimitEntryTest.java index 25f6ab9..22fbc15 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/LimitEntryTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/LimitEntryTest.java @@ -25,9 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Limits.RateLimit.LimitEntry; - import java.util.Calendar; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,20 +35,13 @@ public class LimitEntryTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"unit\" : \"unit\"," + EOL - + " \"verb\" : \"verb\"," + EOL - + " \"remaining\" : 72," + EOL - + " \"available\" : 47," + EOL - + " \"value\" : 59," + EOL - + " \"next-available\" : 1489320000000" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"unit\" : \"unit\"," + EOL + " \"verb\" : \"verb\"," + EOL + + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + " \"value\" : 59," + EOL + + " \"next-available\" : 1489320000000" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -66,22 +57,22 @@ public class LimitEntryTest { public void testMethods() throws Exception { LimitEntry limitentry = objectMapper.readValue(JSON_FULL, LimitEntry.class); limitentry.toString(); - + String unit = limitentry.getUnit(); Assert.assertNotNull(unit); - + String verb = limitentry.getVerb(); Assert.assertNotNull(verb); - + Integer available = limitentry.getAvailable(); Assert.assertNotNull(available); - + Calendar nextAvailable = limitentry.getNextAvailable(); Assert.assertNotNull(nextAvailable); - + Integer value = limitentry.getValue(); Assert.assertNotNull(value); - + Integer remaining = limitentry.getRemaining(); Assert.assertNotNull(remaining); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/LimitsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/LimitsTest.java index ec450d3..bd23ae9 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/LimitsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/LimitsTest.java @@ -26,9 +26,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Limits.AbsoluteLimit; import com.woorea.openstack.nova.model.Limits.RateLimit; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -38,83 +36,40 @@ public class LimitsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"limits\" : {" + EOL - + " \"rate\" : [ {" + EOL - + " \"regex\" : \"regex\"," + EOL - + " \"uri\" : \"uri\"," + EOL - + " \"limit\" : [ {" + EOL - + " \"unit\" : \"unit\"," + EOL - + " \"verb\" : \"verb\"," + EOL - + " \"remaining\" : 72," + EOL - + " \"available\" : 47," + EOL - + " \"value\" : 59," + EOL - + " \"next-available\" : 1489320000000" + EOL - + " }, {" + EOL - + " \"unit\" : \"unit\"," + EOL - + " \"verb\" : \"verb\"," + EOL - + " \"remaining\" : 72," + EOL - + " \"available\" : 47," + EOL - + " \"value\" : 59," + EOL - + " \"next-available\" : 1489320000000" + EOL - + " } ]" + EOL - + " }, {" + EOL - + " \"regex\" : \"regex\"," + EOL - + " \"uri\" : \"uri\"," + EOL - + " \"limit\" : [ {" + EOL - + " \"unit\" : \"unit\"," + EOL - + " \"verb\" : \"verb\"," + EOL - + " \"remaining\" : 72," + EOL - + " \"available\" : 47," + EOL - + " \"value\" : 59," + EOL - + " \"next-available\" : 1489320000000" + EOL - + " }, {" + EOL - + " \"unit\" : \"unit\"," + EOL - + " \"verb\" : \"verb\"," + EOL - + " \"remaining\" : 72," + EOL - + " \"available\" : 47," + EOL - + " \"value\" : 59," + EOL - + " \"next-available\" : 1489320000000" + EOL - + " } ]" + EOL - + " } ]," + EOL - + " \"absolute\" : {" + EOL - + " \"maxServerMeta\" : 30," + EOL - + " \"serverMetaUsed\" : 37," + EOL - + " \"maxPersonality\" : 54," + EOL - + " \"personalityUsed\" : 61," + EOL - + " \"maxImageMeta\" : 82," + EOL - + " \"imageMetaUsed\" : 89," + EOL - + " \"maxPersonalitySize\" : 97," + EOL - + " \"personalitySizeUsed\" : 4," + EOL - + " \"maxTotalCores\" : 32," + EOL - + " \"totalCoresUsed\" : 39," + EOL - + " \"maxTotalInstances\" : 60," + EOL - + " \"totalInstancesUsed\" : 67," + EOL - + " \"maxTotalRAMSize\" : 55," + EOL - + " \"totalRAMUsed\" : 19," + EOL - + " \"maxSecurityGroupRules\" : 44," + EOL - + " \"securityGroupRulesUsed\" : 51," + EOL - + " \"maxTotalKeypairs\" : 64," + EOL - + " \"totalKeyPairsUsed\" : 71," + EOL - + " \"maxTotalVolumes\" : 71," + EOL - + " \"totalVolumesUsed\" : 78," + EOL - + " \"maxSecurityGroups\" : 4," + EOL - + " \"totalSecurityGroupsUsed\" : 59," + EOL - + " \"maxTotalFloatingIps\" : 76," + EOL - + " \"totalFloatingIpsUsed\" : 83," + EOL - + " \"maxTotalVolumeGigabytes\" : 15," + EOL - + " \"totalVolumeGigabytesUsed\" : 22" + EOL - + " }" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"limits\" : {" + EOL + " \"rate\" : [ {" + EOL + + " \"regex\" : \"regex\"," + EOL + " \"uri\" : \"uri\"," + EOL + " \"limit\" : [ {" + EOL + + " \"unit\" : \"unit\"," + EOL + " \"verb\" : \"verb\"," + EOL + + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + " \"value\" : 59," + + EOL + " \"next-available\" : 1489320000000" + EOL + " }, {" + EOL + + " \"unit\" : \"unit\"," + EOL + " \"verb\" : \"verb\"," + EOL + + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + " \"value\" : 59," + + EOL + " \"next-available\" : 1489320000000" + EOL + " } ]" + EOL + " }, {" + EOL + + " \"regex\" : \"regex\"," + EOL + " \"uri\" : \"uri\"," + EOL + " \"limit\" : [ {" + EOL + + " \"unit\" : \"unit\"," + EOL + " \"verb\" : \"verb\"," + EOL + + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + " \"value\" : 59," + + EOL + " \"next-available\" : 1489320000000" + EOL + " }, {" + EOL + + " \"unit\" : \"unit\"," + EOL + " \"verb\" : \"verb\"," + EOL + + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + " \"value\" : 59," + + EOL + " \"next-available\" : 1489320000000" + EOL + " } ]" + EOL + " } ]," + EOL + + " \"absolute\" : {" + EOL + " \"maxServerMeta\" : 30," + EOL + " \"serverMetaUsed\" : 37," + + EOL + " \"maxPersonality\" : 54," + EOL + " \"personalityUsed\" : 61," + EOL + + " \"maxImageMeta\" : 82," + EOL + " \"imageMetaUsed\" : 89," + EOL + + " \"maxPersonalitySize\" : 97," + EOL + " \"personalitySizeUsed\" : 4," + EOL + + " \"maxTotalCores\" : 32," + EOL + " \"totalCoresUsed\" : 39," + EOL + + " \"maxTotalInstances\" : 60," + EOL + " \"totalInstancesUsed\" : 67," + EOL + + " \"maxTotalRAMSize\" : 55," + EOL + " \"totalRAMUsed\" : 19," + EOL + + " \"maxSecurityGroupRules\" : 44," + EOL + " \"securityGroupRulesUsed\" : 51," + EOL + + " \"maxTotalKeypairs\" : 64," + EOL + " \"totalKeyPairsUsed\" : 71," + EOL + + " \"maxTotalVolumes\" : 71," + EOL + " \"totalVolumesUsed\" : 78," + EOL + + " \"maxSecurityGroups\" : 4," + EOL + " \"totalSecurityGroupsUsed\" : 59," + EOL + + " \"maxTotalFloatingIps\" : 76," + EOL + " \"totalFloatingIpsUsed\" : 83," + EOL + + " \"maxTotalVolumeGigabytes\" : 15," + EOL + " \"totalVolumeGigabytesUsed\" : 22" + EOL + + " }" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -130,11 +85,11 @@ public class LimitsTest { public void testMethods() throws Exception { Limits limits = objectMapper.readValue(JSON_FULL, Limits.class); limits.toString(); - + List<RateLimit> rate = limits.getRate(); Assert.assertNotNull(rate); Assert.assertEquals(2, rate.size()); - + AbsoluteLimit absolute = limits.getAbsolute(); Assert.assertNotNull(absolute); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/LinkTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/LinkTest.java index c2fae01..965220d 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/LinkTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/LinkTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,17 +33,12 @@ public class LinkTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -60,13 +54,13 @@ public class LinkTest { public void testMethods() throws Exception { Link link = objectMapper.readValue(JSON_FULL, Link.class); link.toString(); - + String rel = link.getRel(); Assert.assertNotNull(rel); - + String href = link.getHref(); Assert.assertNotNull(href); - + String type = link.getType(); Assert.assertNotNull(type); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/LockTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/LockTest.java index 1c017de..37e9295 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/LockTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/LockTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Lock; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class LockTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"lock\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"lock\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/MetadataTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/MetadataTest.java index b1c65f6..a0f8482 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/MetadataTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/MetadataTest.java @@ -21,9 +21,7 @@ package com.woorea.openstack.nova.model; import org.junit.Test; - import java.util.Collections; - import static org.junit.Assert.*; public class MetadataTest { @@ -39,4 +37,4 @@ public class MetadataTest { public void setMetadata() { metadata.setMetadata(Collections.<String, String>emptyMap()); } -}
\ No newline at end of file +} diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworkForCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworkForCreateTest.java index aae0c7f..ed2fa55 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworkForCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworkForCreateTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,16 +33,12 @@ public class NetworkForCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"uuid\" : \"id\"," + EOL - + " \"fixed_ip\" : \"fixedip\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"uuid\" : \"id\"," + EOL + " \"fixed_ip\" : \"fixedip\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -59,11 +54,11 @@ public class NetworkForCreateTest { public void testMethods() throws Exception { NetworkForCreate networkforcreate = objectMapper.readValue(JSON_FULL, NetworkForCreate.class); networkforcreate.toString(); - + String fixedIp = networkforcreate.getFixedIp(); Assert.assertNotNull(fixedIp); networkforcreate.setFixedIp(fixedIp); - + String id = networkforcreate.getId(); Assert.assertNotNull(id); networkforcreate.setId(id); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworkTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworkTest.java index 73b871d..54e2f8b 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworkTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworkTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,46 +33,26 @@ public class NetworkTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"network\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"bridge\" : \"bridge\"," + EOL - + " \"deleted\" : false," + EOL - + " \"vlan\" : \"vlan\"," + EOL - + " \"broadcast\" : \"broadcast\"," + EOL - + " \"netmask\" : \"netmask\"," + EOL - + " \"injected\" : true," + EOL - + " \"host\" : \"host\"," + EOL - + " \"cidr\" : \"cidr\"," + EOL - + " \"gateway\" : \"gateway\"," + EOL - + " \"dns1\" : \"dns1\"," + EOL - + " \"dns2\" : \"dns2\"," + EOL - + " \"label\" : \"label\"," + EOL - + " \"priority\" : \"priority\"," + EOL - + " \"vpn_public_address\" : \"vpnpublicaddress\"," + EOL - + " \"vpn_private_address\" : \"vpnprivateaddress\"," + EOL - + " \"vpn_public_port\" : \"vpnpublicport\"," + EOL - + " \"dhcp_start\" : \"dhcpstart\"," + EOL - + " \"bridge_interface\" : \"bridgeinterface\"," + EOL - + " \"updated_at\" : \"updatedat\"," + EOL - + " \"multi_host\" : false," + EOL - + " \"created_at\" : \"createdat\"," + EOL - + " \"deleted_at\" : \"deletedat\"," + EOL - + " \"cidr_v6\" : \"cidrv6\"," + EOL - + " \"gateway_v6\" : \"gatewayv6\"," + EOL - + " \"netmask_v6\" : \"netmaskv6\"," + EOL - + " \"project_id\" : \"projectid\"," + EOL - + " \"rxtx_base\" : \"rxtxbase\"" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"network\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"bridge\" : \"bridge\"," + EOL + " \"deleted\" : false," + EOL + " \"vlan\" : \"vlan\"," + EOL + + " \"broadcast\" : \"broadcast\"," + EOL + " \"netmask\" : \"netmask\"," + EOL + + " \"injected\" : true," + EOL + " \"host\" : \"host\"," + EOL + " \"cidr\" : \"cidr\"," + EOL + + " \"gateway\" : \"gateway\"," + EOL + " \"dns1\" : \"dns1\"," + EOL + " \"dns2\" : \"dns2\"," + + EOL + " \"label\" : \"label\"," + EOL + " \"priority\" : \"priority\"," + EOL + + " \"vpn_public_address\" : \"vpnpublicaddress\"," + EOL + + " \"vpn_private_address\" : \"vpnprivateaddress\"," + EOL + + " \"vpn_public_port\" : \"vpnpublicport\"," + EOL + " \"dhcp_start\" : \"dhcpstart\"," + EOL + + " \"bridge_interface\" : \"bridgeinterface\"," + EOL + " \"updated_at\" : \"updatedat\"," + EOL + + " \"multi_host\" : false," + EOL + " \"created_at\" : \"createdat\"," + EOL + + " \"deleted_at\" : \"deletedat\"," + EOL + " \"cidr_v6\" : \"cidrv6\"," + EOL + + " \"gateway_v6\" : \"gatewayv6\"," + EOL + " \"netmask_v6\" : \"netmaskv6\"," + EOL + + " \"project_id\" : \"projectid\"," + EOL + " \"rxtx_base\" : \"rxtxbase\"" + EOL + " }" + EOL + + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -89,85 +68,85 @@ public class NetworkTest { public void testMethods() throws Exception { Network network = objectMapper.readValue(JSON_FULL, Network.class); network.toString(); - + String broadcast = network.getBroadcast(); Assert.assertNotNull(broadcast); - + String gatewayV6 = network.getGatewayV6(); Assert.assertNotNull(gatewayV6); - + String dns2 = network.getDns2(); Assert.assertNotNull(dns2); - + String bridgeInterface = network.getBridgeInterface(); Assert.assertNotNull(bridgeInterface); - + String dns1 = network.getDns1(); Assert.assertNotNull(dns1); - + String cidrV6 = network.getCidrV6(); Assert.assertNotNull(cidrV6); - + String deletedAt = network.getDeletedAt(); Assert.assertNotNull(deletedAt); - + String vlan = network.getVlan(); Assert.assertNotNull(vlan); - + String netmask = network.getNetmask(); Assert.assertNotNull(netmask); - + String netmaskV6 = network.getNetmaskV6(); Assert.assertNotNull(netmaskV6); - + Boolean injected = network.getInjected(); Assert.assertNotNull(injected); - + String host = network.getHost(); Assert.assertNotNull(host); - + String cidr = network.getCidr(); Assert.assertNotNull(cidr); - + String id = network.getId(); Assert.assertNotNull(id); - + String projectId = network.getProjectId(); Assert.assertNotNull(projectId); - + String vpnPublicAddress = network.getVpnPublicAddress(); Assert.assertNotNull(vpnPublicAddress); - + String label = network.getLabel(); Assert.assertNotNull(label); - + String priority = network.getPriority(); Assert.assertNotNull(priority); - + String vpnPublicPort = network.getVpnPublicPort(); Assert.assertNotNull(vpnPublicPort); - + String createdAt = network.getCreatedAt(); Assert.assertNotNull(createdAt); - + Boolean deleted = network.getDeleted(); Assert.assertNotNull(deleted); - + String rxtxBase = network.getRxtxBase(); Assert.assertNotNull(rxtxBase); - + String dhcpStart = network.getDhcpStart(); Assert.assertNotNull(dhcpStart); - + Boolean multiHost = network.getMultiHost(); Assert.assertNotNull(multiHost); - + String bridge = network.getBridge(); Assert.assertNotNull(bridge); - + String gateway = network.getGateway(); Assert.assertNotNull(gateway); - + String updatedAt = network.getUpdatedAt(); Assert.assertNotNull(updatedAt); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworksTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworksTest.java index 3e4272c..bbebe26 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworksTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/NetworksTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,73 +34,38 @@ public class NetworksTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"networks\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"bridge\" : \"bridge\"," + EOL - + " \"deleted\" : false," + EOL - + " \"vlan\" : \"vlan\"," + EOL - + " \"broadcast\" : \"broadcast\"," + EOL - + " \"netmask\" : \"netmask\"," + EOL - + " \"injected\" : true," + EOL - + " \"host\" : \"host\"," + EOL - + " \"cidr\" : \"cidr\"," + EOL - + " \"gateway\" : \"gateway\"," + EOL - + " \"dns1\" : \"dns1\"," + EOL - + " \"dns2\" : \"dns2\"," + EOL - + " \"label\" : \"label\"," + EOL - + " \"priority\" : \"priority\"," + EOL - + " \"vpn_public_address\" : \"vpnpublicaddress\"," + EOL - + " \"vpn_private_address\" : \"vpnprivateaddress\"," + EOL - + " \"vpn_public_port\" : \"vpnpublicport\"," + EOL - + " \"dhcp_start\" : \"dhcpstart\"," + EOL - + " \"bridge_interface\" : \"bridgeinterface\"," + EOL - + " \"updated_at\" : \"updatedat\"," + EOL - + " \"multi_host\" : false," + EOL - + " \"created_at\" : \"createdat\"," + EOL - + " \"deleted_at\" : \"deletedat\"," + EOL - + " \"cidr_v6\" : \"cidrv6\"," + EOL - + " \"gateway_v6\" : \"gatewayv6\"," + EOL - + " \"netmask_v6\" : \"netmaskv6\"," + EOL - + " \"project_id\" : \"projectid\"," + EOL - + " \"rxtx_base\" : \"rxtxbase\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"bridge\" : \"bridge\"," + EOL - + " \"deleted\" : false," + EOL - + " \"vlan\" : \"vlan\"," + EOL - + " \"broadcast\" : \"broadcast\"," + EOL - + " \"netmask\" : \"netmask\"," + EOL - + " \"injected\" : true," + EOL - + " \"host\" : \"host\"," + EOL - + " \"cidr\" : \"cidr\"," + EOL - + " \"gateway\" : \"gateway\"," + EOL - + " \"dns1\" : \"dns1\"," + EOL - + " \"dns2\" : \"dns2\"," + EOL - + " \"label\" : \"label\"," + EOL - + " \"priority\" : \"priority\"," + EOL - + " \"vpn_public_address\" : \"vpnpublicaddress\"," + EOL - + " \"vpn_private_address\" : \"vpnprivateaddress\"," + EOL - + " \"vpn_public_port\" : \"vpnpublicport\"," + EOL - + " \"dhcp_start\" : \"dhcpstart\"," + EOL - + " \"bridge_interface\" : \"bridgeinterface\"," + EOL - + " \"updated_at\" : \"updatedat\"," + EOL - + " \"multi_host\" : false," + EOL - + " \"created_at\" : \"createdat\"," + EOL - + " \"deleted_at\" : \"deletedat\"," + EOL - + " \"cidr_v6\" : \"cidrv6\"," + EOL - + " \"gateway_v6\" : \"gatewayv6\"," + EOL - + " \"netmask_v6\" : \"netmaskv6\"," + EOL - + " \"project_id\" : \"projectid\"," + EOL - + " \"rxtx_base\" : \"rxtxbase\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"networks\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"bridge\" : \"bridge\"," + EOL + " \"deleted\" : false," + EOL + " \"vlan\" : \"vlan\"," + EOL + + " \"broadcast\" : \"broadcast\"," + EOL + " \"netmask\" : \"netmask\"," + EOL + + " \"injected\" : true," + EOL + " \"host\" : \"host\"," + EOL + " \"cidr\" : \"cidr\"," + EOL + + " \"gateway\" : \"gateway\"," + EOL + " \"dns1\" : \"dns1\"," + EOL + " \"dns2\" : \"dns2\"," + + EOL + " \"label\" : \"label\"," + EOL + " \"priority\" : \"priority\"," + EOL + + " \"vpn_public_address\" : \"vpnpublicaddress\"," + EOL + + " \"vpn_private_address\" : \"vpnprivateaddress\"," + EOL + + " \"vpn_public_port\" : \"vpnpublicport\"," + EOL + " \"dhcp_start\" : \"dhcpstart\"," + EOL + + " \"bridge_interface\" : \"bridgeinterface\"," + EOL + " \"updated_at\" : \"updatedat\"," + EOL + + " \"multi_host\" : false," + EOL + " \"created_at\" : \"createdat\"," + EOL + + " \"deleted_at\" : \"deletedat\"," + EOL + " \"cidr_v6\" : \"cidrv6\"," + EOL + + " \"gateway_v6\" : \"gatewayv6\"," + EOL + " \"netmask_v6\" : \"netmaskv6\"," + EOL + + " \"project_id\" : \"projectid\"," + EOL + " \"rxtx_base\" : \"rxtxbase\"" + EOL + " }, {" + EOL + + " \"id\" : \"id\"," + EOL + " \"bridge\" : \"bridge\"," + EOL + " \"deleted\" : false," + EOL + + " \"vlan\" : \"vlan\"," + EOL + " \"broadcast\" : \"broadcast\"," + EOL + + " \"netmask\" : \"netmask\"," + EOL + " \"injected\" : true," + EOL + " \"host\" : \"host\"," + + EOL + " \"cidr\" : \"cidr\"," + EOL + " \"gateway\" : \"gateway\"," + EOL + + " \"dns1\" : \"dns1\"," + EOL + " \"dns2\" : \"dns2\"," + EOL + " \"label\" : \"label\"," + EOL + + " \"priority\" : \"priority\"," + EOL + " \"vpn_public_address\" : \"vpnpublicaddress\"," + EOL + + " \"vpn_private_address\" : \"vpnprivateaddress\"," + EOL + + " \"vpn_public_port\" : \"vpnpublicport\"," + EOL + " \"dhcp_start\" : \"dhcpstart\"," + EOL + + " \"bridge_interface\" : \"bridgeinterface\"," + EOL + " \"updated_at\" : \"updatedat\"," + EOL + + " \"multi_host\" : false," + EOL + " \"created_at\" : \"createdat\"," + EOL + + " \"deleted_at\" : \"deletedat\"," + EOL + " \"cidr_v6\" : \"cidrv6\"," + EOL + + " \"gateway_v6\" : \"gatewayv6\"," + EOL + " \"netmask_v6\" : \"netmaskv6\"," + EOL + + " \"project_id\" : \"projectid\"," + EOL + " \"rxtx_base\" : \"rxtxbase\"" + EOL + " } ]" + EOL + + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -118,13 +81,14 @@ public class NetworksTest { public void testMethods() throws Exception { Networks networks = objectMapper.readValue(JSON_FULL, Networks.class); networks.toString(); - + List<Network> list = networks.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Network x : networks) { + for (@SuppressWarnings("unused") + Network x : networks) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/PauseTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/PauseTest.java index c14cc40..5c54d38 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/PauseTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/PauseTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Pause; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class PauseTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"pause\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"pause\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/PersonalityFileTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/PersonalityFileTest.java index 6e113cb..142bfa8 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/PersonalityFileTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/PersonalityFileTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,16 +33,12 @@ public class PersonalityFileTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"path\" : \"path\"," + EOL - + " \"contents\" : \"contents\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"path\" : \"path\"," + EOL + " \"contents\" : \"contents\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -59,11 +54,11 @@ public class PersonalityFileTest { public void testMethods() throws Exception { PersonalityFile personalityfile = objectMapper.readValue(JSON_FULL, PersonalityFile.class); personalityfile.toString(); - + String path = personalityfile.getPath(); Assert.assertNotNull(path); personalityfile.setPath(path); - + String contents = personalityfile.getContents(); Assert.assertNotNull(contents); personalityfile.setContents(contents); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/QuotaSetTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/QuotaSetTest.java index c26a3a1..200b1f5 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/QuotaSetTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/QuotaSetTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,32 +33,18 @@ public class QuotaSetTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"quota_set\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"gigabytes\" : 77," + EOL - + " \"ram\" : 38," + EOL - + " \"instances\" : 86," + EOL - + " \"volumes\" : 97," + EOL - + " \"cores\" : 58," + EOL - + " \"metadata_items\" : 97," + EOL - + " \"injected_file_content_bytes\" : 86," + EOL - + " \"injected_files\" : 87," + EOL - + " \"floating_ips\" : 2," + EOL - + " \"security_groups\" : 78," + EOL - + " \"security_group_rules\" : 18," + EOL - + " \"injected_file_path_bytes\" : 52," + EOL - + " \"key_pairs\" : 90" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"quota_set\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"gigabytes\" : 77," + EOL + " \"ram\" : 38," + EOL + " \"instances\" : 86," + EOL + + " \"volumes\" : 97," + EOL + " \"cores\" : 58," + EOL + " \"metadata_items\" : 97," + EOL + + " \"injected_file_content_bytes\" : 86," + EOL + " \"injected_files\" : 87," + EOL + + " \"floating_ips\" : 2," + EOL + " \"security_groups\" : 78," + EOL + + " \"security_group_rules\" : 18," + EOL + " \"injected_file_path_bytes\" : 52," + EOL + + " \"key_pairs\" : 90" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -75,59 +60,59 @@ public class QuotaSetTest { public void testMethods() throws Exception { QuotaSet quotaset = objectMapper.readValue(JSON_FULL, QuotaSet.class); quotaset.toString(); - + Integer injectedFileContentBytes = quotaset.getInjectedFileContentBytes(); Assert.assertNotNull(injectedFileContentBytes); quotaset.setInjectedFileContentBytes(injectedFileContentBytes); - + Integer injectedFiles = quotaset.getInjectedFiles(); Assert.assertNotNull(injectedFiles); quotaset.setInjectedFiles(injectedFiles); - + Integer instances = quotaset.getInstances(); Assert.assertNotNull(instances); quotaset.setInstances(instances); - + Integer gigabytes = quotaset.getGigabytes(); Assert.assertNotNull(gigabytes); quotaset.setGigabytes(gigabytes); - + Integer metadataItems = quotaset.getMetadataItems(); Assert.assertNotNull(metadataItems); quotaset.setMetadataItems(metadataItems); - + Integer volumes = quotaset.getVolumes(); Assert.assertNotNull(volumes); quotaset.setVolumes(volumes); - + Integer injectedFilePathBytes = quotaset.getInjectedFilePathBytes(); Assert.assertNotNull(injectedFilePathBytes); quotaset.setInjectedFilePathBytes(injectedFilePathBytes); - + Integer securityGroupRules = quotaset.getSecurityGroupRules(); Assert.assertNotNull(securityGroupRules); quotaset.setSecurityGroupRules(securityGroupRules); - + Integer floatingIps = quotaset.getFloatingIps(); Assert.assertNotNull(floatingIps); quotaset.setFloatingIps(floatingIps); - + Integer cores = quotaset.getCores(); Assert.assertNotNull(cores); quotaset.setCores(cores); - + String id = quotaset.getId(); Assert.assertNotNull(id); quotaset.setId(id); - + Integer securityGroups = quotaset.getSecurityGroups(); Assert.assertNotNull(securityGroups); quotaset.setSecurityGroups(securityGroups); - + Integer ram = quotaset.getRam(); Assert.assertNotNull(ram); quotaset.setRam(ram); - + Integer keyPairs = quotaset.getKeyPairs(); Assert.assertNotNull(keyPairs); quotaset.setKeyPairs(keyPairs); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/RateLimitTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/RateLimitTest.java index ef2e98a..b742174 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/RateLimitTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/RateLimitTest.java @@ -26,9 +26,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Limits.RateLimit; import com.woorea.openstack.nova.model.Limits.RateLimit.LimitEntry; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -38,31 +36,16 @@ public class RateLimitTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"regex\" : \"regex\"," + EOL - + " \"uri\" : \"uri\"," + EOL - + " \"limit\" : [ {" + EOL - + " \"unit\" : \"unit\"," + EOL - + " \"verb\" : \"verb\"," + EOL - + " \"remaining\" : 72," + EOL - + " \"available\" : 47," + EOL - + " \"value\" : 59," + EOL - + " \"next-available\" : 1489320000000" + EOL - + " }, {" + EOL - + " \"unit\" : \"unit\"," + EOL - + " \"verb\" : \"verb\"," + EOL - + " \"remaining\" : 72," + EOL - + " \"available\" : 47," + EOL - + " \"value\" : 59," + EOL - + " \"next-available\" : 1489320000000" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"regex\" : \"regex\"," + EOL + " \"uri\" : \"uri\"," + EOL + + " \"limit\" : [ {" + EOL + " \"unit\" : \"unit\"," + EOL + " \"verb\" : \"verb\"," + EOL + + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + " \"value\" : 59," + EOL + + " \"next-available\" : 1489320000000" + EOL + " }, {" + EOL + " \"unit\" : \"unit\"," + EOL + + " \"verb\" : \"verb\"," + EOL + " \"remaining\" : 72," + EOL + " \"available\" : 47," + EOL + + " \"value\" : 59," + EOL + " \"next-available\" : 1489320000000" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -78,14 +61,14 @@ public class RateLimitTest { public void testMethods() throws Exception { RateLimit ratelimit = objectMapper.readValue(JSON_FULL, RateLimit.class); ratelimit.toString(); - + String regex = ratelimit.getRegex(); Assert.assertNotNull(regex); - + List<LimitEntry> limit = ratelimit.getLimit(); Assert.assertNotNull(limit); Assert.assertEquals(2, limit.size()); - + String uri = ratelimit.getUri(); Assert.assertNotNull(uri); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/RebootTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/RebootTest.java index 494b088..b4e105b 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/RebootTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/RebootTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Reboot; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,19 +34,13 @@ public class RebootTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"reboot\" : {" + EOL - + " \"type\" : \"type\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"reboot\" : {" + EOL + " \"type\" : \"type\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -63,7 +56,7 @@ public class RebootTest { public void testMethods() throws Exception { Reboot reboot = objectMapper.readValue(JSON_FULL, Reboot.class); reboot.toString(); - + String type = reboot.getType(); Assert.assertNotNull(type); reboot.setType(type); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/RebuildTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/RebuildTest.java index b3fb845..501f68d 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/RebuildTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/RebuildTest.java @@ -25,10 +25,8 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Rebuild; - import java.util.List; import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -38,35 +36,19 @@ public class RebuildTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"rebuild\" : {" + EOL - + " \"imageRef\" : \"imageref\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"adminPass\" : \"adminpass\"," + EOL - + " \"accessIPv4\" : \"accessipv4\"," + EOL - + " \"accessIPv6\" : \"accessipv6\"," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"personality\" : [ {" + EOL - + " \"path\" : \"path\"," + EOL - + " \"contents\" : \"contents\"" + EOL - + " }, {" + EOL - + " \"path\" : \"path\"," + EOL - + " \"contents\" : \"contents\"" + EOL - + " } ]," + EOL - + " \"OS-DCF:diskConfig\" : \"diskconfig\"" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"rebuild\" : {" + EOL + " \"imageRef\" : \"imageref\"," + + EOL + " \"name\" : \"name\"," + EOL + " \"adminPass\" : \"adminpass\"," + EOL + + " \"accessIPv4\" : \"accessipv4\"," + EOL + " \"accessIPv6\" : \"accessipv6\"," + EOL + + " \"metadata\" : {" + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + + " \"metadata-k2\" : \"metadata-v2\"" + EOL + " }," + EOL + " \"personality\" : [ {" + EOL + + " \"path\" : \"path\"," + EOL + " \"contents\" : \"contents\"" + EOL + " }, {" + EOL + + " \"path\" : \"path\"," + EOL + " \"contents\" : \"contents\"" + EOL + " } ]," + EOL + + " \"OS-DCF:diskConfig\" : \"diskconfig\"" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -82,37 +64,37 @@ public class RebuildTest { public void testMethods() throws Exception { Rebuild rebuild = objectMapper.readValue(JSON_FULL, Rebuild.class); rebuild.toString(); - - Map<String,String> metadata = rebuild.getMetadata(); + + Map<String, String> metadata = rebuild.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); rebuild.setMetadata(metadata); - + List<PersonalityFile> personality = rebuild.getPersonality(); Assert.assertNotNull(personality); Assert.assertEquals(2, personality.size()); rebuild.setPersonality(personality); - + String name = rebuild.getName(); Assert.assertNotNull(name); rebuild.setName(name); - + String adminPass = rebuild.getAdminPass(); Assert.assertNotNull(adminPass); rebuild.setAdminPass(adminPass); - + String imageRef = rebuild.getImageRef(); Assert.assertNotNull(imageRef); rebuild.setImageRef(imageRef); - + String accessIPv6 = rebuild.getAccessIPv6(); Assert.assertNotNull(accessIPv6); rebuild.setAccessIPv6(accessIPv6); - + String diskConfig = rebuild.getDiskConfig(); Assert.assertNotNull(diskConfig); rebuild.setDiskConfig(diskConfig); - + String accessIPv4 = rebuild.getAccessIPv4(); Assert.assertNotNull(accessIPv4); rebuild.setAccessIPv4(accessIPv4); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/RescueResponseTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/RescueResponseTest.java index 3cbee04..4486034 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/RescueResponseTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/RescueResponseTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.RescueResponse; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,15 +34,11 @@ public class RescueResponseTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"adminPass\" : \"adminpass\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"adminPass\" : \"adminpass\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -59,7 +54,7 @@ public class RescueResponseTest { public void testMethods() throws Exception { RescueResponse rescueresponse = objectMapper.readValue(JSON_FULL, RescueResponse.class); rescueresponse.toString(); - + String adminPass = rescueresponse.getAdminPass(); Assert.assertNotNull(adminPass); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/RescueTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/RescueTest.java index 6c68207..6a7afb6 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/RescueTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/RescueTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Rescue; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,19 +34,13 @@ public class RescueTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"rescue\" : {" + EOL - + " \"adminPass\" : \"adminpass\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"rescue\" : {" + EOL + " \"adminPass\" : \"adminpass\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -63,7 +56,7 @@ public class RescueTest { public void testMethods() throws Exception { Rescue rescue = objectMapper.readValue(JSON_FULL, Rescue.class); rescue.toString(); - + String adminPass = rescue.getAdminPass(); Assert.assertNotNull(adminPass); rescue.setAdminPass(adminPass); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ResizeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ResizeTest.java index 520b9fb..7dfcc42 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ResizeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ResizeTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Resize; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,20 +34,13 @@ public class ResizeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"resize\" : {" + EOL - + " \"flavorRef\" : \"flavorref\"," + EOL - + " \"OS-DCF:diskConfig\" : \"diskconfig\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"resize\" : {" + EOL + " \"flavorRef\" : \"flavorref\"," + + EOL + " \"OS-DCF:diskConfig\" : \"diskconfig\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -64,11 +56,11 @@ public class ResizeTest { public void testMethods() throws Exception { Resize resize = objectMapper.readValue(JSON_FULL, Resize.class); resize.toString(); - + String flavorRef = resize.getFlavorRef(); Assert.assertNotNull(flavorRef); resize.setFlavorRef(flavorRef); - + String diskConfig = resize.getDiskConfig(); Assert.assertNotNull(diskConfig); resize.setDiskConfig(diskConfig); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ResourceTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ResourceTest.java index e48cb62..a4f75ec 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ResourceTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ResourceTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Host.ResourceWrapper.Resource; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,19 +34,12 @@ public class ResourceTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"project\" : \"project\"," + EOL - + " \"host\" : \"host\"," + EOL - + " \"cpu\" : 46," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"disk_gb\" : 46" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"project\" : \"project\"," + EOL + " \"host\" : \"host\"," + + EOL + " \"cpu\" : 46," + EOL + " \"memory_mb\" : 90," + EOL + " \"disk_gb\" : 46" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -63,19 +55,19 @@ public class ResourceTest { public void testMethods() throws Exception { Resource resource = objectMapper.readValue(JSON_FULL, Resource.class); resource.toString(); - + Integer memoryMb = resource.getMemoryMb(); Assert.assertNotNull(memoryMb); - + String host = resource.getHost(); Assert.assertNotNull(host); - + String project = resource.getProject(); Assert.assertNotNull(project); - + Integer cpu = resource.getCpu(); Assert.assertNotNull(cpu); - + Integer diskGb = resource.getDiskGb(); Assert.assertNotNull(diskGb); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ResourceWrapperTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ResourceWrapperTest.java index 3616551..c1be9db 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ResourceWrapperTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ResourceWrapperTest.java @@ -26,7 +26,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Host.ResourceWrapper; import com.woorea.openstack.nova.model.Host.ResourceWrapper.Resource; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,21 +35,13 @@ public class ResourceWrapperTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"resource\" : {" + EOL - + " \"project\" : \"project\"," + EOL - + " \"host\" : \"host\"," + EOL - + " \"cpu\" : 46," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"disk_gb\" : 46" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"resource\" : {" + EOL + " \"project\" : \"project\"," + + EOL + " \"host\" : \"host\"," + EOL + " \"cpu\" : 46," + EOL + " \"memory_mb\" : 90," + EOL + + " \"disk_gb\" : 46" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -66,7 +57,7 @@ public class ResourceWrapperTest { public void testMethods() throws Exception { ResourceWrapper resourcewrapper = objectMapper.readValue(JSON_FULL, ResourceWrapper.class); resourcewrapper.toString(); - + Resource resource = resourcewrapper.getResource(); Assert.assertNotNull(resource); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/RestoreTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/RestoreTest.java index c601a3f..fa059c3 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/RestoreTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/RestoreTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Restore; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class RestoreTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"restore\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"restore\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ResumeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ResumeTest.java index db84968..33cc515 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ResumeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ResumeTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Resume; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class ResumeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"resume\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"resume\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/RevertResizeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/RevertResizeTest.java index 9aca582..5b4dfb4 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/RevertResizeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/RevertResizeTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.RevertResize; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class RevertResizeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"revertResize\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"revertResize\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/RuleTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/RuleTest.java index 65ecb6c..489662c 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/RuleTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/RuleTest.java @@ -27,7 +27,6 @@ import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.SecurityGroup.Rule; import com.woorea.openstack.nova.model.SecurityGroup.Rule.Group; import com.woorea.openstack.nova.model.SecurityGroup.Rule.IpRange; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,31 +36,17 @@ public class RuleTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"security_group_rule\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"security_group_rule\" : {" + EOL + " \"id\" : \"id\"," + + EOL + " \"name\" : \"name\"," + EOL + " \"group\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL + + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + " \"ip_range\" : {" + + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -77,28 +62,28 @@ public class RuleTest { public void testMethods() throws Exception { Rule rule = objectMapper.readValue(JSON_FULL, Rule.class); rule.toString(); - + String parentGroupId = rule.getParentGroupId(); Assert.assertNotNull(parentGroupId); - + String ipProtocol = rule.getIpProtocol(); Assert.assertNotNull(ipProtocol); - + IpRange ipRange = rule.getIpRange(); Assert.assertNotNull(ipRange); - + Integer fromPort = rule.getFromPort(); Assert.assertNotNull(fromPort); - + String name = rule.getName(); Assert.assertNotNull(name); - + String id = rule.getId(); Assert.assertNotNull(id); - + Integer toPort = rule.getToPort(); Assert.assertNotNull(toPort); - + Group group = rule.getGroup(); Assert.assertNotNull(group); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupForCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupForCreateTest.java index 0c995d1..7cd3048 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupForCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupForCreateTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,20 +33,13 @@ public class SecurityGroupForCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"security_group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"security_group\" : {" + EOL + " \"name\" : \"name\"," + + EOL + " \"description\" : \"description\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -63,11 +55,11 @@ public class SecurityGroupForCreateTest { public void testMethods() throws Exception { SecurityGroupForCreate securitygroupforcreate = objectMapper.readValue(JSON_FULL, SecurityGroupForCreate.class); securitygroupforcreate.toString(); - + String name = securitygroupforcreate.getName(); Assert.assertNotNull(name); securitygroupforcreate.setName(name); - + String description = securitygroupforcreate.getDescription(); Assert.assertNotNull(description); securitygroupforcreate.setDescription(description); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreateTest.java index fc5cf69..c87e52f 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupRuleForCreateTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,30 +33,22 @@ public class SecurityGroupRuleForCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"security_group_rule\" : {" + EOL - + " \"cidr\" : \"cidr\"," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"group_id\" : \"groupid\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"security_group_rule\" : {" + EOL + + " \"cidr\" : \"cidr\"," + EOL + " \"parent_group_id\" : \"parentgroupid\"," + EOL + + " \"ip_protocol\" : \"ipprotocol\"," + EOL + " \"from_port\" : 7," + EOL + " \"to_port\" : 98," + + EOL + " \"group_id\" : \"groupid\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { System.out.println("CLASS: " + SecurityGroupRuleForCreate.class.getName()); System.out.println("TEST JSON: " + JSON_FULL); - SecurityGroupRuleForCreate securitygroupruleforcreate = objectMapper.readValue(JSON_FULL, SecurityGroupRuleForCreate.class); + SecurityGroupRuleForCreate securitygroupruleforcreate = + objectMapper.readValue(JSON_FULL, SecurityGroupRuleForCreate.class); String json = objectMapper.writeValueAsString(securitygroupruleforcreate); System.out.println("RE-SERIALIZED OBJECT: " + json); JSONAssert.assertEquals(JSON_FULL, json, JSONCompareMode.LENIENT); @@ -65,29 +56,30 @@ public class SecurityGroupRuleForCreateTest { @Test public void testMethods() throws Exception { - SecurityGroupRuleForCreate securitygroupruleforcreate = objectMapper.readValue(JSON_FULL, SecurityGroupRuleForCreate.class); + SecurityGroupRuleForCreate securitygroupruleforcreate = + objectMapper.readValue(JSON_FULL, SecurityGroupRuleForCreate.class); securitygroupruleforcreate.toString(); - + String parentGroupId = securitygroupruleforcreate.getParentGroupId(); Assert.assertNotNull(parentGroupId); securitygroupruleforcreate.setParentGroupId(parentGroupId); - + String ipProtocol = securitygroupruleforcreate.getIpProtocol(); Assert.assertNotNull(ipProtocol); securitygroupruleforcreate.setIpProtocol(ipProtocol); - + String groupId = securitygroupruleforcreate.getGroupId(); Assert.assertNotNull(groupId); securitygroupruleforcreate.setGroupId(groupId); - + Integer fromPort = securitygroupruleforcreate.getFromPort(); Assert.assertNotNull(fromPort); securitygroupruleforcreate.setFromPort(fromPort); - + String cidr = securitygroupruleforcreate.getCidr(); Assert.assertNotNull(cidr); securitygroupruleforcreate.setCidr(cidr); - + Integer toPort = securitygroupruleforcreate.getToPort(); Assert.assertNotNull(toPort); securitygroupruleforcreate.setToPort(toPort); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupTest.java index b68e503..5abf0df 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerForCreate.SecurityGroup; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,15 +34,11 @@ public class SecurityGroupTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"name\" : \"name\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"name\" : \"name\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -59,7 +54,7 @@ public class SecurityGroupTest { public void testMethods() throws Exception { SecurityGroup securitygroup = objectMapper.readValue(JSON_FULL, SecurityGroup.class); securitygroup.toString(); - + String name = securitygroup.getName(); Assert.assertNotNull(name); securitygroup.setName(name); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupsTest.java index 2ee2faa..3ff73f4 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SecurityGroupsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,101 +34,42 @@ public class SecurityGroupsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"security_groups\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"rules\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " } ]," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"rules\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " } ]," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"security_groups\" : [ {" + EOL + " \"id\" : \"id\"," + + EOL + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"rules\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"group\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL + + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + " }, {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + " \"group\" : {" + EOL + + " \"name\" : \"name\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL + + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + " } ]," + EOL + + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL + + " \"tenant_id\" : \"tenantid\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + " \"rules\" : [ {" + + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + " \"group\" : {" + EOL + + " \"name\" : \"name\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL + + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + " }, {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + " \"group\" : {" + EOL + + " \"name\" : \"name\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL + + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + " } ]," + EOL + + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL + + " \"tenant_id\" : \"tenantid\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -146,13 +85,14 @@ public class SecurityGroupsTest { public void testMethods() throws Exception { SecurityGroups securitygroups = objectMapper.readValue(JSON_FULL, SecurityGroups.class); securitygroups.toString(); - + List<SecurityGroup> list = securitygroups.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") SecurityGroup x : securitygroups) { + for (@SuppressWarnings("unused") + SecurityGroup x : securitygroups) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerActionTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerActionTest.java index 2f638ee..28a56cf 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerActionTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerActionTest.java @@ -1,78 +1,76 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Huawei Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package com.woorea.openstack.nova.model;
-
-import com.woorea.openstack.nova.model.ServerAction.ChangePassword;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-
-public class ServerActionTest {
- private ChangePassword testObj = new ServerAction.ChangePassword();
-
- @Test
- public void testSetAdminPass(){
-
- try {
-
- testObj.setAdminPass("sai");
- assertEquals( testObj.getAdminPass(), "sai");
-
- } catch (Exception e) {
-
- fail("Exception in test obj");
- }
-
- }
-
- @Test
- public void testChangePasswdConstructor(){
-
- try {
- ServerAction.ChangePassword test = new ServerAction.ChangePassword("sai");
- assertEquals( test.getAdminPass(), "sai");
-
- } catch (Exception e) {
-
- fail("Exception in test obj");
- }
-
- }
-
- private ServerAction.Reboot testObj1 = new ServerAction.Reboot();
-
- @Test
- public void testSetType(){
- testObj1.setType("sai");
- assertEquals("sai", testObj1.getType());
- }
-
- private ServerAction.Rebuild testRebuild = new ServerAction.Rebuild();
-
- @Test
- public void testRebuild()
- {
- testRebuild.setAccessIPv4("1.1.1.1");
- assertEquals(testRebuild.getAccessIPv4(),"1.1.1.1");
- }
-}
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package com.woorea.openstack.nova.model; + +import com.woorea.openstack.nova.model.ServerAction.ChangePassword; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + + +public class ServerActionTest { + private ChangePassword testObj = new ServerAction.ChangePassword(); + + @Test + public void testSetAdminPass() { + + try { + + testObj.setAdminPass("sai"); + assertEquals(testObj.getAdminPass(), "sai"); + + } catch (Exception e) { + + fail("Exception in test obj"); + } + + } + + @Test + public void testChangePasswdConstructor() { + + try { + ServerAction.ChangePassword test = new ServerAction.ChangePassword("sai"); + assertEquals(test.getAdminPass(), "sai"); + + } catch (Exception e) { + + fail("Exception in test obj"); + } + + } + + private ServerAction.Reboot testObj1 = new ServerAction.Reboot(); + + @Test + public void testSetType() { + testObj1.setType("sai"); + assertEquals("sai", testObj1.getType()); + } + + private ServerAction.Rebuild testRebuild = new ServerAction.Rebuild(); + + @Test + public void testRebuild() { + testRebuild.setAccessIPv4("1.1.1.1"); + assertEquals(testRebuild.getAccessIPv4(), "1.1.1.1"); + } +} diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerForCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerForCreateTest.java index 7b5d165..8d865bb 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerForCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerForCreateTest.java @@ -25,10 +25,8 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerForCreate.SecurityGroup; - import java.util.List; import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -38,54 +36,26 @@ public class ServerForCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"server\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"adminPass\" : \"adminpass\"," + EOL - + " \"imageRef\" : \"imageref\"," + EOL - + " \"flavorRef\" : \"flavorref\"," + EOL - + " \"accessIPv4\" : \"accessipv4\"," + EOL - + " \"accessIPv6\" : \"accessipv6\"," + EOL - + " \"min\" : 42," + EOL - + " \"max\" : 44," + EOL - + " \"diskConfig\" : \"diskconfig\"," + EOL - + " \"personality\" : [ {" + EOL - + " \"path\" : \"path\"," + EOL - + " \"contents\" : \"contents\"" + EOL - + " }, {" + EOL - + " \"path\" : \"path\"," + EOL - + " \"contents\" : \"contents\"" + EOL - + " } ]," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"networks\" : [ {" + EOL - + " \"uuid\" : \"id\"," + EOL - + " \"fixed_ip\" : \"fixedip\"" + EOL - + " }, {" + EOL - + " \"uuid\" : \"id\"," + EOL - + " \"fixed_ip\" : \"fixedip\"" + EOL - + " } ]," + EOL - + " \"key_name\" : \"keyname\"," + EOL - + " \"security_groups\" : [ {" + EOL - + " \"name\" : \"name\"" + EOL - + " }, {" + EOL - + " \"name\" : \"name\"" + EOL - + " } ]," + EOL - + " \"user_data\" : \"userdata\"," + EOL - + " \"availability_zone\" : \"availabilityzone\"," + EOL - + " \"config_drive\" : true" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"server\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"adminPass\" : \"adminpass\"," + EOL + " \"imageRef\" : \"imageref\"," + EOL + + " \"flavorRef\" : \"flavorref\"," + EOL + " \"accessIPv4\" : \"accessipv4\"," + EOL + + " \"accessIPv6\" : \"accessipv6\"," + EOL + " \"min\" : 42," + EOL + " \"max\" : 44," + EOL + + " \"diskConfig\" : \"diskconfig\"," + EOL + " \"personality\" : [ {" + EOL + + " \"path\" : \"path\"," + EOL + " \"contents\" : \"contents\"" + EOL + " }, {" + EOL + + " \"path\" : \"path\"," + EOL + " \"contents\" : \"contents\"" + EOL + " } ]," + EOL + + " \"metadata\" : {" + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + + " \"metadata-k2\" : \"metadata-v2\"" + EOL + " }," + EOL + " \"networks\" : [ {" + EOL + + " \"uuid\" : \"id\"," + EOL + " \"fixed_ip\" : \"fixedip\"" + EOL + " }, {" + EOL + + " \"uuid\" : \"id\"," + EOL + " \"fixed_ip\" : \"fixedip\"" + EOL + " } ]," + EOL + + " \"key_name\" : \"keyname\"," + EOL + " \"security_groups\" : [ {" + EOL + + " \"name\" : \"name\"" + EOL + " }, {" + EOL + " \"name\" : \"name\"" + EOL + " } ]," + + EOL + " \"user_data\" : \"userdata\"," + EOL + " \"availability_zone\" : \"availabilityzone\"," + + EOL + " \"config_drive\" : true" + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -101,70 +71,70 @@ public class ServerForCreateTest { public void testMethods() throws Exception { ServerForCreate serverforcreate = objectMapper.readValue(JSON_FULL, ServerForCreate.class); serverforcreate.toString(); - - Map<String,String> metadata = serverforcreate.getMetadata(); + + Map<String, String> metadata = serverforcreate.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); serverforcreate.setMetadata(metadata); - + Integer max = serverforcreate.getMax(); Assert.assertNotNull(max); serverforcreate.setMax(max); - + List<NetworkForCreate> networks = serverforcreate.getNetworks(); Assert.assertNotNull(networks); Assert.assertEquals(2, networks.size()); serverforcreate.setNetworks(networks); - + String userData = serverforcreate.getUserData(); Assert.assertNotNull(userData); serverforcreate.setUserData(userData); - + Integer min = serverforcreate.getMin(); Assert.assertNotNull(min); serverforcreate.setMin(min); - + List<PersonalityFile> personality = serverforcreate.getPersonality(); Assert.assertNotNull(personality); Assert.assertEquals(2, personality.size()); serverforcreate.setPersonality(personality); - + String name = serverforcreate.getName(); Assert.assertNotNull(name); serverforcreate.setName(name); - + String flavorRef = serverforcreate.getFlavorRef(); Assert.assertNotNull(flavorRef); serverforcreate.setFlavorRef(flavorRef); - + String keyName = serverforcreate.getKeyName(); Assert.assertNotNull(keyName); serverforcreate.setKeyName(keyName); - + String adminPass = serverforcreate.getAdminPass(); Assert.assertNotNull(adminPass); serverforcreate.setAdminPass(adminPass); - + String imageRef = serverforcreate.getImageRef(); Assert.assertNotNull(imageRef); serverforcreate.setImageRef(imageRef); - + String accessIPv6 = serverforcreate.getAccessIPv6(); Assert.assertNotNull(accessIPv6); serverforcreate.setAccessIPv6(accessIPv6); - + String diskConfig = serverforcreate.getDiskConfig(); Assert.assertNotNull(diskConfig); serverforcreate.setDiskConfig(diskConfig); - + List<SecurityGroup> securityGroups = serverforcreate.getSecurityGroups(); Assert.assertNotNull(securityGroups); Assert.assertEquals(2, securityGroups.size()); - + String availabilityZone = serverforcreate.getAvailabilityZone(); Assert.assertNotNull(availabilityZone); serverforcreate.setAvailabilityZone(availabilityZone); - + String accessIPv4 = serverforcreate.getAccessIPv4(); Assert.assertNotNull(accessIPv4); serverforcreate.setAccessIPv4(accessIPv4); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerTest.java index 27ba42d..290f4a5 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerTest.java @@ -26,10 +26,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.Server.Addresses; import com.woorea.openstack.nova.model.Server.Fault; - import java.util.List; import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -39,236 +37,104 @@ public class ServerTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"server\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"addresses\" : {" + EOL - + " \"addresses\" : {" + EOL - + " \"addresses-k1\" : [ {" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"addresses-k2\" : [ {" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"version\" : \"version\"," + EOL - + " \"addr\" : \"addr\"," + EOL - + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL - + " \"OS-EXT-IPS:type\" : \"type\"" + EOL - + " } ]" + EOL - + " }" + EOL - + " }," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"image\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"progress\" : 3," + EOL - + " \"minRam\" : 62," + EOL - + " \"minDisk\" : 69," + EOL - + " \"created\" : 1485172800000," + EOL - + " \"updated\" : 1486468800000," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"server\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " }," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL - + " }," + EOL - + " \"flavor\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"vcpus\" : 79," + EOL - + " \"ram\" : 38," + EOL - + " \"disk\" : 45," + EOL - + " \"swap\" : \"swap\"," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"public\" : false," + EOL - + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + EOL - + " \"rxtx_factor\" : 11.0," + EOL - + " \"OS-FLV-DISABLED:disabled\" : true," + EOL - + " \"rxtx_quota\" : 42," + EOL - + " \"rxtx_cap\" : 96," + EOL - + " \"os-flavor-access:is_public\" : false" + EOL - + " }," + EOL - + " \"accessIPv4\" : \"accessipv4\"," + EOL - + " \"accessIPv6\" : \"accessipv6\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"progress\" : 3," + EOL - + " \"fault\" : {" + EOL - + " \"code\" : 29," + EOL - + " \"message\" : \"message\"," + EOL - + " \"details\" : \"details\"," + EOL - + " \"created\" : 1485172800000" + EOL - + " }," + EOL - + " \"hostId\" : \"hostid\"," + EOL - + " \"updated\" : \"updated\"," + EOL - + " \"created\" : \"created\"," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"uuid\" : \"uuid\"," + EOL - + " \"adminPass\" : \"adminpass\"," + EOL - + " \"config_drive\" : \"configdrive\"," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"user_id\" : \"userid\"," + EOL - + " \"key_name\" : \"keyname\"," + EOL - + " \"security_groups\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"rules\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " } ]," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"rules\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"group\" : {" + EOL - + " \"name\" : \"name\"," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " }," + EOL - + " \"parent_group_id\" : \"parentgroupid\"," + EOL - + " \"from_port\" : 7," + EOL - + " \"to_port\" : 98," + EOL - + " \"ip_protocol\" : \"ipprotocol\"," + EOL - + " \"ip_range\" : {" + EOL - + " \"cidr\" : \"cidr\"" + EOL - + " }" + EOL - + " } ]," + EOL - + " \"links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]," + EOL - + " \"tenant_id\" : \"tenantid\"" + EOL - + " } ]," + EOL - + " \"OS-EXT-STS:task_state\" : \"taskstate\"," + EOL - + " \"OS-EXT-STS:power_state\" : \"powerstate\"," + EOL - + " \"OS-EXT-STS:vm_state\" : \"vmstate\"," + EOL - + " \"OS-EXT-SRV-ATTR:host\" : \"host\"," + EOL - + " \"OS-EXT-SRV-ATTR:instance_name\" : \"instancename\"," + EOL - + " \"OS-EXT-SRV-ATTR:hypervisor_hostname\" : \"hypervisorhostname\"," + EOL - + " \"OS-DCF:diskConfig\" : \"diskconfig\"," + EOL - + " \"OS-EXT-AZ:availability_zone\" : \"availabilityzone\"," + EOL - + " \"OS-SRV-USG:launched_at\" : \"launchedat\"," + EOL - + " \"OS-SRV-USG:terminated_at\" : \"terminatedat\"," + EOL - + " \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"server\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"addresses\" : {" + EOL + " \"addresses\" : {" + EOL + + " \"addresses-k1\" : [ {" + EOL + " \"version\" : \"version\"," + EOL + + " \"addr\" : \"addr\"," + EOL + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + + " \"OS-EXT-IPS:type\" : \"type\"" + EOL + " }, {" + EOL + + " \"version\" : \"version\"," + EOL + " \"addr\" : \"addr\"," + EOL + + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + " \"OS-EXT-IPS:type\" : \"type\"" + + EOL + " } ]," + EOL + " \"addresses-k2\" : [ {" + EOL + + " \"version\" : \"version\"," + EOL + " \"addr\" : \"addr\"," + EOL + + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + " \"OS-EXT-IPS:type\" : \"type\"" + + EOL + " }, {" + EOL + " \"version\" : \"version\"," + EOL + + " \"addr\" : \"addr\"," + EOL + " \"OS-EXT-IPS-MAC:mac_addr\" : \"macaddr\"," + EOL + + " \"OS-EXT-IPS:type\" : \"type\"" + EOL + " } ]" + EOL + " }" + EOL + " }," + EOL + + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL + + " \"image\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"status\" : \"status\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"progress\" : 3," + EOL + " \"minRam\" : 62," + EOL + + " \"minDisk\" : 69," + EOL + " \"created\" : 1485172800000," + EOL + + " \"updated\" : 1486468800000," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"server\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + + " }," + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + + EOL + " } ]," + EOL + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL + " }," + EOL + + " \"flavor\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"vcpus\" : 79," + EOL + " \"ram\" : 38," + EOL + " \"disk\" : 45," + EOL + + " \"swap\" : \"swap\"," + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + + EOL + " } ]," + EOL + " \"public\" : false," + EOL + " \"OS-FLV-EXT-DATA:ephemeral\" : 65," + + EOL + " \"rxtx_factor\" : 11.0," + EOL + " \"OS-FLV-DISABLED:disabled\" : true," + EOL + + " \"rxtx_quota\" : 42," + EOL + " \"rxtx_cap\" : 96," + EOL + + " \"os-flavor-access:is_public\" : false" + EOL + " }," + EOL + + " \"accessIPv4\" : \"accessipv4\"," + EOL + " \"accessIPv6\" : \"accessipv6\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"progress\" : 3," + EOL + " \"fault\" : {" + EOL + + " \"code\" : 29," + EOL + " \"message\" : \"message\"," + EOL + + " \"details\" : \"details\"," + EOL + " \"created\" : 1485172800000" + EOL + " }," + EOL + + " \"hostId\" : \"hostid\"," + EOL + " \"updated\" : \"updated\"," + EOL + + " \"created\" : \"created\"," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"uuid\" : \"uuid\"," + EOL + " \"adminPass\" : \"adminpass\"," + EOL + + " \"config_drive\" : \"configdrive\"," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"user_id\" : \"userid\"," + EOL + " \"key_name\" : \"keyname\"," + EOL + + " \"security_groups\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + + EOL + " \"description\" : \"description\"," + EOL + " \"rules\" : [ {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + " \"group\" : {" + EOL + + " \"name\" : \"name\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + + EOL + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + + " }, {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"group\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL + + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + + " } ]," + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + + EOL + " } ]," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }, {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"description\" : \"description\"," + EOL + " \"rules\" : [ {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + " \"group\" : {" + EOL + + " \"name\" : \"name\"," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + + EOL + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + + " }, {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"group\" : {" + EOL + " \"name\" : \"name\"," + EOL + + " \"tenant_id\" : \"tenantid\"" + EOL + " }," + EOL + + " \"parent_group_id\" : \"parentgroupid\"," + EOL + " \"from_port\" : 7," + EOL + + " \"to_port\" : 98," + EOL + " \"ip_protocol\" : \"ipprotocol\"," + EOL + + " \"ip_range\" : {" + EOL + " \"cidr\" : \"cidr\"" + EOL + " }" + EOL + + " } ]," + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + + EOL + " } ]," + EOL + " \"tenant_id\" : \"tenantid\"" + EOL + " } ]," + EOL + + " \"OS-EXT-STS:task_state\" : \"taskstate\"," + EOL + + " \"OS-EXT-STS:power_state\" : \"powerstate\"," + EOL + " \"OS-EXT-STS:vm_state\" : \"vmstate\"," + + EOL + " \"OS-EXT-SRV-ATTR:host\" : \"host\"," + EOL + + " \"OS-EXT-SRV-ATTR:instance_name\" : \"instancename\"," + EOL + + " \"OS-EXT-SRV-ATTR:hypervisor_hostname\" : \"hypervisorhostname\"," + EOL + + " \"OS-DCF:diskConfig\" : \"diskconfig\"," + EOL + + " \"OS-EXT-AZ:availability_zone\" : \"availabilityzone\"," + EOL + + " \"OS-SRV-USG:launched_at\" : \"launchedat\"," + EOL + + " \"OS-SRV-USG:terminated_at\" : \"terminatedat\"," + EOL + + " \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]" + + EOL + " }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -284,109 +150,109 @@ public class ServerTest { public void testMethods() throws Exception { Server server = objectMapper.readValue(JSON_FULL, Server.class); server.toString(); - + Addresses addresses = server.getAddresses(); Assert.assertNotNull(addresses); - - Map<String,String> metadata = server.getMetadata(); + + Map<String, String> metadata = server.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); - + String hostId = server.getHostId(); Assert.assertNotNull(hostId); - + String uuid = server.getUuid(); Assert.assertNotNull(uuid); - + String userId = server.getUserId(); Assert.assertNotNull(userId); - + String taskState = server.getTaskState(); Assert.assertNotNull(taskState); - + String powerState = server.getPowerState(); Assert.assertNotNull(powerState); - + String vmState = server.getVmState(); Assert.assertNotNull(vmState); - + String tenantId = server.getTenantId(); Assert.assertNotNull(tenantId); - + String configDrive = server.getConfigDrive(); Assert.assertNotNull(configDrive); - + String host = server.getHost(); Assert.assertNotNull(host); - + String keyName = server.getKeyName(); Assert.assertNotNull(keyName); - + List<Link> links = server.getLinks(); Assert.assertNotNull(links); Assert.assertEquals(2, links.size()); - + String id = server.getId(); Assert.assertNotNull(id); - + String launchedAt = server.getLaunchedAt(); Assert.assertNotNull(launchedAt); - + Image image = server.getImage(); Assert.assertNotNull(image); server.setImage(image); - + String terminatedAt = server.getTerminatedAt(); Assert.assertNotNull(terminatedAt); - + String created = server.getCreated(); Assert.assertNotNull(created); - + Fault fault = server.getFault(); Assert.assertNotNull(fault); - + String hypervisorHostname = server.getHypervisorHostname(); Assert.assertNotNull(hypervisorHostname); - + Flavor flavor = server.getFlavor(); Assert.assertNotNull(flavor); server.setFlavor(flavor); - + String instanceName = server.getInstanceName(); Assert.assertNotNull(instanceName); - + List<String> osExtendedVolumesAttached = server.getOsExtendedVolumesAttached(); Assert.assertNotNull(osExtendedVolumesAttached); Assert.assertEquals(2, osExtendedVolumesAttached.size()); - + String name = server.getName(); Assert.assertNotNull(name); - + Integer progress = server.getProgress(); Assert.assertNotNull(progress); - + String adminPass = server.getAdminPass(); Assert.assertNotNull(adminPass); - + String accessIPv6 = server.getAccessIPv6(); Assert.assertNotNull(accessIPv6); - + String diskConfig = server.getDiskConfig(); Assert.assertNotNull(diskConfig); - + List<SecurityGroup> securityGroups = server.getSecurityGroups(); Assert.assertNotNull(securityGroups); Assert.assertEquals(2, securityGroups.size()); - + String updated = server.getUpdated(); Assert.assertNotNull(updated); - + String availabilityZone = server.getAvailabilityZone(); Assert.assertNotNull(availabilityZone); - + String accessIPv4 = server.getAccessIPv4(); Assert.assertNotNull(accessIPv4); - + String status = server.getStatus(); Assert.assertNotNull(status); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerUsageTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerUsageTest.java index cfec1f7..6cd37cd 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerUsageTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerUsageTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.SimpleTenantUsage.ServerUsage; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,26 +34,16 @@ public class ServerUsageTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"uptime\" : 78," + EOL - + " \"state\" : \"state\"," + EOL - + " \"hours\" : 64.0," + EOL - + " \"vcpus\" : 79," + EOL - + " \"flavor\" : \"flavor\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"instance_id\" : \"instanceid\"," + EOL - + " \"started_at\" : \"startedat\"," + EOL - + " \"ended_at\" : \"endedat\"," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"local_gb\" : 11" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = + "{" + EOL + " \"uptime\" : 78," + EOL + " \"state\" : \"state\"," + EOL + " \"hours\" : 64.0," + EOL + + " \"vcpus\" : 79," + EOL + " \"flavor\" : \"flavor\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"instance_id\" : \"instanceid\"," + EOL + " \"started_at\" : \"startedat\"," + EOL + + " \"ended_at\" : \"endedat\"," + EOL + " \"memory_mb\" : 90," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + " \"local_gb\" : 11" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -70,40 +59,40 @@ public class ServerUsageTest { public void testMethods() throws Exception { ServerUsage serverusage = objectMapper.readValue(JSON_FULL, ServerUsage.class); serverusage.toString(); - + String flavor = serverusage.getFlavor(); Assert.assertNotNull(flavor); - + Integer memoryMb = serverusage.getMemoryMb(); Assert.assertNotNull(memoryMb); - + Double hours = serverusage.getHours(); Assert.assertNotNull(hours); - + String instanceId = serverusage.getInstanceId(); Assert.assertNotNull(instanceId); - + Integer localDiskSize = serverusage.getLocalDiskSize(); Assert.assertNotNull(localDiskSize); - + String endedAt = serverusage.getEndedAt(); Assert.assertNotNull(endedAt); - + String name = serverusage.getName(); Assert.assertNotNull(name); - + String tenantId = serverusage.getTenantId(); Assert.assertNotNull(tenantId); - + String startedAt = serverusage.getStartedAt(); Assert.assertNotNull(startedAt); - + String state = serverusage.getState(); Assert.assertNotNull(state); - + Integer vcpus = serverusage.getVcpus(); Assert.assertNotNull(vcpus); - + Integer uptime = serverusage.getUptime(); Assert.assertNotNull(uptime); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServersTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServersTest.java index ecd5394..bbf80ff 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServersTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServersTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -261,7 +259,9 @@ public class ServersTest { sb.append(" \"OS-EXT-AZ:availability_zone\" : \"availabilityzone\"," + EOL); sb.append(" \"OS-SRV-USG:launched_at\" : \"launchedat\"," + EOL); sb.append(" \"OS-SRV-USG:terminated_at\" : \"terminatedat\"," + EOL); - sb.append(" \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]" + EOL); + sb.append( + " \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]" + + EOL); sb.append(" }, {" + EOL); sb.append(" \"id\" : \"id\"," + EOL); sb.append(" \"name\" : \"name\"," + EOL); @@ -480,17 +480,17 @@ public class ServersTest { sb.append(" \"OS-EXT-AZ:availability_zone\" : \"availabilityzone\"," + EOL); sb.append(" \"OS-SRV-USG:launched_at\" : \"launchedat\"," + EOL); sb.append(" \"OS-SRV-USG:terminated_at\" : \"terminatedat\"," + EOL); - sb.append(" \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]" + EOL); + sb.append( + " \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]" + + EOL); sb.append(" } ]" + EOL); sb.append("}"); JSON_FULL = sb.toString(); } - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -506,13 +506,14 @@ public class ServersTest { public void testMethods() throws Exception { Servers servers = objectMapper.readValue(JSON_FULL, Servers.class); servers.toString(); - + List<Server> list = servers.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Server x : servers) { + for (@SuppressWarnings("unused") + Server x : servers) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SimpleTenantUsageTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SimpleTenantUsageTest.java index da2208f..ce8d0cb 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SimpleTenantUsageTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SimpleTenantUsageTest.java @@ -25,10 +25,8 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.SimpleTenantUsage.ServerUsage; - import java.math.BigDecimal; import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -38,52 +36,27 @@ public class SimpleTenantUsageTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"tenant_usage\" : {" + EOL - + " \"start\" : \"start\"," + EOL - + " \"stop\" : \"stop\"," + EOL - + " \"total_memory_mb_usage\" : 14," + EOL - + " \"total_vcpus_usage\" : 3," + EOL - + " \"total_local_gb_usage\" : 66," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"total_hours\" : \"totalhours\"," + EOL - + " \"server_usages\" : [ {" + EOL - + " \"uptime\" : 78," + EOL - + " \"state\" : \"state\"," + EOL - + " \"hours\" : 64.0," + EOL - + " \"vcpus\" : 79," + EOL - + " \"flavor\" : \"flavor\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"instance_id\" : \"instanceid\"," + EOL - + " \"started_at\" : \"startedat\"," + EOL - + " \"ended_at\" : \"endedat\"," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"local_gb\" : 11" + EOL - + " }, {" + EOL - + " \"uptime\" : 78," + EOL - + " \"state\" : \"state\"," + EOL - + " \"hours\" : 64.0," + EOL - + " \"vcpus\" : 79," + EOL - + " \"flavor\" : \"flavor\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"instance_id\" : \"instanceid\"," + EOL - + " \"started_at\" : \"startedat\"," + EOL - + " \"ended_at\" : \"endedat\"," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"local_gb\" : 11" + EOL - + " } ]" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"tenant_usage\" : {" + EOL + " \"start\" : \"start\"," + + EOL + " \"stop\" : \"stop\"," + EOL + " \"total_memory_mb_usage\" : 14," + EOL + + " \"total_vcpus_usage\" : 3," + EOL + " \"total_local_gb_usage\" : 66," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + " \"total_hours\" : \"totalhours\"," + EOL + + " \"server_usages\" : [ {" + EOL + " \"uptime\" : 78," + EOL + " \"state\" : \"state\"," + + EOL + " \"hours\" : 64.0," + EOL + " \"vcpus\" : 79," + EOL + " \"flavor\" : \"flavor\"," + + EOL + " \"name\" : \"name\"," + EOL + " \"instance_id\" : \"instanceid\"," + EOL + + " \"started_at\" : \"startedat\"," + EOL + " \"ended_at\" : \"endedat\"," + EOL + + " \"memory_mb\" : 90," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"local_gb\" : 11" + EOL + " }, {" + EOL + " \"uptime\" : 78," + EOL + + " \"state\" : \"state\"," + EOL + " \"hours\" : 64.0," + EOL + " \"vcpus\" : 79," + EOL + + " \"flavor\" : \"flavor\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"instance_id\" : \"instanceid\"," + EOL + " \"started_at\" : \"startedat\"," + EOL + + " \"ended_at\" : \"endedat\"," + EOL + " \"memory_mb\" : 90," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + " \"local_gb\" : 11" + EOL + " } ]" + EOL + " }" + + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -99,36 +72,36 @@ public class SimpleTenantUsageTest { public void testMethods() throws Exception { SimpleTenantUsage simpletenantusage = objectMapper.readValue(JSON_FULL, SimpleTenantUsage.class); simpletenantusage.toString(); - + BigDecimal totalMemoryMbUsage = simpletenantusage.getTotalMemoryMbUsage(); Assert.assertNotNull(totalMemoryMbUsage); simpletenantusage.setTotalMemoryMbUsage(totalMemoryMbUsage); - + String stop = simpletenantusage.getStop(); Assert.assertNotNull(stop); simpletenantusage.setStop(stop); - + BigDecimal totalVcpusUsage = simpletenantusage.getTotalVcpusUsage(); Assert.assertNotNull(totalVcpusUsage); simpletenantusage.setTotalVcpusUsage(totalVcpusUsage); - + String tenantId = simpletenantusage.getTenantId(); Assert.assertNotNull(tenantId); simpletenantusage.setTenantId(tenantId); - + String start = simpletenantusage.getStart(); Assert.assertNotNull(start); simpletenantusage.setStart(start); - + List<ServerUsage> serverUsages = simpletenantusage.getServerUsages(); Assert.assertNotNull(serverUsages); Assert.assertEquals(2, serverUsages.size()); simpletenantusage.setServerUsages(serverUsages); - + BigDecimal totalLocalGbUsage = simpletenantusage.getTotalLocalGbUsage(); Assert.assertNotNull(totalLocalGbUsage); simpletenantusage.setTotalLocalGbUsage(totalLocalGbUsage); - + String totalHours = simpletenantusage.getTotalHours(); Assert.assertNotNull(totalHours); simpletenantusage.setTotalHours(totalHours); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SimpleTenantUsagesTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SimpleTenantUsagesTest.java index ee4598c..49bb979 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SimpleTenantUsagesTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SimpleTenantUsagesTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,85 +34,40 @@ public class SimpleTenantUsagesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"tenant_usages\" : [ {" + EOL - + " \"start\" : \"start\"," + EOL - + " \"stop\" : \"stop\"," + EOL - + " \"total_memory_mb_usage\" : 14," + EOL - + " \"total_vcpus_usage\" : 3," + EOL - + " \"total_local_gb_usage\" : 66," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"total_hours\" : \"totalhours\"," + EOL - + " \"server_usages\" : [ {" + EOL - + " \"uptime\" : 78," + EOL - + " \"state\" : \"state\"," + EOL - + " \"hours\" : 64.0," + EOL - + " \"vcpus\" : 79," + EOL - + " \"flavor\" : \"flavor\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"instance_id\" : \"instanceid\"," + EOL - + " \"started_at\" : \"startedat\"," + EOL - + " \"ended_at\" : \"endedat\"," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"local_gb\" : 11" + EOL - + " }, {" + EOL - + " \"uptime\" : 78," + EOL - + " \"state\" : \"state\"," + EOL - + " \"hours\" : 64.0," + EOL - + " \"vcpus\" : 79," + EOL - + " \"flavor\" : \"flavor\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"instance_id\" : \"instanceid\"," + EOL - + " \"started_at\" : \"startedat\"," + EOL - + " \"ended_at\" : \"endedat\"," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"local_gb\" : 11" + EOL - + " } ]" + EOL - + " }, {" + EOL - + " \"start\" : \"start\"," + EOL - + " \"stop\" : \"stop\"," + EOL - + " \"total_memory_mb_usage\" : 14," + EOL - + " \"total_vcpus_usage\" : 3," + EOL - + " \"total_local_gb_usage\" : 66," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"total_hours\" : \"totalhours\"," + EOL - + " \"server_usages\" : [ {" + EOL - + " \"uptime\" : 78," + EOL - + " \"state\" : \"state\"," + EOL - + " \"hours\" : 64.0," + EOL - + " \"vcpus\" : 79," + EOL - + " \"flavor\" : \"flavor\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"instance_id\" : \"instanceid\"," + EOL - + " \"started_at\" : \"startedat\"," + EOL - + " \"ended_at\" : \"endedat\"," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"local_gb\" : 11" + EOL - + " }, {" + EOL - + " \"uptime\" : 78," + EOL - + " \"state\" : \"state\"," + EOL - + " \"hours\" : 64.0," + EOL - + " \"vcpus\" : 79," + EOL - + " \"flavor\" : \"flavor\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"instance_id\" : \"instanceid\"," + EOL - + " \"started_at\" : \"startedat\"," + EOL - + " \"ended_at\" : \"endedat\"," + EOL - + " \"memory_mb\" : 90," + EOL - + " \"tenant_id\" : \"tenantid\"," + EOL - + " \"local_gb\" : 11" + EOL - + " } ]" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"tenant_usages\" : [ {" + EOL + " \"start\" : \"start\"," + + EOL + " \"stop\" : \"stop\"," + EOL + " \"total_memory_mb_usage\" : 14," + EOL + + " \"total_vcpus_usage\" : 3," + EOL + " \"total_local_gb_usage\" : 66," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + " \"total_hours\" : \"totalhours\"," + EOL + + " \"server_usages\" : [ {" + EOL + " \"uptime\" : 78," + EOL + " \"state\" : \"state\"," + + EOL + " \"hours\" : 64.0," + EOL + " \"vcpus\" : 79," + EOL + " \"flavor\" : \"flavor\"," + + EOL + " \"name\" : \"name\"," + EOL + " \"instance_id\" : \"instanceid\"," + EOL + + " \"started_at\" : \"startedat\"," + EOL + " \"ended_at\" : \"endedat\"," + EOL + + " \"memory_mb\" : 90," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"local_gb\" : 11" + EOL + " }, {" + EOL + " \"uptime\" : 78," + EOL + + " \"state\" : \"state\"," + EOL + " \"hours\" : 64.0," + EOL + " \"vcpus\" : 79," + EOL + + " \"flavor\" : \"flavor\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"instance_id\" : \"instanceid\"," + EOL + " \"started_at\" : \"startedat\"," + EOL + + " \"ended_at\" : \"endedat\"," + EOL + " \"memory_mb\" : 90," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + " \"local_gb\" : 11" + EOL + " } ]" + EOL + " }, {" + + EOL + " \"start\" : \"start\"," + EOL + " \"stop\" : \"stop\"," + EOL + + " \"total_memory_mb_usage\" : 14," + EOL + " \"total_vcpus_usage\" : 3," + EOL + + " \"total_local_gb_usage\" : 66," + EOL + " \"tenant_id\" : \"tenantid\"," + EOL + + " \"total_hours\" : \"totalhours\"," + EOL + " \"server_usages\" : [ {" + EOL + + " \"uptime\" : 78," + EOL + " \"state\" : \"state\"," + EOL + " \"hours\" : 64.0," + EOL + + " \"vcpus\" : 79," + EOL + " \"flavor\" : \"flavor\"," + EOL + " \"name\" : \"name\"," + + EOL + " \"instance_id\" : \"instanceid\"," + EOL + " \"started_at\" : \"startedat\"," + EOL + + " \"ended_at\" : \"endedat\"," + EOL + " \"memory_mb\" : 90," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + " \"local_gb\" : 11" + EOL + " }, {" + EOL + + " \"uptime\" : 78," + EOL + " \"state\" : \"state\"," + EOL + " \"hours\" : 64.0," + EOL + + " \"vcpus\" : 79," + EOL + " \"flavor\" : \"flavor\"," + EOL + " \"name\" : \"name\"," + + EOL + " \"instance_id\" : \"instanceid\"," + EOL + " \"started_at\" : \"startedat\"," + EOL + + " \"ended_at\" : \"endedat\"," + EOL + " \"memory_mb\" : 90," + EOL + + " \"tenant_id\" : \"tenantid\"," + EOL + " \"local_gb\" : 11" + EOL + " } ]" + EOL + " } ]" + + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -130,13 +83,14 @@ public class SimpleTenantUsagesTest { public void testMethods() throws Exception { SimpleTenantUsages simpletenantusages = objectMapper.readValue(JSON_FULL, SimpleTenantUsages.class); simpletenantusages.toString(); - + List<SimpleTenantUsage> list = simpletenantusages.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") SimpleTenantUsage x : simpletenantusages) { + for (@SuppressWarnings("unused") + SimpleTenantUsage x : simpletenantusages) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotForCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotForCreateTest.java index e894375..635eabd 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotForCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotForCreateTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,22 +33,14 @@ public class SnapshotForCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"snapshot\" : {" + EOL - + " \"force\" : false," + EOL - + " \"volume_id\" : \"volumeid\"," + EOL - + " \"display_name\" : \"name\"," + EOL - + " \"display_description\" : \"description\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"snapshot\" : {" + EOL + " \"force\" : false," + EOL + + " \"volume_id\" : \"volumeid\"," + EOL + " \"display_name\" : \"name\"," + EOL + + " \"display_description\" : \"description\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -65,19 +56,19 @@ public class SnapshotForCreateTest { public void testMethods() throws Exception { SnapshotForCreate snapshotforcreate = objectMapper.readValue(JSON_FULL, SnapshotForCreate.class); snapshotforcreate.toString(); - + String name = snapshotforcreate.getName(); Assert.assertNotNull(name); snapshotforcreate.setName(name); - + String volumeId = snapshotforcreate.getVolumeId(); Assert.assertNotNull(volumeId); snapshotforcreate.setVolumeId(volumeId); - + String description = snapshotforcreate.getDescription(); Assert.assertNotNull(description); snapshotforcreate.setDescription(description); - + Boolean force = snapshotforcreate.getForce(); Assert.assertNotNull(force); snapshotforcreate.setForce(force); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotTest.java index 23e152c..d177c2e 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,25 +33,15 @@ public class SnapshotTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"snapshot\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"volumeId\" : \"volumeid\"," + EOL - + " \"size\" : 61," + EOL - + " \"createdAt\" : \"createdat\"," + EOL - + " \"displayName\" : \"name\"," + EOL - + " \"displayDescription\" : \"description\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"snapshot\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"volumeId\" : \"volumeid\"," + EOL + " \"size\" : 61," + + EOL + " \"createdAt\" : \"createdat\"," + EOL + " \"displayName\" : \"name\"," + EOL + + " \"displayDescription\" : \"description\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -68,25 +57,25 @@ public class SnapshotTest { public void testMethods() throws Exception { Snapshot snapshot = objectMapper.readValue(JSON_FULL, Snapshot.class); snapshot.toString(); - + String createdAt = snapshot.getCreatedAt(); Assert.assertNotNull(createdAt); - + Integer size = snapshot.getSize(); Assert.assertNotNull(size); - + String name = snapshot.getName(); Assert.assertNotNull(name); - + String volumeId = snapshot.getVolumeId(); Assert.assertNotNull(volumeId); - + String description = snapshot.getDescription(); Assert.assertNotNull(description); - + String id = snapshot.getId(); Assert.assertNotNull(id); - + String status = snapshot.getStatus(); Assert.assertNotNull(status); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotsTest.java index c4e56b5..1b248b2 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SnapshotsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,31 +34,17 @@ public class SnapshotsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"snapshots\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"volumeId\" : \"volumeid\"," + EOL - + " \"size\" : 61," + EOL - + " \"createdAt\" : \"createdat\"," + EOL - + " \"displayName\" : \"name\"," + EOL - + " \"displayDescription\" : \"description\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"volumeId\" : \"volumeid\"," + EOL - + " \"size\" : 61," + EOL - + " \"createdAt\" : \"createdat\"," + EOL - + " \"displayName\" : \"name\"," + EOL - + " \"displayDescription\" : \"description\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"snapshots\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"volumeId\" : \"volumeid\"," + EOL + " \"size\" : 61," + + EOL + " \"createdAt\" : \"createdat\"," + EOL + " \"displayName\" : \"name\"," + EOL + + " \"displayDescription\" : \"description\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"volumeId\" : \"volumeid\"," + EOL + " \"size\" : 61," + + EOL + " \"createdAt\" : \"createdat\"," + EOL + " \"displayName\" : \"name\"," + EOL + + " \"displayDescription\" : \"description\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -76,13 +60,14 @@ public class SnapshotsTest { public void testMethods() throws Exception { Snapshots snapshots = objectMapper.readValue(JSON_FULL, Snapshots.class); snapshots.toString(); - + List<Snapshot> list = snapshots.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Snapshot x : snapshots) { + for (@SuppressWarnings("unused") + Snapshot x : snapshots) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/StartTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/StartTest.java index 3b433a4..e7f2199 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/StartTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/StartTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Start; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class StartTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"os-start\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"os-start\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/StopTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/StopTest.java index b9989b8..6af28ea 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/StopTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/StopTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Stop; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class StopTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"os-stop\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"os-stop\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/SuspendTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/SuspendTest.java index b885ffe..57f43f8 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/SuspendTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/SuspendTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Suspend; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class SuspendTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"suspend\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"suspend\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/UnlockTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/UnlockTest.java index e6f8a05..9f050a0 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/UnlockTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/UnlockTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Unlock; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class UnlockTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"unlock\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"unlock\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/UnpauseTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/UnpauseTest.java index 924eb2a..d348db8 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/UnpauseTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/UnpauseTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Unpause; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class UnpauseTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"unpause\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"unpause\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/UnrescueTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/UnrescueTest.java index 2945ee5..d634ce3 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/UnrescueTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/UnrescueTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.Unrescue; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,17 +33,12 @@ public class UnrescueTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"unrescue\" : { }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"unrescue\" : { }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VncConsoleTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VncConsoleTest.java index 36cf35a..6835fa7 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VncConsoleTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VncConsoleTest.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.nova.model.ServerAction.VncConsole; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,20 +34,13 @@ public class VncConsoleTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"console\" : {" + EOL - + " \"type\" : \"type\"," + EOL - + " \"url\" : \"url\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"console\" : {" + EOL + " \"type\" : \"type\"," + EOL + + " \"url\" : \"url\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -64,10 +56,10 @@ public class VncConsoleTest { public void testMethods() throws Exception { VncConsole vncconsole = objectMapper.readValue(JSON_FULL, VncConsole.class); vncconsole.toString(); - + String type = vncconsole.getType(); Assert.assertNotNull(type); - + String url = vncconsole.getUrl(); Assert.assertNotNull(url); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeAttachmentTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeAttachmentTest.java index b051d52..37dfd64 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeAttachmentTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeAttachmentTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,22 +33,14 @@ public class VolumeAttachmentTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"volumeAttachment\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"volumeId\" : \"volumeid\"," + EOL - + " \"serverId\" : \"serverid\"," + EOL - + " \"device\" : \"device\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"volumeAttachment\" : {" + EOL + " \"id\" : \"id\"," + + EOL + " \"volumeId\" : \"volumeid\"," + EOL + " \"serverId\" : \"serverid\"," + EOL + + " \"device\" : \"device\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -65,19 +56,19 @@ public class VolumeAttachmentTest { public void testMethods() throws Exception { VolumeAttachment volumeattachment = objectMapper.readValue(JSON_FULL, VolumeAttachment.class); volumeattachment.toString(); - + String volumeId = volumeattachment.getVolumeId(); Assert.assertNotNull(volumeId); volumeattachment.setVolumeId(volumeId); - + String id = volumeattachment.getId(); Assert.assertNotNull(id); volumeattachment.setId(id); - + String device = volumeattachment.getDevice(); Assert.assertNotNull(device); volumeattachment.setDevice(device); - + String serverId = volumeattachment.getServerId(); Assert.assertNotNull(serverId); volumeattachment.setServerId(serverId); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeAttachmentsTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeAttachmentsTest.java index f409aa2..441d498 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeAttachmentsTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeAttachmentsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,25 +34,15 @@ public class VolumeAttachmentsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"volumeAttachments\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"volumeId\" : \"volumeid\"," + EOL - + " \"serverId\" : \"serverid\"," + EOL - + " \"device\" : \"device\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"volumeId\" : \"volumeid\"," + EOL - + " \"serverId\" : \"serverid\"," + EOL - + " \"device\" : \"device\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"volumeAttachments\" : [ {" + EOL + " \"id\" : \"id\"," + + EOL + " \"volumeId\" : \"volumeid\"," + EOL + " \"serverId\" : \"serverid\"," + EOL + + " \"device\" : \"device\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"volumeId\" : \"volumeid\"," + EOL + " \"serverId\" : \"serverid\"," + EOL + + " \"device\" : \"device\"" + EOL + " } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -70,13 +58,14 @@ public class VolumeAttachmentsTest { public void testMethods() throws Exception { VolumeAttachments volumeattachments = objectMapper.readValue(JSON_FULL, VolumeAttachments.class); volumeattachments.toString(); - + List<VolumeAttachment> list = volumeattachments.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") VolumeAttachment x : volumeattachments) { + for (@SuppressWarnings("unused") + VolumeAttachment x : volumeattachments) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeForCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeForCreateTest.java index 7654cef..0c7dab7 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeForCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeForCreateTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,27 +34,17 @@ public class VolumeForCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"volume\" : {" + EOL - + " \"size\" : 61," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"availability_zone\" : \"availabilityzone\"," + EOL - + " \"display_name\" : \"name\"," + EOL - + " \"display_description\" : \"description\"," + EOL - + " \"snapshot_id\" : 3" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"volume\" : {" + EOL + " \"size\" : 61," + EOL + " \"metadata\" : {" + EOL + + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"availability_zone\" : \"availabilityzone\"," + EOL + + " \"display_name\" : \"name\"," + EOL + " \"display_description\" : \"description\"," + EOL + + " \"snapshot_id\" : 3" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -72,28 +60,28 @@ public class VolumeForCreateTest { public void testMethods() throws Exception { VolumeForCreate volumeforcreate = objectMapper.readValue(JSON_FULL, VolumeForCreate.class); volumeforcreate.toString(); - - Map<String,String> metadata = volumeforcreate.getMetadata(); + + Map<String, String> metadata = volumeforcreate.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); volumeforcreate.setMetadata(metadata); - + Integer snapshotId = volumeforcreate.getSnapshotId(); Assert.assertNotNull(snapshotId); volumeforcreate.setSnapshotId(snapshotId); - + Integer size = volumeforcreate.getSize(); Assert.assertNotNull(size); volumeforcreate.setSize(size); - + String name = volumeforcreate.getName(); Assert.assertNotNull(name); volumeforcreate.setName(name); - + String description = volumeforcreate.getDescription(); Assert.assertNotNull(description); volumeforcreate.setDescription(description); - + String availabilityZone = volumeforcreate.getAvailabilityZone(); Assert.assertNotNull(availabilityZone); volumeforcreate.setAvailabilityZone(availabilityZone); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeForImageCreateTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeForImageCreateTest.java index 98a3e1a..b9be30d 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeForImageCreateTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeForImageCreateTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,24 +33,16 @@ public class VolumeForImageCreateTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"os-volume_upload_image\" : {" + EOL - + " \"volumeId\" : \"volumeid\"," + EOL - + " \"tenantId\" : \"tenantid\"," + EOL - + " \"force\" : false," + EOL - + " \"container_format\" : \"container_format\"," + EOL - + " \"disk_format\" : \"disk_format\"," + EOL - + " \"image_name\" : \"image_name\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"os-volume_upload_image\" : {" + EOL + + " \"volumeId\" : \"volumeid\"," + EOL + " \"tenantId\" : \"tenantid\"," + EOL + + " \"force\" : false," + EOL + " \"container_format\" : \"container_format\"," + EOL + + " \"disk_format\" : \"disk_format\"," + EOL + " \"image_name\" : \"image_name\"" + EOL + " }" + EOL + + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -67,27 +58,27 @@ public class VolumeForImageCreateTest { public void testMethods() throws Exception { VolumeForImageCreate volumeforimagecreate = objectMapper.readValue(JSON_FULL, VolumeForImageCreate.class); volumeforimagecreate.toString(); - + String image_name = volumeforimagecreate.getImage_name(); Assert.assertNotNull(image_name); volumeforimagecreate.setImage_name(image_name); - + String tenantId = volumeforimagecreate.getTenantId(); Assert.assertNotNull(tenantId); volumeforimagecreate.setTenantId(tenantId); - + String volumeId = volumeforimagecreate.getVolumeId(); Assert.assertNotNull(volumeId); volumeforimagecreate.setVolumeId(volumeId); - + String disk_format = volumeforimagecreate.getDisk_format(); Assert.assertNotNull(disk_format); volumeforimagecreate.setDisk_format(disk_format); - + Boolean force = volumeforimagecreate.getForce(); Assert.assertNotNull(force); volumeforimagecreate.setForce(force); - + String container_format = volumeforimagecreate.getContainer_format(); Assert.assertNotNull(container_format); volumeforimagecreate.setContainer_format(container_format); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTest.java index bf1a7e1..053821c 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTest.java @@ -24,10 +24,9 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - +import java.util.Date; import java.util.List; import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,38 +36,22 @@ public class VolumeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"volume\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"availabilityZone\" : \"availabilityzone\"," + EOL - + " \"volumeType\" : \"volumetype\"," + EOL - + " \"snapshotId\" : \"snapshotid\"," + EOL - + " \"attachments\" : [ {" + EOL - + " \"attachments-v1-k1\" : \"attachments-v1-v1\"," + EOL - + " \"attachments-v1-k2\" : \"attachments-v1-v2\"" + EOL - + " }, {" + EOL - + " \"attachments-v2-k1\" : \"attachments-v2-v1\"," + EOL - + " \"attachments-v2-k2\" : \"attachments-v2-v2\"" + EOL - + " } ]," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"createdAt\" : \"createdat\"," + EOL - + " \"size\" : 61," + EOL - + " \"displayName\" : \"name\"," + EOL - + " \"displayDescription\" : \"description\"" + EOL - + " }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"volume\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"availabilityZone\" : \"availabilityzone\"," + EOL + + " \"volumeType\" : \"volumetype\"," + EOL + " \"snapshotId\" : \"snapshotid\"," + EOL + + " \"attachments\" : [ {" + EOL + " \"attachments-v1-k1\" : \"attachments-v1-v1\"," + EOL + + " \"attachments-v1-k2\" : \"attachments-v1-v2\"" + EOL + " }, {" + EOL + + " \"attachments-v2-k1\" : \"attachments-v2-v1\"," + EOL + + " \"attachments-v2-k2\" : \"attachments-v2-v2\"" + EOL + " } ]," + EOL + " \"metadata\" : {" + + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"createdAt\" : \"createdat\"," + EOL + " \"size\" : 61," + EOL + + " \"displayName\" : \"name\"," + EOL + " \"displayDescription\" : \"description\"" + EOL + " }" + + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -84,39 +67,39 @@ public class VolumeTest { public void testMethods() throws Exception { Volume volume = objectMapper.readValue(JSON_FULL, Volume.class); volume.toString(); - + String volumeType = volume.getVolumeType(); Assert.assertNotNull(volumeType); - + String createdAt = volume.getCreatedAt(); Assert.assertNotNull(createdAt); - - Map<String,String> metadata = volume.getMetadata(); + + Map<String, String> metadata = volume.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); - - List<Map<String,Object>> attachments = volume.getAttachments(); + + List<Map<String, Object>> attachments = volume.getAttachments(); Assert.assertNotNull(attachments); Assert.assertEquals(2, attachments.size()); - + String snapshotId = volume.getSnapshotId(); Assert.assertNotNull(snapshotId); - + Integer size = volume.getSize(); Assert.assertNotNull(size); - + String name = volume.getName(); Assert.assertNotNull(name); - + String description = volume.getDescription(); Assert.assertNotNull(description); - + String id = volume.getId(); Assert.assertNotNull(id); - + String availabilityZone = volume.getAvailabilityZone(); Assert.assertNotNull(availabilityZone); - + String status = volume.getStatus(); Assert.assertNotNull(status); } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTypeTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTypeTest.java index 9033b9e..a2f78f1 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTypeTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTypeTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -33,17 +32,12 @@ public class VolumeTypeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"volume-type\" : { }" + EOL - + "}"; - - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private static final String JSON_FULL = "{" + EOL + " \"volume-type\" : { }" + EOL + "}"; + + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTypesTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTypesTest.java index 73f84b2..0e07453 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTypesTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumeTypesTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,15 +34,11 @@ public class VolumeTypesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"volume-types\" : [ { }, { } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"volume-types\" : [ { }, { } ]" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -60,13 +54,14 @@ public class VolumeTypesTest { public void testMethods() throws Exception { VolumeTypes volumetypes = objectMapper.readValue(JSON_FULL, VolumeTypes.class); volumetypes.toString(); - + List<VolumeType> list = volumetypes.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") VolumeType x : volumetypes) { + for (@SuppressWarnings("unused") + VolumeType x : volumetypes) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumesTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumesTest.java index 6729cc4..ccc28b5 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumesTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/VolumesTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,57 +34,31 @@ public class VolumesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"volumes\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"availabilityZone\" : \"availabilityzone\"," + EOL - + " \"volumeType\" : \"volumetype\"," + EOL - + " \"snapshotId\" : \"snapshotid\"," + EOL - + " \"attachments\" : [ {" + EOL - + " \"attachments-v1-k1\" : \"attachments-v1-v1\"," + EOL - + " \"attachments-v1-k2\" : \"attachments-v1-v2\"" + EOL - + " }, {" + EOL - + " \"attachments-v2-k1\" : \"attachments-v2-v1\"," + EOL - + " \"attachments-v2-k2\" : \"attachments-v2-v2\"" + EOL - + " } ]," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"createdAt\" : \"createdat\"," + EOL - + " \"size\" : 61," + EOL - + " \"displayName\" : \"name\"," + EOL - + " \"displayDescription\" : \"description\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"status\" : \"status\"," + EOL - + " \"availabilityZone\" : \"availabilityzone\"," + EOL - + " \"volumeType\" : \"volumetype\"," + EOL - + " \"snapshotId\" : \"snapshotid\"," + EOL - + " \"attachments\" : [ {" + EOL - + " \"attachments-v1-k1\" : \"attachments-v1-v1\"," + EOL - + " \"attachments-v1-k2\" : \"attachments-v1-v2\"" + EOL - + " }, {" + EOL - + " \"attachments-v2-k1\" : \"attachments-v2-v1\"," + EOL - + " \"attachments-v2-k2\" : \"attachments-v2-v2\"" + EOL - + " } ]," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }," + EOL - + " \"createdAt\" : \"createdat\"," + EOL - + " \"size\" : 61," + EOL - + " \"displayName\" : \"name\"," + EOL - + " \"displayDescription\" : \"description\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"volumes\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"status\" : \"status\"," + EOL + " \"availabilityZone\" : \"availabilityzone\"," + EOL + + " \"volumeType\" : \"volumetype\"," + EOL + " \"snapshotId\" : \"snapshotid\"," + EOL + + " \"attachments\" : [ {" + EOL + " \"attachments-v1-k1\" : \"attachments-v1-v1\"," + EOL + + " \"attachments-v1-k2\" : \"attachments-v1-v2\"" + EOL + " }, {" + EOL + + " \"attachments-v2-k1\" : \"attachments-v2-v1\"," + EOL + + " \"attachments-v2-k2\" : \"attachments-v2-v2\"" + EOL + " } ]," + EOL + " \"metadata\" : {" + + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"createdAt\" : \"createdat\"," + EOL + " \"size\" : 61," + EOL + + " \"displayName\" : \"name\"," + EOL + " \"displayDescription\" : \"description\"" + EOL + " }, {" + + EOL + " \"id\" : \"id\"," + EOL + " \"status\" : \"status\"," + EOL + + " \"availabilityZone\" : \"availabilityzone\"," + EOL + " \"volumeType\" : \"volumetype\"," + EOL + + " \"snapshotId\" : \"snapshotid\"," + EOL + " \"attachments\" : [ {" + EOL + + " \"attachments-v1-k1\" : \"attachments-v1-v1\"," + EOL + + " \"attachments-v1-k2\" : \"attachments-v1-v2\"" + EOL + " }, {" + EOL + + " \"attachments-v2-k1\" : \"attachments-v2-v1\"," + EOL + + " \"attachments-v2-k2\" : \"attachments-v2-v2\"" + EOL + " } ]," + EOL + " \"metadata\" : {" + + EOL + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL + + " }," + EOL + " \"createdAt\" : \"createdat\"," + EOL + " \"size\" : 61," + EOL + + " \"displayName\" : \"name\"," + EOL + " \"displayDescription\" : \"description\"" + EOL + " } ]" + + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -102,13 +74,14 @@ public class VolumesTest { public void testMethods() throws Exception { Volumes volumes = objectMapper.readValue(JSON_FULL, Volumes.class); volumes.toString(); - + List<Volume> list = volumes.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Volume x : volumes) { + for (@SuppressWarnings("unused") + Volume x : volumes) { ++cnt; } Assert.assertEquals(2, cnt); |