diff options
Diffstat (limited to 'common-be/src')
7 files changed, 460 insertions, 11 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 d3a6903091..c0505c2b3d 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.OPERATIONS); + getToscaPresentationValue(JsonPresentationFields.INTERFACE_OPERATION); } public void setOperations(Map<String, OperationDataDefinition> operations) { - setToscaPresentationValue(JsonPresentationFields.OPERATIONS, operations); + setToscaPresentationValue(JsonPresentationFields.INTERFACE_OPERATION, 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 new file mode 100644 index 0000000000..29093e9382 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationDataDefinition.java @@ -0,0 +1,131 @@ +/* + * 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 new file mode 100644 index 0000000000..b8372d6793 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinition.java @@ -0,0 +1,87 @@ +/* + * 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 2c76411b3b..722d605743 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_INPUTS); + getToscaPresentationValue(JsonPresentationFields.OPERATION_INPUT); } public void setInputs(ListDataDefinition<OperationInputDefinition> inputs) { - setToscaPresentationValue(JsonPresentationFields.OPERATION_INPUTS, inputs); + setToscaPresentationValue(JsonPresentationFields.OPERATION_INPUT,inputs); } public ListDataDefinition<OperationOutputDefinition> getOutputs() { return (ListDataDefinition<OperationOutputDefinition>) - getToscaPresentationValue(JsonPresentationFields.OPERATION_OUTPUTS); + getToscaPresentationValue(JsonPresentationFields.OPERATION_OUTPUT); } public void setOutputs(ListDataDefinition<OperationOutputDefinition> outputs) { - setToscaPresentationValue(JsonPresentationFields.OPERATION_OUTPUTS, outputs); + setToscaPresentationValue(JsonPresentationFields.OPERATION_OUTPUT, 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 d621fedabe..d5283c6dc3 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,14 +211,25 @@ 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), - INTERFACES ("interfaces", null), - OPERATIONS ("operations", null), - OPERATION_IMPLEMENTATION("implementation",null), - OPERATION_INPUTS("inputs",null), - OPERATION_OUTPUTS("outputs", null); + + //Interface + INTERFACE ("interface", null), + INTERFACE_OPERATION ("operation", null), + OPERATION_IMPLEMENTATION("operationImplementation",null), + OPERATION_INPUT("operationInput",null), + OPERATION_OUTPUT("operationOutput", 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 new file mode 100644 index 0000000000..e0e07fd259 --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationDataDefinitionTest.java @@ -0,0 +1,159 @@ +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 new file mode 100644 index 0000000000..e25adb3c2f --- /dev/null +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/InterfaceOperationParamDataDefinitionTest.java @@ -0,0 +1,61 @@ +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 |