diff options
Diffstat (limited to 'models-interactions/model-impl')
7 files changed, 54 insertions, 342 deletions
diff --git a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java index 61b6e3afd..d5e8b6c2a 100644 --- a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java +++ b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java @@ -3,7 +3,7 @@ * sdc * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,23 +23,22 @@ package org.onap.policy.sdc; import java.io.Serializable; import java.util.UUID; -import lombok.Getter; -import lombok.Setter; -@Getter -@Setter +import lombok.Data; + +@Data public class Resource implements Serializable { private static final long serialVersionUID = -913729158733348027L; - private UUID resourceUuid; - private UUID resourceInvariantUuid; - private String resourceName; - private String resourceVersion; - private String resourceType; + private UUID resourceUuid; + private UUID resourceInvariantUuid; + private String resourceName; + private String resourceVersion; + private String resourceType; public Resource() { - //Empty Constructor + // Empty Constructor } /** @@ -80,74 +79,4 @@ public class Resource implements Serializable { this.resourceVersion = version; this.resourceType = type; } - - @Override - public String toString() { - return "Resource [resourceUuid=" + resourceUuid + ", resourceInvariantUuid=" + resourceInvariantUuid - + ", resourceName=" + resourceName + ", resourceVersion=" + resourceVersion + ", resourceType=" - + resourceType + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((resourceInvariantUuid == null) ? 0 : resourceInvariantUuid.hashCode()); - result = prime * result + ((resourceName == null) ? 0 : resourceName.hashCode()); - result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode()); - result = prime * result + ((resourceUuid == null) ? 0 : resourceUuid.hashCode()); - result = prime * result + ((resourceVersion == null) ? 0 : resourceVersion.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - Resource other = (Resource) obj; - if (resourceInvariantUuid == null) { - if (other.resourceInvariantUuid != null) { - return false; - } - } else if (!resourceInvariantUuid.equals(other.resourceInvariantUuid)) { - return false; - } - if (resourceName == null) { - if (other.resourceName != null) { - return false; - } - } else if (!resourceName.equals(other.resourceName)) { - return false; - } - if (resourceType == null) { - if (other.resourceType != null) { - return false; - } - } else if (!resourceType.equals(other.resourceType)) { - return false; - } - if (resourceUuid == null) { - if (other.resourceUuid != null) { - return false; - } - } else if (!resourceUuid.equals(other.resourceUuid)) { - return false; - } - if (resourceVersion == null) { - if (other.resourceVersion != null) { - return false; - } - } else if (!resourceVersion.equals(other.resourceVersion)) { - return false; - } - return true; - } - } diff --git a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java index 05842e24c..0b6068dce 100644 --- a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java +++ b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java @@ -21,26 +21,31 @@ package org.onap.policy.sdc; +import com.google.gson.annotations.SerializedName; + import java.io.Serializable; import java.util.UUID; -import lombok.Getter; -import lombok.Setter; -@Getter -@Setter +import lombok.Data; + +@Data public class ResourceInstance implements Serializable { private static final long serialVersionUID = -5506162340393802424L; + @SerializedName("ResourceUUID") + private UUID resourceUuid; + private String resourceInstanceName; private String resourceName; - private UUID resourceInvariantUuid; private String resourceVersion; private String resourceType; - private UUID resourceUuid; + + @SerializedName("ResourceInvariantUUID") + private UUID resourceInvariantUuid; public ResourceInstance() { - //Empty Constructor + // Empty Constructor } /** @@ -59,86 +64,4 @@ public class ResourceInstance implements Serializable { this.resourceType = instance.resourceType; this.resourceUuid = instance.resourceUuid; } - - public UUID getResourceInvariantUUID() { - return resourceInvariantUuid; - } - - public void setResourceInvariantUUID(UUID resourceInvariantUuid) { - this.resourceInvariantUuid = resourceInvariantUuid; - } - - @Override - public String toString() { - return "ResourceInstance [resourceInstanceName=" + resourceInstanceName + ", resourceName=" + resourceName - + ", resourceInvariantUuid=" + resourceInvariantUuid + ", resourceVersion=" + resourceVersion - + ", resourceType=" + resourceType + ", resourceUuid=" + resourceUuid + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((resourceInstanceName == null) ? 0 : resourceInstanceName.hashCode()); - result = prime * result + ((resourceInvariantUuid == null) ? 0 : resourceInvariantUuid.hashCode()); - result = prime * result + ((resourceName == null) ? 0 : resourceName.hashCode()); - result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode()); - result = prime * result + ((resourceUuid == null) ? 0 : resourceUuid.hashCode()); - result = prime * result + ((resourceVersion == null) ? 0 : resourceVersion.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - ResourceInstance other = (ResourceInstance) obj; - if (resourceInstanceName == null) { - if (other.resourceInstanceName != null) { - return false; - } - } else if (!resourceInstanceName.equals(other.resourceInstanceName)) { - return false; - } - if (resourceInvariantUuid == null) { - if (other.resourceInvariantUuid != null) { - return false; - } - } else if (!resourceInvariantUuid.equals(other.resourceInvariantUuid)) { - return false; - } - if (resourceName == null) { - if (other.resourceName != null) { - return false; - } - } else if (!resourceName.equals(other.resourceName)) { - return false; - } - if (resourceType != other.resourceType) { - return false; - } - if (resourceUuid == null) { - if (other.resourceUuid != null) { - return false; - } - } else if (!resourceUuid.equals(other.resourceUuid)) { - return false; - } - if (resourceVersion == null) { - if (other.resourceVersion != null) { - return false; - } - } else if (!resourceVersion.equals(other.resourceVersion)) { - return false; - } - return true; - } - } 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 7ab2f9322..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 @@ -3,7 +3,7 @@ * sdc * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,11 +23,9 @@ package org.onap.policy.sdc; import java.io.Serializable; import java.util.UUID; -import lombok.Getter; -import lombok.Setter; +import lombok.Data; -@Getter -@Setter +@Data public class Service implements Serializable { private static final long serialVersionUID = -1249276698549996806L; @@ -38,7 +36,7 @@ public class Service implements Serializable { private String serviceVersion; public Service() { - //Empty Constructor + // Empty Constructor } public Service(UUID uuid) { @@ -53,13 +51,13 @@ public class Service implements Serializable { * Constructor. * * @param uuid service id - * @param invariantUUID service invariant id + * @param invariantUuid service invariant id * @param name name * @param version version */ - public Service(UUID uuid, UUID invariantUUID, String name, String version) { + public Service(UUID uuid, UUID invariantUuid, String name, String version) { this.serviceUUID = uuid; - this.serviceInvariantUUID = invariantUUID; + this.serviceInvariantUUID = invariantUuid; this.serviceName = name; this.serviceVersion = version; } @@ -75,61 +73,4 @@ public class Service implements Serializable { this.serviceName = service.serviceName; this.serviceVersion = service.serviceVersion; } - - @Override - public String toString() { - return "Service [serviceUUID=" + serviceUUID + ", serviceInvariantUUID=" + serviceInvariantUUID - + ", serviceName=" + serviceName + ", serviceVersion=" + serviceVersion + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((serviceInvariantUUID == null) ? 0 : serviceInvariantUUID.hashCode()); - result = prime * result + ((serviceName == null) ? 0 : serviceName.hashCode()); - result = prime * result + ((serviceUUID == null) ? 0 : serviceUUID.hashCode()); - result = prime * result + ((serviceVersion == null) ? 0 : serviceVersion.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - Service other = (Service) obj; - if (serviceInvariantUUID == null) { - if (other.serviceInvariantUUID != null) { - return false; - } - } else if (!serviceInvariantUUID.equals(other.serviceInvariantUUID)) { - return false; - } - if (serviceName == null) { - if (other.serviceName != null) { - return false; - } - } else if (!serviceName.equals(other.serviceName)) { - return false; - } - if (serviceUUID == null) { - if (other.serviceUUID != null) { - return false; - } - } else if (!serviceUUID.equals(other.serviceUUID)) { - return false; - } - if (serviceVersion == null) { - return other.serviceVersion == null; - } else { - return serviceVersion.equals(other.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 e02952219..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 @@ -3,7 +3,7 @@ * sdc * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,11 +23,9 @@ package org.onap.policy.sdc; import java.io.Serializable; import java.util.UUID; -import lombok.Getter; -import lombok.Setter; +import lombok.Data; -@Getter -@Setter +@Data public class ServiceInstance implements Serializable { private static final long serialVersionUID = 6285260780966679625L; @@ -36,12 +34,13 @@ public class ServiceInstance implements Serializable { private UUID serviceUUID; private UUID serviceInstanceUUID; private UUID widgetModelUUID; + private String widgetModelVersion; private String serviceName; private String serviceInstanceName; public ServiceInstance() { - //Empty Constructor + // Empty Constructor } /** @@ -61,87 +60,4 @@ public class ServiceInstance implements Serializable { this.serviceName = instance.serviceName; this.serviceInstanceName = instance.serviceInstanceName; } - - @Override - public String toString() { - return "ServiceInstance [personaModelUUID=" + personaModelUUID + ", serviceUUID=" + serviceUUID - + ", serviceInstanceUUID=" + serviceInstanceUUID + ", widgetModelUUID=" + widgetModelUUID - + ", widgetModelVersion=" + widgetModelVersion + ", serviceName=" + serviceName - + ", serviceInstanceName=" + serviceInstanceName + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((personaModelUUID == null) ? 0 : personaModelUUID.hashCode()); - result = prime * result + ((serviceInstanceName == null) ? 0 : serviceInstanceName.hashCode()); - result = prime * result + ((serviceInstanceUUID == null) ? 0 : serviceInstanceUUID.hashCode()); - result = prime * result + ((serviceName == null) ? 0 : serviceName.hashCode()); - result = prime * result + ((serviceUUID == null) ? 0 : serviceUUID.hashCode()); - result = prime * result + ((widgetModelUUID == null) ? 0 : widgetModelUUID.hashCode()); - result = prime * result + ((widgetModelVersion == null) ? 0 : widgetModelVersion.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - ServiceInstance other = (ServiceInstance) obj; - if (personaModelUUID == null) { - if (other.personaModelUUID != null) { - return false; - } - } else if (!personaModelUUID.equals(other.personaModelUUID)) { - return false; - } - if (serviceInstanceName == null) { - if (other.serviceInstanceName != null) { - return false; - } - } else if (!serviceInstanceName.equals(other.serviceInstanceName)) { - return false; - } - if (serviceInstanceUUID == null) { - if (other.serviceInstanceUUID != null) { - return false; - } - } else if (!serviceInstanceUUID.equals(other.serviceInstanceUUID)) { - return false; - } - if (serviceName == null) { - if (other.serviceName != null) { - return false; - } - } else if (!serviceName.equals(other.serviceName)) { - return false; - } - if (serviceUUID == null) { - if (other.serviceUUID != null) { - return false; - } - } else if (!serviceUUID.equals(other.serviceUUID)) { - return false; - } - if (widgetModelUUID == null) { - if (other.widgetModelUUID != null) { - return false; - } - } else if (!widgetModelUUID.equals(other.widgetModelUUID)) { - return false; - } - if (widgetModelVersion == null) { - return other.widgetModelVersion == null; - } else { - return widgetModelVersion.equals(other.widgetModelVersion); - } - } } diff --git a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java index 8ae0084f6..e1068cb31 100644 --- a/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java +++ b/models-interactions/model-impl/sdc/src/test/java/org/onap/policy/sdc/ResourceInstanceTest.java @@ -3,7 +3,7 @@ * sdc * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ public class ResourceInstanceTest { ResourceInstance ri = new ResourceInstance(); assertEquals(null, ri.getResourceInstanceName()); assertEquals(null, ri.getResourceUuid()); - assertEquals(null, ri.getResourceInvariantUUID()); + assertEquals(null, ri.getResourceInvariantUuid()); assertEquals(null, ri.getResourceName()); assertEquals(null, ri.getResourceType()); assertEquals(null, ri.getResourceVersion()); @@ -47,7 +47,7 @@ public class ResourceInstanceTest { ResourceInstance ri2 = new ResourceInstance((ResourceInstance) null); assertEquals(null, ri2.getResourceInstanceName()); assertEquals(null, ri2.getResourceUuid()); - assertEquals(null, ri2.getResourceInvariantUUID()); + assertEquals(null, ri2.getResourceInvariantUuid()); assertEquals(null, ri2.getResourceName()); assertEquals(null, ri2.getResourceType()); assertEquals(null, ri2.getResourceVersion()); @@ -55,7 +55,7 @@ public class ResourceInstanceTest { ri2 = new ResourceInstance(ri); assertEquals(ri2.getResourceInstanceName(), ri.getResourceInstanceName()); assertEquals(ri2.getResourceUuid(), ri.getResourceUuid()); - assertEquals(ri2.getResourceInvariantUUID(), ri.getResourceInvariantUUID()); + assertEquals(ri2.getResourceInvariantUuid(), ri.getResourceInvariantUuid()); assertEquals(ri2.getResourceName(), ri.getResourceName()); assertEquals(ri2.getResourceType(), ri.getResourceType()); assertEquals(ri2.getResourceVersion(), ri.getResourceVersion()); @@ -65,7 +65,8 @@ public class ResourceInstanceTest { public void testInstanceName() { ResourceInstance ri = new ResourceInstance(); String name = "nameTestInstance"; - ri.setResourceInstanceName(name);; + ri.setResourceInstanceName(name); + ; assertEquals(name, ri.getResourceInstanceName()); } @@ -81,8 +82,8 @@ public class ResourceInstanceTest { public void testInvariantUuid() { ResourceInstance ri = new ResourceInstance(); UUID uuid = UUID.randomUUID(); - ri.setResourceInvariantUUID(uuid); - assertEquals(uuid, ri.getResourceInvariantUUID()); + ri.setResourceInvariantUuid(uuid); + assertEquals(uuid, ri.getResourceInvariantUuid()); } @Test @@ -117,8 +118,8 @@ public class ResourceInstanceTest { ri1.setResourceInstanceName(INSTANCE); ri1.setResourceName(RESOURCE); - ri1.setResourceInvariantUUID(UUID.randomUUID()); - ri1.setResourceInvariantUUID(UUID.randomUUID()); + ri1.setResourceInvariantUuid(UUID.randomUUID()); + ri1.setResourceInvariantUuid(UUID.randomUUID()); ri1.setResourceVersion(VERSION_000); ri1.setResourceType(ResourceType.VL); ri2 = new ResourceInstance(ri1); @@ -134,8 +135,8 @@ public class ResourceInstanceTest { ri1.setResourceInstanceName(INSTANCE); ri1.setResourceName(RESOURCE); - ri1.setResourceInvariantUUID(UUID.randomUUID()); - ri1.setResourceInvariantUUID(UUID.randomUUID()); + ri1.setResourceInvariantUuid(UUID.randomUUID()); + ri1.setResourceInvariantUuid(UUID.randomUUID()); ri1.setResourceVersion(VERSION_000); ri1.setResourceType(ResourceType.VL); ri2 = new ResourceInstance(ri1); @@ -150,8 +151,8 @@ public class ResourceInstanceTest { ri1.setResourceInstanceName(INSTANCE); ri1.setResourceName(RESOURCE); - ri1.setResourceInvariantUUID(UUID.randomUUID()); - ri1.setResourceInvariantUUID(UUID.randomUUID()); + ri1.setResourceInvariantUuid(UUID.randomUUID()); + ri1.setResourceInvariantUuid(UUID.randomUUID()); ri1.setResourceVersion(VERSION_000); ri1.setResourceType(ResourceType.VL); ri2 = new ResourceInstance(ri1); 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 c06974cd5..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 @@ -3,7 +3,7 @@ * sdc * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,7 +68,8 @@ public class ServiceInstanceTest { public void testInstanceName() { ServiceInstance si = new ServiceInstance(); String name = "nameTestInstance"; - si.setServiceInstanceName(name);; + si.setServiceInstanceName(name); + ; assertEquals(name, si.getServiceInstanceName()); } @@ -116,7 +117,8 @@ public class ServiceInstanceTest { public void testWidgetModelVersion() { ServiceInstance si = new ServiceInstance(); String version = "2.2.2"; - si.setWidgetModelVersion(version);; + si.setWidgetModelVersion(version); + ; assertEquals(version, si.getWidgetModelVersion()); } 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 19238622d..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 @@ -3,7 +3,7 @@ * sdc * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. |