aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be
diff options
context:
space:
mode:
authorKrupaNagabhushan <krupa.nagabhushan@est.tech>2021-08-22 02:04:29 +0100
committerMichael Morris <michael.morris@est.tech>2021-08-24 20:43:02 +0000
commit5f0adaaf5879db0ff9a0d9e772dc6fd6c35901af (patch)
tree12475f113c0391e8caacba56e1a2622a05db5042 /catalog-be
parent38f534f4c7c425f49925dd2d3615729eba703130 (diff)
Fix artifact name invalid error message
Issue-ID: SDC-3680 Signed-off-by: KrupaNagabhushan <krupa.nagabhushan@est.tech> Change-Id: I859953a9a0d8065437589cd7592137b14b29c7e5
Diffstat (limited to 'catalog-be')
-rw-r--r--catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/files/default/error-configuration.yaml4
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java4
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/impl/ComponentsUtils.java7
3 files changed, 11 insertions, 4 deletions
diff --git a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/files/default/error-configuration.yaml b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/files/default/error-configuration.yaml
index 8f5b2b6355..6d243d2e94 100644
--- a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/files/default/error-configuration.yaml
+++ b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/files/default/error-configuration.yaml
@@ -1803,9 +1803,11 @@ errors:
messageId: "SVC4669"
}
#---------SVC4670------------------------------
+ # %1 - artifactname
+ # %2 - validname
ARTIFACT_NAME_INVALID: {
code: 400,
- message: "Error: Artifact name is invalid.",
+ message: "Error: Artifact name '%1' is invalid. Only the following characters are allowed in the Artifact Name: '%2'.",
messageId: "SVC4670"
}
#---------SVC4671------------------------------
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 152b78b15c..0e08be5d7a 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
@@ -198,6 +198,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
private static final String CREATE_RESOURCE_VALIDATE_CAPABILITY_TYPES = "Create Resource - validateCapabilityTypesCreate";
private static final String COMPONENT_INSTANCE_WITH_NAME = "component instance with name ";
private static final String COMPONENT_INSTANCE_WITH_NAME_IN_RESOURCE = "component instance with name {} in resource {} ";
+ private static final String VALID_CHARACTERS_ARTIFACT_NAME = "'A-Z', 'a-z', '0-9', '.', '_', '-', '@' and space";
private static final LoggerSupportability loggerSupportability = LoggerSupportability.getLogger(ResourceBusinessLogic.class.getName());
private final ComponentInstanceBusinessLogic componentInstanceBusinessLogic;
private final ResourceImportManager resourceImportManager;
@@ -2148,7 +2149,8 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
Either<List<NonMetaArtifactInfo>, String> artifactPathAndNameList = getValidArtifactNames(csarInfo, collectedWarningMessages);
if (artifactPathAndNameList.isRight()) {
return Either.right(
- getComponentsUtils().getResponseFormatByArtifactId(ActionStatus.ARTIFACT_NAME_INVALID, artifactPathAndNameList.right().value()));
+ getComponentsUtils().getResponseFormatByArtifactId(ActionStatus.ARTIFACT_NAME_INVALID, artifactPathAndNameList.right().value(),
+ VALID_CHARACTERS_ARTIFACT_NAME));
}
EnumMap<ArtifactOperationEnum, List<NonMetaArtifactInfo>> vfCsarArtifactsToHandle = null;
if (artifactOperation.isCreateOrLink()) {
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ComponentsUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ComponentsUtils.java
index 3b55e67c75..af05825545 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ComponentsUtils.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ComponentsUtils.java
@@ -404,12 +404,15 @@ public class ComponentsUtils {
return responseFormat;
}
- public ResponseFormat getResponseFormatByArtifactId(ActionStatus actionStatus, String artifactId) {
+ public ResponseFormat getResponseFormatByArtifactId(ActionStatus actionStatus, String... params) {
ResponseFormat responseFormat;
switch (actionStatus) {
case RESOURCE_NOT_FOUND:
case ARTIFACT_NOT_FOUND:
- responseFormat = getResponseFormat(ActionStatus.ARTIFACT_NOT_FOUND, artifactId);
+ responseFormat = getResponseFormat(ActionStatus.ARTIFACT_NOT_FOUND, params);
+ break;
+ case ARTIFACT_NAME_INVALID:
+ responseFormat = getResponseFormat(ActionStatus.ARTIFACT_NAME_INVALID, params);
break;
default:
responseFormat = getResponseFormat(actionStatus);