summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core
diff options
context:
space:
mode:
authorshrikantawachar <shrikant.awachar@amdocs.com>2018-02-28 17:48:04 +0530
committerAvi Gaffa <avi.gaffa@amdocs.com>2018-02-28 14:27:41 +0000
commita370bbd083a9bcfb74f18f48d3b36be3fb4026c2 (patch)
tree60daa44b66e12be95a5406eac9aa1439769d8403 /openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core
parentae7384a8dadee748c4d4890d51a49b191e3f92d6 (diff)
Healing for enforcing HEAT validation
Healing implementation for enforcing HEAT validation after upload. Change-Id: I56614245d52a26d570cf2a4548057b9025e1f5cc Issue-ID: SDC-1057 Signed-off-by: shrikantawachar <shrikant.awachar@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core')
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java62
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/entityHealingConfiguration.json3
2 files changed, 33 insertions, 32 deletions
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java
index eef8c3cd44..c13e89cb76 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java
@@ -65,39 +65,39 @@ public class HealingManagerImpl implements HealingManager {
public Optional<Version> healItemVersion(final String itemId, final Version version,
final ItemType itemType, final boolean force) {
String user = getUser();
- if (force || isPrivateHealingNeededByFlag(itemId, version.getId(), user)) {
-
- Map<String, Collection<String>> healersByType = getItemHealers(itemType);
- List<String> failureMessages = new LinkedList<>();
- List<Healer> structureHealersToRun =
- getHealersToRun(healersByType.get(HealerType.structure.name()), itemId, version,
- failureMessages);
- List<Healer> dataHealersToRun =
- getHealersToRun(healersByType.get(HealerType.data.name()), itemId, version,
- failureMessages);
-
- if (structureHealersToRun.isEmpty() && dataHealersToRun.isEmpty()) {
- markAsHealed(itemId, version.getId(), user);
- markAsHealed(itemId, version.getId(), PUBLIC_USER);
- return Optional.empty();
- }
-
- Optional<Version> healVersion = getHealVersion(itemId, version);
- if (!healVersion.isPresent()) {
- // do NOT turn off flag here (in thought of saving version calculate performance next
- // time) because maybe next time the next version will be available (due to deletion of
- // the taken one)
- return Optional.empty();
- }
+ if (!force && !isPrivateHealingNeededByFlags(itemId, version.getId(), user)) {
+ return Optional.empty();
+ }
- failureMessages.addAll(
- doHeal(itemId, healVersion.get(), version, structureHealersToRun, dataHealersToRun, user,
- force));
+ Map<String, Collection<String>> healersByType = getItemHealers(itemType);
+ List<String> failureMessages = new LinkedList<>();
+ List<Healer> structureHealersToRun =
+ getHealersToRun(healersByType.get(HealerType.structure.name()), itemId, version,
+ failureMessages);
+ List<Healer> dataHealersToRun =
+ getHealersToRun(healersByType.get(HealerType.data.name()), itemId, version,
+ failureMessages);
+
+ if (structureHealersToRun.isEmpty() && dataHealersToRun.isEmpty()) {
+ markAsHealed(itemId, version.getId(), user);
+ markAsHealed(itemId, version.getId(), PUBLIC_USER);
+ return Optional.empty();
+ }
- handleFailures(failureMessages);
- return healVersion;
+ Optional<Version> healVersion = getHealVersion(itemId, version);
+ if (!healVersion.isPresent()) {
+ // do NOT turn off flag here (in thought of saving version calculate performance next
+ // time) because maybe next time the next version will be available (due to deletion of
+ // the taken one)
+ return Optional.empty();
}
- return Optional.empty();
+
+ failureMessages.addAll(
+ doHeal(itemId, healVersion.get(), version, structureHealersToRun, dataHealersToRun, user,
+ force));
+ handleFailures(failureMessages);
+
+ return healVersion;
}
private Optional<Version> getHealVersion(String itemId, Version version) {
@@ -200,7 +200,7 @@ public class HealingManagerImpl implements HealingManager {
return failureMessages;
}
- private boolean isPrivateHealingNeededByFlag(String itemId, String version, String user) {
+ private boolean isPrivateHealingNeededByFlags(String itemId, String version, String user) {
Optional<Boolean> userHealingFlag = getHealingFlag(itemId, version, user);
return userHealingFlag.orElseGet(() -> isPublicHealingNeededByFlag(itemId, version));
}
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/entityHealingConfiguration.json b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/entityHealingConfiguration.json
index 2fc23372de..51de9d0802 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/entityHealingConfiguration.json
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/resources/entityHealingConfiguration.json
@@ -1,7 +1,8 @@
{
"vsp": {
"structure": [
- "org.openecomp.sdc.healing.healers.OwnerHealer"
+ "org.openecomp.sdc.healing.healers.OwnerHealer",
+ "org.openecomp.sdc.healing.healers.NetworkPackageHealer"
],
"data": [
"org.openecomp.sdc.healing.healers.ToscaServiceModelHealer"