From 032525a375681fb18cc498d8daed9d73faa21ec3 Mon Sep 17 00:00:00 2001 From: MichaelMorris Date: Tue, 23 Jun 2020 09:15:48 +0100 Subject: Support for Nested/Hierarchical Services Change-Id: I478cf2e1f9cf96443a3e35bf22ac2c9d72bca8f1 Issue-ID: SDC-3145 Signed-off-by: MichaelMorris --- .../datatypes/category/CategoryDataDefinition.java | 106 ++--------------- .../sdc/be/datatypes/enums/GraphPropertyEnum.java | 2 +- .../sdc/be/datatypes/enums/OriginTypeEnum.java | 3 +- .../category/CategoryDataDefinitionTest.java | 129 --------------------- 4 files changed, 15 insertions(+), 225 deletions(-) (limited to 'common-be') diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinition.java index 27d6ae56fa..cf0117f74a 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinition.java @@ -21,114 +21,32 @@ package org.openecomp.sdc.be.datatypes.category; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; - +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import lombok.NoArgsConstructor; import java.util.List; +@Getter +@Setter +@EqualsAndHashCode(callSuper = false) +@ToString +@NoArgsConstructor public class CategoryDataDefinition extends ToscaDataDefinition { private String name; private String normalizedName; private String uniqueId; private List icons; - - public CategoryDataDefinition() { - - } + private boolean useServiceSubstitutionForNestedServices = false; public CategoryDataDefinition(CategoryDataDefinition c) { this.name = c.name; this.normalizedName = c.normalizedName; this.uniqueId = c.uniqueId; this.icons = c.icons; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getNormalizedName() { - return normalizedName; - } - - public void setNormalizedName(String normalizedName) { - this.normalizedName = normalizedName; - } - - public String getUniqueId() { - return uniqueId; - } - - public void setUniqueId(String uniqueId) { - this.uniqueId = uniqueId; - } - - public List getIcons() { - return icons; - } - - public void setIcons(List icons) { - this.icons = icons; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((normalizedName == null) ? 0 : normalizedName.hashCode()); - result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode()); - result = prime * result + ((icons == null) ? 0 : icons.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; - } - CategoryDataDefinition other = (CategoryDataDefinition) obj; - if (name == null) { - if (other.name != null) { - return false; - } - } else if (!name.equals(other.name)) { - return false; - } - if (normalizedName == null) { - if (other.normalizedName != null) { - return false; - } - } else if (!normalizedName.equals(other.normalizedName)) { - return false; - } - if (uniqueId == null) { - if (other.uniqueId != null) { - return false; - } - } else if (!uniqueId.equals(other.uniqueId)) { - return false; - } - if (icons == null) { - return other.icons == null; - } else { - return icons.equals(other.icons); - } - } - - @Override - public String toString() { - return "CategoryDataDefinition [name=" + name + ", normalizedName=" + normalizedName + ", uniqueId=" + uniqueId - + ", icons=" + icons + "]"; + this.useServiceSubstitutionForNestedServices = c.useServiceSubstitutionForNestedServices; } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java index 09e1de6c7b..296b0067b8 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/GraphPropertyEnum.java @@ -50,7 +50,7 @@ public enum GraphPropertyEnum { LAST_LOGIN_TIME("lastLoginTime", Long.class, false, false), //used for category (old format, no json for categories) ICONS("icons", String.class, false, false), - + USE_SUBSTITUTION_FOR_NESTED_SERVICES("useServiceSubstitutionForNestedServices", Boolean.class, false, false), //Archive/Restore IS_ARCHIVED("isArchived", Boolean.class, false, true), IS_VSP_ARCHIVED("isVspArchived", Boolean.class, false, true), diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java index 48394013de..5e709054a4 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/OriginTypeEnum.java @@ -27,7 +27,8 @@ public enum OriginTypeEnum { CVFC("CVFC", "CVFC (Complex Virtual Function Component)", "resource instance", ComponentTypeEnum.RESOURCE, false), PNF("PNF", "PNF (Physical Network Function)", "resource instance", ComponentTypeEnum.RESOURCE, false), CR("CR", "CR (Complex Resource)", "resource instance", ComponentTypeEnum.RESOURCE, false), - ServiceProxy("Service Proxy", "Service Proxy", "service proxy", ComponentTypeEnum.RESOURCE, false); + ServiceProxy("Service Proxy", "Service Proxy", "service proxy", ComponentTypeEnum.RESOURCE, false), + ServiceSubstitution("Service Substitution", "Service Substitution", "service substitution", ComponentTypeEnum.RESOURCE, false); private String value; private String displayValue; diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinitionTest.java index 6422e5564d..2cb0261a67 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/category/CategoryDataDefinitionTest.java @@ -20,10 +20,8 @@ package org.openecomp.sdc.be.datatypes.category; -import org.junit.Assert; import org.junit.Test; -import java.util.List; public class CategoryDataDefinitionTest { @@ -35,137 +33,10 @@ public class CategoryDataDefinitionTest { @Test public void testCopyConstructor() throws Exception { CategoryDataDefinition testSubject; - String result; // default test testSubject = createTestSubject(); CategoryDataDefinition categoryDataDefinition = new CategoryDataDefinition(testSubject); } - @Test - public void testGetName() throws Exception { - CategoryDataDefinition testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getName(); - } - - - @Test - public void testSetName() throws Exception { - CategoryDataDefinition testSubject; - String name = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setName(name); - } - - - @Test - public void testGetNormalizedName() throws Exception { - CategoryDataDefinition testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getNormalizedName(); - } - - - @Test - public void testSetNormalizedName() throws Exception { - CategoryDataDefinition testSubject; - String normalizedName = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setNormalizedName(normalizedName); - } - - - @Test - public void testGetUniqueId() throws Exception { - CategoryDataDefinition testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getUniqueId(); - } - - - @Test - public void testSetUniqueId() throws Exception { - CategoryDataDefinition testSubject; - String uniqueId = ""; - - // default test - testSubject = createTestSubject(); - testSubject.setUniqueId(uniqueId); - } - - - @Test - public void testGetIcons() throws Exception { - CategoryDataDefinition testSubject; - List result; - - // default test - testSubject = createTestSubject(); - result = testSubject.getIcons(); - } - - - @Test - public void testSetIcons() throws Exception { - CategoryDataDefinition testSubject; - List icons = null; - - // default test - testSubject = createTestSubject(); - testSubject.setIcons(icons); - } - - - @Test - public void testHashCode() throws Exception { - CategoryDataDefinition testSubject; - int result; - - // default test - testSubject = createTestSubject(); - result = testSubject.hashCode(); - } - - - @Test - public void testEquals() throws Exception { - CategoryDataDefinition testSubject; - Object obj = null; - boolean result; - - // test 1 - testSubject = createTestSubject(); - obj = null; - result = testSubject.equals(obj); - Assert.assertEquals(false, result); - result = testSubject.equals(testSubject); - Assert.assertEquals(true, result); - result = testSubject.equals(new CategoryDataDefinition(testSubject)); - Assert.assertEquals(true, result); - } - - - @Test - public void testToString() throws Exception { - CategoryDataDefinition testSubject; - String result; - - // default test - testSubject = createTestSubject(); - result = testSubject.toString(); - } } -- cgit 1.2.3-korg