aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-vendor-software-product-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/openecomp-sdc-vendor-software-product-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/openecomp-sdc-vendor-software-product-lib')
-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
3 files changed, 10 insertions, 5 deletions
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());
}
}