From 115b2ef065fa652b380093e4f2571e53c3f0bc19 Mon Sep 17 00:00:00 2001 From: "andre.schmid" Date: Fri, 25 Mar 2022 19:30:14 +0000 Subject: Fix package storage and reducer config reload The package storage configuration was not being reloaded when a configuration file change was made. Increases OrchestrationTemplateCandidateImpl coverage by testing the upload to the artifact storage. Issue-ID: SDC-3934 Change-Id: I533b3c3a92cdadb60a375890da85ee053364e8af Signed-off-by: andre.schmid --- .../vsp/rest/services/VendorSoftwareProductsImpl.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java') diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java index 5540e0f315..9bb68f23af 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java @@ -133,10 +133,9 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts { private final ActivityLogManager activityLogManager; private final NotificationPropagationManager notifier; private final UniqueValueUtil uniqueValueUtil; - private final ArtifactStorageManager artifactStorageManager; + private final StorageFactory storageFactory; private final CatalogVspClient catalogVspClient; - public VendorSoftwareProductsImpl() { this.itemManager = AsdcItemManagerFactory.getInstance().createInterface(); this.permissionsManager = PermissionsManagerFactory.getInstance().createInterface(); @@ -145,7 +144,7 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts { this.activityLogManager = ActivityLogManagerFactory.getInstance().createInterface(); this.notifier = NotificationPropagationManagerFactory.getInstance().createInterface(); this.uniqueValueUtil = new UniqueValueUtil(UniqueValueDaoFactory.getInstance().createInterface()); - this.artifactStorageManager = new StorageFactory().createArtifactStorageManager(); + this.storageFactory = new StorageFactory(); this.catalogVspClient = new CatalogVspClientImpl(); } @@ -156,7 +155,7 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts { ActivityLogManager activityLogManager, NotificationPropagationManager notifier, UniqueValueUtil uniqueValueUtil, - ArtifactStorageManager artifactStorageManager, + final StorageFactory storageFactory, CatalogVspClient catalogVspClient) { this.itemManager = itemManager; this.permissionsManager = permissionsManager; @@ -165,7 +164,7 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts { this.activityLogManager = activityLogManager; this.notifier = notifier; this.uniqueValueUtil = uniqueValueUtil; - this.artifactStorageManager = artifactStorageManager; + this.storageFactory = storageFactory; this.catalogVspClient = catalogVspClient; } @@ -299,8 +298,9 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts { } Integer certifiedVersionsCounter = vsp.getVersionStatusCounters().get(VersionStatus.Certified); + final ArtifactStorageManager artifactStorageManager = storageFactory.createArtifactStorageManager(); if (Objects.isNull(certifiedVersionsCounter) || certifiedVersionsCounter == 0) { - if (artifactStorageManager.isEnabled() && !deleteVspFromStorage(vspId)) { + if (artifactStorageManager.isEnabled() && !deleteVspFromStorage(vspId, artifactStorageManager)) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR) .entity(new Exception(Messages.DELETE_VSP_FROM_STORAGE_ERROR.formatMessage(vspId))).build(); } @@ -308,7 +308,7 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts { } else { final var isVspArchived = getVspList(null, ItemStatus.ARCHIVED.name(), user).stream().anyMatch(item -> item.getId().equals(vspId)); if (isVspArchived) { - if (artifactStorageManager.isEnabled() && !deleteVspFromStorage(vspId)) { + if (artifactStorageManager.isEnabled() && !deleteVspFromStorage(vspId, artifactStorageManager)) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR) .entity(new Exception(Messages.DELETE_VSP_FROM_STORAGE_ERROR.formatMessage(vspId))).build(); } @@ -318,7 +318,7 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts { } } - private boolean deleteVspFromStorage(final String vspId) { + private boolean deleteVspFromStorage(final String vspId, final ArtifactStorageManager artifactStorageManager) { try { artifactStorageManager.delete(vspId); } catch (final Exception e) { -- cgit 1.2.3-korg