aboutsummaryrefslogtreecommitdiffstats
path: root/common-be/src
diff options
context:
space:
mode:
authorandre.schmid <andre.schmid@est.tech>2020-10-14 20:56:11 +0100
committerS�bastien Determe <sebastien.determe@intl.att.com>2020-12-07 14:51:59 +0000
commit95ad93091d5fa6e377e76f312d495151bddc9da8 (patch)
tree9923a98bd90b99cb960cf1f7ead2a57402aca1a8 /common-be/src
parenta9467feb90c33ad5b6b2ed80581c4adf75114046 (diff)
Support interface input during import VFC
Change-Id: I097ce258a7dadbedf1aff6ce53dd1286da074552 Issue-ID: SDC-3372 Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'common-be/src')
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputDataDefinition.java30
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinition.java26
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java1
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/utils/TypeUtils.java3
-rw-r--r--common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinitionTest.java18
5 files changed, 35 insertions, 43 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputDataDefinition.java
index 422b7eac6c..ef2932a50b 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InputDataDefinition.java
@@ -24,10 +24,6 @@ import java.util.Map;
public class InputDataDefinition extends PropertyDataDefinition {
- private String label;
- private Boolean hidden;
- private Boolean immutable;
-
InputDataDefinition() {
super();
}
@@ -43,31 +39,7 @@ public class InputDataDefinition extends PropertyDataDefinition {
this.setImmutable(p.isImmutable());
}
- InputDataDefinition(PropertyDataDefinition p) {
+ public InputDataDefinition(PropertyDataDefinition p) {
super(p);
}
-
- public Boolean isHidden() {
- return hidden;
- }
-
- public void setHidden(Boolean hidden) {
- this.hidden = hidden;
- }
-
- public Boolean isImmutable() {
- return immutable;
- }
-
- public void setImmutable(Boolean immutable) {
- this.immutable = immutable;
- }
-
- public String getLabel() {
- return label;
- }
-
- public void setLabel(String label) {
- this.label = label;
- }
}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinition.java
index a264d4618f..760802ec39 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinition.java
@@ -36,7 +36,6 @@ public class InterfaceDataDefinition extends ToscaDataDefinition implements Seri
this();
setType(type);
setDescription(description);
-
}
@JsonCreator
@@ -45,12 +44,13 @@ public class InterfaceDataDefinition extends ToscaDataDefinition implements Seri
setOperations(new HashMap<>());
}
- public InterfaceDataDefinition(InterfaceDataDefinition p) {
- setUniqueId(p.getUniqueId());
- setType(p.getType());
- setDescription(p.getDescription());
- setToscaResourceName(p.getToscaResourceName());
- setOperations(p.getOperations());
+ public InterfaceDataDefinition(final InterfaceDataDefinition interfaceDataDefinition) {
+ setUniqueId(interfaceDataDefinition.getUniqueId());
+ setType(interfaceDataDefinition.getType());
+ setDescription(interfaceDataDefinition.getDescription());
+ setToscaResourceName(interfaceDataDefinition.getToscaResourceName());
+ setOperations(interfaceDataDefinition.getOperations());
+ setInputs(interfaceDataDefinition.getInputs());
}
public String getUniqueId() {
@@ -61,10 +61,6 @@ public class InterfaceDataDefinition extends ToscaDataDefinition implements Seri
setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId);
}
- public String getType() {
- return (String) getToscaPresentationValue(JsonPresentationFields.TYPE);
- }
-
public void setType(String type) {
setToscaPresentationValue(JsonPresentationFields.TYPE, type);
}
@@ -120,4 +116,12 @@ public class InterfaceDataDefinition extends ToscaDataDefinition implements Seri
public void setLastUpdateDate(Long lastUpdateDate) {
setToscaPresentationValue(JsonPresentationFields.LAST_UPDATE_DATE, lastUpdateDate);
}
+
+ public Map<String, InputDataDefinition> getInputs() {
+ return (Map<String, InputDataDefinition>) getToscaPresentationValue(JsonPresentationFields.INTERFACE_INPUT);
+ }
+
+ public void setInputs(final Map<String, InputDataDefinition> inputs) {
+ setToscaPresentationValue(JsonPresentationFields.INTERFACE_INPUT, inputs);
+ }
}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java
index 76697a7223..436f958893 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java
@@ -249,6 +249,7 @@ public enum JsonPresentationFields {
//Interface
INTERFACES("interfaces", null),
+ INTERFACE_INPUT("input", null),
OPERATIONS("operations", null),
OPERATION_IMPLEMENTATION("implementation", null),
OPERATION_INPUTS("inputs", null),
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/utils/TypeUtils.java b/common-be/src/main/java/org/openecomp/sdc/be/utils/TypeUtils.java
index a1b14b70ca..ee8c7db4f2 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/utils/TypeUtils.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/utils/TypeUtils.java
@@ -48,6 +48,7 @@ public class TypeUtils {
PROPERTIES("properties"), TYPE("type"), STATUS("status"),
ENTRY_SCHEMA("entry_schema"), REQUIRED("required"), DESCRIPTION("description"),
DEFAULT_VALUE("default"), VALUE("value"), CONSTRAINTS("constraints"),
+ DEFAULT("default"),
// Group Types
MEMBERS("members"), METADATA("metadata"),
// Policy Types
@@ -71,6 +72,8 @@ public class TypeUtils {
GET_INPUT("get_input"),
// Definitions
DATA_TYPES("data_types"), NODE_TYPES("node_types"), IMPORTS("imports"),
+ //Operations
+ IMPLEMENTATION("implementation"),
DERIVED_FROM_NAME("derivedFromName");
diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinitionTest.java
index 1393a095b5..1c0d84df2a 100644
--- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinitionTest.java
+++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinitionTest.java
@@ -20,12 +20,14 @@
package org.openecomp.sdc.be.datatypes.elements;
-import org.junit.Test;
-
+import java.util.HashMap;
import java.util.Map;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
-public class InterfaceDataDefinitionTest {
+class InterfaceDataDefinitionTest {
private InterfaceDataDefinition createTestSubject() {
return new InterfaceDataDefinition();
@@ -174,4 +176,14 @@ public class InterfaceDataDefinitionTest {
testSubject = createTestSubject();
testSubject.setOperations(operations);
}
+
+ @Test
+ void testInputs() {
+ final InterfaceDataDefinition interfaceDataDefinition = new InterfaceDataDefinition();
+ final HashMap<String, InputDataDefinition> anInputMap = new HashMap<>();
+ anInputMap.put("anyEntry", new InputDataDefinition());
+ interfaceDataDefinition.setInputs(anInputMap);
+ Assertions.assertEquals(interfaceDataDefinition.getInputs(),
+ interfaceDataDefinition.getToscaPresentationValue(JsonPresentationFields.INTERFACE_INPUT));
+ }
}