summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib
diff options
context:
space:
mode:
authorandre.schmid <andre.schmid@est.tech>2022-03-24 13:11:04 +0000
committerMichael Morris <michael.morris@est.tech>2022-04-04 15:25:41 +0000
commitf6b81e6da9b95ec5ef2c8b2b7b50fb8de9f3dd28 (patch)
tree6503dc17a281a267dbf9e775552ac4444a6b7170 /openecomp-be/lib
parentf2e43fb0a2c36b484b686d6c22342e72da66f679 (diff)
Log partial VSP deletion
Adds entries to the VSP activity log identifying the VSP versions deleted from the MinIO client, and also if the deletion was fully complete. If the VSP deletion from the database fails, there will be registry of what happened with the MinIO deletion. Do some refactor in the VendorSoftwareProductsImpl in relation to the VSP deletion flow and responses. Issue-ID: SDC-3931 Change-Id: I75cb9d7fb74a48db01b242a5f70fefa0a88faa0d Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'openecomp-be/lib')
-rw-r--r--openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java6
-rw-r--r--openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-api/src/main/java/org/openecomp/sdc/activitylog/dao/type/ActivityType.java1
-rw-r--r--openecomp-be/lib/openecomp-sdc-datatypes-lib/src/main/java/org/openecomp/sdc/datatypes/model/ItemType.java12
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/VendorSoftwareProductNotFoundErrorBuilder.java7
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java5
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/VendorSoftwareProductNotFoundErrorBuilderTest.java3
6 files changed, 27 insertions, 7 deletions
diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java
index 2ed67b3963..2b97335f8e 100644
--- a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java
+++ b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java
@@ -96,9 +96,13 @@ public enum Messages {
SUB_ENTITY_NOT_FOUND("Incorrect sub entity details provided."),
FAILED_TO_SYNC("Non existing version cannot be synced."),
FAILED_TO_PUBLISH_OUT_OF_SYNC("Publish is not allowed since the version status is Out of sync"),
- DELETE_VSP_ERROR("Certified VSP must be archived before it can be deleted."),
+ DELETE_VSP_ERROR("Failed to delete VSP '%s' from database"),
+ DELETE_CERTIFIED_VSP_ERROR("Certified VSP '%s' must be archived before it can be deleted."),
DELETE_VSP_ERROR_USED_BY_VF("VSP cannot be deleted as it is used by VF %s. The VSP will only be available for deletion if VF %s is deleted."),
DELETE_VSP_UNEXPECTED_ERROR_USED_BY_VF("An error occurred while retrieving the usage of VSP %s through the rest endpoint %s"),
+ VSP_NOT_FOUND("Vendor Software Product with id '%s' was not found."),
+ VSP_VERSION_NOT_FOUND("Vendor Software Product with id '%s' and version id '%s' was not found."),
+ DELETE_NOT_ARCHIVED_VSP_ERROR("The certified VSP '%s' must be archived before it can be deleted."),
DELETE_VSP_FROM_STORAGE_ERROR("Failed to delete VSP '%s' from Storage"),
DELETE_VLM_ERROR("VLM has been certified and cannot be deleted."),
DELETE_VSP_ARCHIVED_ERROR("VSP has not been archived and cannot be deleted."),
diff --git a/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-api/src/main/java/org/openecomp/sdc/activitylog/dao/type/ActivityType.java b/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-api/src/main/java/org/openecomp/sdc/activitylog/dao/type/ActivityType.java
index 5566d2b788..51e9689594 100644
--- a/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-api/src/main/java/org/openecomp/sdc/activitylog/dao/type/ActivityType.java
+++ b/openecomp-be/lib/openecomp-sdc-activity-log-lib/openecomp-sdc-activity-log-api/src/main/java/org/openecomp/sdc/activitylog/dao/type/ActivityType.java
@@ -26,6 +26,7 @@ public enum ActivityType {
Create_Version,
Commit,
Submit,
+ Delete_From_Storage,
Upload_Artifact,
Upload_Network_Package,
Revert,
diff --git a/openecomp-be/lib/openecomp-sdc-datatypes-lib/src/main/java/org/openecomp/sdc/datatypes/model/ItemType.java b/openecomp-be/lib/openecomp-sdc-datatypes-lib/src/main/java/org/openecomp/sdc/datatypes/model/ItemType.java
index ff4bfd95ab..4968a90a42 100644
--- a/openecomp-be/lib/openecomp-sdc-datatypes-lib/src/main/java/org/openecomp/sdc/datatypes/model/ItemType.java
+++ b/openecomp-be/lib/openecomp-sdc-datatypes-lib/src/main/java/org/openecomp/sdc/datatypes/model/ItemType.java
@@ -19,4 +19,14 @@
*/
package org.openecomp.sdc.datatypes.model;
-public enum ItemType {vlm, vsp}
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@AllArgsConstructor
+public enum ItemType {
+ vlm("vlm"), vsp("vsp");
+
+ @Getter
+ private final String name;
+
+}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/VendorSoftwareProductNotFoundErrorBuilder.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/VendorSoftwareProductNotFoundErrorBuilder.java
index 5b0933d03f..3d6180c380 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/VendorSoftwareProductNotFoundErrorBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/VendorSoftwareProductNotFoundErrorBuilder.java
@@ -23,11 +23,10 @@ import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProdu
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
+import org.openecomp.sdc.common.errors.Messages;
public class VendorSoftwareProductNotFoundErrorBuilder {
- private static final String VSP_FOUND_MSG = "Vendor software product with Id %s not found.";
- private static final String VSP_ID_AND_VERSION_ID_NOT_FOUND_MSG = "Vendor Software Product with id '%s' and version id '%s' not found.";
private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
/**
@@ -38,13 +37,13 @@ public class VendorSoftwareProductNotFoundErrorBuilder {
public VendorSoftwareProductNotFoundErrorBuilder(String vendorSoftwareProductId) {
builder.withId(VSP_NOT_FOUND);
builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(String.format(VSP_FOUND_MSG, vendorSoftwareProductId));
+ builder.withMessage(Messages.VSP_NOT_FOUND.formatMessage(vendorSoftwareProductId));
}
public VendorSoftwareProductNotFoundErrorBuilder(final String vendorSoftwareProductId, final String vendorSoftwareProductVersionId) {
builder.withId(VSP_NOT_FOUND);
builder.withCategory(ErrorCategory.APPLICATION);
- builder.withMessage(String.format(VSP_ID_AND_VERSION_ID_NOT_FOUND_MSG, vendorSoftwareProductId, vendorSoftwareProductVersionId));
+ builder.withMessage(Messages.VSP_VERSION_NOT_FOUND.formatMessage(vendorSoftwareProductId, vendorSoftwareProductVersionId));
}
public ErrorCode build() {
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java
index 21b2caee32..ab43fdc880 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/errors/VendorSoftwareProductErrorCodes.java
@@ -85,6 +85,11 @@ public class VendorSoftwareProductErrorCodes {
public static final String VSP_UPLOAD_STATUS_NOT_FOUND_ERROR = "VSP_UPLOAD_STATUS_NOT_FOUND_ERROR";
public static final String VSP_UPLOAD_ALREADY_FINISHED_ERROR = "VSP_UPLOAD_ALREADY_FINISHED_ERROR";
public static final String VSP_UPLOAD_ALREADY_IN_STATUS_ERROR = "VSP_UPLOAD_ALREADY_IN_STATUS_ERROR";
+ public static final String VSP_DELETE_ALREADY_IN_USE_BY_VF = "VSP_DELETE_ALREADY_IN_USE_BY_VF";
+ public static final String VSP_DELETE_NOT_ARCHIVED = "VSP_DELETE_NOT_ARCHIVED";
+ public static final String VSP_DELETE_GENERIC_ERROR = "VSP_DELETE_GENERIC_ERROR";
+ public static final String VSP_DELETE_FROM_STORAGE_ERROR = "VSP_DELETE_FROM_STORAGE_ERROR";
+ public static final String VSP_DELETE_FROM_DATABASE_ERROR = "VSP_DELETE_FROM_DATABASE_ERROR";
private VendorSoftwareProductErrorCodes() {
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/VendorSoftwareProductNotFoundErrorBuilderTest.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/VendorSoftwareProductNotFoundErrorBuilderTest.java
index 71b77b1ff5..0086dd02f4 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/VendorSoftwareProductNotFoundErrorBuilderTest.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/dao/errors/VendorSoftwareProductNotFoundErrorBuilderTest.java
@@ -16,6 +16,7 @@
package org.openecomp.sdc.vendorsoftwareproduct.dao.errors;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.openecomp.sdc.common.errors.Messages.VSP_VERSION_NOT_FOUND;
import static org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes.VSP_NOT_FOUND;
import org.junit.jupiter.api.Test;
@@ -40,7 +41,7 @@ class VendorSoftwareProductNotFoundErrorBuilderTest {
final ErrorCode actualErrorCode = errorBuilder.build();
assertEquals(ErrorCategory.APPLICATION, actualErrorCode.category());
assertEquals(VSP_NOT_FOUND, actualErrorCode.id());
- final String expectedMsg = String.format("Vendor Software Product with id '%s' and version id '%s' not found.", vspId, vspVersionId);
+ final String expectedMsg = VSP_VERSION_NOT_FOUND.formatMessage(vspId, vspVersionId);
assertEquals(expectedMsg, actualErrorCode.message());
}
}