Make Service base type optional
[sdc.git] / catalog-be / src / test / java / org / openecomp / sdc / be / tosca / ToscaExportHandlerTest.java
index 2b00668..6a3810f 100644 (file)
 
 package org.openecomp.sdc.be.tosca;
 
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyBoolean;
 import static org.mockito.ArgumentMatchers.anyList;
@@ -40,6 +38,7 @@ import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
+import static org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum.VF;
 import static org.openecomp.sdc.be.tosca.PropertyConvertor.PropertyType.PROPERTY;
 
 import fj.data.Either;
@@ -47,8 +46,8 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.List;
 import java.util.LinkedList;
+import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.stream.Collectors;
@@ -56,19 +55,15 @@ import mockit.Deencapsulation;
 import org.apache.commons.collections.MapUtils;
 import org.apache.commons.lang3.tuple.ImmutablePair;
 import org.apache.commons.lang3.tuple.Triple;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import org.mockito.InjectMocks;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
-import org.openecomp.sdc.be.components.BeConfDependentTest;
 import org.openecomp.sdc.be.components.utils.PropertyDataDefinitionBuilder;
 import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
 import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
-import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
-import org.openecomp.sdc.be.datatypes.elements.ForwardingPathElementDataDefinition;
-import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
 import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition;
 import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
 import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition;
@@ -78,10 +73,12 @@ import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
 import org.openecomp.sdc.be.exception.ToscaExportException;
 import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.AttributeDefinition;
 import org.openecomp.sdc.be.model.CapabilityDefinition;
 import org.openecomp.sdc.be.model.CapabilityRequirementRelationship;
 import org.openecomp.sdc.be.model.Component;
 import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.ComponentInstanceAttribute;
 import org.openecomp.sdc.be.model.ComponentInstanceInput;
 import org.openecomp.sdc.be.model.ComponentInstanceProperty;
 import org.openecomp.sdc.be.model.ComponentParametersView;
@@ -102,9 +99,8 @@ import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
 import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
 import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
 import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation;
-import org.openecomp.sdc.be.tosca.model.SubstitutionMapping;
+import org.openecomp.sdc.be.tosca.exception.ToscaConversionException;
 import org.openecomp.sdc.be.tosca.model.ToscaCapability;
-import org.openecomp.sdc.be.tosca.model.ToscaMetadata;
 import org.openecomp.sdc.be.tosca.model.ToscaNodeTemplate;
 import org.openecomp.sdc.be.tosca.model.ToscaNodeType;
 import org.openecomp.sdc.be.tosca.model.ToscaProperty;
@@ -114,8 +110,9 @@ import org.openecomp.sdc.be.tosca.model.ToscaTemplateRequirement;
 import org.openecomp.sdc.be.tosca.model.ToscaTopolgyTemplate;
 import org.openecomp.sdc.be.tosca.utils.InputConverter;
 import org.openecomp.sdc.be.tosca.utils.OutputConverter;
+import org.openecomp.sdc.common.test.BaseConfDependent;
 
