diff options
Diffstat (limited to 'catalog-be/src/test')
-rw-r--r-- | catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java | 53 | ||||
-rw-r--r-- | catalog-be/src/test/resources/config/catalog-be/error-configuration.yaml | 9 |
2 files changed, 11 insertions, 51 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java index bf3ec3cb7e..cd916d0d1e 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java @@ -678,54 +678,6 @@ class ComponentInstanceBusinessLogicTest { assertEquals(expectedResponse.getStatus(), actualResponse.getStatus()); } - @Test - void testToscaGetFunctionValidation_toscaFunctionNotSupportedTest() { - final String userId = "userId"; - final String containerComponentId = "containerComponentId"; - final String containerComponentName = "containerComponentName"; - final String resourceInstanceId = "resourceInstanceId"; - final List<ComponentInstanceProperty> properties = new ArrayList<>(); - final ComponentInstanceProperty propertyGetInput = new ComponentInstanceProperty(); - propertyGetInput.setName("anyName"); - final var toscaGetFunction = new ToscaGetFunctionDataDefinition(); - toscaGetFunction.setFunctionType(ToscaGetFunctionType.GET_ATTRIBUTE); - toscaGetFunction.setPropertySource(PropertySource.SELF); - toscaGetFunction.setPropertyPathFromSource(List.of("sourcePath")); - toscaGetFunction.setSourceName("sourceName"); - toscaGetFunction.setSourceUniqueId("sourceUniqueId"); - toscaGetFunction.setPropertyName("propertyName"); - toscaGetFunction.setPropertyUniqueId("propertyId"); - propertyGetInput.setToscaGetFunction(toscaGetFunction); - properties.add(propertyGetInput); - - final Component component = new Service(); - component.setName(containerComponentName); - component.setUniqueId(containerComponentId); - component.setLastUpdaterUserId(userId); - component.setLifecycleState(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT); - - final Map<String, List<ComponentInstanceProperty>> componentInstanceProps = new HashMap<>(); - componentInstanceProps.put(resourceInstanceId, properties); - component.setComponentInstancesProperties(componentInstanceProps); - - final ComponentInstance resourceInstance = createComponentInstance("componentInstance1"); - resourceInstance.setUniqueId(resourceInstanceId); - component.setComponentInstances(List.of(resourceInstance)); - - mockComponentForToscaGetFunctionValidation(component); - //when - final Either<List<ComponentInstanceProperty>, ResponseFormat> responseFormatEither = - componentInstanceBusinessLogic - .createOrUpdatePropertiesValues(ComponentTypeEnum.RESOURCE_INSTANCE, containerComponentId, resourceInstanceId, properties, userId); - //then - assertTrue(responseFormatEither.isRight(), "Expecting an error"); - final ResponseFormat actualResponse = responseFormatEither.right().value(); - final ResponseFormat expectedResponse = ToscaGetFunctionExceptionSupplier - .functionNotSupported(toscaGetFunction.getFunctionType()).get().getResponseFormat(); - assertEquals(expectedResponse.getFormattedMessage(), actualResponse.getFormattedMessage()); - assertEquals(expectedResponse.getStatus(), actualResponse.getStatus()); - } - @ParameterizedTest @MethodSource("getToscaFunctionForValidation") void testToscaGetFunctionValidation_AttributesNotFoundTest(final ToscaGetFunctionDataDefinition toscaGetFunction, @@ -762,9 +714,8 @@ class ComponentInstanceBusinessLogicTest { //then assertTrue(responseFormatEither.isRight(), "Expecting an error"); final ResponseFormat actualResponse = responseFormatEither.right().value(); - final ResponseFormat expectedResponse = expectedValidationResponse; - assertEquals(expectedResponse.getFormattedMessage(), actualResponse.getFormattedMessage()); - assertEquals(expectedResponse.getStatus(), actualResponse.getStatus()); + assertEquals(expectedValidationResponse.getFormattedMessage(), actualResponse.getFormattedMessage()); + assertEquals(expectedValidationResponse.getStatus(), actualResponse.getStatus()); } @Test diff --git a/catalog-be/src/test/resources/config/catalog-be/error-configuration.yaml b/catalog-be/src/test/resources/config/catalog-be/error-configuration.yaml index 2100dc8292..293bd49632 100644 --- a/catalog-be/src/test/resources/config/catalog-be/error-configuration.yaml +++ b/catalog-be/src/test/resources/config/catalog-be/error-configuration.yaml @@ -2392,3 +2392,12 @@ errors: message: "The %1 '%2' type '%3' was not found.", messageId: "SVC4170" } + + #-----------SVC4172--------------------------- + #%1 - TOSCA function attribute + TOSCA_FUNCTION_MISSING_ATTRIBUTE: { + code: 400, + message: "Missing TOSCA function '%1'.", + messageId: "SVC4172" + } + |