From 27633293d6d45521ea985019ea7b99c2009b62c7 Mon Sep 17 00:00:00 2001 From: JvD_Ericsson Date: Tue, 25 Jul 2023 09:47:41 +0100 Subject: Backend support for operation milestones with activity inputs Issue-ID: SDC-4582 Signed-off-by: JvD_Ericsson Change-Id: I625ec9bb05790bb5f9e78ed9d65abda8f8af5ec3 --- .../tosca/InterfacesOperationsConverterTest.java | 34 +++++++++++++++++++++- .../interfaceDefinition-legacy.yaml | 18 ++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) (limited to 'catalog-be/src/test') 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 createMilestones() { Map toscaMilestones = new HashMap<>(); + OperationInputDefinition input1 = new OperationInputDefinition(); + input1.setValue("testString"); + input1.setType("string"); + input1.setName("stringName"); + OperationInputDefinition input2 = createMockComplexOperationInputDefinition("complex", "complex"); + ListDataDefinition 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 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 activity = activities.get(0); assertEquals(1, activities.size()); assertTrue(activity.containsKey("delegate")); - Map activityVariables = (Map) activity.get("delegate"); + Map activityVariables = (Map) activity.get("delegate"); assertTrue(activityVariables.containsKey("workflow")); assertEquals("workflow1", activityVariables.get("workflow")); + assertTrue(activityVariables.containsKey("inputs")); + assertTrue(activityVariables.get("inputs") instanceof Map); + Map inputs = (Map) 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 complexInput = (Map) inputs.get("complex"); + assertTrue(complexInput.containsKey("intProp")); + assertTrue(complexInput.get("intProp") instanceof Integer); + assertEquals(1, complexInput.get("intProp")); + assertTrue(complexInput.containsKey("stringProp")); + Map complexInputStringProp = (Map) 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 -- cgit 1.2.3-korg