diff options
Diffstat (limited to 'keystone-model')
83 files changed, 933 insertions, 1454 deletions
diff --git a/keystone-model/pom.xml b/keystone-model/pom.xml index 7b3f806..58816a0 100644 --- a/keystone-model/pom.xml +++ b/keystone-model/pom.xml @@ -1,26 +1,27 @@ -<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>keystone-model</artifactId> - <name>OpenStack Keystone Model</name> - <description>OpenStack Keystone Model</description> +<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>keystone-model</artifactId> + <name>OpenStack Keystone Model</name> + <description>OpenStack Keystone 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> + <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/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Access.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Access.java index 0ec9a1c..b78296a 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Access.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Access.java @@ -19,7 +19,6 @@ package com.woorea.openstack.keystone.model; import java.io.Serializable; import java.util.List; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -28,16 +27,16 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class Access implements Serializable { public static final class Service { - - @JsonIgnoreProperties(ignoreUnknown=true) + + @JsonIgnoreProperties(ignoreUnknown = true) public static final class Endpoint { - + private String region; - + private String publicURL; - + private String internalURL; - + private String adminURL; /** @@ -68,24 +67,25 @@ public class Access implements Serializable { return adminURL; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Endpoint [region=" + region + ", publicURL=" - + publicURL + ", internalURL=" + internalURL + return "Endpoint [region=" + region + ", publicURL=" + publicURL + ", internalURL=" + internalURL + ", adminURL=" + adminURL + "]"; } - + } - + private String type; - + private String name; - + private List<Endpoint> endpoints; - + @JsonProperty("endpoints_links") private List<Link> endpointsLinks; @@ -117,25 +117,27 @@ public class Access implements Serializable { return endpointsLinks; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Service [type=" + type + ", name=" + name + ", endpoints=" - + endpoints + ", endpointsLinks=" + endpointsLinks + "]"; + return "Service [type=" + type + ", name=" + name + ", endpoints=" + endpoints + ", endpointsLinks=" + + endpointsLinks + "]"; } - + } - - @JsonIgnoreProperties(ignoreUnknown=true) + + @JsonIgnoreProperties(ignoreUnknown = true) public static final class User { - - @JsonIgnoreProperties(ignoreUnknown=true) + + @JsonIgnoreProperties(ignoreUnknown = true) public static final class Role { - + private String id; - + private String name; /** @@ -152,24 +154,26 @@ public class Access implements Serializable { return name; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { return "Role [id=" + id + ", name=" + name + "]"; } - + } - + private String id; - + private String name; - + private String username; - + private List<Role> roles; - + @JsonProperty("roles_links") private List<Link> rolesLinks; @@ -208,24 +212,25 @@ public class Access implements Serializable { return rolesLinks; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "User [id=" + id + ", name=" + name + ", username=" - + username + ", roles=" + roles + ", rolesLinks=" + return "User [id=" + id + ", name=" + name + ", username=" + username + ", roles=" + roles + ", rolesLinks=" + rolesLinks + "]"; } - + } - + private Token token; - + private List<Service> serviceCatalog; - + private User user; - + private Map<String, Object> metadata; /** @@ -256,13 +261,15 @@ public class Access implements Serializable { return metadata; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Access [token=" + token + ", serviceCatalog=" + serviceCatalog - + ", user=" + user + ", metadata=" + metadata + "]"; + return "Access [token=" + token + ", serviceCatalog=" + serviceCatalog + ", user=" + user + ", metadata=" + + metadata + "]"; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Authentication.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Authentication.java index 6c6b536..6193ede 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Authentication.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Authentication.java @@ -21,7 +21,7 @@ import java.io.Serializable; public abstract class Authentication implements Serializable { private String tenantId; - + private String tenantName; /** @@ -51,5 +51,5 @@ public abstract class Authentication implements Serializable { public void setTenantName(String tenantName) { this.tenantName = tenantName; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoint.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoint.java index 87c93ec..fe38cda 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoint.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoint.java @@ -17,7 +17,6 @@ package com.woorea.openstack.keystone.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -25,18 +24,18 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class Endpoint implements Serializable { private String id; - + @JsonProperty("service_id") private String serviceId; - + private String region; - + @JsonProperty("publicurl") private String publicURL; - + @JsonProperty("internalurl") private String internalURL; - + @JsonProperty("adminurl") private String adminURL; @@ -124,14 +123,15 @@ public class Endpoint implements Serializable { this.adminURL = adminURL; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Endpoint [id=" + id + ", serviceId=" + serviceId + ", region=" - + region + ", publicURL=" + publicURL + ", internalURL=" - + internalURL + ", adminURL=" + adminURL + "]"; + return "Endpoint [id=" + id + ", serviceId=" + serviceId + ", region=" + region + ", publicURL=" + publicURL + + ", internalURL=" + internalURL + ", adminURL=" + adminURL + "]"; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoints.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoints.java index 68ed95c..b92b552 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoints.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Endpoints.java @@ -19,7 +19,6 @@ package com.woorea.openstack.keystone.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Endpoints implements Iterable<Endpoint>, Serializable { @@ -33,8 +32,10 @@ public class Endpoints implements Iterable<Endpoint>, Serializable { public List<Endpoint> getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Endpoints implements Iterable<Endpoint>, Serializable { public Iterator<Endpoint> iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Error.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Error.java index 2da9408..a907871 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Error.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Error.java @@ -17,16 +17,15 @@ package com.woorea.openstack.keystone.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("error") public class Error implements Serializable { private Integer code; - + private String title; - + private String message; /** @@ -50,13 +49,14 @@ public class Error implements Serializable { return message; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Error [code=" + code + ", title=" + title + ", message=" - + message + "]"; + return "Error [code=" + code + ", title=" + title + ", message=" + message + "]"; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Link.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Link.java index 4b94558..525fa32 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Link.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/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/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Metadata.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Metadata.java index 9f2a6ca..5e46b2e 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Metadata.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Metadata.java @@ -36,12 +36,13 @@ public class Metadata { /** * Set the metadata + * * @param metadata */ public void setMetadata(Map<String, String> metadata) { this.metadata = metadata; } - - + + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Role.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Role.java index 8885d51..9f9bb80 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Role.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Role.java @@ -17,18 +17,17 @@ package com.woorea.openstack.keystone.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("role") public class Role implements Serializable { private String id; - + private String name; - + private String description; - + private String enabled; /** diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Roles.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Roles.java index bc9e6a5..2e8ca6a 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Roles.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Roles.java @@ -19,7 +19,6 @@ package com.woorea.openstack.keystone.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Roles implements Iterable<Role>, Serializable { @@ -33,8 +32,10 @@ public class Roles implements Iterable<Role>, Serializable { public List<Role> getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Roles implements Iterable<Role>, Serializable { public Iterator<Role> iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Service.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Service.java index 40cdfae..3f65961 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Service.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Service.java @@ -17,18 +17,17 @@ package com.woorea.openstack.keystone.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("OS-KSADM:service") public class Service implements Serializable { private String id; - + private String type; - + private String name; - + private String description; /** @@ -80,13 +79,14 @@ public class Service implements Serializable { this.description = description; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Service [id=" + id + ", type=" + type + ", name=" + name - + ", description=" + description + "]"; + return "Service [id=" + id + ", type=" + type + ", name=" + name + ", description=" + description + "]"; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Services.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Services.java index a0ba675..6e47645 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Services.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Services.java @@ -19,10 +19,9 @@ package com.woorea.openstack.keystone.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; -public class Services implements Iterable<Service>, Serializable { +public class Services implements Iterable<Service>, Serializable { @JsonProperty("OS-KSADM:services") private List<Service> list; @@ -33,8 +32,10 @@ public class Services implements Iterable<Service>, Serializable { public List<Service> getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Services implements Iterable<Service>, Serializable { public Iterator<Service> iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenant.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenant.java index a8a84fd..ee195de 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenant.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenant.java @@ -17,38 +17,36 @@ package com.woorea.openstack.keystone.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("tenant") -@JsonIgnoreProperties(ignoreUnknown=true) +@JsonIgnoreProperties(ignoreUnknown = true) public class Tenant implements Serializable { private String id; - + private String name; - + private String description; - + private Boolean enabled; - + public Tenant(String name, String description, Boolean enabled) { this.name = name; this.description = description; this.enabled = enabled; } - + public Tenant(String name, String description) { this(name, description, Boolean.TRUE); } - + public Tenant(String name) { this(name, null); } - - public Tenant() { - } + + public Tenant() {} /** * @return the id @@ -106,13 +104,14 @@ public class Tenant implements Serializable { this.enabled = enabled; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Tenant [id=" + id + ", name=" + name + ", description=" - + description + ", enabled=" + enabled + "]"; + return "Tenant [id=" + id + ", name=" + name + ", description=" + description + ", enabled=" + enabled + "]"; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenants.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenants.java index 7ebb1f5..688252d 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenants.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Tenants.java @@ -19,14 +19,13 @@ package com.woorea.openstack.keystone.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Tenants implements Iterable<Tenant>, Serializable { @JsonProperty("tenants") private List<Tenant> list; - + @JsonProperty("tenants_links") private List<Link> links; @@ -44,7 +43,9 @@ public class Tenants implements Iterable<Tenant>, Serializable { return links; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -56,5 +57,5 @@ public class Tenants implements Iterable<Tenant>, Serializable { public Iterator<Tenant> iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Token.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Token.java index 73d92fa..a9aade7 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Token.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Token.java @@ -39,7 +39,7 @@ public final class Token { * @return the issued_at */ public Calendar getIssued_at() { - return issued_at; + return issued_at; } /** @@ -56,13 +56,14 @@ public final class Token { return tenant; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "Token [id=" + id + ", Issued_at=" + issued_at + ", expires=" + expires + ", tenant=" - + tenant + "]"; + return "Token [id=" + id + ", Issued_at=" + issued_at + ", expires=" + expires + ", tenant=" + tenant + "]"; } -}
\ No newline at end of file +} diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/User.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/User.java index bd1652e..046e669 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/User.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/User.java @@ -21,26 +21,25 @@ package com.woorea.openstack.keystone.model; */ import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("user") public class User implements Serializable { private String id; - + private String username; - -// @JsonProperty("OS-KSADM:password") -// @JsonProperty("OS_KSADM_password") + + // @JsonProperty("OS-KSADM:password") + // @JsonProperty("OS_KSADM_password") private String password; - + private String tenantId; - + private String name; - + private String email; - + private Boolean enabled; /** @@ -141,14 +140,15 @@ public class User implements Serializable { this.enabled = enabled; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override public String toString() { - return "User [id=" + id + ", username=" + username + ", password=" - + password + ", tenantId=" + tenantId + ", name=" + name - + ", email=" + email + ", enabled=" + enabled + "]"; + return "User [id=" + id + ", username=" + username + ", password=" + password + ", tenantId=" + tenantId + + ", name=" + name + ", email=" + email + ", enabled=" + enabled + "]"; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Users.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Users.java index 4f511c1..a6e4f14 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Users.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/Users.java @@ -19,7 +19,6 @@ package com.woorea.openstack.keystone.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Users implements Iterable<User>, Serializable { @@ -33,8 +32,10 @@ public class Users implements Iterable<User>, Serializable { public List<User> getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Users implements Iterable<User>, Serializable { public Iterator<User> iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/AccessKey.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/AccessKey.java index 99c776a..2167ca2 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/AccessKey.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/AccessKey.java @@ -21,11 +21,11 @@ import com.woorea.openstack.keystone.model.Authentication; @JsonRootName("auth") public class AccessKey extends Authentication { - + public static final class ApiAccessKeyCredentials { - + private String accessKey; - + private String secretKey; /** @@ -55,15 +55,15 @@ public class AccessKey extends Authentication { public void setSecretKey(String secretKey) { this.secretKey = secretKey; } - + } - + private ApiAccessKeyCredentials apiAccessKeyCredentials = new ApiAccessKeyCredentials(); - + public AccessKey() { - + } - + public AccessKey(String accessKey, String secretKey) { apiAccessKeyCredentials.setAccessKey(accessKey); apiAccessKeyCredentials.setSecretKey(secretKey); @@ -79,9 +79,8 @@ public class AccessKey extends Authentication { /** * @param apiAccessKeyCredentials the apiAccessKeyCredentials to set */ - public void setApiAccessKeyCredentials( - ApiAccessKeyCredentials apiAccessKeyCredentials) { + public void setApiAccessKeyCredentials(ApiAccessKeyCredentials apiAccessKeyCredentials) { this.apiAccessKeyCredentials = apiAccessKeyCredentials; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/TokenAuthentication.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/TokenAuthentication.java index f730fc0..2c33519 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/TokenAuthentication.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/TokenAuthentication.java @@ -21,9 +21,9 @@ import com.woorea.openstack.keystone.model.Authentication; @JsonRootName("auth") public class TokenAuthentication extends Authentication { - + public static final class Token { - + private String id; /** @@ -39,11 +39,11 @@ public class TokenAuthentication extends Authentication { public void setId(String id) { this.id = id; } - + } - + private Token token = new Token(); - + public TokenAuthentication(String token) { this.token.id = token; } @@ -61,5 +61,5 @@ public class TokenAuthentication extends Authentication { public void setToken(Token token) { this.token = token; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/UsernamePassword.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/UsernamePassword.java index 1c07283..3cdb03c 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/UsernamePassword.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/model/authentication/UsernamePassword.java @@ -21,11 +21,11 @@ import com.woorea.openstack.keystone.model.Authentication; @JsonRootName("auth") public class UsernamePassword extends Authentication { - + public static final class PasswordCredentials { - + private String username; - + private String password; /** @@ -55,15 +55,15 @@ public class UsernamePassword extends Authentication { public void setPassword(String password) { this.password = password; } - + } - + private PasswordCredentials passwordCredentials = new PasswordCredentials(); - + public UsernamePassword() { - + } - + public UsernamePassword(String username, String password) { passwordCredentials.setUsername(username); passwordCredentials.setPassword(password); @@ -82,5 +82,5 @@ public class UsernamePassword extends Authentication { public void setPasswordCredentials(PasswordCredentials passwordCredentials) { this.passwordCredentials = passwordCredentials; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Authentication.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Authentication.java index c92d1da..428b3ed 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Authentication.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Authentication.java @@ -19,14 +19,13 @@ package com.woorea.openstack.keystone.v3.model; import java.io.Serializable; import java.util.ArrayList; import java.util.List; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("auth") public class Authentication implements Serializable { - + public static final class Identity { - + public static final Identity password(String userId, String password) { Identity identity = new Identity(); identity.getMethods().add("password"); @@ -36,12 +35,13 @@ public class Authentication implements Serializable { identity.setPassword(method); return identity; } - + public static final Identity password(String domainName, String username, String password) { Identity identity = new Identity(); identity.getMethods().add("password"); Password method = new Password(); - com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User.Domain domain = new com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User.Domain(); + com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User.Domain domain = + new com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User.Domain(); domain.setName(domainName); method.getUser().setDomain(domain); method.getUser().setName(username); @@ -49,7 +49,7 @@ public class Authentication implements Serializable { identity.setPassword(method); return identity; } - + public static final Identity token(String token) { Identity identity = new Identity(); identity.getMethods().add("token"); @@ -58,17 +58,17 @@ public class Authentication implements Serializable { identity.setToken(method); return identity; } - + private List<String> methods = new ArrayList<>(); - + public static final class Password { - + public static final class User { - + public static final class Domain { - + private String id; - + private String name; public String getId() { @@ -87,13 +87,13 @@ public class Authentication implements Serializable { this.name = name; } } - + private Domain domain; - + private String id; - + private String name; - + private String password; public Domain getDomain() { @@ -127,9 +127,9 @@ public class Authentication implements Serializable { public void setPassword(String password) { this.password = password; } - + } - + private User user = new User(); public User getUser() { @@ -139,13 +139,13 @@ public class Authentication implements Serializable { public void setUser(User user) { this.user = user; } - + } - + private Password password; - + public static final class Token { - + private String id; public String getId() { @@ -155,9 +155,9 @@ public class Authentication implements Serializable { public void setId(String id) { this.id = id; } - + } - + private Token token; public List<String> getMethods() { @@ -183,13 +183,13 @@ public class Authentication implements Serializable { public void setToken(Token token) { this.token = token; } - + } - + private Identity identity; - + public static final class Scope { - + public static Scope project(String id) { Scope scope = new Scope(); Project project = new Project(); @@ -197,10 +197,11 @@ public class Authentication implements Serializable { scope.setProject(project); return scope; } - + public static Scope project(String domainName, String projectName) { Scope scope = new Scope(); - com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project.Domain domain = new com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project.Domain(); + com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project.Domain domain = + new com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project.Domain(); domain.setName(domainName); Project project = new Project(); project.setDomain(domain); @@ -208,13 +209,13 @@ public class Authentication implements Serializable { scope.setProject(project); return scope; } - + public static final class Project { - + public static final class Domain { - + private String id; - + private String name; public String getId() { @@ -233,13 +234,13 @@ public class Authentication implements Serializable { this.name = name; } } - + private String id; - + private Domain domain; - + private String name; - + public String getId() { return id; @@ -264,9 +265,9 @@ public class Authentication implements Serializable { public void setName(String name) { this.name = name; } - + } - + private Project project; public Project getProject() { @@ -276,9 +277,9 @@ public class Authentication implements Serializable { public void setProject(Project project) { this.project = project; } - + } - + private Scope scope; public Identity getIdentity() { @@ -296,5 +297,5 @@ public class Authentication implements Serializable { public void setScope(Scope scope) { this.scope = scope; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credential.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credential.java index 26d0b89..280b78d 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credential.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credential.java @@ -18,20 +18,19 @@ package com.woorea.openstack.keystone.v3.model; import java.util.HashMap; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("credential") public class Credential { - + private String id; private String projectId; - + private String type; - + private String userId; - + private Map<String, String> blob = new HashMap<>(); public String getId() { @@ -73,5 +72,5 @@ public class Credential { public void setBlob(Map<String, String> blob) { this.blob = blob; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credentials.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credentials.java index b0e6944..c29b8f6 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credentials.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Credentials.java @@ -19,10 +19,9 @@ package com.woorea.openstack.keystone.v3.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; -public class Credentials implements Iterable<Credential>, Serializable { +public class Credentials implements Iterable<Credential>, Serializable { @JsonProperty("credentials") private List<Credential> list; @@ -33,8 +32,10 @@ public class Credentials implements Iterable<Credential>, Serializable { public List<Credential> getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Credentials implements Iterable<Credential>, Serializable { public Iterator<Credential> iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domain.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domain.java index 6509f79..821bdc2 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domain.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domain.java @@ -22,11 +22,11 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class Domain { private String id; - + private String name; - + private String description; - + private Boolean enabled; public String getId() { @@ -52,7 +52,7 @@ public class Domain { public void setDescription(String description) { this.description = description; } - + public Boolean getEnabled() { return enabled; } @@ -60,5 +60,5 @@ public class Domain { public void setEnabled(Boolean enabled) { this.enabled = enabled; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domains.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domains.java index 32a5442..4880edc 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domains.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Domains.java @@ -19,10 +19,9 @@ package com.woorea.openstack.keystone.v3.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; -public class Domains implements Iterable<Domain>, Serializable { +public class Domains implements Iterable<Domain>, Serializable { @JsonProperty("domains") private List<Domain> list; @@ -33,8 +32,10 @@ public class Domains implements Iterable<Domain>, Serializable { public List<Domain> getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Domains implements Iterable<Domain>, Serializable { public Iterator<Domain> iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoint.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoint.java index 5a60998..e3c19c3 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoint.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoint.java @@ -23,12 +23,12 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class Endpoint { private String id; - + @JsonProperty("interface") private String iface; - + private String name; - + @JsonProperty("service_id") private String serviceId; @@ -63,5 +63,5 @@ public class Endpoint { public void setServiceId(String serviceId) { this.serviceId = serviceId; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoints.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoints.java index b8711d6..5383e75 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoints.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoints.java @@ -19,10 +19,9 @@ package com.woorea.openstack.keystone.v3.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; -public class Endpoints implements Iterable<Endpoint>, Serializable { +public class Endpoints implements Iterable<Endpoint>, Serializable { @JsonProperty("endpoints") private List<Endpoint> list; @@ -33,8 +32,10 @@ public class Endpoints implements Iterable<Endpoint>, Serializable { public List<Endpoint> getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Endpoints implements Iterable<Endpoint>, Serializable { public Iterator<Endpoint> iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Group.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Group.java index 7573119..808b7b5 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Group.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Group.java @@ -23,12 +23,12 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class Group { private String id; - + @JsonProperty("domain_id") private String domainId; - + private String name; - + private String description; public String getId() { @@ -62,5 +62,5 @@ public class Group { public void setDescription(String description) { this.description = description; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Groups.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Groups.java index 2929030..f4b5b62 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Groups.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Groups.java @@ -19,10 +19,9 @@ package com.woorea.openstack.keystone.v3.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; -public class Groups implements Iterable<Group>, Serializable { +public class Groups implements Iterable<Group>, Serializable { @JsonProperty("groups") private List<Group> list; @@ -33,8 +32,10 @@ public class Groups implements Iterable<Group>, Serializable { public List<Group> getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Groups implements Iterable<Group>, Serializable { public Iterator<Group> iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policies.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policies.java index 1d51d64..2064550 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policies.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policies.java @@ -19,10 +19,9 @@ package com.woorea.openstack.keystone.v3.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; -public class Policies implements Iterable<Policy>, Serializable { +public class Policies implements Iterable<Policy>, Serializable { @JsonProperty("policies") private List<Policy> list; @@ -33,8 +32,10 @@ public class Policies implements Iterable<Policy>, Serializable { public List<Policy> getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Policies implements Iterable<Policy>, Serializable { public Iterator<Policy> iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policy.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policy.java index 777ff67..466a300 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policy.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Policy.java @@ -18,20 +18,19 @@ package com.woorea.openstack.keystone.v3.model; import java.util.HashMap; import java.util.Map; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("policy") public class Policy { - + private String id; private String projectId; - + private String type; - + private String userId; - + private Map<String, String> blob = new HashMap<>(); public String getId() { @@ -73,5 +72,5 @@ public class Policy { public void setBlob(Map<String, String> blob) { this.blob = blob; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Project.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Project.java index 5345cb8..2f76faf 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Project.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Project.java @@ -23,12 +23,12 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class Project { private String id; - + @JsonProperty("domain_id") private String domainId; - + private String name; - + private Boolean enabled; public String getId() { @@ -54,7 +54,7 @@ public class Project { public void setName(String name) { this.name = name; } - + public Boolean getEnabled() { return enabled; } @@ -62,5 +62,5 @@ public class Project { public void setEnabled(Boolean enabled) { this.enabled = enabled; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Projects.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Projects.java index bc11b9d..c78df70 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Projects.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Projects.java @@ -19,10 +19,9 @@ package com.woorea.openstack.keystone.v3.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; -public class Projects implements Iterable<Project>, Serializable { +public class Projects implements Iterable<Project>, Serializable { @JsonProperty("projects") private List<Project> list; @@ -33,8 +32,10 @@ public class Projects implements Iterable<Project>, Serializable { public List<Project> getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Projects implements Iterable<Project>, Serializable { public Iterator<Project> iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Role.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Role.java index 4407bba..98ff8e0 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Role.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Role.java @@ -17,18 +17,17 @@ package com.woorea.openstack.keystone.v3.model; import java.io.Serializable; - import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("role") public class Role implements Serializable { private String id; - + private String name; - + private String description; - + private String enabled; /** diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Roles.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Roles.java index ed0d21f..c7f13ae 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Roles.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Roles.java @@ -19,7 +19,6 @@ package com.woorea.openstack.keystone.v3.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; public class Roles implements Iterable<Role>, Serializable { @@ -33,8 +32,10 @@ public class Roles implements Iterable<Role>, Serializable { public List<Role> getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -46,5 +47,5 @@ public class Roles implements Iterable<Role>, Serializable { public Iterator<Role> iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Service.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Service.java index 713a370..a0a3508 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Service.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Service.java @@ -22,11 +22,11 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class Service { private String id; - + private String type; - + private String name; - + private String description; public String getId() { @@ -60,5 +60,5 @@ public class Service { public void setDescription(String description) { this.description = description; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Services.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Services.java index d9e23f1..25da795 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Services.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Services.java @@ -19,11 +19,10 @@ package com.woorea.openstack.keystone.v3.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; import com.woorea.openstack.keystone.model.Service; -public class Services implements Iterable<Service>, Serializable { +public class Services implements Iterable<Service>, Serializable { @JsonProperty("services") private List<Service> list; @@ -34,8 +33,10 @@ public class Services implements Iterable<Service>, Serializable { public List<Service> getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -47,5 +48,5 @@ public class Services implements Iterable<Service>, Serializable { public Iterator<Service> iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Token.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Token.java index ce38ff0..e85bc67 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Token.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Token.java @@ -19,30 +19,29 @@ package com.woorea.openstack.keystone.v3.model; import java.io.Serializable; import java.util.Calendar; import java.util.List; - import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @JsonRootName("token") -@JsonIgnoreProperties(ignoreUnknown=true) +@JsonIgnoreProperties(ignoreUnknown = true) public class Token implements Serializable { - + private String id; - + @JsonProperty("expires_at") private Calendar expiresAt; - + @JsonProperty("issued_at") private Calendar issuedAt; - + private List<String> methods; - - @JsonIgnoreProperties(ignoreUnknown=true) + + @JsonIgnoreProperties(ignoreUnknown = true) public static final class Domain { - + private String id; - + private String name; public String getId() { @@ -60,18 +59,18 @@ public class Token implements Serializable { public void setName(String name) { this.name = name; } - + } - + private Domain domain; - - @JsonIgnoreProperties(ignoreUnknown=true) + + @JsonIgnoreProperties(ignoreUnknown = true) public static final class Project { - + private Domain domain; - + private String id; - + private String name; public Domain getDomain() { @@ -97,19 +96,19 @@ public class Token implements Serializable { public void setName(String name) { this.name = name; } - + } - + private Project project; - - @JsonIgnoreProperties(ignoreUnknown=true) + + @JsonIgnoreProperties(ignoreUnknown = true) public static final class User { - - @JsonIgnoreProperties(ignoreUnknown=true) + + @JsonIgnoreProperties(ignoreUnknown = true) private static final class Domain { - + private String id; - + private String name; public String getId() { @@ -127,11 +126,11 @@ public class Token implements Serializable { public void setName(String name) { this.name = name; } - + } - + private String id; - + private String name; public String getId() { @@ -149,37 +148,37 @@ public class Token implements Serializable { public void setName(String name) { this.name = name; } - + } - + private User user; - - @JsonIgnoreProperties(ignoreUnknown=true) + + @JsonIgnoreProperties(ignoreUnknown = true) public static final class Role { - + private String id; - + private String name; - + } - + private List<Role> roles; - + public static final class Service { - + public static final class Endpoint { - + private String id; - + private String url; - + private String region; - + private Boolean enabled; - + @JsonProperty("legacy_endpoint_id") private String legacyEndpointId; - + @JsonProperty("interface") private String iface; @@ -230,13 +229,13 @@ public class Token implements Serializable { public void setInterface(String iface) { this.iface = iface; } - + } - + private String id; - + private String type; - + private List<Endpoint> endpoints; public String getId() { @@ -262,9 +261,9 @@ public class Token implements Serializable { public void setEndpoints(List<Endpoint> endpoints) { this.endpoints = endpoints; } - + } - + private List<Service> catalog; @@ -374,13 +373,12 @@ public class Token implements Serializable { this.catalog = catalog; } - + @Override public String toString() { - return "Token [id=" + id + ", expiresAt=" + expiresAt + ", issuedAt=" - + issuedAt + ", methods=" + methods + ", domain=" + domain - + ", project=" + project + ", user=" + user + ", roles=" - + roles + ", catalog=" + catalog + "]"; + return "Token [id=" + id + ", expiresAt=" + expiresAt + ", issuedAt=" + issuedAt + ", methods=" + methods + + ", domain=" + domain + ", project=" + project + ", user=" + user + ", roles=" + roles + ", catalog=" + + catalog + "]"; } } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/User.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/User.java index 91a6230..6724213 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/User.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/User.java @@ -23,21 +23,21 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class User { private String id; - + @JsonProperty("domain_id") private String domainId; - + @JsonProperty("default_project_id") private String defaultProjectId; - + private String name; - + private String password; - + private String email; - + private String description; - + private Boolean enabled; public String getId() { @@ -103,5 +103,5 @@ public class User { public void setEnabled(Boolean enabled) { this.enabled = enabled; } - + } diff --git a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Users.java b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Users.java index a371018..41e9b0e 100644 --- a/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Users.java +++ b/keystone-model/src/main/java/com/woorea/openstack/keystone/v3/model/Users.java @@ -19,11 +19,10 @@ package com.woorea.openstack.keystone.v3.model; import java.io.Serializable; import java.util.Iterator; import java.util.List; - import com.fasterxml.jackson.annotation.JsonProperty; import com.woorea.openstack.keystone.model.User; -public class Users implements Iterable<User>, Serializable { +public class Users implements Iterable<User>, Serializable { @JsonProperty("users") private List<User> list; @@ -34,8 +33,10 @@ public class Users implements Iterable<User>, Serializable { public List<User> getList() { return list; } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see java.lang.Object#toString() */ @Override @@ -47,5 +48,5 @@ public class Users implements Iterable<User>, Serializable { public Iterator<User> iterator() { return list.iterator(); } - + } diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/AccessTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/AccessTest.java index 807c528..85e40d9 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/AccessTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/AccessTest.java @@ -26,10 +26,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.keystone.model.Access.Service; import com.woorea.openstack.keystone.model.Access.User; - import java.util.List; import java.util.Map; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -39,101 +37,42 @@ public class AccessTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"access\" : {" + EOL - + " \"token\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"issued_at\" : 1488024000000," + EOL - + " \"expires\" : 1488628800000," + EOL - + " \"tenant\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : false" + EOL - + " }" + EOL - + " }," + EOL - + " \"serviceCatalog\" : [ {" + EOL - + " \"type\" : \"type\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"endpoints\" : [ {" + EOL - + " \"region\" : \"region\"," + EOL - + " \"publicURL\" : \"publicurl\"," + EOL - + " \"internalURL\" : \"internalurl\"," + EOL - + " \"adminURL\" : \"adminurl\"" + EOL - + " }, {" + EOL - + " \"region\" : \"region\"," + EOL - + " \"publicURL\" : \"publicurl\"," + EOL - + " \"internalURL\" : \"internalurl\"," + EOL - + " \"adminURL\" : \"adminurl\"" + EOL - + " } ]," + EOL - + " \"endpoints_links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " }, {" + EOL - + " \"type\" : \"type\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"endpoints\" : [ {" + EOL - + " \"region\" : \"region\"," + EOL - + " \"publicURL\" : \"publicurl\"," + EOL - + " \"internalURL\" : \"internalurl\"," + EOL - + " \"adminURL\" : \"adminurl\"" + EOL - + " }, {" + EOL - + " \"region\" : \"region\"," + EOL - + " \"publicURL\" : \"publicurl\"," + EOL - + " \"internalURL\" : \"internalurl\"," + EOL - + " \"adminURL\" : \"adminurl\"" + EOL - + " } ]," + EOL - + " \"endpoints_links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " } ]," + EOL - + " \"user\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"username\" : \"username\"," + EOL - + " \"roles\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + " } ]," + EOL - + " \"roles_links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + " }," + EOL - + " \"metadata\" : {" + EOL - + " \"metadata-k1\" : \"metadata-v1\"," + EOL - + " \"metadata-k2\" : \"metadata-v2\"" + EOL - + " }" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"access\" : {" + EOL + " \"token\" : {" + EOL + + " \"id\" : \"id\"," + EOL + " \"issued_at\" : 1488024000000," + EOL + + " \"expires\" : 1488628800000," + EOL + " \"tenant\" : {" + EOL + " \"id\" : \"id\"," + + EOL + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"enabled\" : false" + EOL + " }" + EOL + " }," + EOL + " \"serviceCatalog\" : [ {" + + EOL + " \"type\" : \"type\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"endpoints\" : [ {" + EOL + " \"region\" : \"region\"," + EOL + + " \"publicURL\" : \"publicurl\"," + EOL + " \"internalURL\" : \"internalurl\"," + EOL + + " \"adminURL\" : \"adminurl\"" + EOL + " }, {" + EOL + " \"region\" : \"region\"," + + EOL + " \"publicURL\" : \"publicurl\"," + EOL + " \"internalURL\" : \"internalurl\"," + EOL + + " \"adminURL\" : \"adminurl\"" + EOL + " } ]," + EOL + " \"endpoints_links\" : [ {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " }, {" + EOL + " \"type\" : \"type\"," + + EOL + " \"name\" : \"name\"," + EOL + " \"endpoints\" : [ {" + EOL + + " \"region\" : \"region\"," + EOL + " \"publicURL\" : \"publicurl\"," + EOL + + " \"internalURL\" : \"internalurl\"," + EOL + " \"adminURL\" : \"adminurl\"" + EOL + + " }, {" + EOL + " \"region\" : \"region\"," + EOL + " \"publicURL\" : \"publicurl\"," + + EOL + " \"internalURL\" : \"internalurl\"," + EOL + " \"adminURL\" : \"adminurl\"" + EOL + + " } ]," + EOL + " \"endpoints_links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + + EOL + " } ]" + EOL + " } ]," + EOL + " \"user\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"username\" : \"username\"," + EOL + " \"roles\" : [ {" + + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"" + EOL + " }, {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"" + EOL + " } ]," + EOL + + " \"roles_links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " }," + + 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 { @@ -149,18 +88,18 @@ public class AccessTest { public void testMethods() throws Exception { Access access = objectMapper.readValue(JSON_FULL, Access.class); access.toString(); - + List<Service> serviceCatalog = access.getServiceCatalog(); Assert.assertNotNull(serviceCatalog); Assert.assertEquals(2, serviceCatalog.size()); - - Map<String,Object> metadata = access.getMetadata(); + + Map<String, Object> metadata = access.getMetadata(); Assert.assertNotNull(metadata); Assert.assertEquals(2, metadata.size()); - + User user = access.getUser(); Assert.assertNotNull(user); - + Token token = access.getToken(); Assert.assertNotNull(token); } diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/EndpointTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/EndpointTest.java index 5d94b2b..73c2122 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/EndpointTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/EndpointTest.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,15 @@ public class EndpointTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"endpoint\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"region\" : \"region\"," + EOL - + " \"service_id\" : \"serviceid\"," + EOL - + " \"publicurl\" : \"publicurl\"," + EOL - + " \"internalurl\" : \"internalurl\"," + EOL - + " \"adminurl\" : \"adminurl\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"endpoint\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"region\" : \"region\"," + EOL + " \"service_id\" : \"serviceid\"," + EOL + + " \"publicurl\" : \"publicurl\"," + EOL + " \"internalurl\" : \"internalurl\"," + EOL + + " \"adminurl\" : \"adminurl\"" + 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 +57,27 @@ public class EndpointTest { public void testMethods() throws Exception { Endpoint endpoint = objectMapper.readValue(JSON_FULL, Endpoint.class); endpoint.toString(); - + String publicURL = endpoint.getPublicURL(); Assert.assertNotNull(publicURL); endpoint.setPublicURL(publicURL); - + String internalURL = endpoint.getInternalURL(); Assert.assertNotNull(internalURL); endpoint.setInternalURL(internalURL); - + String id = endpoint.getId(); Assert.assertNotNull(id); endpoint.setId(id); - + String region = endpoint.getRegion(); Assert.assertNotNull(region); endpoint.setRegion(region); - + String serviceId = endpoint.getServiceId(); Assert.assertNotNull(serviceId); endpoint.setServiceId(serviceId); - + String adminURL = endpoint.getAdminURL(); Assert.assertNotNull(adminURL); endpoint.setAdminURL(adminURL); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/EndpointsTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/EndpointsTest.java index a20e058..a8f8063 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/EndpointsTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/EndpointsTest.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,29 +34,17 @@ public class EndpointsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"endpoints\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"region\" : \"region\"," + EOL - + " \"service_id\" : \"serviceid\"," + EOL - + " \"publicurl\" : \"publicurl\"," + EOL - + " \"internalurl\" : \"internalurl\"," + EOL - + " \"adminurl\" : \"adminurl\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"region\" : \"region\"," + EOL - + " \"service_id\" : \"serviceid\"," + EOL - + " \"publicurl\" : \"publicurl\"," + EOL - + " \"internalurl\" : \"internalurl\"," + EOL - + " \"adminurl\" : \"adminurl\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"endpoints\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"region\" : \"region\"," + EOL + " \"service_id\" : \"serviceid\"," + EOL + + " \"publicurl\" : \"publicurl\"," + EOL + " \"internalurl\" : \"internalurl\"," + EOL + + " \"adminurl\" : \"adminurl\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"region\" : \"region\"," + EOL + " \"service_id\" : \"serviceid\"," + EOL + + " \"publicurl\" : \"publicurl\"," + EOL + " \"internalurl\" : \"internalurl\"," + EOL + + " \"adminurl\" : \"adminurl\"" + 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 { @@ -74,13 +60,14 @@ public class EndpointsTest { public void testMethods() throws Exception { Endpoints endpoints = objectMapper.readValue(JSON_FULL, Endpoints.class); endpoints.toString(); - + List<Endpoint> list = endpoints.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Endpoint x : endpoints) { + for (@SuppressWarnings("unused") + Endpoint x : endpoints) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/ErrorTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/ErrorTest.java index c9903b9..a5c2aef 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/ErrorTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/ErrorTest.java @@ -24,7 +24,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -34,21 +33,13 @@ public class ErrorTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"error\" : {" + EOL - + " \"code\" : 29," + EOL - + " \"title\" : \"title\"," + EOL - + " \"message\" : \"message\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"error\" : {" + EOL + " \"code\" : 29," + EOL + + " \"title\" : \"title\"," + EOL + " \"message\" : \"message\"" + EOL + " }" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(SerializationFeature.WRAP_ROOT_VALUE) - .enable(DeserializationFeature.UNWRAP_ROOT_VALUE) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(SerializationFeature.WRAP_ROOT_VALUE) + .enable(DeserializationFeature.UNWRAP_ROOT_VALUE).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -64,13 +55,13 @@ public class ErrorTest { public void testMethods() throws Exception { Error error = objectMapper.readValue(JSON_FULL, Error.class); error.toString(); - + Integer code = error.getCode(); Assert.assertNotNull(code); - + String title = error.getTitle(); Assert.assertNotNull(title); - + String message = error.getMessage(); Assert.assertNotNull(message); } diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/LinkTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/LinkTest.java index 493abb4..f568530 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/LinkTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/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/keystone-model/src/test/java/com/woorea/openstack/keystone/model/MetadataTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/MetadataTest.java index c07826b..aad5d77 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/MetadataTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/MetadataTest.java @@ -35,4 +35,4 @@ public class MetadataTest { metadata.setMetadata(null); } -}
\ No newline at end of file +} diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/RoleTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/RoleTest.java index 739767b..6a32304 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/RoleTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/RoleTest.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 RoleTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"role\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : \"enabled\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"role\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"enabled\" : \"enabled\"" + 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,18 +56,18 @@ public class RoleTest { public void testMethods() throws Exception { Role role = objectMapper.readValue(JSON_FULL, Role.class); role.toString(); - + String name = role.getName(); Assert.assertNotNull(name); role.setName(name); - + String description = role.getDescription(); Assert.assertNotNull(description); role.setDescription(description); - + String id = role.getId(); Assert.assertNotNull(id); - + String enabled = role.getEnabled(); Assert.assertNotNull(enabled); role.setEnabled(enabled); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/RolesTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/RolesTest.java index 86f64df..9536a97 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/RolesTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/RolesTest.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 RolesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"roles\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : \"enabled\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : \"enabled\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"roles\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"enabled\" : \"enabled\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"enabled\" : \"enabled\"" + 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 RolesTest { public void testMethods() throws Exception { Roles roles = objectMapper.readValue(JSON_FULL, Roles.class); roles.toString(); - + List<Role> list = roles.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Role x : roles) { + for (@SuppressWarnings("unused") + Role x : roles) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/ServiceTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/ServiceTest.java index fec059e..c285b84 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/ServiceTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/ServiceTest.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 ServiceTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"OS-KSADM:service\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"OS-KSADM:service\" : {" + EOL + " \"id\" : \"id\"," + + EOL + " \"type\" : \"type\"," + 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 { @@ -65,18 +56,18 @@ public class ServiceTest { public void testMethods() throws Exception { Service service = objectMapper.readValue(JSON_FULL, Service.class); service.toString(); - + String name = service.getName(); Assert.assertNotNull(name); service.setName(name); - + String description = service.getDescription(); Assert.assertNotNull(description); service.setDescription(description); - + String id = service.getId(); Assert.assertNotNull(id); - + String type = service.getType(); Assert.assertNotNull(type); service.setType(type); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/ServicesTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/ServicesTest.java index 6c60bcc..84b77fa 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/ServicesTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/ServicesTest.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 ServicesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"OS-KSADM:services\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"OS-KSADM:services\" : [ {" + EOL + " \"id\" : \"id\"," + + EOL + " \"type\" : \"type\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"description\" : \"description\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"type\" : \"type\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"description\" : \"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 { @@ -70,13 +58,14 @@ public class ServicesTest { public void testMethods() throws Exception { Services services = objectMapper.readValue(JSON_FULL, Services.class); services.toString(); - + List<Service> list = services.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Service x : services) { + for (@SuppressWarnings("unused") + Service x : services) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TenantTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TenantTest.java index 6ddc765..a1d1dde 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TenantTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TenantTest.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 TenantTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"tenant\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : false" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"tenant\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"enabled\" : 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 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 TenantTest { public void testMethods() throws Exception { Tenant tenant = objectMapper.readValue(JSON_FULL, Tenant.class); tenant.toString(); - + String name = tenant.getName(); Assert.assertNotNull(name); tenant.setName(name); - + String description = tenant.getDescription(); Assert.assertNotNull(description); tenant.setDescription(description); - + String id = tenant.getId(); Assert.assertNotNull(id); tenant.setId(id); - + Boolean enabled = tenant.getEnabled(); Assert.assertNotNull(enabled); tenant.setEnabled(enabled); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TenantsTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TenantsTest.java index e79394e..246fa75 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TenantsTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TenantsTest.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,34 +34,18 @@ public class TenantsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"tenants\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : false" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : false" + EOL - + " } ]," + EOL - + " \"tenants_links\" : [ {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " }, {" + EOL - + " \"rel\" : \"rel\"," + EOL - + " \"href\" : \"href\"," + EOL - + " \"type\" : \"type\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"tenants\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"description\" : \"description\"," + EOL + " \"enabled\" : false" + EOL + " }, {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"description\" : \"description\"," + EOL + " \"enabled\" : false" + EOL + " } ]," + EOL + + " \"tenants_links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + + EOL + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL + + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + 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 { @@ -79,17 +61,18 @@ public class TenantsTest { public void testMethods() throws Exception { Tenants tenants = objectMapper.readValue(JSON_FULL, Tenants.class); tenants.toString(); - + List<Link> links = tenants.getLinks(); Assert.assertNotNull(links); Assert.assertEquals(2, links.size()); - + List<Tenant> list = tenants.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Tenant x : tenants) { + for (@SuppressWarnings("unused") + Tenant x : tenants) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TokenTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TokenTest.java index f91b97a..06dc2a6 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TokenTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/TokenTest.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,23 +34,14 @@ public class TokenTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"id\" : \"id\"," + EOL - + " \"issued_at\" : 1488024000000," + EOL - + " \"expires\" : 1488628800000," + EOL - + " \"tenant\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : false" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"id\" : \"id\"," + EOL + " \"issued_at\" : 1488024000000," + + EOL + " \"expires\" : 1488628800000," + EOL + " \"tenant\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"enabled\" : 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 { @@ -68,16 +57,16 @@ public class TokenTest { public void testMethods() throws Exception { Token token = objectMapper.readValue(JSON_FULL, Token.class); token.toString(); - + Calendar expires = token.getExpires(); Assert.assertNotNull(expires); - + String id = token.getId(); Assert.assertNotNull(id); - + Calendar issued_at = token.getIssued_at(); Assert.assertNotNull(issued_at); - + Tenant tenant = token.getTenant(); Assert.assertNotNull(tenant); } diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/UserTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/UserTest.java index 0b7b9c1..2b33632 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/UserTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/UserTest.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 UserTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"user\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"username\" : \"username\"," + EOL - + " \"password\" : \"password\"," + EOL - + " \"tenantId\" : \"tenantid\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"email\" : \"email\"," + EOL - + " \"enabled\" : false" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"user\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"username\" : \"username\"," + EOL + " \"password\" : \"password\"," + EOL + + " \"tenantId\" : \"tenantid\"," + EOL + " \"name\" : \"name\"," + EOL + " \"email\" : \"email\"," + + EOL + " \"enabled\" : 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 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,31 +57,31 @@ public class UserTest { public void testMethods() throws Exception { User user = objectMapper.readValue(JSON_FULL, User.class); user.toString(); - + String password = user.getPassword(); Assert.assertNotNull(password); user.setPassword(password); - + String name = user.getName(); Assert.assertNotNull(name); user.setName(name); - + String tenantId = user.getTenantId(); Assert.assertNotNull(tenantId); user.setTenantId(tenantId); - + String id = user.getId(); Assert.assertNotNull(id); user.setId(id); - + String email = user.getEmail(); Assert.assertNotNull(email); user.setEmail(email); - + Boolean enabled = user.getEnabled(); Assert.assertNotNull(enabled); user.setEnabled(enabled); - + String username = user.getUsername(); Assert.assertNotNull(username); user.setUsername(username); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/UsersTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/UsersTest.java index eea318b..c9d09cb 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/UsersTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/UsersTest.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 UsersTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"users\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"username\" : \"username\"," + EOL - + " \"password\" : \"password\"," + EOL - + " \"tenantId\" : \"tenantid\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"email\" : \"email\"," + EOL - + " \"enabled\" : false" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"username\" : \"username\"," + EOL - + " \"password\" : \"password\"," + EOL - + " \"tenantId\" : \"tenantid\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"email\" : \"email\"," + EOL - + " \"enabled\" : false" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"users\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"username\" : \"username\"," + EOL + " \"password\" : \"password\"," + EOL + + " \"tenantId\" : \"tenantid\"," + EOL + " \"name\" : \"name\"," + EOL + " \"email\" : \"email\"," + + EOL + " \"enabled\" : false" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"username\" : \"username\"," + EOL + " \"password\" : \"password\"," + EOL + + " \"tenantId\" : \"tenantid\"," + EOL + " \"name\" : \"name\"," + EOL + " \"email\" : \"email\"," + + EOL + " \"enabled\" : 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 { @@ -76,13 +60,14 @@ public class UsersTest { public void testMethods() throws Exception { Users users = objectMapper.readValue(JSON_FULL, Users.class); users.toString(); - + List<User> list = users.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") User x : users) { + for (@SuppressWarnings("unused") + User x : users) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/AccessKeyTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/AccessKeyTest.java index ffaae7e..f7dcd2d 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/AccessKeyTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/AccessKeyTest.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.keystone.model.authentication.AccessKey.ApiAccessKeyCredentials; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,24 +34,15 @@ public class AccessKeyTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"auth\" : {" + EOL - + " \"tenantId\" : \"tenantid\"," + EOL - + " \"tenantName\" : \"tenantname\"," + EOL - + " \"apiAccessKeyCredentials\" : {" + EOL - + " \"accessKey\" : \"accesskey\"," + EOL - + " \"secretKey\" : \"secretkey\"" + EOL - + " }" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"auth\" : {" + EOL + " \"tenantId\" : \"tenantid\"," + + EOL + " \"tenantName\" : \"tenantname\"," + EOL + " \"apiAccessKeyCredentials\" : {" + EOL + + " \"accessKey\" : \"accesskey\"," + EOL + " \"secretKey\" : \"secretkey\"" + 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 { @@ -68,15 +58,15 @@ public class AccessKeyTest { public void testMethods() throws Exception { AccessKey accesskey = objectMapper.readValue(JSON_FULL, AccessKey.class); accesskey.toString(); - + ApiAccessKeyCredentials apiAccessKeyCredentials = accesskey.getApiAccessKeyCredentials(); Assert.assertNotNull(apiAccessKeyCredentials); accesskey.setApiAccessKeyCredentials(apiAccessKeyCredentials); - + String tenantId = accesskey.getTenantId(); Assert.assertNotNull(tenantId); accesskey.setTenantId(tenantId); - + String tenantName = accesskey.getTenantName(); Assert.assertNotNull(tenantName); accesskey.setTenantName(tenantName); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/ApiAccessKeyCredentialsTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/ApiAccessKeyCredentialsTest.java index 4a0534c..b06eeac 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/ApiAccessKeyCredentialsTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/ApiAccessKeyCredentialsTest.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.keystone.model.authentication.AccessKey.ApiAccessKeyCredentials; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,22 +34,19 @@ public class ApiAccessKeyCredentialsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"accessKey\" : \"accesskey\"," + EOL - + " \"secretKey\" : \"secretkey\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"accessKey\" : \"accesskey\"," + EOL + " \"secretKey\" : \"secretkey\"" + 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 { System.out.println("CLASS: " + ApiAccessKeyCredentials.class.getName()); System.out.println("TEST JSON: " + JSON_FULL); - ApiAccessKeyCredentials apiaccesskeycredentials = objectMapper.readValue(JSON_FULL, ApiAccessKeyCredentials.class); + ApiAccessKeyCredentials apiaccesskeycredentials = + objectMapper.readValue(JSON_FULL, ApiAccessKeyCredentials.class); String json = objectMapper.writeValueAsString(apiaccesskeycredentials); System.out.println("RE-SERIALIZED OBJECT: " + json); JSONAssert.assertEquals(JSON_FULL, json, JSONCompareMode.LENIENT); @@ -58,13 +54,14 @@ public class ApiAccessKeyCredentialsTest { @Test public void testMethods() throws Exception { - ApiAccessKeyCredentials apiaccesskeycredentials = objectMapper.readValue(JSON_FULL, ApiAccessKeyCredentials.class); + ApiAccessKeyCredentials apiaccesskeycredentials = + objectMapper.readValue(JSON_FULL, ApiAccessKeyCredentials.class); apiaccesskeycredentials.toString(); - + String secretKey = apiaccesskeycredentials.getSecretKey(); Assert.assertNotNull(secretKey); apiaccesskeycredentials.setSecretKey(secretKey); - + String accessKey = apiaccesskeycredentials.getAccessKey(); Assert.assertNotNull(accessKey); apiaccesskeycredentials.setAccessKey(accessKey); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/PasswordCredentialsTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/PasswordCredentialsTest.java index 02adcaa..f629150 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/PasswordCredentialsTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/PasswordCredentialsTest.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.keystone.model.authentication.UsernamePassword.PasswordCredentials; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,16 +34,12 @@ public class PasswordCredentialsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"username\" : \"username\"," + EOL - + " \"password\" : \"password\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"username\" : \"username\"," + EOL + " \"password\" : \"password\"" + EOL + "}"; - private ObjectMapper objectMapper = new ObjectMapper() - .setSerializationInclusion(Include.NON_NULL) - .enable(SerializationFeature.INDENT_OUTPUT) - .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); + private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) + .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); @Test public void testSerialization() throws Exception { @@ -60,11 +55,11 @@ public class PasswordCredentialsTest { public void testMethods() throws Exception { PasswordCredentials passwordcredentials = objectMapper.readValue(JSON_FULL, PasswordCredentials.class); passwordcredentials.toString(); - + String password = passwordcredentials.getPassword(); Assert.assertNotNull(password); passwordcredentials.setPassword(password); - + String username = passwordcredentials.getUsername(); Assert.assertNotNull(username); passwordcredentials.setUsername(username); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/TokenTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/TokenTest.java index 5fd13ef..057760a 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/TokenTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/TokenTest.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.keystone.model.authentication.TokenAuthentication.Token; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,15 +34,11 @@ public class TokenTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"id\" : \"id\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"id\" : \"id\"" + 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 TokenTest { public void testMethods() throws Exception { Token token = objectMapper.readValue(JSON_FULL, Token.class); token.toString(); - + String id = token.getId(); Assert.assertNotNull(id); token.setId(id); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/UsernamePasswordTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/UsernamePasswordTest.java index 60d5385..c691484 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/UsernamePasswordTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/model/authentication/UsernamePasswordTest.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.keystone.model.authentication.UsernamePassword.PasswordCredentials; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,24 +34,15 @@ public class UsernamePasswordTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"auth\" : {" + EOL - + " \"tenantId\" : \"tenantid\"," + EOL - + " \"tenantName\" : \"tenantname\"," + EOL - + " \"passwordCredentials\" : {" + EOL - + " \"username\" : \"username\"," + EOL - + " \"password\" : \"password\"" + EOL - + " }" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"auth\" : {" + EOL + " \"tenantId\" : \"tenantid\"," + + EOL + " \"tenantName\" : \"tenantname\"," + EOL + " \"passwordCredentials\" : {" + EOL + + " \"username\" : \"username\"," + EOL + " \"password\" : \"password\"" + 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 { @@ -68,15 +58,15 @@ public class UsernamePasswordTest { public void testMethods() throws Exception { UsernamePassword usernamepassword = objectMapper.readValue(JSON_FULL, UsernamePassword.class); usernamepassword.toString(); - + PasswordCredentials passwordCredentials = usernamepassword.getPasswordCredentials(); Assert.assertNotNull(passwordCredentials); usernamepassword.setPasswordCredentials(passwordCredentials); - + String tenantId = usernamepassword.getTenantId(); Assert.assertNotNull(tenantId); usernamepassword.setTenantId(tenantId); - + String tenantName = usernamepassword.getTenantName(); Assert.assertNotNull(tenantName); usernamepassword.setTenantName(tenantName); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/AuthenticationTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/AuthenticationTest.java index 2779e1b..8fdaf88 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/AuthenticationTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/AuthenticationTest.java @@ -26,7 +26,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.keystone.v3.model.Authentication.Identity; import com.woorea.openstack.keystone.v3.model.Authentication.Scope; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,45 +35,21 @@ public class AuthenticationTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"auth\" : {" + EOL - + " \"identity\" : {" + EOL - + " \"methods\" : [ \"methods-v1\", \"methods-v2\" ]," + EOL - + " \"password\" : {" + EOL - + " \"user\" : {" + EOL - + " \"domain\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + " }," + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"password\" : \"password\"" + EOL - + " }" + EOL - + " }," + EOL - + " \"token\" : {" + EOL - + " \"id\" : \"id\"" + EOL - + " }" + EOL - + " }," + EOL - + " \"scope\" : {" + EOL - + " \"project\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"domain\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + " }," + EOL - + " \"name\" : \"name\"" + EOL - + " }" + EOL - + " }" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"auth\" : {" + EOL + " \"identity\" : {" + EOL + + " \"methods\" : [ \"methods-v1\", \"methods-v2\" ]," + EOL + " \"password\" : {" + EOL + + " \"user\" : {" + EOL + " \"domain\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"" + EOL + " }," + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"password\" : \"password\"" + EOL + " }" + EOL + + " }," + EOL + " \"token\" : {" + EOL + " \"id\" : \"id\"" + EOL + " }" + EOL + + " }," + EOL + " \"scope\" : {" + EOL + " \"project\" : {" + EOL + " \"id\" : \"id\"," + + EOL + " \"domain\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"" + EOL + " }," + EOL + " \"name\" : \"name\"" + EOL + + " }" + 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 { @@ -90,11 +65,11 @@ public class AuthenticationTest { public void testMethods() throws Exception { Authentication authentication = objectMapper.readValue(JSON_FULL, Authentication.class); authentication.toString(); - + Identity identity = authentication.getIdentity(); Assert.assertNotNull(identity); authentication.setIdentity(identity); - + Scope scope = authentication.getScope(); Assert.assertNotNull(scope); authentication.setScope(scope); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/CredentialTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/CredentialTest.java index aaa2725..55f4774 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/CredentialTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/CredentialTest.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,26 +34,15 @@ public class CredentialTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"credential\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"projectId\" : \"projectid\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"userId\" : \"userid\"," + EOL - + " \"blob\" : {" + EOL - + " \"blob-k1\" : \"blob-v1\"," + EOL - + " \"blob-k2\" : \"blob-v2\"" + EOL - + " }" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"credential\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"projectId\" : \"projectid\"," + EOL + " \"type\" : \"type\"," + EOL + + " \"userId\" : \"userid\"," + EOL + " \"blob\" : {" + EOL + " \"blob-k1\" : \"blob-v1\"," + EOL + + " \"blob-k2\" : \"blob-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 { @@ -71,24 +58,24 @@ public class CredentialTest { public void testMethods() throws Exception { Credential credential = objectMapper.readValue(JSON_FULL, Credential.class); credential.toString(); - - Map<String,String> blob = credential.getBlob(); + + Map<String, String> blob = credential.getBlob(); Assert.assertNotNull(blob); Assert.assertEquals(2, blob.size()); credential.setBlob(blob); - + String id = credential.getId(); Assert.assertNotNull(id); credential.setId(id); - + String type = credential.getType(); Assert.assertNotNull(type); credential.setType(type); - + String userId = credential.getUserId(); Assert.assertNotNull(userId); credential.setUserId(userId); - + String projectId = credential.getProjectId(); Assert.assertNotNull(projectId); credential.setProjectId(projectId); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/CredentialsTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/CredentialsTest.java index a2e2e52..5aca3fc 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/CredentialsTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/CredentialsTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,33 +34,17 @@ public class CredentialsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"credentials\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"projectId\" : \"projectid\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"userId\" : \"userid\"," + EOL - + " \"blob\" : {" + EOL - + " \"blob-k1\" : \"blob-v1\"," + EOL - + " \"blob-k2\" : \"blob-v2\"" + EOL - + " }" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"projectId\" : \"projectid\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"userId\" : \"userid\"," + EOL - + " \"blob\" : {" + EOL - + " \"blob-k1\" : \"blob-v1\"," + EOL - + " \"blob-k2\" : \"blob-v2\"" + EOL - + " }" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"credentials\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"projectId\" : \"projectid\"," + EOL + " \"type\" : \"type\"," + EOL + + " \"userId\" : \"userid\"," + EOL + " \"blob\" : {" + EOL + " \"blob-k1\" : \"blob-v1\"," + EOL + + " \"blob-k2\" : \"blob-v2\"" + EOL + " }" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"projectId\" : \"projectid\"," + EOL + " \"type\" : \"type\"," + EOL + + " \"userId\" : \"userid\"," + EOL + " \"blob\" : {" + EOL + " \"blob-k1\" : \"blob-v1\"," + EOL + + " \"blob-k2\" : \"blob-v2\"" + 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 { @@ -78,13 +60,14 @@ public class CredentialsTest { public void testMethods() throws Exception { Credentials credentials = objectMapper.readValue(JSON_FULL, Credentials.class); credentials.toString(); - + List<Credential> list = credentials.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Credential x : credentials) { + for (@SuppressWarnings("unused") + Credential x : credentials) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/DomainTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/DomainTest.java index f2ea79a..895d2b0 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/DomainTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/DomainTest.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.keystone.v3.model.Token.Domain; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,16 +34,12 @@ public class DomainTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"id\" : \"id\"," + 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 static final String JSON_FULL = + "{" + EOL + " \"id\" : \"id\"," + 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); @Test public void testSerialization() throws Exception { @@ -60,11 +55,11 @@ public class DomainTest { public void testMethods() throws Exception { Domain domain = objectMapper.readValue(JSON_FULL, Domain.class); domain.toString(); - + String name = domain.getName(); Assert.assertNotNull(name); domain.setName(name); - + String id = domain.getId(); Assert.assertNotNull(id); domain.setId(id); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/DomainsTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/DomainsTest.java index e517ff7..0fabf5e 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/DomainsTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/DomainsTest.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 DomainsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"domains\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : false" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : false" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"domains\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"enabled\" : false" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"enabled\" : 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 { @@ -70,13 +58,14 @@ public class DomainsTest { public void testMethods() throws Exception { Domains domains = objectMapper.readValue(JSON_FULL, Domains.class); domains.toString(); - + List<Domain> list = domains.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Domain x : domains) { + for (@SuppressWarnings("unused") + Domain x : domains) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/EndpointTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/EndpointTest.java index 91807cf..0381510 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/EndpointTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/EndpointTest.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.keystone.v3.model.Token.Service.Endpoint; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -35,20 +34,13 @@ public class EndpointTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"id\" : \"id\"," + EOL - + " \"url\" : \"url\"," + EOL - + " \"region\" : \"region\"," + EOL - + " \"enabled\" : false," + EOL - + " \"interface\" : \"interface\"," + EOL - + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"id\" : \"id\"," + EOL + " \"url\" : \"url\"," + EOL + + " \"region\" : \"region\"," + EOL + " \"enabled\" : false," + EOL + " \"interface\" : \"interface\"," + + EOL + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + 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,27 +56,27 @@ public class EndpointTest { public void testMethods() throws Exception { Endpoint endpoint = objectMapper.readValue(JSON_FULL, Endpoint.class); endpoint.toString(); - + String legacyEndpointId = endpoint.getLegacyEndpointId(); Assert.assertNotNull(legacyEndpointId); endpoint.setLegacyEndpointId(legacyEndpointId); - + String id = endpoint.getId(); Assert.assertNotNull(id); endpoint.setId(id); - + String region = endpoint.getRegion(); Assert.assertNotNull(region); endpoint.setRegion(region); - + String interfaceProperty = endpoint.getInterface(); Assert.assertNotNull(interfaceProperty); endpoint.setInterface(interfaceProperty); - + String url = endpoint.getUrl(); Assert.assertNotNull(url); endpoint.setUrl(url); - + Boolean enabled = endpoint.getEnabled(); Assert.assertNotNull(enabled); endpoint.setEnabled(enabled); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/EndpointsTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/EndpointsTest.java index ef75d1b..df22f86 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/EndpointsTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/EndpointsTest.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 EndpointsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"endpoints\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"interface\" : \"interface\"," + EOL - + " \"service_id\" : \"serviceid\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"interface\" : \"interface\"," + EOL - + " \"service_id\" : \"serviceid\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"endpoints\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"interface\" : \"interface\"," + EOL + + " \"service_id\" : \"serviceid\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"interface\" : \"interface\"," + EOL + + " \"service_id\" : \"serviceid\"" + 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 EndpointsTest { public void testMethods() throws Exception { Endpoints endpoints = objectMapper.readValue(JSON_FULL, Endpoints.class); endpoints.toString(); - + List<Endpoint> list = endpoints.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Endpoint x : endpoints) { + for (@SuppressWarnings("unused") + Endpoint x : endpoints) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/GroupTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/GroupTest.java index f9ee0a4..4f553f1 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/GroupTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/GroupTest.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 GroupTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"group\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"domain_id\" : \"domainid\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"group\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"domain_id\" : \"domainid\"" + 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 GroupTest { public void testMethods() throws Exception { Group group = objectMapper.readValue(JSON_FULL, Group.class); group.toString(); - + String name = group.getName(); Assert.assertNotNull(name); group.setName(name); - + String description = group.getDescription(); Assert.assertNotNull(description); group.setDescription(description); - + String id = group.getId(); Assert.assertNotNull(id); group.setId(id); - + String domainId = group.getDomainId(); Assert.assertNotNull(domainId); group.setDomainId(domainId); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/GroupsTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/GroupsTest.java index eea955d..5d1a9a2 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/GroupsTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/GroupsTest.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 GroupsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"groups\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"domain_id\" : \"domainid\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"domain_id\" : \"domainid\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"groups\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"domain_id\" : \"domainid\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"domain_id\" : \"domainid\"" + 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 GroupsTest { public void testMethods() throws Exception { Groups groups = objectMapper.readValue(JSON_FULL, Groups.class); groups.toString(); - + List<Group> list = groups.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Group x : groups) { + for (@SuppressWarnings("unused") + Group x : groups) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/IdentityTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/IdentityTest.java index 799708f..0726544 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/IdentityTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/IdentityTest.java @@ -27,9 +27,7 @@ import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.keystone.v3.model.Authentication.Identity; import com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password; import com.woorea.openstack.keystone.v3.model.Authentication.Identity.Token; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -39,29 +37,16 @@ public class IdentityTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"methods\" : [ \"methods-v1\", \"methods-v2\" ]," + EOL - + " \"password\" : {" + EOL - + " \"user\" : {" + EOL - + " \"domain\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + " }," + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"password\" : \"password\"" + EOL - + " }" + EOL - + " }," + EOL - + " \"token\" : {" + EOL - + " \"id\" : \"id\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"methods\" : [ \"methods-v1\", \"methods-v2\" ]," + EOL + " \"password\" : {" + EOL + + " \"user\" : {" + EOL + " \"domain\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"" + EOL + " }," + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"password\" : \"password\"" + EOL + " }" + EOL + + " }," + EOL + " \"token\" : {" + EOL + " \"id\" : \"id\"" + 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 { @@ -77,16 +62,16 @@ public class IdentityTest { public void testMethods() throws Exception { Identity identity = objectMapper.readValue(JSON_FULL, Identity.class); identity.toString(); - + Password password = identity.getPassword(); Assert.assertNotNull(password); identity.setPassword(password); - + List<String> methods = identity.getMethods(); Assert.assertNotNull(methods); Assert.assertEquals(2, methods.size()); identity.setMethods(methods); - + Token token = identity.getToken(); Assert.assertNotNull(token); identity.setToken(token); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/PasswordTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/PasswordTest.java index 4b2cd04..46ca89a 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/PasswordTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/PasswordTest.java @@ -26,7 +26,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password; import com.woorea.openstack.keystone.v3.model.Authentication.Identity.Password.User; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,23 +35,14 @@ public class PasswordTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"user\" : {" + EOL - + " \"domain\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + " }," + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"password\" : \"password\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"user\" : {" + EOL + " \"domain\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"" + EOL + " }," + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"password\" : \"password\"" + 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 { @@ -68,7 +58,7 @@ public class PasswordTest { public void testMethods() throws Exception { Password password = objectMapper.readValue(JSON_FULL, Password.class); password.toString(); - + User user = password.getUser(); Assert.assertNotNull(user); password.setUser(user); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/PoliciesTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/PoliciesTest.java index 3a8dc83..8d3096b 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/PoliciesTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/PoliciesTest.java @@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,33 +34,17 @@ public class PoliciesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"policies\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"projectId\" : \"projectid\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"userId\" : \"userid\"," + EOL - + " \"blob\" : {" + EOL - + " \"blob-k1\" : \"blob-v1\"," + EOL - + " \"blob-k2\" : \"blob-v2\"" + EOL - + " }" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"projectId\" : \"projectid\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"userId\" : \"userid\"," + EOL - + " \"blob\" : {" + EOL - + " \"blob-k1\" : \"blob-v1\"," + EOL - + " \"blob-k2\" : \"blob-v2\"" + EOL - + " }" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"policies\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"projectId\" : \"projectid\"," + EOL + " \"type\" : \"type\"," + EOL + + " \"userId\" : \"userid\"," + EOL + " \"blob\" : {" + EOL + " \"blob-k1\" : \"blob-v1\"," + EOL + + " \"blob-k2\" : \"blob-v2\"" + EOL + " }" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"projectId\" : \"projectid\"," + EOL + " \"type\" : \"type\"," + EOL + + " \"userId\" : \"userid\"," + EOL + " \"blob\" : {" + EOL + " \"blob-k1\" : \"blob-v1\"," + EOL + + " \"blob-k2\" : \"blob-v2\"" + 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 { @@ -78,13 +60,14 @@ public class PoliciesTest { public void testMethods() throws Exception { Policies policies = objectMapper.readValue(JSON_FULL, Policies.class); policies.toString(); - + List<Policy> list = policies.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Policy x : policies) { + for (@SuppressWarnings("unused") + Policy x : policies) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/PolicyTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/PolicyTest.java index c4f7a73..50f7d8e 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/PolicyTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/PolicyTest.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,26 +34,15 @@ public class PolicyTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"policy\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"projectId\" : \"projectid\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"userId\" : \"userid\"," + EOL - + " \"blob\" : {" + EOL - + " \"blob-k1\" : \"blob-v1\"," + EOL - + " \"blob-k2\" : \"blob-v2\"" + EOL - + " }" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"policy\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"projectId\" : \"projectid\"," + EOL + " \"type\" : \"type\"," + EOL + + " \"userId\" : \"userid\"," + EOL + " \"blob\" : {" + EOL + " \"blob-k1\" : \"blob-v1\"," + EOL + + " \"blob-k2\" : \"blob-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 { @@ -71,24 +58,24 @@ public class PolicyTest { public void testMethods() throws Exception { Policy policy = objectMapper.readValue(JSON_FULL, Policy.class); policy.toString(); - - Map<String,String> blob = policy.getBlob(); + + Map<String, String> blob = policy.getBlob(); Assert.assertNotNull(blob); Assert.assertEquals(2, blob.size()); policy.setBlob(blob); - + String id = policy.getId(); Assert.assertNotNull(id); policy.setId(id); - + String type = policy.getType(); Assert.assertNotNull(type); policy.setType(type); - + String userId = policy.getUserId(); Assert.assertNotNull(userId); policy.setUserId(userId); - + String projectId = policy.getProjectId(); Assert.assertNotNull(projectId); policy.setProjectId(projectId); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ProjectTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ProjectTest.java index 5526ad1..c040dd0 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ProjectTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ProjectTest.java @@ -26,7 +26,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.keystone.v3.model.Token.Domain; import com.woorea.openstack.keystone.v3.model.Token.Project; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,20 +35,13 @@ public class ProjectTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"domain\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + " }," + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"domain\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"" + EOL + + " }," + EOL + " \"id\" : \"id\"," + 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 { @@ -65,15 +57,15 @@ public class ProjectTest { public void testMethods() throws Exception { Project project = objectMapper.readValue(JSON_FULL, Project.class); project.toString(); - + Domain domain = project.getDomain(); Assert.assertNotNull(domain); project.setDomain(domain); - + String name = project.getName(); Assert.assertNotNull(name); project.setName(name); - + String id = project.getId(); Assert.assertNotNull(id); project.setId(id); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ProjectsTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ProjectsTest.java index 3582a4a..f6a267e 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ProjectsTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ProjectsTest.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,14 @@ public class ProjectsTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"projects\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"enabled\" : false," + EOL - + " \"domain_id\" : \"domainid\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"enabled\" : false," + EOL - + " \"domain_id\" : \"domainid\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"projects\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"enabled\" : false," + EOL + " \"domain_id\" : \"domainid\"" + + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"enabled\" : false," + EOL + " \"domain_id\" : \"domainid\"" + 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 +57,14 @@ public class ProjectsTest { public void testMethods() throws Exception { Projects projects = objectMapper.readValue(JSON_FULL, Projects.class); projects.toString(); - + List<Project> list = projects.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Project x : projects) { + for (@SuppressWarnings("unused") + Project x : projects) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/RoleTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/RoleTest.java index ad39df2..5d4086f 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/RoleTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/RoleTest.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.keystone.v3.model.Token.Role; - import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import org.skyscreamer.jsonassert.JSONCompareMode; @@ -34,11 +33,9 @@ public class RoleTest { private static final String JSON_FULL = "{ }"; - 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/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/RolesTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/RolesTest.java index cd8fbde..a2d8cee 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/RolesTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/RolesTest.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 RolesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"roles\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : \"enabled\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : \"enabled\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"roles\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"enabled\" : \"enabled\"" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"," + EOL + + " \"enabled\" : \"enabled\"" + 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 RolesTest { public void testMethods() throws Exception { Roles roles = objectMapper.readValue(JSON_FULL, Roles.class); roles.toString(); - + List<Role> list = roles.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Role x : roles) { + for (@SuppressWarnings("unused") + Role x : roles) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ScopeTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ScopeTest.java index 6beedb5..e84180a 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ScopeTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ScopeTest.java @@ -26,7 +26,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.keystone.v3.model.Authentication.Scope; import com.woorea.openstack.keystone.v3.model.Authentication.Scope.Project; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -36,22 +35,13 @@ public class ScopeTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"project\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"domain\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + " }," + EOL - + " \"name\" : \"name\"" + EOL - + " }" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"project\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"domain\" : {" + EOL + " \"id\" : \"id\"," + 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 { @@ -67,7 +57,7 @@ public class ScopeTest { public void testMethods() throws Exception { Scope scope = objectMapper.readValue(JSON_FULL, Scope.class); scope.toString(); - + Project project = scope.getProject(); Assert.assertNotNull(project); scope.setProject(project); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ServiceTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ServiceTest.java index 5edf7d6..1c48c88 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ServiceTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ServiceTest.java @@ -26,9 +26,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.woorea.openstack.keystone.v3.model.Token.Service; import com.woorea.openstack.keystone.v3.model.Token.Service.Endpoint; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -38,31 +36,18 @@ public class ServiceTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"id\" : \"id\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"endpoints\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"url\" : \"url\"," + EOL - + " \"region\" : \"region\"," + EOL - + " \"enabled\" : false," + EOL - + " \"interface\" : \"interface\"," + EOL - + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"url\" : \"url\"," + EOL - + " \"region\" : \"region\"," + EOL - + " \"enabled\" : false," + EOL - + " \"interface\" : \"interface\"," + EOL - + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"id\" : \"id\"," + EOL + " \"type\" : \"type\"," + EOL + " \"endpoints\" : [ {" + EOL + + " \"id\" : \"id\"," + EOL + " \"url\" : \"url\"," + EOL + " \"region\" : \"region\"," + + EOL + " \"enabled\" : false," + EOL + " \"interface\" : \"interface\"," + EOL + + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL + " }, {" + EOL + + " \"id\" : \"id\"," + EOL + " \"url\" : \"url\"," + EOL + " \"region\" : \"region\"," + + EOL + " \"enabled\" : false," + EOL + " \"interface\" : \"interface\"," + EOL + + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + 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,16 +63,16 @@ public class ServiceTest { public void testMethods() throws Exception { Service service = objectMapper.readValue(JSON_FULL, Service.class); service.toString(); - + List<Endpoint> endpoints = service.getEndpoints(); Assert.assertNotNull(endpoints); Assert.assertEquals(2, endpoints.size()); service.setEndpoints(endpoints); - + String id = service.getId(); Assert.assertNotNull(id); service.setId(id); - + String type = service.getType(); Assert.assertNotNull(type); service.setType(type); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ServicesTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ServicesTest.java index 0a88d6a..1f24494 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ServicesTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/ServicesTest.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.keystone.model.Service; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,25 +35,15 @@ public class ServicesTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"services\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"description\" : \"description\"" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = + "{" + EOL + " \"services\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + " \"type\" : \"type\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"description\" : \"description\"" + EOL + " }, {" + EOL + + " \"id\" : \"id\"," + EOL + " \"type\" : \"type\"," + EOL + " \"name\" : \"name\"," + EOL + + " \"description\" : \"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 { @@ -71,13 +59,14 @@ public class ServicesTest { public void testMethods() throws Exception { Services services = objectMapper.readValue(JSON_FULL, Services.class); services.toString(); - + List<Service> list = services.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") Service x : services) { + for (@SuppressWarnings("unused") + Service x : services) { ++cnt; } Assert.assertEquals(2, cnt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/TokenTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/TokenTest.java index 4852e61..2677941 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/TokenTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/TokenTest.java @@ -29,10 +29,8 @@ import com.woorea.openstack.keystone.v3.model.Token.Project; import com.woorea.openstack.keystone.v3.model.Token.Role; import com.woorea.openstack.keystone.v3.model.Token.Service; import com.woorea.openstack.keystone.v3.model.Token.User; - import java.util.Calendar; import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -42,76 +40,34 @@ public class TokenTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"token\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"methods\" : [ \"methods-v1\", \"methods-v2\" ]," + EOL - + " \"domain\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + " }," + EOL - + " \"project\" : {" + EOL - + " \"domain\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + " }," + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + " }," + EOL - + " \"user\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"" + EOL - + " }," + EOL - + " \"roles\" : [ { }, { } ]," + EOL - + " \"catalog\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"endpoints\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"url\" : \"url\"," + EOL - + " \"region\" : \"region\"," + EOL - + " \"enabled\" : false," + EOL - + " \"interface\" : \"interface\"," + EOL - + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"url\" : \"url\"," + EOL - + " \"region\" : \"region\"," + EOL - + " \"enabled\" : false," + EOL - + " \"interface\" : \"interface\"," + EOL - + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL - + " } ]" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"type\" : \"type\"," + EOL - + " \"endpoints\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"url\" : \"url\"," + EOL - + " \"region\" : \"region\"," + EOL - + " \"enabled\" : false," + EOL - + " \"interface\" : \"interface\"," + EOL - + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"url\" : \"url\"," + EOL - + " \"region\" : \"region\"," + EOL - + " \"enabled\" : false," + EOL - + " \"interface\" : \"interface\"," + EOL - + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + EOL - + " } ]" + EOL - + " } ]," + EOL - + " \"expires_at\" : 1489752000000," + EOL - + " \"issued_at\" : 1488456000000" + 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 + " \"token\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"methods\" : [ \"methods-v1\", \"methods-v2\" ]," + EOL + " \"domain\" : {" + EOL + + " \"id\" : \"id\"," + EOL + " \"name\" : \"name\"" + EOL + " }," + EOL + + " \"project\" : {" + EOL + " \"domain\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"" + EOL + " }," + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"" + EOL + " }," + EOL + " \"user\" : {" + EOL + " \"id\" : \"id\"," + + EOL + " \"name\" : \"name\"" + EOL + " }," + EOL + " \"roles\" : [ { }, { } ]," + EOL + + " \"catalog\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + " \"type\" : \"type\"," + EOL + + " \"endpoints\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + " \"url\" : \"url\"," + EOL + + " \"region\" : \"region\"," + EOL + " \"enabled\" : false," + EOL + + " \"interface\" : \"interface\"," + EOL + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + " \"url\" : \"url\"," + EOL + + " \"region\" : \"region\"," + EOL + " \"enabled\" : false," + EOL + + " \"interface\" : \"interface\"," + EOL + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + + EOL + " } ]" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + " \"type\" : \"type\"," + + EOL + " \"endpoints\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + " \"url\" : \"url\"," + + EOL + " \"region\" : \"region\"," + EOL + " \"enabled\" : false," + EOL + + " \"interface\" : \"interface\"," + EOL + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + " \"url\" : \"url\"," + EOL + + " \"region\" : \"region\"," + EOL + " \"enabled\" : false," + EOL + + " \"interface\" : \"interface\"," + EOL + " \"legacy_endpoint_id\" : \"legacyendpointid\"" + + EOL + " } ]" + EOL + " } ]," + EOL + " \"expires_at\" : 1489752000000," + EOL + + " \"issued_at\" : 1488456000000" + 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 { @@ -127,42 +83,42 @@ public class TokenTest { public void testMethods() throws Exception { Token token = objectMapper.readValue(JSON_FULL, Token.class); token.toString(); - + List<String> methods = token.getMethods(); Assert.assertNotNull(methods); Assert.assertEquals(2, methods.size()); token.setMethods(methods); - + List<Service> catalog = token.getCatalog(); Assert.assertNotNull(catalog); Assert.assertEquals(2, catalog.size()); token.setCatalog(catalog); - + Domain domain = token.getDomain(); Assert.assertNotNull(domain); token.setDomain(domain); - + List<Role> roles = token.getRoles(); Assert.assertNotNull(roles); Assert.assertEquals(2, roles.size()); token.setRoles(roles); - + Project project = token.getProject(); Assert.assertNotNull(project); token.setProject(project); - + Calendar issuedAt = token.getIssuedAt(); Assert.assertNotNull(issuedAt); token.setIssuedAt(issuedAt); - + String id = token.getId(); Assert.assertNotNull(id); token.setId(id); - + User user = token.getUser(); Assert.assertNotNull(user); token.setUser(user); - + Calendar expiresAt = token.getExpiresAt(); Assert.assertNotNull(expiresAt); token.setExpiresAt(expiresAt); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/UserTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/UserTest.java index dc144ed..c751b7d 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/UserTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/UserTest.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,16 @@ public class UserTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"user\" : {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"password\" : \"password\"," + EOL - + " \"email\" : \"email\"," + EOL - + " \"description\" : \"description\"," + EOL - + " \"enabled\" : false," + EOL - + " \"domain_id\" : \"domainid\"," + EOL - + " \"default_project_id\" : \"defaultprojectid\"" + 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 + " \"user\" : {" + EOL + " \"id\" : \"id\"," + EOL + + " \"name\" : \"name\"," + EOL + " \"password\" : \"password\"," + EOL + " \"email\" : \"email\"," + + EOL + " \"description\" : \"description\"," + EOL + " \"enabled\" : false," + EOL + + " \"domain_id\" : \"domainid\"," + EOL + " \"default_project_id\" : \"defaultprojectid\"" + 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 +58,35 @@ public class UserTest { public void testMethods() throws Exception { User user = objectMapper.readValue(JSON_FULL, User.class); user.toString(); - + String password = user.getPassword(); Assert.assertNotNull(password); user.setPassword(password); - + String name = user.getName(); Assert.assertNotNull(name); user.setName(name); - + String description = user.getDescription(); Assert.assertNotNull(description); user.setDescription(description); - + String id = user.getId(); Assert.assertNotNull(id); user.setId(id); - + String email = user.getEmail(); Assert.assertNotNull(email); user.setEmail(email); - + String domainId = user.getDomainId(); Assert.assertNotNull(domainId); user.setDomainId(domainId); - + Boolean enabled = user.getEnabled(); Assert.assertNotNull(enabled); user.setEnabled(enabled); - + String defaultProjectId = user.getDefaultProjectId(); Assert.assertNotNull(defaultProjectId); user.setDefaultProjectId(defaultProjectId); diff --git a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/UsersTest.java b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/UsersTest.java index ab6c557..ceb7df1 100644 --- a/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/UsersTest.java +++ b/keystone-model/src/test/java/com/woorea/openstack/keystone/v3/model/UsersTest.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.keystone.model.User; - import java.util.List; - import org.junit.Assert; import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; @@ -37,31 +35,17 @@ public class UsersTest { private static final String EOL = System.lineSeparator(); - private static final String JSON_FULL = "{" + EOL - + " \"users\" : [ {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"username\" : \"username\"," + EOL - + " \"password\" : \"password\"," + EOL - + " \"tenantId\" : \"tenantid\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"email\" : \"email\"," + EOL - + " \"enabled\" : false" + EOL - + " }, {" + EOL - + " \"id\" : \"id\"," + EOL - + " \"username\" : \"username\"," + EOL - + " \"password\" : \"password\"," + EOL - + " \"tenantId\" : \"tenantid\"," + EOL - + " \"name\" : \"name\"," + EOL - + " \"email\" : \"email\"," + EOL - + " \"enabled\" : false" + EOL - + " } ]" + EOL - + "}"; + private static final String JSON_FULL = "{" + EOL + " \"users\" : [ {" + EOL + " \"id\" : \"id\"," + EOL + + " \"username\" : \"username\"," + EOL + " \"password\" : \"password\"," + EOL + + " \"tenantId\" : \"tenantid\"," + EOL + " \"name\" : \"name\"," + EOL + " \"email\" : \"email\"," + + EOL + " \"enabled\" : false" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL + + " \"username\" : \"username\"," + EOL + " \"password\" : \"password\"," + EOL + + " \"tenantId\" : \"tenantid\"," + EOL + " \"name\" : \"name\"," + EOL + " \"email\" : \"email\"," + + EOL + " \"enabled\" : 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 { @@ -77,13 +61,14 @@ public class UsersTest { public void testMethods() throws Exception { Users users = objectMapper.readValue(JSON_FULL, Users.class); users.toString(); - + List<User> list = users.getList(); Assert.assertNotNull(list); Assert.assertEquals(2, list.size()); - + int cnt = 0; - for (@SuppressWarnings("unused") User x : users) { + for (@SuppressWarnings("unused") + User x : users) { ++cnt; } Assert.assertEquals(2, cnt); |