diff options
author | Jim Hahn <jrh3@att.com> | 2020-03-12 18:55:21 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2020-03-12 19:36:44 -0400 |
commit | 309c49634bf9fcb53458d3e5f07684cb7bfbdd6f (patch) | |
tree | c3d020e98b3ea052f34588a036310ecf0c7032f9 /models-interactions | |
parent | 77c21cec25d98cf5832acfab38a532006c639669 (diff) |
Revert some UUID variable names
Unfortunately, some code uses "new Yaml(...)" to decode policies and
"Yaml" doesn't understand GSON annotations. As a result, this means
that the field names must match the serialized name, thus they must
continue to end with "UUID" instead of "Uuid".
Issue-ID: POLICY-1910
Signed-off-by: Jim Hahn <jrh3@att.com>
Change-Id: I97c2f5c7e59b758b13a1dbcceed709b2e2e064a2
Diffstat (limited to 'models-interactions')
5 files changed, 63 insertions, 80 deletions
diff --git a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java index 765eeec54..d372f1221 100644 --- a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java +++ b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java @@ -21,11 +21,8 @@ package org.onap.policy.sdc; -import com.google.gson.annotations.SerializedName; - import java.io.Serializable; import java.util.UUID; - import lombok.Data; @Data @@ -33,12 +30,8 @@ public class Service implements Serializable { private static final long serialVersionUID = -1249276698549996806L; - @SerializedName("serviceUuid") - private UUID serviceUuid; - - @SerializedName("serviceInvariantUuid") - private UUID serviceInvariantUuid; - + private UUID serviceUUID; + private UUID serviceInvariantUUID; private String serviceName; private String serviceVersion; @@ -47,7 +40,7 @@ public class Service implements Serializable { } public Service(UUID uuid) { - this.serviceUuid = uuid; + this.serviceUUID = uuid; } public Service(String name) { @@ -63,8 +56,8 @@ public class Service implements Serializable { * @param version version */ public Service(UUID uuid, UUID invariantUuid, String name, String version) { - this.serviceUuid = uuid; - this.serviceInvariantUuid = invariantUuid; + this.serviceUUID = uuid; + this.serviceInvariantUUID = invariantUuid; this.serviceName = name; this.serviceVersion = version; } @@ -75,8 +68,8 @@ public class Service implements Serializable { * @param service copy object */ public Service(Service service) { - this.serviceUuid = service.serviceUuid; - this.serviceInvariantUuid = service.serviceInvariantUuid; + this.serviceUUID = service.serviceUUID; + this.serviceInvariantUUID = service.serviceInvariantUUID; this.serviceName = service.serviceName; this.serviceVersion = service.serviceVersion; } diff --git a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java index 45e1dc56a..b476de20f 100644 --- a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java +++ b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java @@ -21,11 +21,8 @@ package org.onap.policy.sdc; -import com.google.gson.annotations.SerializedName; - import java.io.Serializable; import java.util.UUID; - import lombok.Data; @Data @@ -33,17 +30,10 @@ public class ServiceInstance implements Serializable { private static final long serialVersionUID = 6285260780966679625L; - @SerializedName("personaModelUUID") - private UUID personaModelUuid; - - @SerializedName("serviceUUID") - private UUID serviceUuid; - - @SerializedName("serviceInstanceUUID") - private UUID serviceInstanceUuid; - - @SerializedName("widgetModelUUID") - private UUID widgetModelUuid; + private UUID personaModelUUID; + private UUID serviceUUID; + private UUID serviceInstanceUUID; + private UUID widgetModelUUID; private String widgetModelVersion; private String serviceName; @@ -62,10 +52,10 @@ public class ServiceInstance implements Serializable { if (instance == null) { return; } - this.personaModelUuid = instance.personaModelUuid; - this.serviceUuid = instance.serviceUuid; - this.serviceInstanceUuid = instance.serviceInstanceUuid; - this.widgetModelUuid = instance.widgetModelUuid; + this.personaModelUUID = instance.personaModelUUID; + this.serviceUUID = instance.serviceUUID; + this.serviceInstanceUUID = instance.serviceInstanceUUID; + this.widgetModelUUID = instance.widgetModelUUID; this.widgetModelVersion = instance.widgetModelVersion; this.serviceName = instance.serviceName; this.serviceInstanceName = instance.serviceInstanceName; diff --git a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java index c81a12fc5..3e134d67b 100644 --- a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java +++ b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceInstanceTest.java @@ -38,29 +38,29 @@ public class ServiceInstanceTest { public void testConstructors() { ServiceInstance si = new ServiceInstance(); assertEquals(null, si.getServiceInstanceName()); - assertEquals(null, si.getServiceUuid()); - assertEquals(null, si.getServiceInstanceUuid()); + assertEquals(null, si.getServiceUUID()); + assertEquals(null, si.getServiceInstanceUUID()); assertEquals(null, si.getServiceName()); - assertEquals(null, si.getPersonaModelUuid()); - assertEquals(null, si.getWidgetModelUuid()); + assertEquals(null, si.getPersonaModelUUID()); + assertEquals(null, si.getWidgetModelUUID()); assertEquals(null, si.getWidgetModelVersion()); ServiceInstance si2 = new ServiceInstance((ServiceInstance) null); assertEquals(null, si2.getServiceInstanceName()); - assertEquals(null, si2.getServiceUuid()); - assertEquals(null, si2.getServiceInstanceUuid()); + assertEquals(null, si2.getServiceUUID()); + assertEquals(null, si2.getServiceInstanceUUID()); assertEquals(null, si2.getServiceName()); - assertEquals(null, si2.getPersonaModelUuid()); - assertEquals(null, si2.getWidgetModelUuid()); + assertEquals(null, si2.getPersonaModelUUID()); + assertEquals(null, si2.getWidgetModelUUID()); assertEquals(null, si2.getWidgetModelVersion()); si2 = new ServiceInstance(si); assertEquals(si2.getServiceInstanceName(), si.getServiceInstanceName()); - assertEquals(si2.getServiceUuid(), si.getServiceUuid()); - assertEquals(si2.getServiceInstanceUuid(), si.getServiceInstanceUuid()); + assertEquals(si2.getServiceUUID(), si.getServiceUUID()); + assertEquals(si2.getServiceInstanceUUID(), si.getServiceInstanceUUID()); assertEquals(si2.getServiceName(), si.getServiceName()); - assertEquals(si2.getPersonaModelUuid(), si.getPersonaModelUuid()); - assertEquals(si2.getWidgetModelUuid(), si.getWidgetModelUuid()); + assertEquals(si2.getPersonaModelUUID(), si.getPersonaModelUUID()); + assertEquals(si2.getWidgetModelUUID(), si.getWidgetModelUUID()); assertEquals(si2.getWidgetModelVersion(), si.getWidgetModelVersion()); } @@ -77,16 +77,16 @@ public class ServiceInstanceTest { public void testUuid() { ServiceInstance si = new ServiceInstance(); UUID uuid = UUID.randomUUID(); - si.setServiceUuid(uuid); - assertEquals(uuid, si.getServiceUuid()); + si.setServiceUUID(uuid); + assertEquals(uuid, si.getServiceUUID()); } @Test public void testInstanceUuid() { ServiceInstance si = new ServiceInstance(); UUID uuid = UUID.randomUUID(); - si.setServiceInstanceUuid(uuid); - assertEquals(uuid, si.getServiceInstanceUuid()); + si.setServiceInstanceUUID(uuid); + assertEquals(uuid, si.getServiceInstanceUUID()); } @Test @@ -101,16 +101,16 @@ public class ServiceInstanceTest { public void testPersonaModelUuid() { ServiceInstance si = new ServiceInstance(); UUID uuid = UUID.randomUUID(); - si.setPersonaModelUuid(uuid); - assertEquals(uuid, si.getPersonaModelUuid()); + si.setPersonaModelUUID(uuid); + assertEquals(uuid, si.getPersonaModelUUID()); } @Test public void testWidgetModelUuid() { ServiceInstance si = new ServiceInstance(); UUID uuid = UUID.randomUUID(); - si.setWidgetModelUuid(uuid); - assertEquals(uuid, si.getWidgetModelUuid()); + si.setWidgetModelUUID(uuid); + assertEquals(uuid, si.getWidgetModelUUID()); } @Test @@ -131,10 +131,10 @@ public class ServiceInstanceTest { si1.setServiceInstanceName(INSTANCE); si1.setServiceName(SERVICE); - si1.setServiceInstanceUuid(UUID.randomUUID()); - si1.setServiceUuid(UUID.randomUUID()); - si1.setPersonaModelUuid(UUID.randomUUID()); - si1.setWidgetModelUuid(UUID.randomUUID()); + si1.setServiceInstanceUUID(UUID.randomUUID()); + si1.setServiceUUID(UUID.randomUUID()); + si1.setPersonaModelUUID(UUID.randomUUID()); + si1.setWidgetModelUUID(UUID.randomUUID()); si1.setWidgetModelVersion(VERSION_333); si2 = new ServiceInstance(si1); assertTrue(si1.equals(si2)); @@ -149,10 +149,10 @@ public class ServiceInstanceTest { si1.setServiceInstanceName(INSTANCE); si1.setServiceName(SERVICE); - si1.setServiceInstanceUuid(UUID.randomUUID()); - si1.setServiceUuid(UUID.randomUUID()); - si1.setPersonaModelUuid(UUID.randomUUID()); - si1.setWidgetModelUuid(UUID.randomUUID()); + si1.setServiceInstanceUUID(UUID.randomUUID()); + si1.setServiceUUID(UUID.randomUUID()); + si1.setPersonaModelUUID(UUID.randomUUID()); + si1.setWidgetModelUUID(UUID.randomUUID()); si1.setWidgetModelVersion(VERSION_333); si2 = new ServiceInstance(si1); assertEquals(si1.toString(), si2.toString()); @@ -166,10 +166,10 @@ public class ServiceInstanceTest { si1.setServiceInstanceName(INSTANCE); si1.setServiceName(SERVICE); - si1.setServiceInstanceUuid(UUID.randomUUID()); - si1.setServiceUuid(UUID.randomUUID()); - si1.setPersonaModelUuid(UUID.randomUUID()); - si1.setWidgetModelUuid(UUID.randomUUID()); + si1.setServiceInstanceUUID(UUID.randomUUID()); + si1.setServiceUUID(UUID.randomUUID()); + si1.setPersonaModelUUID(UUID.randomUUID()); + si1.setWidgetModelUUID(UUID.randomUUID()); si1.setWidgetModelVersion(VERSION_333); si2 = new ServiceInstance(si1); assertEquals(si1.hashCode(), si2.hashCode()); diff --git a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java index dc5d9d3b2..73efbb014 100644 --- a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java +++ b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ServiceTest.java @@ -36,23 +36,23 @@ public class ServiceTest { @Test public void testConstructors() { Service svc = new Service(); - assertEquals(null, svc.getServiceUuid()); - assertEquals(null, svc.getServiceInvariantUuid()); + assertEquals(null, svc.getServiceUUID()); + assertEquals(null, svc.getServiceInvariantUUID()); assertEquals(null, svc.getServiceName()); assertEquals(null, svc.getServiceVersion()); UUID uuid = UUID.randomUUID(); svc = new Service(uuid); - assertEquals(uuid, svc.getServiceUuid()); - assertEquals(null, svc.getServiceInvariantUuid()); + assertEquals(uuid, svc.getServiceUUID()); + assertEquals(null, svc.getServiceInvariantUUID()); assertEquals(null, svc.getServiceName()); assertEquals(null, svc.getServiceVersion()); String name = "constTest"; svc = new Service(name); - assertEquals(null, svc.getServiceUuid()); + assertEquals(null, svc.getServiceUUID()); assertEquals(name, svc.getServiceName()); - assertEquals(null, svc.getServiceInvariantUuid()); + assertEquals(null, svc.getServiceInvariantUUID()); assertEquals(null, svc.getServiceVersion()); uuid = UUID.randomUUID(); @@ -60,14 +60,14 @@ public class ServiceTest { name = "constTestUUID"; String version = "0.0.1"; svc = new Service(uuid, uuidInvariant, name, version); - assertEquals(uuid, svc.getServiceUuid()); - assertEquals(uuidInvariant, svc.getServiceInvariantUuid()); + assertEquals(uuid, svc.getServiceUUID()); + assertEquals(uuidInvariant, svc.getServiceInvariantUUID()); assertEquals(name, svc.getServiceName()); assertEquals(version, svc.getServiceVersion()); Service s2 = new Service(svc); - assertEquals(uuid, s2.getServiceUuid()); - assertEquals(uuidInvariant, s2.getServiceInvariantUuid()); + assertEquals(uuid, s2.getServiceUUID()); + assertEquals(uuidInvariant, s2.getServiceInvariantUUID()); assertEquals(name, s2.getServiceName()); assertEquals(version, s2.getServiceVersion()); } @@ -76,16 +76,16 @@ public class ServiceTest { public void testUuid() { Service svc = new Service(); UUID uuid = UUID.randomUUID(); - svc.setServiceUuid(uuid); - assertEquals(uuid, svc.getServiceUuid()); + svc.setServiceUUID(uuid); + assertEquals(uuid, svc.getServiceUUID()); } @Test public void testInvariantUuid() { Service svc = new Service(); UUID uuid = UUID.randomUUID(); - svc.setServiceInvariantUuid(uuid); - assertEquals(uuid, svc.getServiceInvariantUuid()); + svc.setServiceInvariantUUID(uuid); + assertEquals(uuid, svc.getServiceInvariantUUID()); } @Test diff --git a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java index f1a9540c0..47f6f1494 100644 --- a/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java +++ b/models-interactions/model-yaml/src/main/java/org/onap/policy/controlloop/policy/builder/impl/ControlLoopPolicyBuilderImpl.java @@ -114,7 +114,7 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder { if (service == null) { throw new BuilderException("Service must not be null"); } - if (service.getServiceUuid() == null && Strings.isNullOrEmpty(service.getServiceName())) { + if (service.getServiceUUID() == null && Strings.isNullOrEmpty(service.getServiceName())) { throw new BuilderException("Invalid service - need either a serviceUUID or serviceName"); } if (controlLoopPolicy.getControlLoop().getServices() == null) { @@ -134,7 +134,7 @@ public class ControlLoopPolicyBuilderImpl implements ControlLoopPolicyBuilder { if (service == null) { throw new BuilderException("Service must not be null"); } - if (service.getServiceUuid() == null && Strings.isNullOrEmpty(service.getServiceName())) { + if (service.getServiceUUID() == null && Strings.isNullOrEmpty(service.getServiceName())) { throw new BuilderException("Invalid service - need either a serviceUUID or serviceName"); } boolean removed = controlLoopPolicy.getControlLoop().getServices().remove(service); |