summaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src
diff options
context:
space:
mode:
authorkaty.rotman <katy.rotman@amdocs.com>2017-10-09 11:57:18 +0300
committerkaty.rotman <katy.rotman@amdocs.com>2017-10-09 11:57:18 +0300
commit723cec335bf69d656c8c3e53cd9c10422121c9ca (patch)
tree40b8fa1e37a4b029431969e5cde69065a5a68484 /openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src
parent43f7a392d0d0f56316c4ab7f2ea473b143033e84 (diff)
Fix VSP resubmit logic
Issue-ID: SDC-434 Change-Id: I2472f4a35f53763136f1e7586c4df24e3af25759 Signed-off-by: katy.rotman <katy.rotman@amdocs.com>
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src')
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java5
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java45
2 files changed, 28 insertions, 22 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java
index 738e267ca0..0adca1c695 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/VendorSoftwareProductManager.java
@@ -34,7 +34,7 @@ import java.io.IOException;
import java.util.Collection;
import java.util.List;
-public interface VendorSoftwareProductManager {
+public interface VendorSoftwareProductManager {
Version checkout(String vendorSoftwareProductId, String user);
@@ -78,4 +78,7 @@ public interface VendorSoftwareProductManager {
String fetchValidationVsp(String user);
Collection<ComputeEntity> getComputeByVsp(String vspId, Version version, String user);
+
+ Version healAndAdvanceFinalVersion(String vspId, VspDetails vendorSoftwareProductInfo,
+ String user) throws IOException;
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
index f4015ab848..0a3428579d 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
@@ -634,7 +634,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
try {
validateUniqueName(VALIDATION_VSP_NAME);
} catch (Exception ignored) {
- logger.debug("",ignored);
+ logger.debug("", ignored);
return VALIDATION_VSP_ID;
}
VspDetails validationVsp = new VspDetails();
@@ -708,7 +708,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
vsps.add(new VersionedVendorSoftwareProductInfo(vsp, versionInfo));
}
} catch (RuntimeException rte) {
- logger.debug("",rte);
+ logger.debug("", rte);
logger.error(
"Error trying to retrieve vsp[" + entry.getKey() + "] version[" + version.toString
() + "] " +
@@ -789,8 +789,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
throw new CoreException(new VendorSoftwareProductNotFoundErrorBuilder(vspId).build());
}
vsp.setValidationData(orchestrationTemplateDao.getValidationData(vspId, version));
-
- if (Objects.isNull(vsp.getOnboardingOrigin())) {
+ if (Objects.isNull(vsp.getOnboardingOrigin())) { //todo should this only be done for non-Manual?
vsp.setOnboardingOrigin(OnboardingTypesEnum.ZIP.toString());
}
@@ -818,22 +817,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
autoHeal(vspId, checkoutVersion, vendorSoftwareProductInfo, user);
return checkin(vspId, user);
case Final:
- Version checkoutFinalVersion = checkout(vspId, user);
- autoHeal(vspId, checkoutFinalVersion, vendorSoftwareProductInfo, user);
- Version checkinFinalVersion = checkin(vspId, user);
- ValidationResponse response = submit(vspId, user);
- if (!response.isValid()) {
- return checkout(vspId, user);
- }
-
- try {
- Version finalVersion = checkinFinalVersion.calculateNextFinal();
- createPackage(vspId, finalVersion, user);
- return finalVersion;
- } catch (IOException ex) {
- logger.debug("",ex);
- throw new Exception(ex.getMessage());
- }
+ return healAndAdvanceFinalVersion(vspId, vendorSoftwareProductInfo, user);
default:
//do nothing
break;
@@ -841,8 +825,27 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
return versionInfo.getActiveVersion();
}
- @Override
+ public Version healAndAdvanceFinalVersion(String vspId, VspDetails vendorSoftwareProductInfo,
+ String user) throws IOException {
+
+ Version checkoutFinalVersion = checkout(vspId, user);
+ autoHeal(vspId, checkoutFinalVersion, vendorSoftwareProductInfo, user);
+ Version checkinFinalVersion = checkin(vspId, user);
+
+ ValidationResponse response = Objects.requireNonNull(submit(vspId, user),
+ "Null response not expected");
+ if (!response.isValid()) {
+ return checkout(vspId, user);
+ }
+
+ Version finalVersion = checkinFinalVersion.calculateNextFinal();
+ createPackage(vspId, finalVersion, user);
+ return finalVersion;
+
+ }
+
+ @Override
public void deleteVsp(String vspId, String user) {
mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);