aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ModelServlet.java3
-rw-r--r--catalog-be/src/main/resources/import/tosca/models/init/etsi-SOL001-v2.5.1/payload.json3
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ModelServletTest.java3
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/ModelCreateRequest.java3
4 files changed, 7 insertions, 5 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ModelServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ModelServlet.java
index 6449a91112..f52277f3ef 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ModelServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/ModelServlet.java
@@ -112,9 +112,6 @@ public class ModelServlet extends AbstractValidationsServlet {
validateUser(ValidationUtils.sanitizeInputString(userId));
final var modelName = ValidationUtils.sanitizeInputString(modelCreateRequest.getName().trim());
try {
- if (modelCreateRequest.getModelType() == null){
- modelCreateRequest.setModelType(ModelTypeEnum.NORMATIVE);
- }
final Model createdModel = modelBusinessLogic
.createModel(new JMapper<>(Model.class, ModelCreateRequest.class).getDestination(modelCreateRequest));
modelBusinessLogic.createModelImports(modelName, modelImportsZip);
diff --git a/catalog-be/src/main/resources/import/tosca/models/init/etsi-SOL001-v2.5.1/payload.json b/catalog-be/src/main/resources/import/tosca/models/init/etsi-SOL001-v2.5.1/payload.json
index 565863dfad..9b246eac00 100644
--- a/catalog-be/src/main/resources/import/tosca/models/init/etsi-SOL001-v2.5.1/payload.json
+++ b/catalog-be/src/main/resources/import/tosca/models/init/etsi-SOL001-v2.5.1/payload.json
@@ -1,3 +1,4 @@
{
- "name": "ETSI SOL001 v2.5.1"
+ "name": "ETSI SOL001 v2.5.1",
+ "modelType": "NORMATIVE"
} \ No newline at end of file
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ModelServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ModelServletTest.java
index 4e1c0e7945..f96386ded3 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ModelServletTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/ModelServletTest.java
@@ -59,6 +59,7 @@ import org.openecomp.sdc.be.components.validation.UserValidations;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.config.SpringConfig;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datatypes.enums.ModelTypeEnum;
import org.openecomp.sdc.be.exception.BusinessException;
import org.openecomp.sdc.be.impl.ComponentsUtils;
import org.openecomp.sdc.be.impl.ServletUtils;
@@ -157,6 +158,7 @@ class ModelServletTest extends JerseyTest {
model = new Model(modelName);
modelCreateRequest = new ModelCreateRequest();
modelCreateRequest.setName(modelName);
+ modelCreateRequest.setModelType(ModelTypeEnum.NORMATIVE);
}
@Override
@@ -207,6 +209,7 @@ class ModelServletTest extends JerseyTest {
when(modelBusinessLogic.createModel(any(Model.class))).thenReturn(model);
ModelCreateRequest derviedModelCreateRequest = new ModelCreateRequest();
derviedModelCreateRequest.setName("derivedModel");
+ derviedModelCreateRequest.setModelType(ModelTypeEnum.NORMATIVE_EXTENSION);
derviedModelCreateRequest.setDerivedFrom(model.getName());
final FormDataMultiPart formDataMultiPart = buildCreateFormDataMultiPart(new byte[0], parseToJsonString(derviedModelCreateRequest));
final var response = target(rootPath.toString()).request(MediaType.APPLICATION_JSON)
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/ModelCreateRequest.java b/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/ModelCreateRequest.java
index 8c2ee302f7..2130261d88 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/ModelCreateRequest.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/ModelCreateRequest.java
@@ -37,7 +37,8 @@ public class ModelCreateRequest {
private String name;
private String derivedFrom;
-
+
+ @NotNull(message = "Model type cannot be null")
private ModelTypeEnum modelType;
}