From 53d5049c1b4acab91c90e491abdee7cc0b1c0cc5 Mon Sep 17 00:00:00 2001 From: talig Date: Tue, 1 May 2018 10:10:09 +0300 Subject: Remove vsp and vlm redundant properties Change-Id: I1faf9af304c7c97303e98744b036f9b1c0db8f0c Issue-ID: SDC-343 Signed-off-by: talig --- .../rest/services/VendorLicenseModelsImpl.java | 20 ++++++++------------ .../rest/services/VendorSoftwareProductsImpl.java | 12 ++++-------- .../vendorlicense/impl/VendorLicenseModelTest.java | 2 -- .../impl/VendorSoftwareProductManagerImplTest.java | 4 ---- .../dao/types/VendorLicenseModelEntity.java | 8 -------- .../zusammen/VendorLicenseModelDaoZusammenImpl.java | 6 +----- .../convertor/ElementToVLMGeneralConvertor.java | 6 ------ .../vendorsoftwareproduct/dao/type/VspDetails.java | 15 --------------- 8 files changed, 13 insertions(+), 60 deletions(-) (limited to 'openecomp-be') diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java index 0e645dd4e9..f596a8dd1b 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/services/VendorLicenseModelsImpl.java @@ -28,7 +28,6 @@ import static org.openecomp.sdcrests.vendorlicense.types.VendorLicenseModelActio import java.util.HashMap; import java.util.Map; import java.util.Objects; -import java.util.Optional; import java.util.function.Predicate; import javax.inject.Named; import javax.ws.rs.core.Response; @@ -163,19 +162,16 @@ public class VendorLicenseModelsImpl implements VendorLicenseModels { public Response getLicenseModel(String vlmId, String versionId, String user) { Version version = versioningManager.get(vlmId, new Version(versionId)); VendorLicenseModelEntity vlm = vendorLicenseManager.getVendorLicenseModel(vlmId, version); - vlm.setWritetimeMicroSeconds(version.getModificationTime().getTime()); try { - Optional healedVersion = HealingManagerFactory.getInstance().createInterface() - .healItemVersion(vlmId, version, ItemType.vlm, - false); - - if (healedVersion.isPresent()) { - vlm.setVersion(healedVersion.get()); - if (version.getStatus() == VersionStatus.Certified) { - submitHealedVersion(vlmId, healedVersion.get(), versionId, user); - } - } + HealingManagerFactory.getInstance().createInterface() + .healItemVersion(vlmId, version, ItemType.vlm, false) + .ifPresent(healedVersion -> { + vlm.setVersion(healedVersion); + if (version.getStatus() == VersionStatus.Certified) { + submitHealedVersion(vlmId, healedVersion, versionId, user); + } + }); } catch (Exception e) { LOGGER.error(String.format("Error while auto healing VLM with Id %s and version %s", vlmId, versionId), e); } 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 16ef8c5761..9610da8553 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 @@ -224,7 +224,6 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts { public Response getVsp(String vspId, String versionId, String user) { Version version = versioningManager.get(vspId, new Version(versionId)); VspDetails vspDetails = vendorSoftwareProductManager.getVsp(vspId, version); - vspDetails.setWritetimeMicroSeconds(version.getModificationTime().getTime()); try { HealingManagerFactory.getInstance().createInterface() @@ -252,13 +251,10 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts { versioningManager.get(vspDetails.getVendorId(), vspDetails.getVlmVersion()); } - Optional validationResponse = - submit(vspDetails.getId(), vspDetails.getVersion(), "Submit healed Vsp", user); - // TODO: 8/9/2017 before collaboration checkout was done at this scenario (equivalent - // to new version in collaboration). need to decide what should be done now. - validationResponse.ifPresent(validationResponse1 -> { - throw new IllegalStateException("Certified vsp after healing failed on validation"); - }); + submit(vspDetails.getId(), vspDetails.getVersion(), "Submit healed Vsp", user) + .ifPresent(validationResponse -> { + throw new IllegalStateException("Certified vsp after healing failed on validation"); + }); vendorSoftwareProductManager.createPackage(vspDetails.getId(), vspDetails.getVersion()); } catch (Exception ex) { LOGGER.error(String.format(SUBMIT_HEALED_VERSION_ERROR, vspDetails.getId(), vspDetails.getVersion().getId(), diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseModelTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseModelTest.java index 8ef9c5aec6..410f7c65c0 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseModelTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseModelTest.java @@ -120,8 +120,6 @@ public class VendorLicenseModelTest { .updateUniqueName(VendorLicenseConstants.UniqueValues.VENDOR_NAME, existingVlm.getVendorName(), updatedVlm.getVendorName()); - existingVlm.setWritetimeMicroSeconds(8L); - doReturn(existingVlm).when(vendorLicenseModelDaoMcok).get(any(VendorLicenseModelEntity.class)); vendorLicenseManager.updateVendorLicenseModel(updatedVlm); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java index 299affe29f..f5c7fb29e8 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java @@ -215,7 +215,6 @@ public class VendorSoftwareProductManagerImplTest { createVspDetails(VSP_ID, VERSION01, "VSP1_updated", null, "vendorName", "vlm1Id", "icon", "category_updated", "subCategory", "456", null); - existingVsp.setWritetimeMicroSeconds(8L); doReturn(existingVsp).when(vspInfoDaoMock) .get(any(VspDetails.class)); doNothing().when(vendorSoftwareProductManager) @@ -247,7 +246,6 @@ public class VendorSoftwareProductManagerImplTest { createVspDetails(VSP_ID, VERSION01, "VSP1_updated", null, "vendorName", "vlm1Id", "icon", "category_updated", "subCategory", "456", updFgs); - existingVsp.setWritetimeMicroSeconds(8L); doReturn(existingVsp).when(vspInfoDaoMock) .get(any(VspDetails.class)); doNothing().when(vendorSoftwareProductManager) @@ -292,7 +290,6 @@ public class VendorSoftwareProductManagerImplTest { createVspDetails(VSP_ID, VERSION01, "VSP1", null, "vendorName", "vlm1Id", "icon", "category", "subCategory", "456", null); - existingVsp.setWritetimeMicroSeconds(8L); doReturn(existingVsp).when(vspInfoDaoMock).get(any(VspDetails.class)); VspDetails actualVsp = @@ -316,7 +313,6 @@ public class VendorSoftwareProductManagerImplTest { createVspDetails(VSP_ID, VERSION01, "VSP1", null, "vendorName", "vlm1Id", "icon", "category", "subCategory", "456", null); - existingVsp.setWritetimeMicroSeconds(8L); doReturn(existingVsp) .when(vspInfoDaoMock).get(any(VspDetails.class)); diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/VendorLicenseModelEntity.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/VendorLicenseModelEntity.java index 0d43d7e5eb..aab2e61d4e 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/VendorLicenseModelEntity.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-api/src/main/java/org/openecomp/sdc/vendorlicense/dao/types/VendorLicenseModelEntity.java @@ -147,12 +147,4 @@ public class VendorLicenseModelEntity implements VersionableEntity { && Objects.equals(description, that.description) && Objects.equals(iconRef, that.iconRef); } - - public Long getWritetimeMicroSeconds() { - return writetimeMicroSeconds; - } - - public void setWritetimeMicroSeconds(Long writetimeMicroSeconds) { - this.writetimeMicroSeconds = writetimeMicroSeconds; - } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VendorLicenseModelDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VendorLicenseModelDaoZusammenImpl.java index 78b31f8865..e4a078d6d6 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VendorLicenseModelDaoZusammenImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/VendorLicenseModelDaoZusammenImpl.java @@ -134,10 +134,9 @@ public class VendorLicenseModelDaoZusammenImpl implements VendorLicenseModelDao @Override public void delete(VendorLicenseModelEntity entity) { - + throw new UnsupportedOperationException("Delete vlm version is done using versioning manager"); } - private ZusammenElement mapVlmToZusammenElement(VendorLicenseModelEntity vendorLicenseModel, Action action) { ZusammenElement generalElement = @@ -150,14 +149,11 @@ public class VendorLicenseModelDaoZusammenImpl implements VendorLicenseModelDao info.addProperty(InfoPropertyName.name.name(), vendorLicenseModel.getVendorName()); info.addProperty(InfoPropertyName.description.name(), vendorLicenseModel.getDescription()); info.addProperty(InfoPropertyName.iconRef.name(), vendorLicenseModel.getIconRef()); - info.addProperty(InfoPropertyName.oldVersion.name(), vendorLicenseModel.getOldVersion()); } - public enum InfoPropertyName { name, description, iconRef, - oldVersion } } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertor.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertor.java index c2ef5a6c41..10a532c572 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertor.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/dao/impl/zusammen/convertor/ElementToVLMGeneralConvertor.java @@ -30,7 +30,6 @@ public class ElementToVLMGeneralConvertor extends ElementConvertor { } - private VendorLicenseModelEntity mapInfoToVendorLicenseModelEntity(Info info) { VendorLicenseModelEntity vendorLicenseModelEntity = new VendorLicenseModelEntity(); @@ -41,12 +40,7 @@ public class ElementToVLMGeneralConvertor extends ElementConvertor { VendorLicenseModelDaoZusammenImpl.InfoPropertyName.description.name())); vendorLicenseModelEntity.setIconRef(info.getProperty( VendorLicenseModelDaoZusammenImpl.InfoPropertyName.iconRef.name())); - vendorLicenseModelEntity.setOldVersion(info.getProperty( - VendorLicenseModelDaoZusammenImpl.InfoPropertyName.oldVersion.name())); - return vendorLicenseModelEntity; } - - } diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetails.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetails.java index 3ba77ad0ee..9f82b73978 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetails.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetails.java @@ -52,8 +52,6 @@ public class VspDetails implements VersionableEntity { private List featureGroups; - private Long writetimeMicroSeconds; - private String onboardingMethod; public VspDetails() { @@ -172,18 +170,6 @@ public class VspDetails implements VersionableEntity { this.featureGroups = featureGroups; } - public Long getWritetimeMicroSeconds() { - return this.writetimeMicroSeconds; - } - - public void setWritetimeMicroSeconds(Long writetimeMicroSeconds) { - this.writetimeMicroSeconds = writetimeMicroSeconds; - } - - /*public boolean isOldVersion() { - return this.oldVersion; - }*/ - public String getOnboardingMethod() { return onboardingMethod; } @@ -192,7 +178,6 @@ public class VspDetails implements VersionableEntity { this.onboardingMethod = onboardingMethod; } - @Override public String toString() { return String.format( -- cgit 1.2.3-korg