aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-model/src/test
diff options
context:
space:
mode:
authorJvD_Ericsson <jeff.van.dam@est.tech>2023-03-02 14:42:45 +0000
committerJvD_Ericsson <jeff.van.dam@est.tech>2023-03-10 17:32:30 +0000
commit0606cf6d6dd2cd4630f4cdd14e2e1eee626ca377 (patch)
treefbf0ee90a49cc23ac3a65d325afb15e6c2613182 /catalog-model/src/test
parent86c6a41b4ecf80b9edf554120ddebf572599c679 (diff)
Support for delete of non normative interface types
Issue-ID: SDC-4423 Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech> Change-Id: Ic41a8d0e792f4f0c6effd7eb6c9bd74887a0506c
Diffstat (limited to 'catalog-model/src/test')
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperationTest.java15
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ModelOperationTest.java8
2 files changed, 19 insertions, 4 deletions
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperationTest.java
index b8230ff87a..d73e7092cc 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperationTest.java
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import fj.data.Either;
@@ -51,6 +52,7 @@ import org.openecomp.sdc.be.datatypes.enums.ModelTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
import org.openecomp.sdc.be.model.InterfaceDefinition;
import org.openecomp.sdc.be.model.ModelTestBase;
+import org.openecomp.sdc.be.model.normatives.ElementTypeEnum;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.util.OperationTestsUtil;
import org.openecomp.sdc.be.resources.data.InterfaceData;
@@ -70,6 +72,7 @@ public class InterfaceLifecycleOperationTest {
private static String INTERFACE_TYPE = "tosca.interfaces.standard";
JanusGraphGenericDao janusGraphGenericDao = Mockito.mock(JanusGraphGenericDao.class);
+ ModelOperation modelOperation = Mockito.mock(ModelOperation.class);
@InjectMocks
private InterfaceLifecycleOperation interfaceLifecycleOperation = new InterfaceLifecycleOperation();
@@ -217,4 +220,16 @@ public class InterfaceLifecycleOperationTest {
Assert.assertEquals(1, interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(MODEL_NAME).left().value().size());
}
+
+ @Test
+ void removeInterfaceTypeFromAdditionalType() {
+ String modelName = "model";
+ String interfaceType = "tosca.artifact.interface.PreviouslyExistingType1";
+ InterfaceDefinition interfaceDefinition = new InterfaceDefinition();
+ interfaceDefinition.setModel(modelName);
+ interfaceDefinition.setType(interfaceType);
+
+ interfaceLifecycleOperation.removeInterfaceTypeFromAdditionalType(interfaceDefinition);
+ verify(modelOperation).removeTypeFromAdditionalType(ElementTypeEnum.INTERFACE_LIFECYCLE_TYPE, modelName, interfaceType);
+ }
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ModelOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ModelOperationTest.java
index c68ed71a07..5e9fc199f0 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ModelOperationTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ModelOperationTest.java
@@ -646,7 +646,7 @@ class ModelOperationTest extends ModelTestBase {
when(toscaModelImportCassandraDao.findAllByModel(modelName)).thenReturn(modelImports);
String dataTypeName = "tosca.datatypes.nfv.PreviouslyExistingType1";
- modelOperation.removeDataTypeFromAdditionalType(ElementTypeEnum.DATA_TYPE, modelName, dataTypeName);
+ modelOperation.removeTypeFromAdditionalType(ElementTypeEnum.DATA_TYPE, modelName, dataTypeName);
ArgumentCaptor<List<ToscaImportByModel>> importListArgumentCaptor = ArgumentCaptor.forClass(List.class);
verify(toscaModelImportCassandraDao).saveAll(eq(modelName), importListArgumentCaptor.capture());
@@ -658,7 +658,7 @@ class ModelOperationTest extends ModelTestBase {
expectedAdditionalTypesImport.setFullPath(ADDITIONAL_TYPE_DEFINITIONS_PATH.toString());
expectedAdditionalTypesImport.setContent(Files.readString(testResourcePath.resolve(Path.of("expected-additional_types-5.yaml"))));
final ToscaImportByModel actualAdditionalTypesImport =
- actualImportList.stream().filter(expectedAdditionalTypesImport::equals).findFirst().orElse(null);
+ actualImportList.stream().filter(expectedAdditionalTypesImport::equals).findFirst().orElse(null);
assertNotNull(actualAdditionalTypesImport);
assertEquals(expectedAdditionalTypesImport.getContent(), actualAdditionalTypesImport.getContent());
}
@@ -679,7 +679,7 @@ class ModelOperationTest extends ModelTestBase {
when(toscaModelImportCassandraDao.findAllByModel(modelName)).thenReturn(modelImports);
String dataTypeName = "tosca.datatypes.nfv.PreviouslyExistingType1";
- modelOperation.removeDataTypeFromAdditionalType(ElementTypeEnum.DATA_TYPE, modelName, dataTypeName);
+ modelOperation.removeTypeFromAdditionalType(ElementTypeEnum.DATA_TYPE, modelName, dataTypeName);
ArgumentCaptor<List<ToscaImportByModel>> importListArgumentCaptor = ArgumentCaptor.forClass(List.class);
verify(toscaModelImportCassandraDao).saveAll(eq(modelName), importListArgumentCaptor.capture());
@@ -691,7 +691,7 @@ class ModelOperationTest extends ModelTestBase {
expectedAdditionalTypesImport.setFullPath(ADDITIONAL_TYPE_DEFINITIONS_PATH.toString());
expectedAdditionalTypesImport.setContent(Files.readString(testResourcePath.resolve(Path.of("expected-additional_types-6.yaml"))));
final ToscaImportByModel actualAdditionalTypesImport =
- actualImportList.stream().filter(expectedAdditionalTypesImport::equals).findFirst().orElse(null);
+ actualImportList.stream().filter(expectedAdditionalTypesImport::equals).findFirst().orElse(null);
assertNotNull(actualAdditionalTypesImport);
assertEquals(expectedAdditionalTypesImport.getContent(), actualAdditionalTypesImport.getContent());
}