From e7dfc47fc893cc6aef80f795bd675f8443864550 Mon Sep 17 00:00:00 2001 From: aribeiro Date: Mon, 30 Sep 2019 11:04:00 +0100 Subject: [PATCH] Fix for error message. Fixing error message for invalid values across SDC backend API. Issue-ID: SDC-2324 Change-Id: If01307138baf7692e398abf20eb75bbe9a8aa394 Signed-off-by: aribeiro --- asdctool/src/main/resources/config/error-configuration.yaml | 8 ++++---- .../sdc/be/components/impl/ResourceBusinessLogic.java | 4 ++-- .../src/main/resources/config/error-configuration.yaml | 8 ++++---- .../sdc/be/components/impl/ResourceBusinessLogicTest.java | 12 ++++++------ .../resources/config/catalog-be/error-configuration.yaml | 8 ++++---- test-apis-ci/src/test/resources/CI/error-configuration.yaml | 8 ++++---- .../resources/config/test-apis-ci/error-configuration.yaml | 8 ++++---- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/asdctool/src/main/resources/config/error-configuration.yaml b/asdctool/src/main/resources/config/error-configuration.yaml index c21f24b2ad..e201f8979a 100644 --- a/asdctool/src/main/resources/config/error-configuration.yaml +++ b/asdctool/src/main/resources/config/error-configuration.yaml @@ -136,7 +136,7 @@ errors: # %1 - resource/service COMPONENT_INVALID_CATEGORY: { code: 400, - message: "Error: Invalid Content. Invalid %1 category.", + message: "Error: Invalid Content. Value %1 for the field Category is invalid.", messageId: "SVC4054" } #---------SVC4055------------------------------ @@ -249,20 +249,20 @@ errors: # %1 - Service/Resource INVALID_COMPONENT_NAME: { code: 400, - message: 'Error: Invalid Content. %1 name is not allowed to contain characters like <>:"\/|?* and space characters other than regular space.', + message: 'Error: Invalid Content. Value %1 for Component name is invalid. Only alphanumeric characters and regular spaces are allowed.', messageId: "SVC4070" } #---------SVC4071------------------------------ INVALID_VENDOR_NAME: { code: 400, - message: 'Error: Invalid Content. Vendor name is not allowed to contain characters like <>:"\/|?* and space characters other than regular space.', + message: 'Error: Invalid Content. Value %1 for the field Vendor name is invalid. Only alphanumeric characters and regular spaces are allowed.', messageId: "SVC4071" } #---------SVC4072------------------------------ INVALID_VENDOR_RELEASE: { code: 400, - message: 'Error: Invalid Content. Vendor release is not allowed to contain characters like <>:"\/|?* and space characters other than regular space.', + message: 'Error: Invalid Content. Value %1 for the field Vendor release is invalid. Only alphanumeric characters and regular spaces are allowed.', messageId: "SVC4072" } #---------SVC4073------------------------------ diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java index c40c845718..5a997205ea 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java @@ -4695,7 +4695,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { log.info("vendor release is not valid."); ResponseFormat errorResponse = componentsUtils.getResponseFormat(ActionStatus.INVALID_VENDOR_RELEASE); componentsUtils.auditResource(errorResponse, user, resource, actionEnum); - throw new ByActionStatusComponentException(ActionStatus.INVALID_VENDOR_RELEASE); + throw new ByActionStatusComponentException(ActionStatus.INVALID_VENDOR_RELEASE, vendorRelease); } } } @@ -4728,7 +4728,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { log.info("vendor name is not valid."); ResponseFormat errorResponse = componentsUtils.getResponseFormat(ActionStatus.INVALID_VENDOR_NAME); componentsUtils.auditResource(errorResponse, user, resource, actionEnum); - throw new ByActionStatusComponentException(ActionStatus.INVALID_VENDOR_NAME); + throw new ByActionStatusComponentException(ActionStatus.INVALID_VENDOR_NAME, vendorName); } } } diff --git a/catalog-be/src/main/resources/config/error-configuration.yaml b/catalog-be/src/main/resources/config/error-configuration.yaml index adc467c913..3045e9ec97 100644 --- a/catalog-be/src/main/resources/config/error-configuration.yaml +++ b/catalog-be/src/main/resources/config/error-configuration.yaml @@ -152,7 +152,7 @@ errors: # %1 - resource/service COMPONENT_INVALID_CATEGORY: { code: 400, - message: "Error: Invalid Content. Invalid %1 category.", + message: "Error: Invalid Content. Value %1 for the field Category is invalid.", messageId: "SVC4054" } #---------SVC4055------------------------------ @@ -265,20 +265,20 @@ errors: # %1 - Service/Resource INVALID_COMPONENT_NAME: { code: 400, - message: 'Error: Invalid Content. %1 name is not allowed to contain characters like <>:"\/|?* and space characters other than regular space.', + message: 'Error: Invalid Content. Value %1 for Component name is invalid. Only alphanumeric characters and regular spaces are allowed.', messageId: "SVC4070" } #---------SVC4071------------------------------ INVALID_VENDOR_NAME: { code: 400, - message: 'Error: Invalid Content. Vendor name is not allowed to contain characters like <>:"\/|?* and space characters other than regular space.', + message: 'Error: Invalid Content. Value %1 for the field Vendor name is invalid. Only alphanumeric characters and regular spaces are allowed.', messageId: "SVC4071" } #---------SVC4072------------------------------ INVALID_VENDOR_RELEASE: { code: 400, - message: 'Error: Invalid Content. Vendor release is not allowed to contain characters like <>:"\/|?* and space characters other than regular space.', + message: 'Error: Invalid Content. Value %1 for the field Vendor release is invalid. Only alphanumeric characters and regular spaces are allowed.', messageId: "SVC4072" } #---------SVC4073------------------------------ diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java index 92168fa871..18f39b1892 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogicTest.java @@ -799,19 +799,19 @@ public class ResourceBusinessLogicTest extends ComponentBusinessLogicMock { try { bl.createResource(resource, AuditingActionEnum.CREATE_RESOURCE, user, null, null); } catch (ByActionStatusComponentException e) { - assertComponentException(e, ActionStatus.INVALID_VENDOR_NAME); + assertComponentException(e, ActionStatus.INVALID_VENDOR_NAME, nameWrongFormat); } } private void testVendorReleaseWrongFormat() { Resource resource = createResourceObject(false); // contains > - String nameWrongFormat = "1>2"; - resource.setVendorRelease(nameWrongFormat); + String vendorReleaseWrongFormat = "1>2"; + resource.setVendorRelease(vendorReleaseWrongFormat); try { bl.createResource(resource, AuditingActionEnum.CREATE_RESOURCE, user, null, null); } catch (ByActionStatusComponentException e) { - assertComponentException(e, ActionStatus.INVALID_VENDOR_RELEASE); + assertComponentException(e, ActionStatus.INVALID_VENDOR_RELEASE, vendorReleaseWrongFormat); } } @@ -1200,7 +1200,7 @@ public class ResourceBusinessLogicTest extends ComponentBusinessLogicMock { try { bl.updateResourceMetadata(resource.getUniqueId(), updatedResource, null, user, false); } catch (ByActionStatusComponentException e) { - assertComponentException(e, ActionStatus.INVALID_VENDOR_NAME); + assertComponentException(e, ActionStatus.INVALID_VENDOR_NAME, nameWrongFormat); } } @@ -1223,7 +1223,7 @@ public class ResourceBusinessLogicTest extends ComponentBusinessLogicMock { try { bl.updateResourceMetadata(resource.getUniqueId(), updatedResource, null, user, false); } catch (ByActionStatusComponentException e) { - assertComponentException(e, ActionStatus.INVALID_VENDOR_NAME); + assertComponentException(e, ActionStatus.INVALID_VENDOR_NAME, nameWrongFormat); } } 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 9475c696f5..5ef10e035a 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 @@ -146,7 +146,7 @@ errors: # %1 - resource/service COMPONENT_INVALID_CATEGORY: { code: 400, - message: "Error: Invalid Content. Invalid %1 category.", + message: "Error: Invalid Content. Value %1 for the field Category is invalid.", messageId: "SVC4054" } #---------SVC4055------------------------------ @@ -259,20 +259,20 @@ errors: # %1 - Service/Resource INVALID_COMPONENT_NAME: { code: 400, - message: 'Error: Invalid Content. %1 name is not allowed to contain characters like <>:"\/|?* and space characters other than regular space.', + message: 'Error: Invalid Content. Value %1 for Component name is invalid. Only alphanumeric characters and regular spaces are allowed.', messageId: "SVC4070" } #---------SVC4071------------------------------ INVALID_VENDOR_NAME: { code: 400, - message: 'Error: Invalid Content. Vendor name is not allowed to contain characters like <>:"\/|?* and space characters other than regular space.', + message: 'Error: Invalid Content. Value %1 for the field Vendor name is invalid. Only alphanumeric characters and regular spaces are allowed.', messageId: "SVC4071" } #---------SVC4072------------------------------ INVALID_VENDOR_RELEASE: { code: 400, - message: 'Error: Invalid Content. Vendor release is not allowed to contain characters like <>:"\/|?* and space characters other than regular space.', + message: 'Error: Invalid Content. Value %1 for the field Vendor release is invalid. Only alphanumeric characters and regular spaces are allowed.', messageId: "SVC4072" } #---------SVC4073------------------------------ diff --git a/test-apis-ci/src/test/resources/CI/error-configuration.yaml b/test-apis-ci/src/test/resources/CI/error-configuration.yaml index e06343717e..7fc65221aa 100644 --- a/test-apis-ci/src/test/resources/CI/error-configuration.yaml +++ b/test-apis-ci/src/test/resources/CI/error-configuration.yaml @@ -142,7 +142,7 @@ errors: # %1 - resource/service COMPONENT_INVALID_CATEGORY: { code: 400, - message: "Error: Invalid Content. Invalid %1 category.", + message: "Error: Invalid Content. Value %1 for the field Category is invalid.", messageId: "SVC4054" } #---------SVC4055------------------------------ @@ -255,20 +255,20 @@ errors: # %1 - Service/Resource INVALID_COMPONENT_NAME: { code: 400, - message: 'Error: Invalid Content. %1 name is not allowed to contain characters like <>:"\/|?* and space characters other than regular space.', + message: 'Error: Invalid Content. Value %1 for Component name is invalid. Only alphanumeric characters and regular spaces are allowed.', messageId: "SVC4070" } #---------SVC4071------------------------------ INVALID_VENDOR_NAME: { code: 400, - message: 'Error: Invalid Content. Vendor name is not allowed to contain characters like <>:"\/|?* and space characters other than regular space.', + message: 'Error: Invalid Content. Value %1 for the field Vendor name is invalid. Only alphanumeric characters and regular spaces are allowed.', messageId: "SVC4071" } #---------SVC4072------------------------------ INVALID_VENDOR_RELEASE: { code: 400, - message: 'Error: Invalid Content. Vendor release is not allowed to contain characters like <>:"\/|?* and space characters other than regular space.', + message: 'Error: Invalid Content. Value %1 for the field Vendor release is invalid. Only alphanumeric characters and regular spaces are allowed.', messageId: "SVC4072" } #---------SVC4073------------------------------ diff --git a/test-apis-ci/src/test/resources/config/test-apis-ci/error-configuration.yaml b/test-apis-ci/src/test/resources/config/test-apis-ci/error-configuration.yaml index 5bf37daad6..268c440222 100644 --- a/test-apis-ci/src/test/resources/config/test-apis-ci/error-configuration.yaml +++ b/test-apis-ci/src/test/resources/config/test-apis-ci/error-configuration.yaml @@ -147,7 +147,7 @@ errors: # %1 - resource/service COMPONENT_INVALID_CATEGORY: { code: 400, - message: "Error: Invalid Content. Invalid %1 category.", + message: "Error: Invalid Content. Value %1 for the field Category is invalid.", messageId: "SVC4054" } #---------SVC4055------------------------------ @@ -260,20 +260,20 @@ errors: # %1 - Service/Resource INVALID_COMPONENT_NAME: { code: 400, - message: 'Error: Invalid Content. %1 name is not allowed to contain characters like <>:"\/|?* and space characters other than regular space.', + message: 'Error: Invalid Content. Value %1 for Component name is invalid. Only alphanumeric characters and regular spaces are allowed.', messageId: "SVC4070" } #---------SVC4071------------------------------ INVALID_VENDOR_NAME: { code: 400, - message: 'Error: Invalid Content. Vendor name is not allowed to contain characters like <>:"\/|?* and space characters other than regular space.', + message: 'Error: Invalid Content. Value %1 for the field Vendor name is invalid. Only alphanumeric characters and regular spaces are allowed.', messageId: "SVC4071" } #---------SVC4072------------------------------ INVALID_VENDOR_RELEASE: { code: 400, - message: 'Error: Invalid Content. Vendor release is not allowed to contain characters like <>:"\/|?* and space characters other than regular space.', + message: 'Error: Invalid Content. Value %1 for the field Vendor release is invalid. Only alphanumeric characters and regular spaces are allowed.', messageId: "SVC4072" } #---------SVC4073------------------------------ -- 2.16.6