summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2022-05-05 18:07:31 +0100
committerMichaelMorris <michael.morris@est.tech>2022-05-05 18:09:14 +0100
commit6140bdb1768134828d68d02c392c0cade6739d3b (patch)
tree93d13ab970e54bc125524f10b3397d2562c0fe2b
parentb0943317bf995e0d7128b3ab829babdfbcef5a6e (diff)
Fix additional_types file being deleted
Signed-off-by: MichaelMorris <michael.morris@est.tech> Issue-ID: SDC-3989 Change-Id: I6b22be3890d1e80b564ec66ab08ea7fe5f36bbe6
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ToscaModelImportCassandraDao.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java4
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java2
3 files changed, 7 insertions, 1 deletions
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ToscaModelImportCassandraDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ToscaModelImportCassandraDao.java
index d21b561094..7c0cba5fa1 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ToscaModelImportCassandraDao.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/cassandra/ToscaModelImportCassandraDao.java
@@ -20,6 +20,7 @@
package org.openecomp.sdc.be.dao.cassandra;
import static java.util.function.Predicate.not;
+import static org.openecomp.sdc.common.api.Constants.ADDITIONAL_TYPE_DEFINITIONS;
import com.datastax.driver.core.Session;
import com.datastax.driver.mapping.Mapper;
@@ -98,6 +99,7 @@ public class ToscaModelImportCassandraDao extends CassandraDao {
final List<ToscaImportByModel> actualImportOfModelList = toscaImportByModelAccessor.findAllByModel(modelId).all();
final List<ToscaImportByModel> removedImportList = actualImportOfModelList.stream()
.filter(not(importOfModelList::contains))
+ .filter(not(toscaImport -> ADDITIONAL_TYPE_DEFINITIONS.equals(toscaImport.getFullPath())))
.collect(Collectors.toList());
importOfModelList.forEach(toscaImportByModelMapper::save);
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java
index 8118eb3619..01e5cdcd40 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ModelOperation.java
@@ -18,6 +18,8 @@
*/
package org.openecomp.sdc.be.model.operations.impl;
+import static org.openecomp.sdc.common.api.Constants.ADDITIONAL_TYPE_DEFINITIONS;
+
import fj.data.Either;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
@@ -65,7 +67,7 @@ import org.yaml.snakeyaml.Yaml;
public class ModelOperation {
private static final Logger log = Logger.getLogger(ModelOperation.class);
- static final Path ADDITIONAL_TYPE_DEFINITIONS_PATH = Path.of("additional_type_definitions.yaml");
+ static final Path ADDITIONAL_TYPE_DEFINITIONS_PATH = Path.of(ADDITIONAL_TYPE_DEFINITIONS);
private final JanusGraphGenericDao janusGraphGenericDao;
private final JanusGraphDao janusGraphDao;
diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java
index 80cc076b56..7a0feb9361 100644
--- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java
+++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java
@@ -61,6 +61,8 @@ public final class Constants {
public static final String CATALOG_BE = "catalog-be";
public static final String RESOURCE_SUPPORTED_VERSION = "0.0.1";
public static final String ARTIFACT_ID_FORMAT = "%s:%s:%s"; // resourceName:resourceVersion:artifactName
+ public static final String ADDITIONAL_TYPE_DEFINITIONS = "additional_type_definitions.yaml";
+
public static final String SERVICE_ARTIFACT_ID_FORMAT = "%s:%s:%s:%s"; // serviceName:serviceVersion:nodeTemplateName:artifactName
public static final String CONTENT_DISPOSITION = "content-disposition";