aboutsummaryrefslogtreecommitdiffstats
path: root/common-be
diff options
context:
space:
mode:
authorpriyanshu <pagarwal@amdocs.com>2018-12-24 16:26:27 +0530
committerpriyanshu <pagarwal@amdocs.com>2018-12-24 16:26:27 +0530
commit01f825bc81b0701dc35f239fb60d03eec39d9ea6 (patch)
treedf397f8af9000d901b926e4ec1e0b40923732653 /common-be
parentb6e7850484ba61df259e38fd6b59e94c2a7de5b6 (diff)
Interface operation feature enhancements
1. API restructuring to enhance model and provide more capabilities. 2. Allowed multiple interface creation under same resource/service 3. Enhanced validations to align with updated model 4. API restructuring to align UI model with Tosca model 5. Enhanced Junit and code coverage. Change-Id: Ieb5a5d72bc752774f9d702c587efaa127e43bd24 Issue-ID: SDC-1999 Signed-off-by: priyanshu <pagarwal@amdocs.com>
Diffstat (limited to 'common-be')
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceDataDefinition.java4
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationDataDefinition.java131
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinition.java87
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java8
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java21
-rw-r--r--common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationDataDefinitionTest.java159
-rw-r--r--common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinitionTest.java61
7 files changed, 11 insertions, 460 deletions
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 c0505c2b3d..d3a6903091 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
@@ -95,11 +95,11 @@ public class InterfaceDataDefinition extends ToscaDataDefinition implements Seri
public Map<String, OperationDataDefinition> getOperations() {
return (Map<String, OperationDataDefinition>)
- getToscaPresentationValue(JsonPresentationFields.INTERFACE_OPERATION);
+ getToscaPresentationValue(JsonPresentationFields.OPERATIONS);
}
public void setOperations(Map<String, OperationDataDefinition> operations) {
- setToscaPresentationValue(JsonPresentationFields.INTERFACE_OPERATION, operations);
+ setToscaPresentationValue(JsonPresentationFields.OPERATIONS, operations);
}
public String getToscaResourceName() {
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationDataDefinition.java
deleted file mode 100644
index 29093e9382..0000000000
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationDataDefinition.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright © 2016-2018 European Support Limited
- *
- * 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.
- */
-
-package org.openecomp.sdc.be.datatypes.elements;
-
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
-
-import java.io.Serializable;
-
-import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.ARTIFACT_UUID;
-import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.DESCRIPTION;
-import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_INPUT_PARAMETERS;
-import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_OPERATION_TYPE;
-import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_OUTPUT_PARAMETERS;
-import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_WORKFLOW_ASSOCIATION_TYPE;
-import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_WORKFLOW_ID;
-import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_WORKFLOW_VERSION_ID;
-import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.TOSCA_RESOURCE_NAME;
-import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.UNIQUE_ID;
-
-public class InterfaceOperationDataDefinition extends ToscaDataDefinition implements Serializable {
-
- @JsonCreator
- public InterfaceOperationDataDefinition() {
- super();
- }
-
- public InterfaceOperationDataDefinition(InterfaceOperationDataDefinition iodd) {
- super();
- setUniqueId(iodd.getUniqueId());
- setInputParams(iodd.getInputParams());
- setOutputParams(iodd.getOutputParams());
- setDescription(iodd.getDescription());
- setToscaResourceName(iodd.getToscaResourceName());
- setOperationType(iodd.getOperationType());
- setArtifactUUID(iodd.getArtifactUUID());
- setWorkflowId(iodd.getWorkflowId());
- setWorkflowVersionId(iodd.getWorkflowVersionId());
- setWorkflowAssociationType(iodd.getWorkflowAssociationType());
- }
-
- public ListDataDefinition<InterfaceOperationParamDataDefinition> getInputParams() {
- return (ListDataDefinition<InterfaceOperationParamDataDefinition>)
- getToscaPresentationValue(IO_INPUT_PARAMETERS);
- }
- public void setInputParams(ListDataDefinition<InterfaceOperationParamDataDefinition>
- inputParams) {
- setToscaPresentationValue(IO_INPUT_PARAMETERS, inputParams);
- }
-
- public ListDataDefinition<InterfaceOperationParamDataDefinition> getOutputParams() {
- return (ListDataDefinition<InterfaceOperationParamDataDefinition>)
- getToscaPresentationValue(IO_OUTPUT_PARAMETERS);
- }
- public void setOutputParams(ListDataDefinition<InterfaceOperationParamDataDefinition>
- outputParams) {
- setToscaPresentationValue(IO_OUTPUT_PARAMETERS, outputParams);
- }
-
- public String getUniqueId() {
- return (String) getToscaPresentationValue(UNIQUE_ID);
- }
- public void setUniqueId(String uid) {
- setToscaPresentationValue(UNIQUE_ID, uid);
- }
-
- public String getDescription() {
- return (String) getToscaPresentationValue(DESCRIPTION);
- }
- public void setDescription(String description) {
- setToscaPresentationValue(DESCRIPTION, description);
- }
-
- public String getOperationType() {
- return (String) getToscaPresentationValue(IO_OPERATION_TYPE);
- }
- public void setOperationType(String operationType) {
- setToscaPresentationValue(IO_OPERATION_TYPE, operationType);
- }
-
- public String getToscaResourceName() {
- return (String) getToscaPresentationValue(TOSCA_RESOURCE_NAME);
- }
- public void setToscaResourceName(String toscaResourceName) {
- setToscaPresentationValue(TOSCA_RESOURCE_NAME, toscaResourceName);
- }
-
- public String getWorkflowId(){
- return (String) getToscaPresentationValue(IO_WORKFLOW_ID);
- }
- public void setWorkflowId(String workflowId) {
- setToscaPresentationValue(IO_WORKFLOW_ID, workflowId);
- }
-
- public String getWorkflowVersionId() {
- return (String) getToscaPresentationValue(IO_WORKFLOW_VERSION_ID);
- }
- public void setWorkflowVersionId(String workflowVersionId) {
- setToscaPresentationValue(IO_WORKFLOW_VERSION_ID, workflowVersionId);
- }
-
- public String getArtifactUUID() {
- return (String) getToscaPresentationValue(ARTIFACT_UUID);
- }
- public void setArtifactUUID(String artifactUUID) {
- setToscaPresentationValue(ARTIFACT_UUID, artifactUUID);
- }
-
- public String getWorkflowAssociationType() {
- return (String) getToscaPresentationValue(IO_WORKFLOW_ASSOCIATION_TYPE);
- }
-
- public void setWorkflowAssociationType(String workflowAssociationType) {
- setToscaPresentationValue(IO_WORKFLOW_ASSOCIATION_TYPE, workflowAssociationType);
- }
-}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinition.java
deleted file mode 100644
index b8372d6793..0000000000
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinition.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright © 2016-2018 European Support Limited
- *
- * 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.
- */
-
-package org.openecomp.sdc.be.datatypes.elements;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
-
-import java.io.Serializable;
-
-import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_MANDATORY;
-import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_PROPERTY;
-import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_NAME;
-import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_TYPE;
-
-public class InterfaceOperationParamDataDefinition extends ToscaDataDefinition implements Serializable {
-
- @JsonCreator
- public InterfaceOperationParamDataDefinition() {
- super();
- }
-
- public InterfaceOperationParamDataDefinition(InterfaceOperationParamDataDefinition iopdd) {
- super();
- setName(iopdd.getName());
- setProperty(iopdd.getProperty());
- setMandatory(iopdd.getMandatory());
- setType(iopdd.getType());
- }
-
- public InterfaceOperationParamDataDefinition(String name, String property, boolean mandatory, String type) {
- super();
- setName(name);
- setProperty(property);
- setMandatory(mandatory);
- setType(type);
- }
-
- //used for OperationOutputDefinition
- public InterfaceOperationParamDataDefinition(String name, boolean mandatory, String type) {
- super();
- setName(name);
- setMandatory(mandatory);
- setType(type);
- }
-
- public String getName() {
- return (String) getToscaPresentationValue(IO_NAME);
- }
- public void setName(String name) {
- setToscaPresentationValue(IO_NAME, name);
- }
-
- public String getProperty() {
- return (String) getToscaPresentationValue(IO_PROPERTY);
- }
- public void setProperty(String property) {
- setToscaPresentationValue(IO_PROPERTY, property);
- }
-
- public Boolean getMandatory() {
- return (Boolean) getToscaPresentationValue(IO_MANDATORY);
- }
- public void setMandatory(Boolean mandatory) {
- setToscaPresentationValue(IO_MANDATORY, mandatory);
- }
-
- public String getType() {
- return (String) getToscaPresentationValue(IO_TYPE);
- }
- public void setType(String type) {
- setToscaPresentationValue(IO_TYPE, type);
- }
-}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java
index 722d605743..2c76411b3b 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/OperationDataDefinition.java
@@ -99,20 +99,20 @@ public class OperationDataDefinition extends ToscaDataDefinition implements Seri
public ListDataDefinition<OperationInputDefinition> getInputs() {
return (ListDataDefinition<OperationInputDefinition>)
- getToscaPresentationValue(JsonPresentationFields.OPERATION_INPUT);
+ getToscaPresentationValue(JsonPresentationFields.OPERATION_INPUTS);
}
public void setInputs(ListDataDefinition<OperationInputDefinition> inputs) {
- setToscaPresentationValue(JsonPresentationFields.OPERATION_INPUT,inputs);
+ setToscaPresentationValue(JsonPresentationFields.OPERATION_INPUTS, inputs);
}
public ListDataDefinition<OperationOutputDefinition> getOutputs() {
return (ListDataDefinition<OperationOutputDefinition>)
- getToscaPresentationValue(JsonPresentationFields.OPERATION_OUTPUT);
+ getToscaPresentationValue(JsonPresentationFields.OPERATION_OUTPUTS);
}
public void setOutputs(ListDataDefinition<OperationOutputDefinition> outputs) {
- setToscaPresentationValue(JsonPresentationFields.OPERATION_OUTPUT, outputs);
+ setToscaPresentationValue(JsonPresentationFields.OPERATION_OUTPUTS, outputs);
}
public String getName() {
return (String) getToscaPresentationValue(JsonPresentationFields.NAME);
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 d5283c6dc3..d621fedabe 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
@@ -211,25 +211,14 @@ public enum JsonPresentationFields {
CI_IS_ORIGIN_ARCHIVED("isOriginArchived", null),
//Interface Operation
- IO_OPERATION_TYPE("operationType",null),
- IO_INPUT_PARAMETERS("inputParams",null),
- IO_OUTPUT_PARAMETERS("outputParams",null),
- IO_NAME("name", null),
- IO_MANDATORY("mandatory", null),
- IO_TYPE("type", null),
- IO_PROPERTY("property", null),
IO_WORKFLOW_ID("workflowId", null),
IO_WORKFLOW_VERSION_ID("workflowVersionId", null),
IO_WORKFLOW_ASSOCIATION_TYPE("workflowAssociationType", null),
-
- //Interface
- INTERFACE ("interface", null),
- INTERFACE_OPERATION ("operation", null),
- OPERATION_IMPLEMENTATION("operationImplementation",null),
- OPERATION_INPUT("operationInput",null),
- OPERATION_OUTPUT("operationOutput", null)
- ;
-
+ INTERFACES ("interfaces", null),
+ OPERATIONS ("operations", null),
+ OPERATION_IMPLEMENTATION("implementation",null),
+ OPERATION_INPUTS("inputs",null),
+ OPERATION_OUTPUTS("outputs", null);
private String presentation;
private GraphPropertyEnum storedAs;
diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationDataDefinitionTest.java
deleted file mode 100644
index e0e07fd259..0000000000
--- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationDataDefinitionTest.java
+++ /dev/null
@@ -1,159 +0,0 @@
-package org.openecomp.sdc.be.datatypes.elements;
-
-import org.junit.Test;
-
-public class InterfaceOperationDataDefinitionTest {
-
- private InterfaceOperationDataDefinition createTestSubject() {
- return new InterfaceOperationDataDefinition();
- }
-
- @Test
- public void testCopyConstructor() throws Exception {
- InterfaceOperationDataDefinition testSubject;
-
- // default test
- testSubject = createTestSubject();
- new InterfaceOperationDataDefinition(testSubject);
- }
-
- @Test
- public void testGetInputParams() throws Exception {
- InterfaceOperationDataDefinition testSubject;
- ListDataDefinition<InterfaceOperationParamDataDefinition> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getInputParams();
- }
-
- @Test
- public void testSetInputParams() throws Exception {
- InterfaceOperationDataDefinition testSubject;
- ListDataDefinition<InterfaceOperationParamDataDefinition> inputParams = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setInputParams(inputParams);
- }
-
- @Test
- public void testGetOutputParams() throws Exception {
- InterfaceOperationDataDefinition testSubject;
- ListDataDefinition<InterfaceOperationParamDataDefinition> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getOutputParams();
- }
-
- @Test
- public void testSetOutputParams() throws Exception {
- InterfaceOperationDataDefinition testSubject;
- ListDataDefinition<InterfaceOperationParamDataDefinition> outputParams = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setOutputParams(outputParams);
- }
-
- @Test
- public void testGetUniqueId() throws Exception {
- InterfaceOperationDataDefinition testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getUniqueId();
- }
-
- @Test
- public void testSetUniqueId() throws Exception {
- InterfaceOperationDataDefinition testSubject;
- String uid = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setUniqueId(uid);
- }
-
- @Test
- public void testGetDescription() throws Exception {
- InterfaceOperationDataDefinition testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getDescription();
- }
-
- @Test
- public void testSetDescription() throws Exception {
- InterfaceOperationDataDefinition testSubject;
- String description = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setDescription(description);
- }
-
- @Test
- public void testGetOperationType() throws Exception {
- InterfaceOperationDataDefinition testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getOperationType();
- }
-
- @Test
- public void testSetOperationType() throws Exception {
- InterfaceOperationDataDefinition testSubject;
- String operationType = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setOperationType(operationType);
- }
-
- @Test
- public void testGetToscaResourceName() throws Exception {
- InterfaceOperationDataDefinition testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getToscaResourceName();
- }
-
- @Test
- public void testSetToscaResourceName() throws Exception {
- InterfaceOperationDataDefinition testSubject;
- String toscaResourceName = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setToscaResourceName(toscaResourceName);
- }
-
- @Test
- public void testGetArtifactUUID() throws Exception {
- InterfaceOperationDataDefinition testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getArtifactUUID();
- }
-
- @Test
- public void testSetArtifactUUID() throws Exception {
- InterfaceOperationDataDefinition testSubject;
- String artifactUUID = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setArtifactUUID(artifactUUID);
- }
-} \ No newline at end of file
diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinitionTest.java
deleted file mode 100644
index e25adb3c2f..0000000000
--- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinitionTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.openecomp.sdc.be.datatypes.elements;
-
-import org.junit.Test;
-
-public class InterfaceOperationParamDataDefinitionTest {
-
- private InterfaceOperationParamDataDefinition createTestSubject() {
- return new InterfaceOperationParamDataDefinition();
- }
-
- @Test
- public void testOverloadConstructor() throws Exception {
- InterfaceOperationParamDataDefinition testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- new InterfaceOperationParamDataDefinition(testSubject);
- new InterfaceOperationParamDataDefinition("", "",true, "");
- }
-
- @Test
- public void testGetParamName() throws Exception {
- InterfaceOperationParamDataDefinition testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getName();
- }
-
- @Test
- public void testSetParamName() throws Exception {
- InterfaceOperationParamDataDefinition testSubject;
- String paramName = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setName(paramName);
- }
-
- @Test
- public void testGetParamId() throws Exception {
- InterfaceOperationParamDataDefinition testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getProperty();
- }
-
- @Test
- public void testSetParamId() throws Exception {
- InterfaceOperationParamDataDefinition testSubject;
- String paramId = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setProperty(paramId);
- }
-} \ No newline at end of file