-public class ToscaExportHandlerTest extends BeConfDependentTest {
+class ToscaExportHandlerTest extends BaseConfDependent {
 
     private static final String COMPONENT_PROPERTY_NAME = "prop1";
     private static final String COMPONENT_PROPERTY_TYPE = "string";
@@ -129,7 +126,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
     private ToscaExportHandler testSubject;
 
     @Mock
-    private ApplicationDataTypeCache dataTypeCache;
+    private ApplicationDataTypeCache applicationDataTypeCache;
 
     @Mock
     private ToscaOperationFacade toscaOperationFacade;
@@ -161,12 +158,22 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
     @Mock
     private PolicyExportParser policyExportParser;
 
-    @Before
-    public void setUpMock() {
-        MockitoAnnotations.initMocks(this);
-               doReturn(new ToscaProperty()).when(propertyConvertor).convertProperty(any(), any(), eq(PROPERTY));
+    @Mock
+    private AttributeConverter attributeConverter;
+
+    @BeforeAll
+    public static void setupBeforeClass() {
+        componentName = "catalog-be";
+        confPath = "src/test/resources/config";
+        setUp();
+    }
+
+    @BeforeEach
+    void setUpMock() {
+        MockitoAnnotations.openMocks(this);
+        doReturn(new ToscaProperty()).when(propertyConvertor).convertProperty(any(), any(), eq(PROPERTY));
         doReturn(new HashMap<String, Object>()).when(interfacesOperationsConverter)
-                .getInterfacesMap(any(), isNull(), anyMap(), anyMap(), anyBoolean(), anyBoolean());
+            .getInterfacesMap(any(), isNull(), anyMap(), anyMap(), anyBoolean(), anyBoolean());
     }
 
     private Resource getNewResource() {
@@ -229,55 +236,55 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
     }
 
     @Test
-    public void testExportComponent() throws Exception {
+    void testExportComponent() {
         Component component = getNewResource();
         Either<ToscaRepresentation, ToscaError> result;
 
-        when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
-        when(capabilityRequirementConverter.convertRequirements(any(Map.class), any(Resource.class),
-                any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
-        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes())
+        when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
+        when(capabilityRequirementConverter.convertRequirements(anyMap(), any(Resource.class),
+            any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
             .thenReturn(Either.left(Collections.emptyMap()));
 
         // default test when component is Resource
         result = testSubject.exportComponent(component);
-        Assert.assertNotNull(result);
+        assertNotNull(result);
 
         component = getNewService();
-        when(capabilityRequirementConverter.convertRequirements(any(Map.class), any(Service.class),
-                any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
-        when(dataTypeCache.getAll()).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
+        when(capabilityRequirementConverter.convertRequirements(anyMap(), any(Service.class),
+            any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
+        when(applicationDataTypeCache.getAll(null)).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
 
         // default test when component is Service
         result = testSubject.exportComponent(component);
-        Assert.assertNotNull(result);
+        assertNotNull(result);
     }
 
     @Test
-    public void testExportComponentInterface() throws Exception {
-        Component component = getNewResource();
+    void testExportComponentInterface() {
+        Resource component = getNewResource();
         Either<ToscaRepresentation, ToscaError> result;
 
-        ((Resource) component).setInterfaces(new HashMap<>());
+        component.setInterfaces(new HashMap<>());
 
-        when(dataTypeCache.getAll()).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
-        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes())
+        when(applicationDataTypeCache.getAll(null)).thenReturn(Either.right(JanusGraphOperationStatus.NOT_FOUND));
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
             .thenReturn(Either.left(Collections.emptyMap()));
         // default test when convertInterfaceNodeType is right
         result = testSubject.exportComponentInterface(component, false);
-        Assert.assertNotNull(result);
+        assertNotNull(result);
 
-        when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
-        when(capabilityRequirementConverter.convertRequirements(any(Map.class), any(Resource.class),
-                any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
+        when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
+        when(capabilityRequirementConverter.convertRequirements(anyMap(), any(Resource.class),
+            any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
 
         // default test when convertInterfaceNodeType is left
         result = testSubject.exportComponentInterface(component, false);
-        Assert.assertNotNull(result);
+        assertNotNull(result);
     }
 
     @Test
-    public void testConvertInterfaceNodeTypeProperties() throws Exception {
+    void testConvertInterfaceNodeTypeProperties() {
 
         Resource component = getNewResource();
 
@@ -293,96 +300,94 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         component.setName(RESOURCE_NAME);
         component.setToscaResourceName(RESOURCE_NAME);
 
-        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes())
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
             .thenReturn(Either.left(Collections.emptyMap()));
-        when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
+        when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
         // when convertRequirements is called, make it return the same value as 3rd (index=2) argument.
-        when(capabilityRequirementConverter.convertRequirements(any(Map.class), any(Resource.class),
-                any(ToscaNodeType.class))).thenAnswer(i -> Either.left(i.getArgument(2)));
+        when(capabilityRequirementConverter.convertRequirements(anyMap(), any(Resource.class),
+            any(ToscaNodeType.class))).thenAnswer(i -> Either.left(i.getArgument(2)));
 
         Either<ToscaTemplate, ToscaError> result = (Either<ToscaTemplate, ToscaError>) Deencapsulation
             .invoke(testSubject, "convertInterfaceNodeType", new HashMap<String, Component>(), component,
                 new ToscaTemplate(TOSCA_VERSION), new HashMap<String, ToscaNodeType>(), false);
-        Assert.assertNotNull(result);
-        assertThat(result.isLeft(), is(true));
+        assertNotNull(result);
+        assertTrue(result.isLeft());
         Map<String, ToscaNodeType> nodeTypeMap = result.left().value().getNode_types();
-        assertThat(nodeTypeMap.size(), is(1));
+        assertEquals(1,nodeTypeMap.size());
         ToscaNodeType toscaNodeType = nodeTypeMap.values().iterator().next();
         Map<String, ToscaProperty> propertyMap = toscaNodeType.getProperties();
         // Check if inputs and properties in component are merged properly
-        assertThat(propertyMap.size(), is(2));
-        assertThat(propertyMap.containsKey(COMPONENT_INPUT_NAME), is(true));
-        assertThat(propertyMap.containsKey(COMPONENT_PROPERTY_NAME), is(true));
+        assertEquals(2, propertyMap.size());
+        assertTrue(propertyMap.containsKey(COMPONENT_INPUT_NAME));
+        assertTrue(propertyMap.containsKey(COMPONENT_PROPERTY_NAME));
     }
 
     @Test
-    public void testCreateToscaRepresentation() throws Exception {
+    void testCreateToscaRepresentation() {
         ToscaTemplate toscaTemplate = new ToscaTemplate("");
         ToscaRepresentation result;
 
         // default test
         result = testSubject.createToscaRepresentation(toscaTemplate);
-        Assert.assertNotNull(result);
+        assertNotNull(result);
     }
 
     @Test
-    public void testGetDependencies() throws Exception {
+    void testGetDependencies() {
 
         Component component = new Resource();
         Either<ToscaTemplate, ToscaError> result;
 
         // default test
         result = testSubject.getDependencies(component);
-        Assert.assertNotNull(result);
+        assertNotNull(result);
     }
 
     @Test
-    public void testSetImports() throws Exception {
+    void testSetImports() {
         Resource resource = new Resource();
         resource.setResourceType(ResourceTypeEnum.PNF);
 
-        Component component = resource;
-        component.setName("TestResourceName");
+        resource.setName("TestResourceName");
         Map<String, ArtifactDefinition> artifactList = new HashMap<>();
         ArtifactDefinition artifact = new ArtifactDefinition();
         artifact.setArtifactName("name.name2");
         artifactList.put("assettoscatemplate", artifact);
-        component.setArtifacts(artifactList);
-        component.setToscaArtifacts(artifactList);
+        resource.setArtifacts(artifactList);
+        resource.setToscaArtifacts(artifactList);
         ToscaTemplate toscaTemplate = new ToscaTemplate("");
 
-
         ComponentInstance ci = new ComponentInstance();
         ci.setComponentUid("name");
         ci.setOriginType(OriginTypeEnum.PNF);
         ci.setSourceModelUid("modelName");
         List<ComponentInstance> componentInstanceList = new LinkedList<>();
         componentInstanceList.add(ci);
-        component.setComponentInstances(componentInstanceList);
+        resource.setComponentInstances(componentInstanceList);
 
-        when(toscaOperationFacade.getToscaFullElement(eq("name"))).thenReturn(Either.left(component));
+        when(toscaOperationFacade.getToscaFullElement("name")).thenReturn(Either.left(resource));
 
         Either<ImmutablePair<ToscaTemplate, Map<String, Component>>, ToscaError> result;
-        result = Deencapsulation.invoke(testSubject, "fillImports", component, toscaTemplate);
+        result = Deencapsulation.invoke(testSubject, "fillImports", resource, toscaTemplate);
 
         verify(toscaOperationFacade, times(1)).getToscaFullElement("name");
-        Assert.assertTrue(result.isLeft());
+        assertTrue(result.isLeft());
         ToscaTemplate toscaTemplateRes = result.left().value().left;
-        Assert.assertTrue(toscaTemplateRes.getImports().size() == 8);
-        Assert.assertNotNull(toscaTemplateRes.getImports().get(6).get("resource-TestResourceName-interface"));
-        Assert.assertNotNull(toscaTemplateRes.getImports().get(7).get("resource-TestResourceName"));
-        Assert.assertTrue(toscaTemplateRes.getDependencies().size() == 1);
-        Assert.assertNotNull(toscaTemplateRes.getDependencies().get(0).getLeft().equals("name.name2"));
+        assertEquals(8, toscaTemplateRes.getImports().size());
+        assertNotNull(toscaTemplateRes.getImports().get(6).get("resource-TestResourceName-interface"));
+        assertNotNull(toscaTemplateRes.getImports().get(7).get("resource-TestResourceName"));
+        assertEquals(1, toscaTemplateRes.getDependencies().size());
+        assertEquals("name.name2", toscaTemplateRes.getDependencies().get(0).getLeft());
     }
 
     @Test
-    public void testConvertToscaTemplate() throws Exception {
+    void testConvertToscaTemplate() throws Exception {
 
-        Component component = getNewResource();
-        ToscaTemplate toscaNode = new ToscaTemplate("");
+        final Component component = getNewResource();
+        final ToscaTemplate toscaNode = new ToscaTemplate("");
         Either<ToscaTemplate, ToscaError> result;
-        List<ComponentInstance> resourceInstances = new ArrayList<>();
-        ComponentInstance instance = new ComponentInstance();
+        final List<ComponentInstance> resourceInstances = new ArrayList<>();
+        final ComponentInstance instance = new ComponentInstance();
 
         instance.setOriginType(OriginTypeEnum.SERVICE);
         instance.setSourceModelUid("targetModelUid");
@@ -390,17 +395,20 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
 
         component.setComponentInstances(resourceInstances);
 
-        when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
-        when(capabilityRequirementConverter.getOriginComponent(any(Map.class),
-            any(ComponentInstance.class))).thenReturn(Either.right(false));
+        when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
+        when(capabilityRequirementConverter.getOriginComponent(anyMap(), any(ComponentInstance.class))).thenReturn(Either.right(false));
+
+        final Map<String, ToscaProperty> map = new HashMap<>();
+        map.put("mock", new ToscaProperty());
+        doReturn(map).when(outputConverter).convert(any(), any());
 
         // default test
         result = Deencapsulation.invoke(testSubject, "convertToscaTemplate", component, toscaNode);
-        Assert.assertNotNull(result);
+        assertNotNull(result);
     }
 
     @Test
-    public void testConvertToscaTemplateWhenComponentContainsGroup() {
+    void testConvertToscaTemplateWhenComponentContainsGroup() throws ToscaConversionException {
         Component component = getNewResource();
         ToscaTemplate toscaNode = new ToscaTemplate("");
         Either<ToscaTemplate, ToscaError> result;
@@ -419,26 +427,29 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         String[] array = {"value1", "value2"};
         substitutionMappingMap.put("key", array);
 
-        when(capabilityRequirementConverter.convertSubstitutionMappingCapabilities(any(Map.class),
+        when(capabilityRequirementConverter.convertSubstitutionMappingCapabilities(anyMap(),
             any(Component.class))).thenReturn(Either.left(substitutionMappingMap));
 
-        when(capabilityRequirementConverter.convertSubstitutionMappingRequirements(any(Map.class),
-            any(Component.class), any(SubstitutionMapping.class)))
-            .thenReturn(Either.left(new SubstitutionMapping()));
+        when(capabilityRequirementConverter.convertSubstitutionMappingRequirements(any(Component.class), anyMap()))
+            .thenReturn(Either.left(Collections.emptyMap()));
 
-        when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
+        when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
 
-        when(inputConverter.convertInputs(any(List.class), any(Map.class))).thenReturn(new HashMap<>());
+        when(inputConverter.convertInputs(anyList(), anyMap())).thenReturn(new HashMap<>());
 
         when(groupExportParser.getGroups(component)).thenReturn(null);
 
+        final Map<String, ToscaProperty> map = new HashMap<>();
+        map.put("mock", new ToscaProperty());
+        doReturn(map).when(outputConverter).convert(any(), any());
+
         // test component contains group
         result = Deencapsulation.invoke(testSubject, "convertToscaTemplate", component, toscaNode);
-        Assert.assertNotNull(result);
+        assertNotNull(result);
     }
 
     @Test
-    public void testConvertToscaTemplateWhenComponentIsService() throws Exception {
+    void testConvertToscaTemplateWhenComponentIsService() throws Exception {
         Component component = getNewService();
         ToscaTemplate toscaNode = new ToscaTemplate("");
         Either<ToscaTemplate, ToscaError> result;
@@ -461,19 +472,23 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
             .thenReturn(Either.left(substitutionMappingMap));
 
         when(capabilityRequirementConverter
-            .convertSubstitutionMappingRequirements(anyMap(), any(Component.class), any(SubstitutionMapping.class)))
-            .thenReturn(Either.left(new SubstitutionMapping()));
+            .convertSubstitutionMappingRequirements(any(Component.class), anyMap()))
+            .thenReturn(Either.left(Collections.emptyMap()));
 
-        when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
+        when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
 
         when(inputConverter.convertInputs(anyList(), anyMap())).thenReturn(new HashMap<>());
+        final Map<String, ToscaProperty> map = new HashMap<>();
+        map.put("mock", new ToscaProperty());
+        doReturn(map).when(outputConverter).convert(any(), any());
+
         // test component contains group
         result = Deencapsulation.invoke(testSubject, "convertToscaTemplate", component, toscaNode);
-        Assert.assertNotNull(result);
+        assertNotNull(result);
     }
 
     @Test
-    public void testConvertMetadata_1() throws Exception {
+    void testConvertMetadata_1() {
 
         Component component = getNewResource();
         boolean isInstance = true;
@@ -483,11 +498,11 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
 
         // default test
         Map<String, String> result = Deencapsulation.invoke(testSubject, "convertMetadata", component, isInstance, componentInstance);
-        Assert.assertNotNull(result);
+        assertNotNull(result);
     }
 
     @Test
-    public void testFillImports() throws Exception {
+    void testFillImports() {
 
         Component component = getNewService();
         ToscaTemplate toscaTemplate = new ToscaTemplate("");
@@ -507,13 +522,24 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         when(toscaOperationFacade.getToscaFullElement(any(String.class)))
             .thenReturn(Either.left(component));
 
+        Resource baseType = getNewResource();
+        Map<String, ArtifactDefinition> baseTypeToscaArtifacts = new HashMap<>();
+        ArtifactDefinition baseTypeArtifact = new ArtifactDefinition();
+        baseTypeArtifact.setArtifactName("typeA");
+        baseTypeToscaArtifacts.put("assettoscatemplate", baseTypeArtifact);
+        baseType.setToscaArtifacts(baseTypeToscaArtifacts);
+
+        component.setDerivedFromGenericType("org.typeA");
+        component.setDerivedFromGenericVersion("1.0");
+        when(toscaOperationFacade.getByToscaResourceNameAndVersion("org.typeA", "1.0", null)).thenReturn(Either.left(baseType));
+
         // default test
         result = Deencapsulation.invoke(testSubject, "fillImports", component, toscaTemplate);
-        Assert.assertNotNull(result);
+        assertNotNull(result);
     }
 
     @Test
-    public void testCreateDependency() throws Exception {
+    void testCreateDependency() {
 
         Map<String, Component> componentCache = new HashMap<>();
         List<Map<String, Map<String, String>>> imports = new ArrayList<>();
@@ -530,43 +556,43 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         ci.setOriginType(OriginTypeEnum.ServiceProxy);
         ci.setSourceModelUid("modelName");
 
-        when(toscaOperationFacade.getToscaFullElement(eq("name"))).thenReturn(Either.left(component));
+        when(toscaOperationFacade.getToscaFullElement("name")).thenReturn(Either.left(component));
 
-        when(toscaOperationFacade.getToscaFullElement(eq("modelName")))
-            .thenReturn(Either.left(new Service()));
+        when(toscaOperationFacade.getToscaFullElement("modelName")).thenReturn(Either.left(new Service()));
 
         // default test
         Deencapsulation.invoke(testSubject, "createDependency", componentCache, imports, dependecies, ci);
+        assertFalse(componentCache.isEmpty());
     }
 
     @Test
-    public void testGetInterfaceFilename() throws Exception {
+    void testGetInterfaceFilename() {
         String artifactName = "artifact.name";
         String result;
 
         // default test
         result = ToscaExportHandler.getInterfaceFilename(artifactName);
-        Assert.assertNotNull(result);
+        assertNotNull(result);
     }
 
     @Test
-    public void testConvertNodeType() throws Exception {
+    void testConvertNodeType() {
         Component component = new Resource();
         ToscaTemplate toscaNode = new ToscaTemplate("");
         Map<String, ToscaNodeType> nodeTypes = new HashMap<>();
         Either<ToscaTemplate, ToscaError> result;
 
-        when(dataTypeCache.getAll()).thenReturn(Either.right(JanusGraphOperationStatus.ALREADY_EXIST));
-        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes())
+        when(applicationDataTypeCache.getAll(null)).thenReturn(Either.right(JanusGraphOperationStatus.ALREADY_EXIST));
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
             .thenReturn(Either.left(Collections.emptyMap()));
         // default test
         result = Deencapsulation
             .invoke(testSubject, "convertNodeType", new HashMap<>(), component, toscaNode, nodeTypes);
-        Assert.assertNotNull(result);
+        assertNotNull(result);
     }
 
     @Test
-    public void testConvertInterfaceNodeType() throws Exception {
+    void testConvertInterfaceNodeType() {
         Component component = getNewResource();
         ToscaTemplate toscaNode = new ToscaTemplate("");
         Map<String, ToscaNodeType> nodeTypes = new HashMap<>();
@@ -575,178 +601,287 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         inputs.add(new InputDefinition());
         component.setInputs(inputs);
 
-        when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
-        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes())
+        when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
             .thenReturn(Either.left(Collections.emptyMap()));
 
-        when(capabilityRequirementConverter.convertRequirements(any(Map.class), any(Resource.class),
-                any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
+        when(capabilityRequirementConverter.convertRequirements(anyMap(), any(Resource.class),
+            any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
 
         // default test
         result = Deencapsulation.invoke(testSubject, "convertInterfaceNodeType", new HashMap<>(), component, toscaNode
             , nodeTypes, false);
-        Assert.assertNotNull(result);
+        assertNotNull(result);
     }
 
     @Test
-    public void testConvertReqCapAndTypeName() throws Exception {
+    void testConvertReqCapAndTypeName() {
         Component component = new Resource();
         ToscaTemplate toscaNode = new ToscaTemplate("");
-        Map<String, ToscaNodeType> nodeTypes = new HashMap();
+        Map<String, ToscaNodeType> nodeTypes = new HashMap<>();
         ToscaNodeType toscaNodeType = new ToscaNodeType();
         Map<String, DataTypeDefinition> dataTypes = new HashMap<>();
         Either<ToscaTemplate, ToscaError> result;
 
         when(
             capabilityRequirementConverter
-                .convertCapabilities(any(Map.class), any(Resource.class), any(Map.class)))
+                .convertCapabilities(anyMap(), any(Resource.class), anyMap()))
             .thenReturn(new HashMap<>());
 
-        when(capabilityRequirementConverter.convertRequirements(any(Map.class), any(Resource.class),
-                any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
+        when(capabilityRequirementConverter.convertRequirements(anyMap(), any(Resource.class),
+            any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
 
         // default test
         result = Deencapsulation
             .invoke(testSubject, "convertReqCapAndTypeName", new HashMap<>(), component, toscaNode, nodeTypes,
                 toscaNodeType, dataTypes);
-        Assert.assertNotNull(result);
+        assertNotNull(result);
 
         component = new Service();
 
-        when(capabilityRequirementConverter.convertRequirements(any(Map.class), any(Service.class),
-                any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
+        when(capabilityRequirementConverter.convertRequirements(anyMap(), any(Service.class),
+            any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
 
         // test when component is service
         result = Deencapsulation
             .invoke(testSubject, "convertReqCapAndTypeName", new HashMap<>(), component, toscaNode, nodeTypes,
                 toscaNodeType, dataTypes);
-        Assert.assertNotNull(result);
+        assertNotNull(result);
     }
 
     @Test
-    public void testConvertNodeTemplates() throws Exception {
-        Component component = getNewResource();
-        List<ComponentInstance> componentInstances = new ArrayList<>();
-        Map<String, List<ComponentInstanceProperty>> componentInstancesProperties = new HashMap<>();
-        Map<String, Component> componentCache = new HashMap<>();
-        Map<String, DataTypeDefinition> dataTypes = new HashMap<>();
-        ToscaTopolgyTemplate topologyTemplate = new ToscaTopolgyTemplate();
-        Either<Map<String, ToscaNodeTemplate>, ToscaError> result;
-        Map<String, List<ComponentInstanceInput>> componentInstancesInputs = new HashMap<>();
-        List<ComponentInstanceInput> inputs = new ArrayList<>();
-        inputs.add(new ComponentInstanceInput());
-        componentInstancesInputs.put("key", inputs);
-        List<RequirementCapabilityRelDef> resourceInstancesRelations = new ArrayList<>();
-        RequirementCapabilityRelDef reldef = new RequirementCapabilityRelDef();
+    void testConvertNodeTemplatesWhenComponentIsService() {
+        final Component component = getNewService();
+        final List<ComponentInstance> componentInstances = new ArrayList<>();
+        final Map<String, List<ComponentInstanceProperty>> componentInstancesProperties = new HashMap<>();
+        final Map<String, Component> componentCache = new HashMap<>();
+        final Map<String, DataTypeDefinition> dataTypes = new HashMap<>();
+        final ToscaTopolgyTemplate topologyTemplate = new ToscaTopolgyTemplate();
+        final Either<Map<String, ToscaNodeTemplate>, ToscaError> result;
+        final Map<String, List<ComponentInstanceInput>> componentInstancesInputs = new HashMap<>();
+        final List<ComponentInstanceInput> inputs = new ArrayList<>();
+        final ComponentInstanceInput componentInstanceInput = new ComponentInstanceInput();
+        componentInstanceInput.setUniqueId("uuid");
+        inputs.add(componentInstanceInput);
+        componentInstancesInputs.put("uuid", inputs);
+        final List<RequirementCapabilityRelDef> resourceInstancesRelations = new ArrayList<>();
+        final RequirementCapabilityRelDef reldef = new RequirementCapabilityRelDef();
         reldef.setFromNode("node");
         resourceInstancesRelations.add(reldef);
         component.setComponentInstancesRelations(resourceInstancesRelations);
 
-        ComponentInstance instance = new ComponentInstance();
+        final ComponentInstance instance = new ComponentInstance();
         instance.setUniqueId("id");
         instance.setComponentUid("uid");
         instance.setOriginType(OriginTypeEnum.ServiceProxy);
-        List<GroupInstance> groupInstances = new ArrayList<>();
-        GroupInstance groupInst = new GroupInstance();
-        List<String> artifacts = new ArrayList<>();
+        final List<GroupInstance> groupInstances = new ArrayList<>();
+        final GroupInstance groupInst = new GroupInstance();
+        final List<String> artifacts = new ArrayList<>();
         artifacts.add("artifact");
         groupInst.setArtifacts(artifacts);
         groupInst.setType("type");
         groupInstances.add(groupInst);
         instance.setGroupInstances(groupInstances);
+
+        final List<PropertyDefinition> properties = new ArrayList<>();
+        properties.add(new PropertyDefinition());
+        instance.setProperties(properties);
+
+        instance.setUniqueId("uuid");
+        instance.setDescription("desc");
+        instance.setSourceModelUid("sourceModelUid");
+
         componentInstances.add(instance);
 
+        component.setComponentInstances(componentInstances);
+
         component.setComponentInstancesInputs(componentInstancesInputs);
         component.setInvariantUUID("uuid");
         component.setUUID("uuid");
         component.setDescription("desc");
+        component.setUniqueId("uid");
 
         componentCache.put("uid", component);
 
-        componentInstancesProperties.put("id", new ArrayList<>());
-        componentInstancesInputs.put("id", new ArrayList<>());
+        final List<ComponentInstanceProperty> componentInstanceProperties = new ArrayList<>();
+        componentInstanceProperties.add(new ComponentInstanceProperty());
+
+        componentInstancesProperties.put("uuid", componentInstanceProperties);
+        component.setComponentInstancesProperties(componentInstancesProperties);
+
+        final Map<String, List<ComponentInstanceAttribute>> componentInstancesAttributes = new HashMap<>();
+        final List<ComponentInstanceAttribute> componentInstanceAttributes = new ArrayList<>();
+        final ComponentInstanceAttribute componentInstanceAttribute = new ComponentInstanceAttribute();
+        componentInstanceAttribute.setDefaultValue("def value");
+        componentInstanceAttributes.add(componentInstanceAttribute);
 
-        when(capabilityRequirementConverter.getOriginComponent(any(Map.class),
-            any(ComponentInstance.class))).thenReturn(Either.left(component));
+        componentInstancesAttributes.put("uuid", componentInstanceAttributes);
+        component.setComponentInstancesAttributes(componentInstancesAttributes);
+
+        ComponentInstanceProperty cip = new ComponentInstanceProperty();
+        cip.setInstanceUniqueId("id");
 
-        when(capabilityRequirementConverter.convertComponentInstanceCapabilities(
-            any(ComponentInstance.class), any(Map.class), any(ToscaNodeTemplate.class)))
+        List<ComponentInstanceProperty> list = new ArrayList<>();
+        list.add(cip);
+
+        componentInstancesProperties.put("id", list);
+        component.setComponentInstancesProperties(componentInstancesProperties);
+
+        when(capabilityRequirementConverter.getOriginComponent(anyMap(), any(ComponentInstance.class))).thenReturn(Either.left(component));
+        when(capabilityRequirementConverter
+            .convertComponentInstanceCapabilities(any(ComponentInstance.class), anyMap(), any(ToscaNodeTemplate.class)))
             .thenReturn(Either.left(new ToscaNodeTemplate()));
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any())).thenReturn(Either.left(Collections.emptyMap()));
+        when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
+        when(capabilityRequirementConverter.convertRequirements(anyMap(), any(Resource.class), any(ToscaNodeType.class)))
+            .thenReturn(Either.left(new ToscaNodeType()));
+        when(toscaOperationFacade.getToscaFullElement("uid")).thenReturn(Either.left(component));
+        when(toscaOperationFacade.getToscaFullElement("sourceModelUid")).thenReturn(Either.left(component));
+        when(toscaOperationFacade.getLatestByName("serviceProxy", null)).thenReturn(Either.left(new Resource()));
+        when(toscaOperationFacade.getToscaElement(any(String.class), any(ComponentParametersView.class))).thenReturn(Either.left(new Resource()));
+
+        final Map<String, String[]> substitutionMappingMap = new HashMap<>();
+        final String[] array = {"value1", "value2"};
+        substitutionMappingMap.put("key", array);
+        when(capabilityRequirementConverter.convertSubstitutionMappingCapabilities(anyMap(), any(Component.class)))
+            .thenReturn(Either.left(substitutionMappingMap));
+
+        when(capabilityRequirementConverter
+            .convertSubstitutionMappingRequirements(any(Component.class), anyMap()))
+            .thenReturn(Either.left(Collections.emptyMap()));
 
         // default test
-        result = Deencapsulation.invoke(testSubject, "convertNodeTemplates", component, componentInstances,
-            componentInstancesProperties, new HashMap<>(), componentCache, dataTypes, topologyTemplate);
-        Assert.assertNotNull(result);
+        final Either<ToscaRepresentation, ToscaError> toscaRepresentationToscaErrorEither = testSubject.exportComponent(component);
+        assertNotNull(toscaRepresentationToscaErrorEither);
+
     }
 
     @Test
-    public void testConvertNodeTemplatesWhenComponentIsService() throws Exception {
-        Component component = getNewService();
-        List<ComponentInstance> componentInstances = new ArrayList<>();
-        Map<String, List<ComponentInstanceProperty>> componentInstancesProperties = new HashMap<>();
-        Map<String, List<ComponentInstanceProperty>> componentInstancesInterfaces = new HashMap<>();
-        Map<String, Component> componentCache = new HashMap<>();
-        Map<String, DataTypeDefinition> dataTypes = new HashMap<>();
-        ToscaTopolgyTemplate topologyTemplate = new ToscaTopolgyTemplate();
-        Either<Map<String, ToscaNodeTemplate>, ToscaError> result;
-        Map<String, List<ComponentInstanceInput>> componentInstancesInputs = new HashMap<>();
-        List<ComponentInstanceInput> inputs = new ArrayList<>();
-        inputs.add(new ComponentInstanceInput());
-        componentInstancesInputs.put("key", inputs);
-        List<RequirementCapabilityRelDef> resourceInstancesRelations = new ArrayList<>();
-        RequirementCapabilityRelDef reldef = new RequirementCapabilityRelDef();
+    void testConvertNodeTemplatesWhenComponentIsResource() {
+        final Resource component = getNewResource();
+        component.setResourceType(VF);
+        final List<ComponentInstance> componentInstances = new ArrayList<>();
+        final Map<String, List<ComponentInstanceProperty>> componentInstancesProperties = new HashMap<>();
+        final Map<String, Component> componentCache = new HashMap<>();
+        final Map<String, DataTypeDefinition> dataTypes = new HashMap<>();
+        final ToscaTopolgyTemplate topologyTemplate = new ToscaTopolgyTemplate();
+        final Either<Map<String, ToscaNodeTemplate>, ToscaError> result;
+        final Map<String, List<ComponentInstanceInput>> componentInstancesInputs = new HashMap<>();
+        final List<ComponentInstanceInput> inputs = new ArrayList<>();
+        final ComponentInstanceInput componentInstanceInput = new ComponentInstanceInput();
+        componentInstanceInput.setUniqueId("uuid");
+        inputs.add(componentInstanceInput);
+        componentInstancesInputs.put("uuid", inputs);
+        final List<RequirementCapabilityRelDef> resourceInstancesRelations = new ArrayList<>();
+        final RequirementCapabilityRelDef reldef = new RequirementCapabilityRelDef();
         reldef.setFromNode("node");
         resourceInstancesRelations.add(reldef);
         component.setComponentInstancesRelations(resourceInstancesRelations);
 
-        ComponentInstance instance = new ComponentInstance();
+        final ComponentInstance instance = new ComponentInstance();
         instance.setUniqueId("id");
         instance.setComponentUid("uid");
-        instance.setOriginType(OriginTypeEnum.ServiceProxy);
-        List<GroupInstance> groupInstances = new ArrayList<>();
-        GroupInstance groupInst = new GroupInstance();
-        List<String> artifacts = new ArrayList<>();
+        instance.setOriginType(OriginTypeEnum.VFC);
+        final List<GroupInstance> groupInstances = new ArrayList<>();
+        final GroupInstance groupInst = new GroupInstance();
+        final List<String> artifacts = new ArrayList<>();
         artifacts.add("artifact");
         groupInst.setArtifacts(artifacts);
         groupInst.setType("type");
         groupInstances.add(groupInst);
         instance.setGroupInstances(groupInstances);
+
+        final List<PropertyDefinition> properties = new ArrayList<>();
+        properties.add(new PropertyDefinition());
+        instance.setProperties(properties);
+        component.setProperties(properties);
+
+        instance.setUniqueId("uuid");
+        instance.setDescription("desc");
+        instance.setSourceModelUid("sourceModelUid");
+        final Map<String, ArtifactDefinition> artifactList = new HashMap<>();
+        final ArtifactDefinition artifact = new ArtifactDefinition();
+        artifact.setArtifactName("name.name2");
+        artifactList.put("assettoscatemplate", artifact);
+        instance.setArtifacts(artifactList);
+
+        Map<String, ToscaArtifactDataDefinition> toscaArtifactDataDefinitionMap = new HashMap<>();
+        toscaArtifactDataDefinitionMap.put("assettoscatemplate", new ToscaArtifactDataDefinition());
+        instance.setToscaArtifacts(toscaArtifactDataDefinitionMap);
+
         componentInstances.add(instance);
 
+        component.setComponentInstances(componentInstances);
+
         component.setComponentInstancesInputs(componentInstancesInputs);
         component.setInvariantUUID("uuid");
         component.setUUID("uuid");
         component.setDescription("desc");
+        component.setUniqueId("uid");
+
+        componentCache.put("uid", component);
 
-        Map<String, ForwardingPathDataDefinition> forwardingPaths = new HashMap<>();
-        ForwardingPathDataDefinition path = new ForwardingPathDataDefinition();
-        ListDataDefinition<ForwardingPathElementDataDefinition> list = new ListDataDefinition<>();
-        path.setPathElements(list);
-        forwardingPaths.put("key", path);
+        final List<ComponentInstanceProperty> componentInstanceProperties = new ArrayList<>();
+        componentInstanceProperties.add(new ComponentInstanceProperty());
 
-        ((Service) component).setForwardingPaths(forwardingPaths);
+        componentInstancesProperties.put("uuid", componentInstanceProperties);
+        component.setComponentInstancesProperties(componentInstancesProperties);
 
-        componentCache.put("uid", component);
+        final Map<String, List<ComponentInstanceAttribute>> componentInstancesAttributes = new HashMap<>();
+        final List<ComponentInstanceAttribute> componentInstanceAttributes = new ArrayList<>();
+        final ComponentInstanceAttribute componentInstanceAttribute = new ComponentInstanceAttribute();
+        componentInstanceAttribute.setDefaultValue("def value");
+        componentInstanceAttributes.add(componentInstanceAttribute);
+
+        componentInstancesAttributes.put("uuid", componentInstanceAttributes);
+        component.setComponentInstancesAttributes(componentInstancesAttributes);
+
+        component.setArtifacts(artifactList);
+        component.setToscaArtifacts(artifactList);
 
-        componentInstancesProperties.put("id", new ArrayList<>());
-        componentInstancesInterfaces.put("id", new ArrayList<>());
-        componentInstancesInputs.put("id", new ArrayList<>());
+        final List<AttributeDefinition> attributes = new ArrayList<>();
+        final var attribute = new AttributeDefinition();
+        attribute.setName("mock");
+        attributes.add(attribute);
+        component.setAttributes(attributes);
 
-        when(capabilityRequirementConverter.getOriginComponent(any(Map.class),
-            any(ComponentInstance.class))).thenReturn(Either.left(component));
+        List<ComponentInstanceInput> componentInstanceInputs = new ArrayList<>();
+        componentInstanceInputs.add(new ComponentInstanceInput());
+
+        componentInstancesInputs.put("id", componentInstanceInputs);
+        component.setComponentInstancesInputs(componentInstancesInputs);
 
-        when(capabilityRequirementConverter.convertComponentInstanceCapabilities(
-            any(ComponentInstance.class), any(Map.class), any(ToscaNodeTemplate.class)))
+        when(capabilityRequirementConverter.getOriginComponent(anyMap(), any(ComponentInstance.class))).thenReturn(Either.left(component));
+        when(capabilityRequirementConverter
+            .convertComponentInstanceCapabilities(any(ComponentInstance.class), anyMap(), any(ToscaNodeTemplate.class)))
             .thenReturn(Either.left(new ToscaNodeTemplate()));
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any())).thenReturn(Either.left(Collections.emptyMap()));
+        when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
+        when(capabilityRequirementConverter.convertRequirements(anyMap(), any(Resource.class), any(ToscaNodeType.class)))
+            .thenReturn(Either.left(new ToscaNodeType()));
+        when(toscaOperationFacade.getToscaFullElement("uid")).thenReturn(Either.left(component));
+        when(toscaOperationFacade.getToscaFullElement("sourceModelUid")).thenReturn(Either.left(component));
+        when(toscaOperationFacade.getLatestByName("serviceProxy", null)).thenReturn(Either.left(new Resource()));
+        when(toscaOperationFacade.getToscaElement(any(String.class), any(ComponentParametersView.class))).thenReturn(Either.left(new Resource()));
+
+        final Map<String, String[]> substitutionMappingMap = new HashMap<>();
+        final String[] array = {"value1", "value2"};
+        substitutionMappingMap.put("key", array);
+        when(capabilityRequirementConverter.convertSubstitutionMappingCapabilities(anyMap(), any(Component.class)))
+            .thenReturn(Either.left(substitutionMappingMap));
+
+        when(capabilityRequirementConverter
+            .convertSubstitutionMappingRequirements(any(Component.class), anyMap()))
+            .thenReturn(Either.left(Collections.emptyMap()));
 
         // default test
-        result = Deencapsulation.invoke(testSubject, "convertNodeTemplates", component, componentInstances,
-            componentInstancesProperties, componentInstancesInterfaces, componentCache, dataTypes, topologyTemplate);
-        Assert.assertNotNull(result);
+        final Either<ToscaRepresentation, ToscaError> toscaRepresentationToscaErrorEither = testSubject.exportComponent(component);
+        assertNotNull(toscaRepresentationToscaErrorEither);
+
     }
 
     @Test
-    public void testConvertNodeTemplatesWhenConvertComponentInstanceCapabilitiesIsRight() throws Exception {
+    void testConvertNodeTemplatesWhenConvertComponentInstanceCapabilitiesIsRight() {
         Component component = getNewResource();
         List<ComponentInstance> componentInstances = new ArrayList<>();
         Map<String, List<ComponentInstanceProperty>> componentInstancesProperties = new HashMap<>();
@@ -770,6 +905,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         instance.setComponentUid("uid");
         instance.setOriginType(OriginTypeEnum.ServiceProxy);
         componentInstances.add(instance);
+        component.setComponentInstances(componentInstances);
 
         component.setComponentInstancesInputs(componentInstancesInputs);
         component.setInvariantUUID("uuid");
@@ -778,21 +914,22 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
 
         componentCache.put("uid", component);
 
-        when(capabilityRequirementConverter.getOriginComponent(any(Map.class),
-            any(ComponentInstance.class))).thenReturn(Either.left(component));
-
-        when(capabilityRequirementConverter.convertComponentInstanceCapabilities(
-            any(ComponentInstance.class), any(Map.class), any(ToscaNodeTemplate.class)))
+        when(capabilityRequirementConverter.getOriginComponent(anyMap(), any(ComponentInstance.class))).thenReturn(Either.left(component));
+        when(capabilityRequirementConverter
+            .convertComponentInstanceCapabilities(any(ComponentInstance.class), anyMap(), any(ToscaNodeTemplate.class)))
             .thenReturn(Either.right(ToscaError.GENERAL_ERROR));
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any())).thenReturn(Either.left(Collections.emptyMap()));
+        when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
+        when(capabilityRequirementConverter.convertRequirements(anyMap(), any(Resource.class),
+            any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
 
         // default test
-        result = Deencapsulation.invoke(testSubject, "convertNodeTemplates", component, componentInstances,
-            componentInstancesProperties, componentInstancesInterfaces, componentCache, dataTypes, topologyTemplate);
-        Assert.assertNotNull(result);
+        final Either<ToscaRepresentation, ToscaError> toscaRepresentationToscaErrorEither = testSubject.exportComponent(component);
+        assertNotNull(toscaRepresentationToscaErrorEither);
     }
 
     @Test
-    public void testConvetNodeTemplateWhenGetOriginComponentIsRight() throws Exception {
+    void testConvetNodeTemplateWhenGetOriginComponentIsRight() {
         Component component = getNewResource();
         List<ComponentInstance> componentInstances = new ArrayList<>();
         Map<String, List<ComponentInstanceProperty>> componentInstancesProperties = new HashMap<>();
@@ -816,33 +953,42 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         instance.setComponentUid("uid");
         instance.setOriginType(OriginTypeEnum.ServiceProxy);
         componentInstances.add(instance);
+        component.setComponentInstances(componentInstances);
 
         component.setComponentInstancesInputs(componentInstancesInputs);
         component.setInvariantUUID("uuid");
         component.setUUID("uuid");
         component.setDescription("desc");
 
+        final List<AttributeDefinition> attributes = new ArrayList<>();
+        final var attribute = new AttributeDefinition();
+        attribute.setName("mock");
+        attributes.add(attribute);
+        component.setAttributes(attributes);
+
         componentCache.put("uid", component);
 
-        when(capabilityRequirementConverter.getOriginComponent(any(Map.class),
-            any(ComponentInstance.class))).thenReturn(Either.right(false));
+        when(capabilityRequirementConverter.getOriginComponent(anyMap(), any(ComponentInstance.class))).thenReturn(Either.right(false));
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any())).thenReturn(Either.left(Collections.emptyMap()));
+        when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
+        when(capabilityRequirementConverter.convertRequirements(anyMap(), any(Resource.class),
+            any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
 
         // default test
-        result = Deencapsulation.invoke(testSubject, "convertNodeTemplates", component, componentInstances,
-            componentInstancesProperties, componentInstancesInterfaces, componentCache, dataTypes, topologyTemplate);
-        Assert.assertNotNull(result);
+        final Either<ToscaRepresentation, ToscaError> toscaRepresentationToscaErrorEither = testSubject.exportComponent(component);
+        assertNotNull(toscaRepresentationToscaErrorEither);
     }
 
     @Test
-    public void testConvertNodeTemplatesWhenConvertComponentInstanceRequirmentsIsRight() {
-        Component component = new Resource();
+    void testConvertNodeTemplatesWhenConvertComponentInstanceRequirmentsIsRight() {
+        Resource component = getNewResource();
+        component.setResourceType(VF);
         List<ComponentInstance> componentInstances = new ArrayList<>();
         Map<String, List<ComponentInstanceProperty>> componentInstancesProperties = new HashMap<>();
         Map<String, List<ComponentInstanceProperty>> componentInstancesInterfaces = new HashMap<>();
         Map<String, Component> componentCache = new HashMap<>();
         Map<String, DataTypeDefinition> dataTypes = new HashMap<>();
         ToscaTopolgyTemplate topologyTemplate = new ToscaTopolgyTemplate();
-        Either<Map<String, ToscaNodeTemplate>, ToscaError> result;
         Map<String, List<ComponentInstanceInput>> componentInstancesInputs = new HashMap<>();
         List<ComponentInstanceInput> inputs = new ArrayList<>();
         inputs.add(new ComponentInstanceInput());
@@ -859,81 +1005,39 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         resourceInstancesRelations.add(reldef);
         component.setComponentInstancesRelations(resourceInstancesRelations);
 
+        Map<String, ArtifactDefinition> artifactList = new HashMap<>();
+        ArtifactDefinition artifact = new ArtifactDefinition();
+        artifact.setArtifactName("name.name2");
+        artifactList.put("assettoscatemplate", artifact);
+        component.setArtifacts(artifactList);
+        component.setToscaArtifacts(artifactList);
+
         ComponentInstance instance = new ComponentInstance();
         instance.setUniqueId("id");
+        instance.setComponentUid("id");
+        instance.setOriginType(OriginTypeEnum.VF);
         componentInstances.add(instance);
+        component.setComponentInstances(componentInstances);
 
         component.setComponentInstancesInputs(componentInstancesInputs);
         component.setComponentInstances(componentInstances);
 
-        when(capabilityRequirementConverter.getOriginComponent(any(Map.class),
-            any(ComponentInstance.class))).thenReturn(Either.left(component));
-
-        // default test
-        result = Deencapsulation.invoke(testSubject, "convertNodeTemplates", component, componentInstances,
-            componentInstancesProperties, componentInstancesInterfaces, componentCache, dataTypes, topologyTemplate);
-        Assert.assertNotNull(result);
-    }
-
-    @Test
-    public void testAddComponentInstanceInputs() throws Exception {
-
-        Map<String, DataTypeDefinition> dataTypes = new HashMap<>();
-        Map<String, List<ComponentInstanceInput>> componentInstancesInputs = new HashMap<>();
-        ComponentInstance componentInstance = new ComponentInstance();
-        String instanceUniqueId = "id";
-        Map<String, Object> props = new HashMap<>();
-
-        List<ComponentInstanceInput> componentInstanceInputs = new ArrayList<>();
-        componentInstanceInputs.add(new ComponentInstanceInput());
-
-        componentInstancesInputs.put(instanceUniqueId, componentInstanceInputs);
-
-        // default test
-        Deencapsulation.invoke(testSubject, "addComponentInstanceInputs", dataTypes, componentInstancesInputs,
-            instanceUniqueId, props);
-    }
-
-    @Test
-    public void testAddPropertiesOfComponentInstance() throws Exception {
-        Map<String, List<ComponentInstanceProperty>> componentInstancesProperties = new HashMap<>();
-        Map<String, DataTypeDefinition> dataTypes = new HashMap<>();
-        ComponentInstance componentInstance = new ComponentInstance();
-        String instanceUniqueId = "id";
-        Map<String, Object> props = new HashMap<>();
-
-        ComponentInstanceProperty cip = new ComponentInstanceProperty();
-        cip.setInstanceUniqueId("id");
-
-        List<ComponentInstanceProperty> list = new ArrayList<>();
-        list.add(cip);
-
-        componentInstancesProperties.put("id", list);
-
-        // default test
-        Deencapsulation.invoke(testSubject, "addPropertiesOfComponentInstance", componentInstancesProperties, dataTypes,
-            instanceUniqueId, props);
-    }
-
-    @Test
-    public void testAddPropertiesOfParentComponent() throws Exception {
-        Map<String, DataTypeDefinition> dataTypes = new HashMap<>();
-        ComponentInstance componentInstance = new ComponentInstance();
-        Component componentOfInstance = new Resource();
-        Map<String, Object> props = new HashMap<>();
-
-        List<PropertyDefinition> properties = new ArrayList<>();
-        properties.add(new PropertyDefinition());
-
-        ((Resource) componentOfInstance).setProperties(properties);
+        doReturn(Either.left(component)).when(toscaOperationFacade).getToscaFullElement("id");
+        when(capabilityRequirementConverter.getOriginComponent(anyMap(), any(ComponentInstance.class))).thenReturn(Either.left(component));
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any())).thenReturn(Either.left(Collections.emptyMap()));
+        when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
+        when(capabilityRequirementConverter.convertRequirements(anyMap(), any(Resource.class),
+            any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
+        when(toscaOperationFacade.getToscaElement(any(String.class), any(ComponentParametersView.class)))
+            .thenReturn(Either.right(StorageOperationStatus.BAD_REQUEST));
 
         // default test
-        Deencapsulation.invoke(testSubject, "addPropertiesOfParentComponent", dataTypes,
-            componentOfInstance, props);
+        final Either<ToscaRepresentation, ToscaError> result = testSubject.exportComponent(component);
+        assertNotNull(result);
     }
 
     @Test
-    public void testCreateNodeType() throws Exception {
+    void testCreateNodeType() {
 
         Component component = new Resource();
         List<String> array = new ArrayList<>();
@@ -943,16 +1047,16 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
 
         // test when component is resource
         result = Deencapsulation.invoke(testSubject, "createNodeType", component);
-        Assert.assertNotNull(result);
+        assertNotNull(result);
 
         component = new Service();
         // test when component is service
         result = Deencapsulation.invoke(testSubject, "createNodeType", component);
-        Assert.assertNotNull(result);
+        assertNotNull(result);
     }
 
     @Test
-    public void testCreateProxyInterfaceTypesComponentNotFound() throws Exception {
+    void testCreateProxyInterfaceTypesComponentNotFound() {
         Component container = new Service();
         Either<Map<String, ToscaNodeType>, ToscaError> result;
         List<ComponentInstance> componentInstances = new ArrayList<>();
@@ -967,11 +1071,11 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
             any(ComponentParametersView.class)))
             .thenReturn(Either.right(StorageOperationStatus.BAD_REQUEST));
         result = Deencapsulation.invoke(testSubject, "createProxyInterfaceTypes", container);
-        Assert.assertTrue(result.isRight());
+        assertTrue(result.isRight());
     }
 
     @Test
-    public void testCreateProxyInterfaceTypesWhenInterfaceLifecycleFetchFailed() {
+    void testCreateProxyInterfaceTypesWhenInterfaceLifecycleFetchFailed() {
         Component container = new Service();
         Either<Map<String, ToscaNodeType>, ToscaError> result;
         List<ComponentInstance> componentInstances = new ArrayList<>();
@@ -985,14 +1089,14 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         when(toscaOperationFacade.getToscaElement(any(String.class),
             any(ComponentParametersView.class)))
             .thenReturn(Either.left(new Resource()));
-        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes())
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
             .thenReturn(Either.right(StorageOperationStatus.BAD_REQUEST));
         result = Deencapsulation.invoke(testSubject, "createProxyInterfaceTypes", container);
-        Assert.assertTrue(result.isRight());
+        assertTrue(result.isRight());
     }
 
     @Test
-    public void testCreateProxyInterfaceTypesPositive() {
+    void testCreateProxyInterfaceTypesPositive() {
         Component container = new Service();
         Either<Map<String, ToscaNodeType>, ToscaError> result;
         List<ComponentInstance> componentInstances = new ArrayList<>();
@@ -1003,7 +1107,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         componentInstances.add(instance);
         container.setComponentInstances(componentInstances);
 
-        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes())
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
             .thenReturn(Either.left(Collections.emptyMap()));
 
         Component proxyResource = new Resource();
@@ -1015,13 +1119,13 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
             .thenReturn(Either.left(proxyResource));
 
         result = Deencapsulation.invoke(testSubject, "createProxyInterfaceTypes", container);
-        Assert.assertNotNull(result);
-        Assert.assertTrue(result.isLeft());
-        Assert.assertEquals(1, result.left().value().size());
+        assertNotNull(result);
+        assertTrue(result.isLeft());
+        assertEquals(1, result.left().value().size());
     }
 
     @Test
-    public void testCreateProxyNodeTypes() throws Exception {
+    void testCreateProxyNodeTypes() {
         Map<String, Component> componentCache = new HashMap<>();
         Component container = new Resource();
         Either<Map<String, ToscaNodeType>, ToscaError> result;
@@ -1033,16 +1137,16 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         componentInstances.add(instance);
         container.setComponentInstances(componentInstances);
 
-        when(toscaOperationFacade.getLatestByName("serviceProxy"))
+        when(toscaOperationFacade.getLatestByName("serviceProxy", null))
             .thenReturn(Either.right(StorageOperationStatus.BAD_REQUEST));
 
         // test when getLatestByName return is right
         result = Deencapsulation.invoke(testSubject, "createProxyNodeTypes", componentCache, container);
-        Assert.assertNotNull(result);
+        assertNotNull(result);
     }
 
     @Test
-    public void testCreateServiceSubstitutionNodeTypes() throws Exception {
+    void testCreateServiceSubstitutionNodeTypes() {
         Map<String, Component> componentCache = new HashMap<>();
 
         Component referencedService = getNewService();
@@ -1061,20 +1165,20 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         componentInstances.add(instance);
         containerService.setComponentInstances(componentInstances);
 
-        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes())
+        when(interfaceLifecycleOperation.getAllInterfaceLifecycleTypes(any()))
             .thenReturn(Either.left(Collections.emptyMap()));
-        when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
-        when(capabilityRequirementConverter.convertRequirements(any(Map.class), any(Service.class),
+        when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
+        when(capabilityRequirementConverter.convertRequirements(anyMap(), any(Service.class),
             any(ToscaNodeType.class))).thenReturn(Either.left(new ToscaNodeType()));
 
         ToscaTemplate toscaNode = new ToscaTemplate("1_1");
 
         Deencapsulation.invoke(testSubject, "createServiceSubstitutionNodeTypes", componentCache, containerService, toscaNode);
-        Assert.assertNotNull(toscaNode.getNode_types());
+        assertNotNull(toscaNode.getNode_types());
     }
 
     @Test
-    public void testCreateProxyNodeTypesWhenGetLatestByNameReturnValue() {
+    void testCreateProxyNodeTypesWhenGetLatestByNameReturnValue() {
         Map<String, Component> componentCache = new HashMap<>();
         Component container = new Resource();
         Either<Map<String, ToscaNodeType>, ToscaError> result;
@@ -1086,7 +1190,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         componentInstances.add(instance);
         container.setComponentInstances(componentInstances);
 
-        when(toscaOperationFacade.getLatestByName("serviceProxy")).thenReturn(Either.left(new Resource()));
+        when(toscaOperationFacade.getLatestByName("serviceProxy", null)).thenReturn(Either.left(new Resource()));
 
         ComponentParametersView parameterView = new ComponentParametersView();
         parameterView.disableAll();
@@ -1096,31 +1200,31 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
             any(ComponentParametersView.class)))
             .thenReturn(Either.right(StorageOperationStatus.BAD_REQUEST));
 
-        when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
+        when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
 
         // test when getLatestByName is left
         result = Deencapsulation.invoke(testSubject, "createProxyNodeTypes", componentCache, container);
-        Assert.assertNotNull(result);
+        assertNotNull(result);
     }
 
     @Test
-    public void testCreateProxyNodeType() throws Exception {
+    void testCreateProxyNodeType() {
         Map<String, Component> componentCache = new HashMap<>();
         Component origComponent = new Resource();
         Component proxyComponent = new Resource();
         ComponentInstance instance = new ComponentInstance();
         ToscaNodeType result;
 
-        when(dataTypeCache.getAll()).thenReturn(Either.left(new HashMap<>()));
+        when(applicationDataTypeCache.getAll(null)).thenReturn(Either.left(new HashMap<>()));
 
         // default test
         result = Deencapsulation.invoke(testSubject, "createProxyNodeType", componentCache, origComponent,
             proxyComponent, instance);
-        Assert.assertNotNull(result);
+        assertNotNull(result);
     }
 
     @Test
-    public void testConvertComponentInstanceRequirements() throws Exception {
+    void testConvertComponentInstanceRequirements() {
         Component component = new Resource();
         ComponentInstance componentInstance = new ComponentInstance();
         List<RequirementCapabilityRelDef> relations = new ArrayList<>();
@@ -1132,7 +1236,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         // default test
         result = Deencapsulation.invoke(testSubject, "convertComponentInstanceRequirements", component,
             componentInstance, relations, nodeTypeTemplate, originComponent, componentCache);
-        Assert.assertNotNull(result);
+        assertNotNull(result);
 
         RequirementCapabilityRelDef reldef = new RequirementCapabilityRelDef();
         reldef.setFromNode("name");
@@ -1152,11 +1256,11 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         // test when filteredRElations ins't empty
         result = Deencapsulation.invoke(testSubject, "convertComponentInstanceRequirements", component,
             componentInstance, relations, nodeTypeTemplate, originComponent, componentCache);
-        Assert.assertNotNull(result);
+        assertNotNull(result);
     }
 
     @Test
-    public void buildRequirementFailure() {
+    void buildRequirementFailure() {
         final Component fromOriginComponent = new Resource();
         final ComponentInstance fromInstance = new ComponentInstance();
         final String fromInstanceUid = "fromInstanceUid";
@@ -1207,7 +1311,6 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
             .format("Failed to find a requirement with uniqueId %s on a component with uniqueId %s",
                 relation.getRequirementUid(), fromOriginComponent.getUniqueId());
 
-
         assertThrows(ToscaExportException.class, () ->
             Deencapsulation.invoke(testSubject, "buildRequirement", fromInstance, fromOriginComponent,
                 instancesList, relationshipDefinition, new HashMap<>()), expectedError);
@@ -1239,7 +1342,6 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         when(toscaOperationFacade.getToscaElement(any(String.class), any(ComponentParametersView.class)))
             .thenReturn(Either.left(toOriginComponent));
 
-
         requirementDefinition.setCapability(capabilityName);
         relation.setCapability("wrong");
         final String requirementPreviousName = "requirementPreviousName";
@@ -1257,7 +1359,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
     }
 
     @Test
-    public void testBuildRequirement() {
+    void testBuildRequirement() {
         final ComponentInstance fromInstance = new ComponentInstance();
         fromInstance.setUniqueId("name");
         fromInstance.setComponentUid("string");
@@ -1309,14 +1411,14 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         when(
             capabilityRequirementConverter
                 .buildSubstitutedName(anyMap(), eq(toOriginComponent), anyList(), eq(capabilityName), eq(
-                    capabilityPreviousName)))
+                    capabilityPreviousName), any()))
             .thenReturn(Either.left(builtCapabilityName));
 
         final String builtRequirementName = "builtRequirementName";
         when(
             capabilityRequirementConverter
                 .buildSubstitutedName(anyMap(), eq(fromOriginComponent), anyList(), eq(requirementName), eq(
-                    requirementPreviousName)))
+                    requirementPreviousName), any()))
             .thenReturn(Either.left(builtRequirementName));
 
         final Map<String, ToscaTemplateRequirement> actualRequirementMap =
@@ -1338,7 +1440,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
     }
 
     @Test
-    public void testAddRequirmentsWithBuildAndAddRequirements() {
+    void testAddRequirmentsWithBuildAndAddRequirements() {
         ComponentInstance fromInstance = new ComponentInstance();
         Component fromOriginComponent = new Resource();
         List<ComponentInstance> instancesList = new ArrayList<>();
@@ -1387,7 +1489,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
 
         when(
             capabilityRequirementConverter
-                .buildSubstitutedName(anyMap(), any(Component.class), anyList(), anyString(), anyString()))
+                .buildSubstitutedName(anyMap(), any(Component.class), anyList(), anyString(), anyString(), any()))
             .thenReturn(Either.right(false));
 
         final String expectedErrorMsg =
@@ -1401,7 +1503,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
     }
 
     @Test
-    public void testBuildAndAddRequirement() {
+    void testBuildAndAddRequirement() {
         Component fromOriginComponent = new Resource();
         Component toOriginComponent = new Resource();
         CapabilityDefinition capability = new CapabilityDefinition();
@@ -1420,12 +1522,12 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
 
         when(
             capabilityRequirementConverter
-                .buildSubstitutedName(anyMap(), eq(toOriginComponent), anyList(), eq("cap"), anyString()))
+                .buildSubstitutedName(anyMap(), eq(toOriginComponent), anyList(), eq("cap"), anyString(), any()))
             .thenReturn(Either.left("buildCapNameRes"));
 
         when(
             capabilityRequirementConverter
-                .buildSubstitutedName(anyMap(), eq(fromOriginComponent), anyList(), eq("req"), anyString()))
+                .buildSubstitutedName(anyMap(), eq(fromOriginComponent), anyList(), eq("req"), anyString(), any()))
             .thenReturn(Either.left("buildReqNameRes"));
 
         // default test
@@ -1441,7 +1543,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
     }
 
     @Test
-    public void testBuildRequirementBuildSubstitutedNameReturnsValueTwice() {
+    void testBuildRequirementBuildSubstitutedNameReturnsValueTwice() {
         final Component fromOriginComponent = new Resource();
         final Component toOriginComponent = new Resource();
         final CapabilityDefinition capability = new CapabilityDefinition();
@@ -1457,8 +1559,10 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         relationship.setRequirement("req");
 
         final String builtCapabilityOrRequirementName = "builtCapabilityOrRequirementName";
-        when(capabilityRequirementConverter.buildSubstitutedName(any(), any(), any(), any(), any()))
+        when(capabilityRequirementConverter.buildSubstitutedName(anyMap(), eq(fromOriginComponent), anyList(), eq("cap"), any(), any()))
             .thenReturn(Either.left(builtCapabilityOrRequirementName));
+        when(capabilityRequirementConverter.buildSubstitutedName(anyMap(), eq(toOriginComponent), anyList(), eq("req"), any(), any()))
+        .thenReturn(Either.left(builtCapabilityOrRequirementName));
 
         final Map<String, ToscaTemplateRequirement> requirementMap = Deencapsulation
             .invoke(testSubject, "buildRequirement", fromOriginComponent, toOriginComponent, capability, requirement,
@@ -1472,7 +1576,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
     }
 
     @Test
-    public void testIsRequirementBelongToRelation() throws Exception {
+    void testIsRequirementBelongToRelation() {
 
         Component originComponent = new Resource();
         RelationshipInfo reqAndRelationshipPair = new RelationshipInfo();
@@ -1486,11 +1590,11 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         // test return false
         result = Deencapsulation.invoke(testSubject, "isRequirementBelongToRelation", originComponent,
             reqAndRelationshipPair, requirement, fromInstanceId);
-        Assert.assertNotNull(result);
+        assertFalse(result);
     }
 
     @Test
-    public void testIsRequirementBelongToRelationWithNonAtomicComponent() {
+    void testIsRequirementBelongToRelationWithNonAtomicComponent() {
 
         Component originComponent = new Service();
         RelationshipInfo reqAndRelationshipPair = new RelationshipInfo();
@@ -1501,11 +1605,11 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         // default test return true
         result = Deencapsulation.invoke(testSubject, "isRequirementBelongToRelation", originComponent,
             reqAndRelationshipPair, requirement, fromInstanceId);
-        Assert.assertNotNull(result);
+        assertTrue(result);
     }
 
     @Test
-    public void testIsRequirementBelongToOwner() throws Exception {
+    void testIsRequirementBelongToOwner() {
 
         RelationshipInfo reqAndRelationshipPair = new RelationshipInfo();
         RequirementDefinition requirement = new RequirementDefinition();
@@ -1519,39 +1623,37 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         // default test
         result = Deencapsulation.invoke(testSubject, "isRequirementBelongToOwner", reqAndRelationshipPair, requirement,
             fromInstanceId, originComponent);
-        Assert.assertNotNull(result);
+        assertFalse(result);
     }
 
     @Test
-    public void testIsCvfc() throws Exception {
+    void testIsCvfc() {
 
-        Component component = new Resource();
+        Component component = new Service();
         boolean result;
 
-        component = new Service();
-
         result = Deencapsulation.invoke(testSubject, "isCvfc", component);
-        Assert.assertNotNull(result);
+        assertFalse(result);
     }
 
     @Test
-    public void testConvertCapabilities() throws Exception {
-        Component component = new Resource();
-        SubstitutionMapping substitutionMappings = new SubstitutionMapping();
-        Map<String, Component> componentCache = new HashMap<>();
-        Either<SubstitutionMapping, ToscaError> result;
+    void testConvertCapabilities() {
+        final Component component = new Resource();
+        final Map<String, Component> componentCache = new HashMap<>();
 
+        final Either<Map<String, String[]>, ToscaError> expectedResult = Either.right(ToscaError.NODE_TYPE_CAPABILITY_ERROR);
         when(capabilityRequirementConverter.convertSubstitutionMappingCapabilities(componentCache, component))
-            .thenReturn(Either.right(ToscaError.NODE_TYPE_CAPABILITY_ERROR));
+            .thenReturn(expectedResult);
 
         // default test return isRight
-        result = Deencapsulation.invoke(testSubject, "convertCapabilities", component, substitutionMappings,
-            componentCache);
-        Assert.assertNotNull(result);
+        final Either<Map<String, String[]>, ToscaError> actualResult =
+            Deencapsulation.invoke(testSubject, "convertSubstitutionMappingCapabilities", component, componentCache);
+        assertNotNull(actualResult);
+        assertEquals(expectedResult, actualResult);
     }
 
     @Test
-    public void testConvertCapabilities_1() throws Exception {
+    void testConvertCapabilities_1() {
         Component component = new Resource();
         ToscaNodeType nodeType = new ToscaNodeType();
         Map<String, DataTypeDefinition> dataTypes = new HashMap<>();
@@ -1563,11 +1665,11 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         // default test
         result = Deencapsulation
             .invoke(testSubject, "convertCapabilities", new HashMap<>(), component, nodeType, dataTypes);
-        Assert.assertNotNull(result);
+        assertNotNull(result);
     }
 
     @Test
-    public void testConvertToNodeTemplateArtifacts() throws Exception {
+    void testConvertToNodeTemplateArtifacts() {
         Map<String, ToscaArtifactDataDefinition> container = new HashMap<>();
         ToscaArtifactDataDefinition art = new ToscaArtifactDataDefinition();
         art.setFile("test_file");
@@ -1575,113 +1677,113 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         Map<String, ToscaTemplateArtifact> result;
         container.put("test_art", art);
         result = Deencapsulation.invoke(testSubject, "convertToNodeTemplateArtifacts", container);
-        Assert.assertNotNull(result);
-        Assert.assertTrue(MapUtils.isNotEmpty(result));
-        Assert.assertTrue(result.get("test_art").getFile().equals("test_file"));
-        Assert.assertTrue(result.get("test_art").getType().equals("test_type"));
+        assertNotNull(result);
+        assertTrue(MapUtils.isNotEmpty(result));
+        assertEquals("test_file", result.get("test_art").getFile());
+        assertEquals("test_type", result.get("test_art").getType());
     }
 
     @Test
-    public void testGetProxyNodeTypeInterfacesNoInterfaces() {
+    void testGetProxyNodeTypeInterfacesNoInterfaces() {
         Component service = new Service();
         Optional<Map<String, Object>> proxyNodeTypeInterfaces =
-                testSubject.getProxyNodeTypeInterfaces(service, DATA_TYPES);
-        Assert.assertFalse(proxyNodeTypeInterfaces.isPresent());
+            testSubject.getProxyNodeTypeInterfaces(service, DATA_TYPES);
+        assertFalse(proxyNodeTypeInterfaces.isPresent());
     }
 
     @Test
-    public void testGetProxyNodeTypeInterfaces() {
+    void testGetProxyNodeTypeInterfaces() {
         Component service = getTestComponent();
         Optional<Map<String, Object>> proxyNodeTypeInterfaces =
-                testSubject.getProxyNodeTypeInterfaces(service, DATA_TYPES);
-        Assert.assertTrue(proxyNodeTypeInterfaces.isPresent());
+            testSubject.getProxyNodeTypeInterfaces(service, DATA_TYPES);
+        assertTrue(proxyNodeTypeInterfaces.isPresent());
         Map<String, Object> componentInterfaces = proxyNodeTypeInterfaces.get();
-        Assert.assertNotNull(componentInterfaces);
+        assertNotNull(componentInterfaces);
     }
 
 
     @Test
-    public void testGetProxyNodeTypePropertiesComponentNull() {
+    void testGetProxyNodeTypePropertiesComponentNull() {
         Optional<Map<String, ToscaProperty>> proxyNodeTypeProperties =
-                testSubject.getProxyNodeTypeProperties(null, DATA_TYPES);
-        Assert.assertFalse(proxyNodeTypeProperties.isPresent());
+            testSubject.getProxyNodeTypeProperties(null, DATA_TYPES);
+        assertFalse(proxyNodeTypeProperties.isPresent());
     }
 
     @Test
-    public void testGetProxyNodeTypePropertiesNoProperties() {
+    void testGetProxyNodeTypePropertiesNoProperties() {
         Component service = new Service();
         Optional<Map<String, ToscaProperty>> proxyNodeTypeProperties =
-                testSubject.getProxyNodeTypeProperties(service, DATA_TYPES);
-        Assert.assertFalse(proxyNodeTypeProperties.isPresent());
+            testSubject.getProxyNodeTypeProperties(service, DATA_TYPES);
+        assertFalse(proxyNodeTypeProperties.isPresent());
     }
 
     @Test
-    public void testGetProxyNodeTypeProperties() {
+    void testGetProxyNodeTypeProperties() {
         Component service = getTestComponent();
         service.setProperties(Arrays.asList(createMockProperty("componentPropStr", "Default String Prop"),
-                createMockProperty("componentPropInt", null)));
+            createMockProperty("componentPropInt", null)));
         Optional<Map<String, ToscaProperty>> proxyNodeTypeProperties =
-                testSubject.getProxyNodeTypeProperties(service, DATA_TYPES);
-        Assert.assertTrue(proxyNodeTypeProperties.isPresent());
+            testSubject.getProxyNodeTypeProperties(service, DATA_TYPES);
+        assertTrue(proxyNodeTypeProperties.isPresent());
         Map<String, ToscaProperty> componentProperties = proxyNodeTypeProperties.get();
-        Assert.assertNotNull(componentProperties);
-        Assert.assertEquals(2, componentProperties.size());
+        assertNotNull(componentProperties);
+        assertEquals(2, componentProperties.size());
     }
 
     @Test
-    public void testAddInputsToPropertiesNoInputs() {
+    void testAddInputsToPropertiesNoInputs() {
         Component service = getTestComponent();
         service.setProperties(Arrays.asList(createMockProperty("componentPropStr", "Default String Prop"),
-                createMockProperty("componentPropInt", null)));
+            createMockProperty("componentPropInt", null)));
         Optional<Map<String, ToscaProperty>> proxyNodeTypePropertiesResult =
-                testSubject.getProxyNodeTypeProperties(service, DATA_TYPES);
+            testSubject.getProxyNodeTypeProperties(service, DATA_TYPES);
 
-        Assert.assertTrue(proxyNodeTypePropertiesResult.isPresent());
+        assertTrue(proxyNodeTypePropertiesResult.isPresent());
         Map<String, ToscaProperty> proxyNodeTypeProperties = proxyNodeTypePropertiesResult.get();
         testSubject.addInputsToProperties(DATA_TYPES, null, proxyNodeTypeProperties);
-        Assert.assertNotNull(proxyNodeTypeProperties);
-        Assert.assertEquals(2, proxyNodeTypeProperties.size());
+        assertNotNull(proxyNodeTypeProperties);
+        assertEquals(2, proxyNodeTypeProperties.size());
         testSubject.addInputsToProperties(DATA_TYPES, new ArrayList<>(), proxyNodeTypeProperties);
-        Assert.assertEquals(2, proxyNodeTypeProperties.size());
+        assertEquals(2, proxyNodeTypeProperties.size());
     }
 
     @Test
-    public void testAddInputsToPropertiesWithInputs() {
+    void testAddInputsToPropertiesWithInputs() {
         Component service = getTestComponent();
         service.setProperties(Arrays.asList(createMockProperty("componentPropStr", "Default String Prop"),
-                createMockProperty("componentPropInt", null)));
+            createMockProperty("componentPropInt", null)));
         service.setInputs(Arrays.asList(createMockInput("componentInputStr1",
-                "Default String Input1"), createMockInput("componentInputStr2", "Default String Input2")));
+            "Default String Input1"), createMockInput("componentInputStr2", "Default String Input2")));
         Optional<Map<String, ToscaProperty>> proxyNodeTypePropertiesResult =
-                testSubject.getProxyNodeTypeProperties(service, DATA_TYPES);
+            testSubject.getProxyNodeTypeProperties(service, DATA_TYPES);
 
-        Assert.assertTrue(proxyNodeTypePropertiesResult.isPresent());
+        assertTrue(proxyNodeTypePropertiesResult.isPresent());
         Map<String, ToscaProperty> proxyNodeTypeProperties = proxyNodeTypePropertiesResult.get();
         testSubject.addInputsToProperties(DATA_TYPES, service.getInputs(), proxyNodeTypeProperties);
-        Assert.assertNotNull(proxyNodeTypeProperties);
-        Assert.assertEquals(4, proxyNodeTypeProperties.size());
+        assertNotNull(proxyNodeTypeProperties);
+        assertEquals(4, proxyNodeTypeProperties.size());
     }
 
     @Test
-    public void testAddInputsToPropertiesOnlyInputs() {
+    void testAddInputsToPropertiesOnlyInputs() {
         Component service = getTestComponent();
         service.setInputs(Arrays.asList(createMockInput("componentInputStr1",
-                "Default String Input1"), createMockInput("componentInputStr2", "Default String Input2")));
+            "Default String Input1"), createMockInput("componentInputStr2", "Default String Input2")));
         Optional<Map<String, ToscaProperty>> proxyNodeTypePropertiesResult =
-                testSubject.getProxyNodeTypeProperties(service, DATA_TYPES);
+            testSubject.getProxyNodeTypeProperties(service, DATA_TYPES);
 
-        Assert.assertTrue(proxyNodeTypePropertiesResult.isPresent());
+        assertTrue(proxyNodeTypePropertiesResult.isPresent());
         Map<String, ToscaProperty> proxyNodeTypeProperties = proxyNodeTypePropertiesResult.get();
         testSubject.addInputsToProperties(DATA_TYPES, service.getInputs(), proxyNodeTypeProperties);
-        Assert.assertNotNull(proxyNodeTypeProperties);
-        Assert.assertEquals(2, proxyNodeTypeProperties.size());
+        assertNotNull(proxyNodeTypeProperties);
+        assertEquals(2, proxyNodeTypeProperties.size());
     }
 
     @Test
-    public void testOperationImplementationInProxyNodeTypeNotPresent() {
+    void testOperationImplementationInProxyNodeTypeNotPresent() {
         Component service = getTestComponent();
         InterfaceDefinition interfaceDefinition =
-                service.getInterfaces().get("normalizedServiceComponentName-interface");
+            service.getInterfaces().get("normalizedServiceComponentName-interface");
         interfaceDefinition.setOperations(new HashMap<>());
         final OperationDataDefinition operation = new OperationDataDefinition();
         operation.setName("start");
@@ -1692,12 +1794,12 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         interfaceDefinition.getOperations().put(operation.getName(), operation);
         service.getInterfaces().put("normalizedServiceComponentName-interface", interfaceDefinition);
         service.setInputs(Arrays.asList(createMockInput("componentInputStr1",
-                "Default String Input1"), createMockInput("componentInputStr2", "Default String Input2")));
+            "Default String Input1"), createMockInput("componentInputStr2", "Default String Input2")));
         Optional<Map<String, Object>> proxyNodeTypeInterfaces =
-                testSubject.getProxyNodeTypeInterfaces(service, DATA_TYPES);
-        Assert.assertTrue(proxyNodeTypeInterfaces.isPresent());
+            testSubject.getProxyNodeTypeInterfaces(service, DATA_TYPES);
+        assertTrue(proxyNodeTypeInterfaces.isPresent());
         Map<String, Object> componentInterfaces = proxyNodeTypeInterfaces.get();
-        Assert.assertNotNull(componentInterfaces);
+        assertNotNull(componentInterfaces);
     }
 
     private Component getTestComponent() {
@@ -1711,7 +1813,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         return component;
     }
 
-    private PropertyDefinition createMockProperty(String propertyName, String defaultValue){
+    private PropertyDefinition createMockProperty(String propertyName, String defaultValue) {
         PropertyDefinition propertyDefinition = new PropertyDefinition();
         propertyDefinition.setName(propertyName);
         propertyDefinition.setType("string");
@@ -1719,7 +1821,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
         return propertyDefinition;
     }
 
-    private InputDefinition createMockInput(String inputName, String defaultValue){
+    private InputDefinition createMockInput(String inputName, String defaultValue) {
         InputDefinition inputDefinition = new InputDefinition();
         inputDefinition.setName(inputName);
         inputDefinition.setType("string");