diff options
author | JvD_Ericsson <jeff.van.dam@est.tech> | 2023-07-25 09:47:41 +0100 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2023-09-22 07:43:02 +0000 |
commit | 27633293d6d45521ea985019ea7b99c2009b62c7 (patch) | |
tree | 1e3df4c1aa47c14c2cb5abeb19080056748353a3 /catalog-be/src/test | |
parent | 629837b3f7a282c74604987fd531ff4523f98a0c (diff) |
Backend support for operation milestones with activity inputs
Issue-ID: SDC-4582
Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech>
Change-Id: I625ec9bb05790bb5f9e78ed9d65abda8f8af5ec3
Diffstat (limited to 'catalog-be/src/test')
-rw-r--r-- | catalog-be/src/test/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverterTest.java | 34 | ||||
-rw-r--r-- | catalog-be/src/test/resources/interfaceDefinition/interfaceDefinition-legacy.yaml | 18 |
2 files changed, 51 insertions, 1 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverterTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverterTest.java index dfe4107b86..974d321c62 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverterTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/InterfacesOperationsConverterTest.java @@ -427,9 +427,18 @@ class InterfacesOperationsConverterTest { private Map<String, MilestoneDataDefinition> createMilestones() { Map<String, MilestoneDataDefinition> toscaMilestones = new HashMap<>(); + OperationInputDefinition input1 = new OperationInputDefinition(); + input1.setValue("testString"); + input1.setType("string"); + input1.setName("stringName"); + OperationInputDefinition input2 = createMockComplexOperationInputDefinition("complex", "complex"); + ListDataDefinition<OperationInputDefinition> inputs = new ListDataDefinition<>(); + inputs.add(input1); + inputs.add(input2); ActivityDataDefinition activity = new ActivityDataDefinition(); activity.setType(ActivityTypeEnum.DELEGATE.getValue()); activity.setWorkflow("workflow1"); + activity.setInputs(inputs); ListDataDefinition<ActivityDataDefinition> activities = new ListDataDefinition<>(); activities.add(activity); MilestoneDataDefinition milestone = new MilestoneDataDefinition(); @@ -607,6 +616,7 @@ class InterfacesOperationsConverterTest { @Test void testGetInterfaceAsMapWithMilestones() { + addComplexTypeToDataTypes(); Component component = new Resource(); component.setNormalizedName("normalizedComponentName"); InterfaceDefinition addedInterface = new InterfaceDefinition(); @@ -637,9 +647,31 @@ class InterfacesOperationsConverterTest { Map<String, Object> activity = activities.get(0); assertEquals(1, activities.size()); assertTrue(activity.containsKey("delegate")); - Map<String, String> activityVariables = (Map<String, String>) activity.get("delegate"); + Map<String, Object> activityVariables = (Map<String, Object>) activity.get("delegate"); assertTrue(activityVariables.containsKey("workflow")); assertEquals("workflow1", activityVariables.get("workflow")); + assertTrue(activityVariables.containsKey("inputs")); + assertTrue(activityVariables.get("inputs") instanceof Map); + Map<String, Object> inputs = (Map<String, Object>) activityVariables.get("inputs"); + assertNotNull(inputs); + assertTrue(inputs.containsKey("stringName")); + assertTrue(inputs.get("stringName") instanceof String); + String input = (String) inputs.get("stringName"); + assertEquals("testString", input); + assertTrue(inputs.containsKey("complex")); + Map<String, Object> complexInput = (Map<String, Object>) inputs.get("complex"); + assertTrue(complexInput.containsKey("intProp")); + assertTrue(complexInput.get("intProp") instanceof Integer); + assertEquals(1, complexInput.get("intProp")); + assertTrue(complexInput.containsKey("stringProp")); + Map<String, Object> complexInputStringProp = (Map<String, Object>) complexInput.get("stringProp"); + assertTrue(complexInputStringProp.containsKey("type")); + assertTrue(ToscaFunctionType.findType((String) complexInputStringProp.get("type")).isPresent()); + assertTrue(complexInputStringProp.containsKey("propertyName")); + assertEquals("designer", complexInputStringProp.get("propertyName")); + assertTrue(complexInputStringProp.containsKey("propertySource")); + assertEquals("SELF", complexInputStringProp.get("propertySource")); + } private void addComplexTypeToDataTypes() { diff --git a/catalog-be/src/test/resources/interfaceDefinition/interfaceDefinition-legacy.yaml b/catalog-be/src/test/resources/interfaceDefinition/interfaceDefinition-legacy.yaml index 8f350edd54..7daba75d5e 100644 --- a/catalog-be/src/test/resources/interfaceDefinition/interfaceDefinition-legacy.yaml +++ b/catalog-be/src/test/resources/interfaceDefinition/interfaceDefinition-legacy.yaml @@ -59,6 +59,24 @@ start: workflow: workflow1 - type: delegate workflow: workflow2 + inputs: + string: + type: string + value: testString + complex: + type: tosca.datatypes.nfv.VirtualCpu + value: + virtual_cpu_oversubscription_policy: pol + cpu_architecture: cpu + virtual_cpu_clock: 27Hz + vdu_cpu_requirements: + 'k1': 'v1' + 'k2': 'v2' + virtual_cpu_pinning: + virtual_cpu_pinning_policy: pol + virtual_cpu_pinning_rule: + - 1 + - 2 on_timeout: activities: - type: delegate |