aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be
diff options
context:
space:
mode:
authortalig <talig@amdocs.com>2018-05-30 16:15:50 +0300
committerAvi Gaffa <avi.gaffa@amdocs.com>2018-06-03 06:45:43 +0000
commit4d0dbee1a1ac7c58c665cdd0e8576bfa9edd1e0e (patch)
treed5785cc2d65afb78630ce2d83479bdf4622e2da1 /openecomp-be
parentc3322117d0aba0a00feaf9126a579f233318d013 (diff)
Add minimum to number questionnaire fields
In case of compute validation error - display its name (same as other entities) Change-Id: Ie3f0190a3b30d1ed6210f50958f61d8a883d5bef Issue-ID: SDC-1387 Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-be')
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java25
-rw-r--r--openecomp-be/tools/install/database/schemaTemplates/questionnaire/component.ftl25
2 files changed, 31 insertions, 19 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java
index faa53862ef..db6a63a2ba 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java
@@ -66,6 +66,7 @@ import org.openecomp.sdc.versioning.dao.types.Version;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.EnumMap;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -85,7 +86,8 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa
private static final Logger logger =
LoggerFactory.getLogger(CompositionEntityDataManagerImpl.class);
private Map<CompositionEntityId, CompositionEntityData> entities = new HashMap<>();
- private Map<CompositionEntityType, String> nonDynamicSchemas = new HashMap<>();
+ private Map<CompositionEntityType, String> nonDynamicSchemas =
+ new EnumMap<>(CompositionEntityType.class);
private List<CompositionEntityValidationData> roots = new ArrayList<>();
private VendorSoftwareProductInfoDao vspInfoDao;
@@ -175,10 +177,10 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa
@Override
public Map<CompositionEntityId, Collection<String>> validateEntitiesQuestionnaire() {
Map<CompositionEntityId, Collection<String>> errorsByEntityId = new HashMap<>();
- entities.entrySet().forEach(entry -> {
- Collection<String> errors = validateQuestionnaire(entry.getValue());
+ entities.forEach((key, value) -> {
+ Collection<String> errors = validateQuestionnaire(value);
if (errors != null) {
- errorsByEntityId.put(entry.getKey(), errors);
+ errorsByEntityId.put(key, errors);
}
});
return errorsByEntityId;
@@ -191,9 +193,8 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa
public void buildTrees() {
Map<CompositionEntityId, CompositionEntityValidationData> entitiesValidationData =
new HashMap<>();
- entities.entrySet().forEach(
- entry -> addValidationDataEntity(entitiesValidationData, entry.getKey(),
- entry.getValue().entity));
+ entities.forEach((key, value) -> addValidationDataEntity(entitiesValidationData, key,
+ value.entity));
}
public Collection<CompositionEntityValidationData> getTrees() {
@@ -225,7 +226,7 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa
return entitiesWithErrors;
}
- return null;
+ return new HashSet<>();
}
private boolean isThereErrorsInSubTree(CompositionEntityValidationData entity) {
@@ -445,6 +446,10 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa
Image image = JsonUtil.json2Object(compositionData, Image.class);
return image.getFileName();
+ case compute:
+ ComputeData compute = JsonUtil.json2Object(compositionData, ComputeData.class);
+ return compute.getName();
+
case vsp:
CompositionEntityData vspEntity = getCompositionEntityDataById(entity);
if (Objects.isNull(vspEntity)) {
@@ -455,9 +460,9 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa
vspInfoDao.get(new VspDetails(vspQuestionnaireEntity.getId(),
vspQuestionnaireEntity.getVersion()));
return vspDetails.getName();
+ default:
+ return null;
}
-
- return null;
}
private void removeNodesWithoutErrors(CompositionEntityValidationData node,
diff --git a/openecomp-be/tools/install/database/schemaTemplates/questionnaire/component.ftl b/openecomp-be/tools/install/database/schemaTemplates/questionnaire/component.ftl
index c023f1c88c..6b00c37061 100644
--- a/openecomp-be/tools/install/database/schemaTemplates/questionnaire/component.ftl
+++ b/openecomp-be/tools/install/database/schemaTemplates/questionnaire/component.ftl
@@ -48,10 +48,12 @@
"properties": {
"bootDiskSizePerVM": {
"type": "number",
+ "minimum": 0,
"maximum": 100
},
"ephemeralDiskSizePerVM": {
"type": "number",
+ "minimum": 0,
"maximum": 400
}
},
@@ -104,10 +106,10 @@
"maximum": {
"type": "number",
"minimum": <#if (componentQuestionnaireData.compute.numOfVMs.minimum)??
- && (componentQuestionnaireData.compute.numOfVMs.minimum)?is_number
- && ((componentQuestionnaireData.compute.numOfVMs.minimum) > 0
- && (componentQuestionnaireData.compute.numOfVMs.minimum) <= 100)>
- ${componentQuestionnaireData.compute.numOfVMs.minimum}<#else>
+&& (componentQuestionnaireData.compute.numOfVMs.minimum)?is_number
+&& ((componentQuestionnaireData.compute.numOfVMs.minimum) > 0
+&& (componentQuestionnaireData.compute.numOfVMs.minimum) <= 100)>
+ ${componentQuestionnaireData.compute.numOfVMs.minimum}<#else>
0</#if> ,
"exclusiveMinimum": true,
"maximum": 100
@@ -198,7 +200,8 @@
"default": ""
},
"networkTransactionsPerSecond": {
- "type": "number"
+ "type": "number",
+ "minimum": 0
}
},
"additionalProperties": false
@@ -221,7 +224,8 @@
"default": "On Site"
},
"backupStorageSize": {
- "type": "number"
+ "type": "number",
+ "minimum": 0
},
"backupSolution": {
"type": "string"
@@ -253,17 +257,20 @@
"type": "object",
"properties": {
"sizeOfLogFiles": {
- "type": "number",
+ "type": "integer",
+ "minimum": 0,
"maximum": 5,
"exclusiveMaximum": true
},
"logBackupFrequency": {
- "type": "number",
+ "type": "integer",
+ "minimum": 0,
"maximum": 4,
"exclusiveMaximum": true
},
"logRetentionPeriod": {
- "type": "number",
+ "type": "integer",
+ "minimum": 0,
"maximum": 15,
"exclusiveMaximum": true
},