diff options
Diffstat (limited to 'keystone-model/src/test')
43 files changed, 540 insertions, 1080 deletions
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); |