From 1433d54a4dd40ea06c2fc16cc79f1d6ec08d3405 Mon Sep 17 00:00:00 2001 From: "Smokowski, Steve (ss835w)" Date: Thu, 2 Apr 2020 16:19:51 -0400 Subject: Fix Parsing issue on nova servers Issue-ID: SO-2663 Signed-off-by: Smokowski, Steve (ss835w) Change-Id: I6b689ccb0baf6d87980e8439a11ecc5879951fa3 --- .../openstack/nova/model/IdResourceEntity.java | 35 ++++++++++++++++++++++ .../com/woorea/openstack/nova/model/Server.java | 4 +-- .../woorea/openstack/nova/model/ServerTest.java | 4 +-- .../woorea/openstack/nova/model/ServersTest.java | 4 +-- 4 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 nova-model/src/main/java/com/woorea/openstack/nova/model/IdResourceEntity.java diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/IdResourceEntity.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/IdResourceEntity.java new file mode 100644 index 0000000..dff4be8 --- /dev/null +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/IdResourceEntity.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + + +package com.woorea.openstack.nova.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class IdResourceEntity { + + @JsonProperty + private String id; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + +} diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Server.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Server.java index 70b7f88..8a61751 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/Server.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Server.java @@ -255,7 +255,7 @@ public class Server implements Serializable { private String terminatedAt; @JsonProperty("os-extended-volumes:volumes_attached") - private List osExtendedVolumesAttached; + private List osExtendedVolumesAttached; private String uuid; @@ -488,7 +488,7 @@ public class Server implements Serializable { /** * @return the osExtendedVolumesAttached */ - public List getOsExtendedVolumesAttached() { + public List getOsExtendedVolumesAttached() { return osExtendedVolumesAttached; } diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerTest.java index 290f4a5..a12536f 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServerTest.java @@ -128,7 +128,7 @@ public class ServerTest { + " \"OS-EXT-AZ:availability_zone\" : \"availabilityzone\"," + EOL + " \"OS-SRV-USG:launched_at\" : \"launchedat\"," + EOL + " \"OS-SRV-USG:terminated_at\" : \"terminatedat\"," + EOL - + " \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]" + + " \"os-extended-volumes:volumes_attached\" : [ { \"id\":\"osextendedvolumesattached-v1\"},{\"id\": \"osextendedvolumesattached-v2\"} ]" + EOL + " }" + EOL + "}"; private ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(Include.NON_NULL) @@ -221,7 +221,7 @@ public class ServerTest { String instanceName = server.getInstanceName(); Assert.assertNotNull(instanceName); - List osExtendedVolumesAttached = server.getOsExtendedVolumesAttached(); + List osExtendedVolumesAttached = server.getOsExtendedVolumesAttached(); Assert.assertNotNull(osExtendedVolumesAttached); Assert.assertEquals(2, osExtendedVolumesAttached.size()); diff --git a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServersTest.java b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServersTest.java index bbf80ff..0e3f766 100644 --- a/nova-model/src/test/java/com/woorea/openstack/nova/model/ServersTest.java +++ b/nova-model/src/test/java/com/woorea/openstack/nova/model/ServersTest.java @@ -260,7 +260,7 @@ public class ServersTest { sb.append(" \"OS-SRV-USG:launched_at\" : \"launchedat\"," + EOL); sb.append(" \"OS-SRV-USG:terminated_at\" : \"terminatedat\"," + EOL); sb.append( - " \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]" + " \"os-extended-volumes:volumes_attached\" : [ { \"id\":\"osextendedvolumesattached-v1\"},{\"id\": \"osextendedvolumesattached-v2\"} ]" + EOL); sb.append(" }, {" + EOL); sb.append(" \"id\" : \"id\"," + EOL); @@ -481,7 +481,7 @@ public class ServersTest { sb.append(" \"OS-SRV-USG:launched_at\" : \"launchedat\"," + EOL); sb.append(" \"OS-SRV-USG:terminated_at\" : \"terminatedat\"," + EOL); sb.append( - " \"os-extended-volumes:volumes_attached\" : [ \"osextendedvolumesattached-v1\", \"osextendedvolumesattached-v2\" ]" + " \"os-extended-volumes:volumes_attached\" : [ { \"id\":\"osextendedvolumesattached-v1\"},{\"id\": \"osextendedvolumesattached-v2\"} ]" + EOL); sb.append(" } ]" + EOL); sb.append("}"); -- cgit 1.2.3-korg