summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test/java/org
diff options
context:
space:
mode:
authorojasdubey <ojas.dubey@amdocs.com>2018-07-17 17:18:51 +0530
committerojasdubey <ojas.dubey@amdocs.com>2018-07-17 17:18:51 +0530
commit4a5b82998fdd61e84e81b298043c5ef8feafac24 (patch)
treedf687006f9bb1fe1f30ad23f4e8c2fe855a9d3ab /catalog-be/src/test/java/org
parente52b1dc4c0beb4727d21463e3c9b0a87611e70eb (diff)
Revert - Workflow Operation output tosca
Reverting changes to export workflow operation outputs to TOSCA template Change-Id: I0d50fd8eea0200efa3102494a0aadd1527d39a8b Issue-ID: SDC-1450 Signed-off-by: ojasdubey <ojas.dubey@amdocs.com>
Diffstat (limited to 'catalog-be/src/test/java/org')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/InterfaceUIDataConverterTest.java8
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtilTest.java67
2 files changed, 16 insertions, 59 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/InterfaceUIDataConverterTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/InterfaceUIDataConverterTest.java
index 7e8dde9842..b158ddf5da 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/InterfaceUIDataConverterTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/datamodel/utils/InterfaceUIDataConverterTest.java
@@ -1,10 +1,15 @@
package org.openecomp.sdc.be.datamodel.utils;
+import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.IO_INPUT_PARAMETERS;
+
+import java.util.LinkedList;
+
import org.junit.Test;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.InterfaceOperationDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.OperationInputDefinition;
+import org.openecomp.sdc.be.datatypes.elements.OperationOutputDefinition;
import org.openecomp.sdc.be.model.Operation;
public class InterfaceUIDataConverterTest {
@@ -23,8 +28,9 @@ public class InterfaceUIDataConverterTest {
Operation operationData = new Operation();
InterfaceOperationDataDefinition result;
ListDataDefinition<OperationInputDefinition> inputs = new ListDataDefinition<>();
+ ListDataDefinition<OperationOutputDefinition> outputs = new ListDataDefinition<>();
operationData.setInputs(inputs);
- operationData.setOutputs(new ListDataDefinition<>());
+ operationData.setOutputs(outputs);
operationData.setImplementation(new ArtifactDataDefinition());
// default test
result = InterfaceUIDataConverter.convertOperationDataToInterfaceData(operationData);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtilTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtilTest.java
index 0c5db04bbd..67b27f678f 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtilTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtilTest.java
@@ -27,7 +27,6 @@ import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.OperationInputDefinition;
-import org.openecomp.sdc.be.datatypes.elements.OperationOutputDefinition;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.InterfaceDefinition;
import org.openecomp.sdc.be.model.Resource;
@@ -36,6 +35,11 @@ import org.openecomp.sdc.be.tosca.ToscaRepresentation;
import org.openecomp.sdc.be.tosca.model.ToscaNodeType;
import org.openecomp.sdc.be.tosca.model.ToscaTemplate;
+/**
+ * @author KATYR
+ * @since April 12, 2018
+ */
+
public class InterfacesOperationsToscaUtilTest {
@BeforeClass
@@ -50,7 +54,7 @@ public class InterfacesOperationsToscaUtilTest {
component.setNormalizedName("normalizedComponentName");
InterfaceDefinition addedInterface = new InterfaceDefinition();
addedInterface.setToscaResourceName("interface.types.test_resource_name");
- addOperationsToInterface(addedInterface, 5, 3, 0, true, false);
+ addOperationsToInterface(addedInterface, 5, 3, true);
final String interfaceType = "normalizedComponentName-interface";
((Resource) component).setInterfaces(new HashMap<>());
((Resource) component).getInterfaces().put(interfaceType, addedInterface);
@@ -73,7 +77,7 @@ public class InterfacesOperationsToscaUtilTest {
InterfaceDefinition addedInterface = new InterfaceDefinition();
addedInterface.setToscaResourceName("com.some.resource.or.other.resourceName");
- addOperationsToInterface(addedInterface, 3, 2, 0, true, false);
+ addOperationsToInterface(addedInterface, 3, 2, true);
final String interfaceType = "normalizedComponentName-interface";
((Resource) component).setInterfaces(new HashMap<>());
((Resource) component).getInterfaces().put(interfaceType, addedInterface);
@@ -103,7 +107,7 @@ public class InterfacesOperationsToscaUtilTest {
InterfaceDefinition addedInterface = new InterfaceDefinition();
addedInterface.setToscaResourceName("com.some.resource.or.other.resourceNameNoInputs");
- addOperationsToInterface(addedInterface, 3, 3, 0, false, false);
+ addOperationsToInterface(addedInterface, 3, 3, false);
final String interfaceType = "normalizedComponentName-interface";
((Resource) component).setInterfaces(new HashMap<>());
((Resource) component).getInterfaces().put(interfaceType, addedInterface);
@@ -125,38 +129,9 @@ public class InterfacesOperationsToscaUtilTest {
Assert.assertTrue(toscaRepresentation.getMainYaml().contains("com.some.resource.or.other.resourceName"));
}
- @Test
- public void addInterfaceDefinitionElementWithOutputs() {
- Component component = new Resource();
- component.setNormalizedName("normalizedComponentName");
- InterfaceDefinition addedInterface = new InterfaceDefinition();
- addedInterface.setToscaResourceName("com.some.resource.or.other.resourceName");
-
- addOperationsToInterface(addedInterface, 2, 0, 2, false, true);
- final String interfaceType = "normalizedComponentName-interface";
- ((Resource) component).setInterfaces(new HashMap<>());
- ((Resource) component).getInterfaces().put(interfaceType, addedInterface);
- ToscaNodeType nodeType = new ToscaNodeType();
- InterfacesOperationsToscaUtil.addInterfaceDefinitionElement(component, nodeType);
-
- ToscaExportHandler handler = new ToscaExportHandler();
- ToscaTemplate template = new ToscaTemplate("test");
- Map<String, ToscaNodeType> nodeTypes = new HashMap<>();
- nodeTypes.put("test", nodeType);
- template.setNode_types(nodeTypes);
- final ToscaRepresentation toscaRepresentation = handler.createToscaRepresentation(template);
-
- Assert.assertFalse(toscaRepresentation.getMainYaml().contains("operations"));
- Assert.assertTrue(toscaRepresentation.getMainYaml().contains("resourceName:"));
- Assert.assertTrue(toscaRepresentation.getMainYaml().contains("outputs:"));
- Assert.assertFalse(toscaRepresentation.getMainYaml().contains("defaultp"));
- Assert.assertTrue(toscaRepresentation.getMainYaml().contains("has description"));
- Assert.assertTrue(toscaRepresentation.getMainYaml().contains("naming_function_"));
- Assert.assertTrue(toscaRepresentation.getMainYaml().contains("com.some.resource.or.other.resourceName"));
- }
private void addOperationsToInterface(InterfaceDefinition addedInterface, int numOfOps, int numOfInputsPerOp,
- int numOfOutputsPerOp, boolean hasInputs, boolean hasOutputs) {
+ boolean hasInputs) {
addedInterface.setOperations(new HashMap<>());
for (int i = 0; i < numOfOps; i++) {
@@ -169,9 +144,6 @@ public class InterfacesOperationsToscaUtilTest {
if (hasInputs) {
operation.setInputs(createInputs(numOfInputsPerOp));
}
- if (hasOutputs) {
- operation.setOutputs(createOutputs(numOfOutputsPerOp));
- }
addedInterface.getOperations().put(operation.getName(), operation);
}
}
@@ -186,18 +158,6 @@ public class InterfacesOperationsToscaUtilTest {
return operationInputDefinitionList;
}
- private ListDataDefinition<OperationOutputDefinition> createOutputs(int numOfOutputs) {
- ListDataDefinition<OperationOutputDefinition> operationOutputDefinitionList = new ListDataDefinition<>();
- for (int i = 0; i < numOfOutputs; i++) {
- operationOutputDefinitionList.add(createMockOperationOutputDefinition("output_" + i,
- java.util.UUID.randomUUID().toString() + "." + "naming_function_" + i, getTestOutputType(i)));
- }
- return operationOutputDefinitionList;
- }
-
- private String getTestOutputType(int i) {
- return i%2 == 0 ? "integer" : "boolean";
- }
private OperationInputDefinition createMockOperationInputDefinition(String name, String id) {
OperationInputDefinition operationInputDefinition = new OperationInputDefinition();
@@ -205,13 +165,4 @@ public class InterfacesOperationsToscaUtilTest {
operationInputDefinition.setInputId(id);
return operationInputDefinition;
}
-
- private OperationOutputDefinition createMockOperationOutputDefinition(String name, String id, String type) {
- OperationOutputDefinition operationOutputDefinition = new OperationOutputDefinition();
- operationOutputDefinition.setName(name);
- operationOutputDefinition.setInputId(id);
- operationOutputDefinition.setType(type);
- return operationOutputDefinition;
- }
-
}