summaryrefslogtreecommitdiffstats
path: root/nova-model/src/test/java/com/woorea/openstack/nova/model/ImagesTest.java
diff options
context:
space:
mode:
authorSmokowski, Steve (ss835w) <ss835w@us.att.com>2019-05-02 09:42:55 -0400
committerSmokowski, Steve (ss835w) <ss835w@us.att.com>2019-05-07 10:02:17 -0400
commit3f9a0c3183480d150089c0d5a6e507c877f7d121 (patch)
treeb3db04cbe2cef23f81503177a50edc5360ffa486 /nova-model/src/test/java/com/woorea/openstack/nova/model/ImagesTest.java
parente153f0adfbed711ce1e215748594a4d04fd1edaf (diff)
Enhance Openstack Client
Update Openstack Client to support additional fields Updat all formatting issues Issue-ID: SO-1844 Change-Id: I1369e0c18cc25274db8df7e12855a020b8da38da Signed-off-by: Smokowski, Steve (ss835w) <ss835w@us.att.com>
Diffstat (limited to 'nova-model/src/test/java/com/woorea/openstack/nova/model/ImagesTest.java')
-rw-r--r--nova-model/src/test/java/com/woorea/openstack/nova/model/ImagesTest.java115
1 files changed, 32 insertions, 83 deletions
diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ImagesTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ImagesTest.java
index 2b52804..c54e22e 100644
--- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ImagesTest.java
+++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ImagesTest.java
@@ -24,9 +24,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-
import java.util.List;
-
import org.junit.Assert;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
@@ -36,85 +34,35 @@ public class ImagesTest {
private static final String EOL = System.lineSeparator();
- private static final String JSON_FULL = "{" + EOL
- + " \"images\" : [ {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"status\" : \"status\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"progress\" : 3," + EOL
- + " \"minRam\" : 62," + EOL
- + " \"minDisk\" : 69," + EOL
- + " \"created\" : 1485172800000," + EOL
- + " \"updated\" : 1486468800000," + EOL
- + " \"metadata\" : {" + EOL
- + " \"metadata-k1\" : \"metadata-v1\"," + EOL
- + " \"metadata-k2\" : \"metadata-v2\"" + EOL
- + " }," + EOL
- + " \"server\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]" + EOL
- + " }," + EOL
- + " \"links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]," + EOL
- + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL
- + " }, {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"status\" : \"status\"," + EOL
- + " \"name\" : \"name\"," + EOL
- + " \"progress\" : 3," + EOL
- + " \"minRam\" : 62," + EOL
- + " \"minDisk\" : 69," + EOL
- + " \"created\" : 1485172800000," + EOL
- + " \"updated\" : 1486468800000," + EOL
- + " \"metadata\" : {" + EOL
- + " \"metadata-k1\" : \"metadata-v1\"," + EOL
- + " \"metadata-k2\" : \"metadata-v2\"" + EOL
- + " }," + EOL
- + " \"server\" : {" + EOL
- + " \"id\" : \"id\"," + EOL
- + " \"links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]" + EOL
- + " }," + EOL
- + " \"links\" : [ {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " }, {" + EOL
- + " \"rel\" : \"rel\"," + EOL
- + " \"href\" : \"href\"," + EOL
- + " \"type\" : \"type\"" + EOL
- + " } ]," + EOL
- + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL
- + " } ]" + EOL
- + "}";
+ private static final String JSON_FULL = "{" + EOL + " \"images\" : [ {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"status\" : \"status\"," + EOL + " \"name\" : \"name\"," + EOL + " \"progress\" : 3," + EOL
+ + " \"minRam\" : 62," + EOL + " \"minDisk\" : 69," + EOL + " \"created\" : 1485172800000," + EOL
+ + " \"updated\" : 1486468800000," + EOL + " \"metadata\" : {" + EOL
+ + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL
+ + " }," + EOL + " \"server\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"links\" : [ {"
+ + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL
+ + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " },"
+ + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL
+ + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL
+ + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL + " }, {" + EOL + " \"id\" : \"id\"," + EOL
+ + " \"status\" : \"status\"," + EOL + " \"name\" : \"name\"," + EOL + " \"progress\" : 3," + EOL
+ + " \"minRam\" : 62," + EOL + " \"minDisk\" : 69," + EOL + " \"created\" : 1485172800000," + EOL
+ + " \"updated\" : 1486468800000," + EOL + " \"metadata\" : {" + EOL
+ + " \"metadata-k1\" : \"metadata-v1\"," + EOL + " \"metadata-k2\" : \"metadata-v2\"" + EOL
+ + " }," + EOL + " \"server\" : {" + EOL + " \"id\" : \"id\"," + EOL + " \"links\" : [ {"
+ + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL
+ + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]" + EOL + " },"
+ + EOL + " \"links\" : [ {" + EOL + " \"rel\" : \"rel\"," + EOL + " \"href\" : \"href\"," + EOL
+ + " \"type\" : \"type\"" + EOL + " }, {" + EOL + " \"rel\" : \"rel\"," + EOL
+ + " \"href\" : \"href\"," + EOL + " \"type\" : \"type\"" + EOL + " } ]," + EOL
+ + " \"OS-EXT-IMG-SIZE:size\" : 43" + EOL + " } ]" + EOL + "}";
- private ObjectMapper objectMapper = new ObjectMapper()
- .setSerializationInclusion(Include.NON_NULL)
- .enable(SerializationFeature.INDENT_OUTPUT)
- .enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
- .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL)
+ .enable(SerializationFeature.INDENT_OUTPUT).enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+ .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
@Test
public void testSerialization() throws Exception {
@@ -130,13 +78,14 @@ public class ImagesTest {
public void testMethods() throws Exception {
Images images = objectMapper.readValue(JSON_FULL, Images.class);
images.toString();
-
+
List<Image> list = images.getList();
Assert.assertNotNull(list);
Assert.assertEquals(2, list.size());
-
+
int cnt = 0;
- for (@SuppressWarnings("unused") Image x : images) {
+ for (@SuppressWarnings("unused")
+ Image x : images) {
++cnt;
}
Assert.assertEquals(2, cnt);