summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src/test/java/org')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/PropertiesUtilsTest.java1
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogicTest.java33
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverterTest.java11
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/GroupExportParserImplTest.java8
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/InputAnnotationConvertToToscaTest.java8
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/PolicyExportParserImplTest.java9
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/PropertyConvertorTest.java68
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java164
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportUtilsTest.java198
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsConverterTest.java (renamed from catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtilTest.java)61
10 files changed, 278 insertions, 283 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/PropertiesUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/PropertiesUtilsTest.java
index d038381c21..8789b15be0 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/PropertiesUtilsTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/utils/PropertiesUtilsTest.java
@@ -14,7 +14,6 @@
* limitations under the License.
*/
package org.openecomp.sdc.be.components.impl.utils;
-
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogicTest.java
index def3f8cc69..bded51db11 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/PropertyDataValueMergeBusinessLogicTest.java
@@ -20,10 +20,24 @@
package org.openecomp.sdc.be.components.merge.property;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.when;
+
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Maps;
import fj.data.Either;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -37,21 +51,7 @@ import org.openecomp.sdc.be.model.DataTypeDefinition;
import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
import org.openecomp.sdc.be.model.tosca.ToscaPropertyType;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.when;
+import org.openecomp.sdc.be.tosca.PropertyConvertor;
@RunWith(MockitoJUnitRunner.class)
public class PropertyDataValueMergeBusinessLogicTest {
@@ -67,7 +67,8 @@ public class PropertyDataValueMergeBusinessLogicTest {
public void setUp() throws Exception {
PropertyValueMerger propertyValueMerger = new PropertyValueMerger();
- testInstance = new PropertyDataValueMergeBusinessLogic(propertyValueMerger, applicationDataTypeCache);
+ testInstance = new PropertyDataValueMergeBusinessLogic(propertyValueMerger, applicationDataTypeCache,
+ new PropertyConvertor());
}
@Test
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverterTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverterTest.java
index 5d6c98209c..5254c08dab 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverterTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/CapabilityRequirementConverterTest.java
@@ -19,6 +19,8 @@ package org.openecomp.sdc.be.tosca;
import org.junit.Before;
import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
@@ -35,6 +37,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
import static java.util.Arrays.asList;
import static org.assertj.core.api.Assertions.assertThat;
@@ -42,6 +45,14 @@ import static org.mockito.Mockito.doReturn;
public class CapabilityRequirementConverterTest {
+ @InjectMocks
+ CapabilityRequirementConverter testSubject;
+
+ @Mock
+ ToscaOperationFacade toscaOperationFacade;
+ @Mock
+ private PropertyConvertor propertyConvertorMock;
+
CapabilityRequirementConverter capabiltyRequirementConvertor = Mockito.spy(new CapabilityRequirementConverter());
ComponentInstance instanceProxy = Mockito.spy( new ComponentInstance() );
ComponentInstance vfInstance = Mockito.spy( new ComponentInstance() );
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/GroupExportParserImplTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/GroupExportParserImplTest.java
index 35be3821b2..b55f7d8514 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/GroupExportParserImplTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/GroupExportParserImplTest.java
@@ -68,9 +68,10 @@ public class GroupExportParserImplTest {
@Mock
private ApplicationDataTypeCache dataTypeCache;
-
@Mock
private Component component;
+ @Mock
+ private PropertyConvertor propertyConvertor;
@Before
public void setUp() throws Exception {
@@ -79,13 +80,14 @@ public class GroupExportParserImplTest {
private void initGroupExportParser() {
when(dataTypeCache.getAll()).thenReturn(Either.left(null));
- groupExportParser = new GroupExportParserImpl(dataTypeCache);
+ groupExportParser = new GroupExportParserImpl(dataTypeCache, propertyConvertor);
}
@Test
public void failToGetAllDataTypes() {
when(dataTypeCache.getAll()).thenReturn(Either.right(null));
- assertThatExceptionOfType(SdcResourceNotFoundException.class).isThrownBy(() -> groupExportParser = new GroupExportParserImpl(dataTypeCache));
+ assertThatExceptionOfType(SdcResourceNotFoundException.class).isThrownBy(() -> groupExportParser = new GroupExportParserImpl(dataTypeCache,
+ propertyConvertor));
}
@Test
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/InputAnnotationConvertToToscaTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/InputAnnotationConvertToToscaTest.java
index a3d4ae91ab..2d95fc130d 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/InputAnnotationConvertToToscaTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/InputAnnotationConvertToToscaTest.java
@@ -77,10 +77,10 @@ public class InputAnnotationConvertToToscaTest {
property3.setType(ToscaPropertyType.BOOLEAN.getType());
property3.setValue("True");
- dataTypes = new HashMap();
+ dataTypes = new HashMap<>();
DataTypeDefinition dataTypeDefinition = new DataTypeDefinition();
- List<PropertyDefinition> properties = new ArrayList();
+ List<PropertyDefinition> properties = new ArrayList<>();
properties.add(property1);
dataTypeDefinition.setProperties(properties);
@@ -91,7 +91,7 @@ public class InputAnnotationConvertToToscaTest {
annotation.setName("Annotation1");
annotation.setDescription("description1");
- List<PropertyDataDefinition> propertiesAnnotation = new ArrayList();
+ List<PropertyDataDefinition> propertiesAnnotation = new ArrayList<>();
propertiesAnnotation.add(property2);
propertiesAnnotation.add(property3);
annotation.setProperties(propertiesAnnotation);
@@ -107,7 +107,7 @@ public class InputAnnotationConvertToToscaTest {
ArrayList<InputDefinition> inputDefList = new ArrayList<> ();
inputDefList.add(inputDefinition);
- inputConverter = new InputConverter();
+ inputConverter = new InputConverter(new PropertyConvertor());
Map<String, ToscaProperty> resultInputs ;
resultInputs = inputConverter.convertInputs(inputDefList,dataTypes);
//verify one Input only
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/PolicyExportParserImplTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/PolicyExportParserImplTest.java
index 4e377578a3..b499830138 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/PolicyExportParserImplTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/PolicyExportParserImplTest.java
@@ -63,6 +63,8 @@ public class PolicyExportParserImplTest {
@Mock
private ApplicationDataTypeCache dataTypeCache;
+ @Mock
+ private PropertyConvertor propertyConvertor;
@Mock
private Component component;
@@ -71,7 +73,8 @@ public class PolicyExportParserImplTest {
public void failToGetAllDataTypes() {
when(dataTypeCache.getAll()).thenReturn(Either.right(null));
- assertThatExceptionOfType(SdcResourceNotFoundException.class).isThrownBy(() -> policiyExportParser = new PolicyExportParserImpl(dataTypeCache));
+ assertThatExceptionOfType(SdcResourceNotFoundException.class).isThrownBy(() -> policiyExportParser = new PolicyExportParserImpl(dataTypeCache,
+ propertyConvertor));
}
@Test
@@ -79,7 +82,7 @@ public class PolicyExportParserImplTest {
when(dataTypeCache.getAll()).thenReturn(Either.left(null));
when(component.getPolicies()).thenReturn(null);
- policiyExportParser = new PolicyExportParserImpl(dataTypeCache);
+ policiyExportParser = new PolicyExportParserImpl(dataTypeCache, propertyConvertor);
Map<String, ToscaPolicyTemplate> policies = policiyExportParser.getPolicies(component);
assertThat(policies).isEqualTo(null);
}
@@ -105,7 +108,7 @@ public class PolicyExportParserImplTest {
when(component.getPolicies()).thenReturn(policiesToAdd);
when(component.getComponentInstances()).thenReturn(getComponentInstances());
when(component.getGroups()).thenReturn(getGroups());
- policiyExportParser = new PolicyExportParserImpl(dataTypeCache);
+ policiyExportParser = new PolicyExportParserImpl(dataTypeCache, propertyConvertor);
Map<String, ToscaPolicyTemplate> policies = policiyExportParser.getPolicies(component);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/PropertyConvertorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/PropertyConvertorTest.java
index 0e6e171a43..d7c53d5bec 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/PropertyConvertorTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/PropertyConvertorTest.java
@@ -20,9 +20,25 @@
package org.openecomp.sdc.be.tosca;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import fj.data.Either;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
import org.openecomp.sdc.be.components.utils.PropertyDataDefinitionBuilder;
import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition;
import org.openecomp.sdc.be.model.DataTypeDefinition;
@@ -32,29 +48,20 @@ import org.openecomp.sdc.be.model.tosca.ToscaPropertyType;
import org.openecomp.sdc.be.tosca.model.ToscaNodeType;
import org.openecomp.sdc.be.tosca.model.ToscaProperty;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
+@RunWith(MockitoJUnitRunner.class)
public class PropertyConvertorTest {
private PropertyDefinition property;
- Map<String, DataTypeDefinition> dataTypes;
+ private Map<String, DataTypeDefinition> dataTypes;
+
+ @InjectMocks
+ private PropertyConvertor propertyConvertor;
@Before
public void setUp(){
property = new PropertyDefinition();
property.setName("myProperty");
property.setType(ToscaPropertyType.INTEGER.getType());
- dataTypes = new HashMap();
+ dataTypes = new HashMap<>();
dataTypes.put(property.getName(), new DataTypeDefinition());
}
@@ -65,12 +72,12 @@ public class PropertyConvertorTest {
property.setSchema(schema);
- PropertyConvertor.getInstance().convertProperty(dataTypes, property, PropertyConvertor.PropertyType.PROPERTY);
+ propertyConvertor.convertProperty(dataTypes, property, PropertyConvertor.PropertyType.PROPERTY);
}
@Test
public void convertPropertyWhenValueAndDefaultNull() {
- ToscaProperty prop = PropertyConvertor.getInstance().convertProperty(dataTypes, property, PropertyConvertor.PropertyType.PROPERTY);
+ ToscaProperty prop = propertyConvertor.convertProperty(dataTypes, property, PropertyConvertor.PropertyType.PROPERTY);
assertNotNull(prop);
assertNull(prop.getDefaultp());
}
@@ -79,7 +86,7 @@ public class PropertyConvertorTest {
public void convertPropertyWhenValueNullAndDefaultNotEmpty() {
final String def = "1";
property.setDefaultValue(def);
- ToscaProperty result = PropertyConvertor.getInstance().convertProperty(dataTypes, property, PropertyConvertor.PropertyType.PROPERTY);
+ ToscaProperty result = propertyConvertor.convertProperty(dataTypes, property, PropertyConvertor.PropertyType.PROPERTY);
assertNotNull(result);
assertEquals(Integer.valueOf(def), result.getDefaultp());
}
@@ -92,16 +99,15 @@ public class PropertyConvertorTest {
property1.setDefaultValue("2");
dataTypes.put(property1.getName(), new DataTypeDefinition());
Resource resource = new Resource();
- List<PropertyDefinition> properties = new ArrayList();
+ List<PropertyDefinition> properties = new ArrayList<>();
properties.add(property);
properties.add(property1);
resource.setProperties(properties);
- Either<ToscaNodeType, ToscaError> result = PropertyConvertor.getInstance().convertProperties(resource, new ToscaNodeType(), dataTypes);
+ Either<ToscaNodeType, ToscaError> result = propertyConvertor.convertProperties(resource, new ToscaNodeType(), dataTypes);
assertTrue(result.isLeft());
assertEquals(2, result.left().value().getProperties().size());
int cnt = 0;
- for (Iterator<ToscaProperty> it = result.left().value().getProperties().values().iterator(); it.hasNext(); ) {
- ToscaProperty prop = it.next();
+ for (ToscaProperty prop : result.left().value().getProperties().values()) {
if (prop.getDefaultp() == null) {
cnt++;
}
@@ -118,15 +124,14 @@ public class PropertyConvertorTest {
property.setDefaultValue("1");
dataTypes.put(property1.getName(), new DataTypeDefinition());
Resource resource = new Resource();
- List<PropertyDefinition> properties = new ArrayList();
+ List<PropertyDefinition> properties = new ArrayList<>();
properties.add(property);
properties.add(property1);
resource.setProperties(properties);
- Either<ToscaNodeType, ToscaError> result = PropertyConvertor.getInstance().convertProperties(resource, new ToscaNodeType(), dataTypes);
+ Either<ToscaNodeType, ToscaError> result = propertyConvertor.convertProperties(resource, new ToscaNodeType(), dataTypes);
assertTrue(result.isLeft());
assertEquals(2, result.left().value().getProperties().size());
- for (Iterator<ToscaProperty> it = result.left().value().getProperties().values().iterator(); it.hasNext(); ) {
- ToscaProperty prop = it.next();
+ for (ToscaProperty prop : result.left().value().getProperties().values()) {
assertNotNull(prop.getDefaultp());
}
}
@@ -138,15 +143,14 @@ public class PropertyConvertorTest {
property1.setType(ToscaPropertyType.INTEGER.getType());
dataTypes.put(property1.getName(), new DataTypeDefinition());
Resource resource = new Resource();
- List<PropertyDefinition> properties = new ArrayList();
+ List<PropertyDefinition> properties = new ArrayList<>();
properties.add(property);
properties.add(property1);
resource.setProperties(properties);
- Either<ToscaNodeType, ToscaError> result = PropertyConvertor.getInstance().convertProperties(resource, new ToscaNodeType(), dataTypes);
+ Either<ToscaNodeType, ToscaError> result = propertyConvertor.convertProperties(resource, new ToscaNodeType(), dataTypes);
assertTrue(result.isLeft());
assertEquals(2, result.left().value().getProperties().size());
- for (Iterator<ToscaProperty> it = result.left().value().getProperties().values().iterator(); it.hasNext(); ) {
- ToscaProperty prop = it.next();
+ for (ToscaProperty prop : result.left().value().getProperties().values()) {
assertNull(prop.getDefaultp());
}
}
@@ -157,7 +161,7 @@ public class PropertyConvertorTest {
.setDefaultValue("::")
.setType(ToscaPropertyType.STRING.getType())
.build();
- ToscaProperty toscaProperty = PropertyConvertor.getInstance().convertProperty(Collections.emptyMap(), property1, PropertyConvertor.PropertyType.PROPERTY);
+ ToscaProperty toscaProperty = propertyConvertor.convertProperty(Collections.emptyMap(), property1, PropertyConvertor.PropertyType.PROPERTY);
assertThat(toscaProperty.getDefaultp()).isEqualTo("::");
}
@@ -167,7 +171,7 @@ public class PropertyConvertorTest {
.setDefaultValue("/")
.setType(ToscaPropertyType.STRING.getType())
.build();
- ToscaProperty toscaProperty = PropertyConvertor.getInstance().convertProperty(Collections.emptyMap(), property1, PropertyConvertor.PropertyType.PROPERTY);
+ ToscaProperty toscaProperty = propertyConvertor.convertProperty(Collections.emptyMap(), property1, PropertyConvertor.PropertyType.PROPERTY);
assertThat(toscaProperty.getDefaultp()).isEqualTo("/");
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java
index ca4f569cf3..45cdbbdfaa 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportHandlerTest.java
@@ -23,10 +23,14 @@ package org.openecomp.sdc.be.tosca;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyList;
import static org.mockito.ArgumentMatchers.anyMap;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isNull;
+import static org.mockito.Mockito.doReturn;
+import static org.openecomp.sdc.be.tosca.PropertyConvertor.PropertyType.PROPERTY;
import fj.data.Either;
import java.util.ArrayList;
@@ -35,6 +39,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.stream.Collectors;
import mockit.Deencapsulation;
import org.apache.commons.collections.MapUtils;
@@ -50,9 +55,11 @@ 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;
import org.openecomp.sdc.be.datatypes.elements.ToscaArtifactDataDefinition;
@@ -103,6 +110,7 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
private static final String COMPONENT_INPUT_TYPE = "integer";
private static final String RESOURCE_NAME = "resource";
private static final String TOSCA_VERSION = "tosca_simple_yaml_1_1";
+ private static final Map<String, DataTypeDefinition> DATA_TYPES = new HashMap<>();
@InjectMocks
private ToscaExportHandler testSubject;
@@ -123,17 +131,26 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
private GroupExportParser groupExportParser;
@Mock
+ private PropertyConvertor propertyConvertor;
+
+ @Mock
private GroupExportParserImpl groupExportParserImpl;
@Mock
private InterfaceLifecycleOperation interfaceLifecycleOperation;
@Mock
+ private InterfacesOperationsConverter interfacesOperationsConverter;
+
+ @Mock
private PolicyExportParser policyExportParser;
@Before
public void setUpMock() throws Exception {
MockitoAnnotations.initMocks(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());
}
private Resource getNewResource() {
@@ -1427,4 +1444,151 @@ public class ToscaExportHandlerTest extends BeConfDependentTest {
Assert.assertTrue(result.get("test_art").getFile().equals("test_file"));
Assert.assertTrue(result.get("test_art").getType().equals("test_type"));
}
+
+ @Test
+ public void testGetProxyNodeTypeInterfacesNoInterfaces() {
+ Component service = new Service();
+ Optional<Map<String, Object>> proxyNodeTypeInterfaces =
+ testSubject.getProxyNodeTypeInterfaces(service, DATA_TYPES);
+ Assert.assertFalse(proxyNodeTypeInterfaces.isPresent());
+ }
+
+ @Test
+ public void testGetProxyNodeTypeInterfaces() {
+ Component service = getTestComponent();
+ Optional<Map<String, Object>> proxyNodeTypeInterfaces =
+ testSubject.getProxyNodeTypeInterfaces(service, DATA_TYPES);
+ Assert.assertTrue(proxyNodeTypeInterfaces.isPresent());
+ Map<String, Object> componentInterfaces = proxyNodeTypeInterfaces.get();
+ Assert.assertNotNull(componentInterfaces);
+ }
+
+
+ @Test
+ public void testGetProxyNodeTypePropertiesComponentNull() {
+ Optional<Map<String, ToscaProperty>> proxyNodeTypeProperties =
+ testSubject.getProxyNodeTypeProperties(null, DATA_TYPES);
+ Assert.assertFalse(proxyNodeTypeProperties.isPresent());
+ }
+
+ @Test
+ public void testGetProxyNodeTypePropertiesNoProperties() {
+ Component service = new Service();
+ Optional<Map<String, ToscaProperty>> proxyNodeTypeProperties =
+ testSubject.getProxyNodeTypeProperties(service, DATA_TYPES);
+ Assert.assertFalse(proxyNodeTypeProperties.isPresent());
+ }
+
+ @Test
+ public void testGetProxyNodeTypeProperties() {
+ Component service = getTestComponent();
+ service.setProperties(Arrays.asList(createMockProperty("componentPropStr", "Default String Prop"),
+ createMockProperty("componentPropInt", null)));
+ Optional<Map<String, ToscaProperty>> proxyNodeTypeProperties =
+ testSubject.getProxyNodeTypeProperties(service, DATA_TYPES);
+ Assert.assertTrue(proxyNodeTypeProperties.isPresent());
+ Map<String, ToscaProperty> componentProperties = proxyNodeTypeProperties.get();
+ Assert.assertNotNull(componentProperties);
+ Assert.assertEquals(2, componentProperties.size());
+ }
+
+ @Test
+ public void testAddInputsToPropertiesNoInputs() {
+ Component service = getTestComponent();
+ service.setProperties(Arrays.asList(createMockProperty("componentPropStr", "Default String Prop"),
+ createMockProperty("componentPropInt", null)));
+ Optional<Map<String, ToscaProperty>> proxyNodeTypePropertiesResult =
+ testSubject.getProxyNodeTypeProperties(service, DATA_TYPES);
+
+ Assert.assertTrue(proxyNodeTypePropertiesResult.isPresent());
+ Map<String, ToscaProperty> proxyNodeTypeProperties = proxyNodeTypePropertiesResult.get();
+ testSubject.addInputsToProperties(DATA_TYPES, null, proxyNodeTypeProperties);
+ Assert.assertNotNull(proxyNodeTypeProperties);
+ Assert.assertEquals(2, proxyNodeTypeProperties.size());
+ testSubject.addInputsToProperties(DATA_TYPES, new ArrayList<>(), proxyNodeTypeProperties);
+ Assert.assertEquals(2, proxyNodeTypeProperties.size());
+ }
+
+ @Test
+ public void testAddInputsToPropertiesWithInputs() {
+ Component service = getTestComponent();
+ service.setProperties(Arrays.asList(createMockProperty("componentPropStr", "Default String Prop"),
+ createMockProperty("componentPropInt", null)));
+ service.setInputs(Arrays.asList(createMockInput("componentInputStr1",
+ "Default String Input1"), createMockInput("componentInputStr2", "Default String Input2")));
+ Optional<Map<String, ToscaProperty>> proxyNodeTypePropertiesResult =
+ testSubject.getProxyNodeTypeProperties(service, DATA_TYPES);
+
+ Assert.assertTrue(proxyNodeTypePropertiesResult.isPresent());
+ Map<String, ToscaProperty> proxyNodeTypeProperties = proxyNodeTypePropertiesResult.get();
+ testSubject.addInputsToProperties(DATA_TYPES, service.getInputs(), proxyNodeTypeProperties);
+ Assert.assertNotNull(proxyNodeTypeProperties);
+ Assert.assertEquals(4, proxyNodeTypeProperties.size());
+ }
+
+ @Test
+ public void testAddInputsToPropertiesOnlyInputs() {
+ Component service = getTestComponent();
+ service.setInputs(Arrays.asList(createMockInput("componentInputStr1",
+ "Default String Input1"), createMockInput("componentInputStr2", "Default String Input2")));
+ Optional<Map<String, ToscaProperty>> proxyNodeTypePropertiesResult =
+ testSubject.getProxyNodeTypeProperties(service, DATA_TYPES);
+
+ Assert.assertTrue(proxyNodeTypePropertiesResult.isPresent());
+ Map<String, ToscaProperty> proxyNodeTypeProperties = proxyNodeTypePropertiesResult.get();
+ testSubject.addInputsToProperties(DATA_TYPES, service.getInputs(), proxyNodeTypeProperties);
+ Assert.assertNotNull(proxyNodeTypeProperties);
+ Assert.assertEquals(2, proxyNodeTypeProperties.size());
+ }
+
+ @Test
+ public void testOperationImplementationInProxyNodeTypeNotPresent() {
+ Component service = getTestComponent();
+ InterfaceDefinition interfaceDefinition =
+ service.getInterfaces().get("normalizedServiceComponentName-interface");
+ interfaceDefinition.setOperations(new HashMap<>());
+ final OperationDataDefinition operation = new OperationDataDefinition();
+ operation.setName("start");
+ operation.setDescription("op description");
+ final ArtifactDataDefinition implementation = new ArtifactDataDefinition();
+ implementation.setArtifactName("createBPMN.bpmn");
+ operation.setImplementation(implementation);
+ 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")));
+ Optional<Map<String, Object>> proxyNodeTypeInterfaces =
+ testSubject.getProxyNodeTypeInterfaces(service, DATA_TYPES);
+ Assert.assertTrue(proxyNodeTypeInterfaces.isPresent());
+ Map<String, Object> componentInterfaces = proxyNodeTypeInterfaces.get();
+ Assert.assertNotNull(componentInterfaces);
+ }
+
+ private Component getTestComponent() {
+ Component component = new Service();
+ component.setNormalizedName("normalizedServiceComponentName");
+ InterfaceDefinition addedInterface = new InterfaceDefinition();
+ addedInterface.setType("com.some.service.or.other.serviceName");
+ final String interfaceType = "normalizedServiceComponentName-interface";
+ component.setInterfaces(new HashMap<>());
+ component.getInterfaces().put(interfaceType, addedInterface);
+ return component;
+ }
+
+ private PropertyDefinition createMockProperty(String propertyName, String defaultValue){
+ PropertyDefinition propertyDefinition = new PropertyDefinition();
+ propertyDefinition.setName(propertyName);
+ propertyDefinition.setType("string");
+ propertyDefinition.setDefaultValue(defaultValue);
+ return propertyDefinition;
+ }
+
+ private InputDefinition createMockInput(String inputName, String defaultValue){
+ InputDefinition inputDefinition = new InputDefinition();
+ inputDefinition.setName(inputName);
+ inputDefinition.setType("string");
+ inputDefinition.setDefaultValue(defaultValue);
+ return inputDefinition;
+ }
+
}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportUtilsTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportUtilsTest.java
deleted file mode 100644
index 55a2083e7c..0000000000
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/ToscaExportUtilsTest.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Copyright © 2016-2019 European Support Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.openecomp.sdc.be.tosca;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
-import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition;
-import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.DataTypeDefinition;
-import org.openecomp.sdc.be.model.InputDefinition;
-import org.openecomp.sdc.be.model.InterfaceDefinition;
-import org.openecomp.sdc.be.model.PropertyDefinition;
-import org.openecomp.sdc.be.model.Service;
-import org.openecomp.sdc.be.tosca.model.ToscaProperty;
-import org.openecomp.sdc.be.tosca.utils.ToscaExportUtils;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Optional;
-
-public class ToscaExportUtilsTest {
-
- private static final Map<String, DataTypeDefinition> dataTypes = new HashMap<>();
-
- @Test
- public void testGetProxyNodeTypeInterfacesNoInterfaces() {
- Component service = new Service();
- Optional<Map<String, Object>> proxyNodeTypeInterfaces =
- ToscaExportUtils.getProxyNodeTypeInterfaces(service, dataTypes);
- Assert.assertFalse(proxyNodeTypeInterfaces.isPresent());
- }
-
- @Test
- public void testGetProxyNodeTypeInterfaces() {
- Component service = getTestComponent();
- Optional<Map<String, Object>> proxyNodeTypeInterfaces =
- ToscaExportUtils.getProxyNodeTypeInterfaces(service, dataTypes);
- Assert.assertTrue(proxyNodeTypeInterfaces.isPresent());
- Map<String, Object> componentInterfaces = proxyNodeTypeInterfaces.get();
- Assert.assertNotNull(componentInterfaces);
- Assert.assertEquals(1, componentInterfaces.size());
- }
-
-
- @Test
- public void testGetProxyNodeTypePropertiesComponentNull() {
- Optional<Map<String, ToscaProperty>> proxyNodeTypeProperties =
- ToscaExportUtils.getProxyNodeTypeProperties(null, dataTypes);
- Assert.assertFalse(proxyNodeTypeProperties.isPresent());
- }
-
- @Test
- public void testGetProxyNodeTypePropertiesNoProperties() {
- Component service = new Service();
- Optional<Map<String, ToscaProperty>> proxyNodeTypeProperties =
- ToscaExportUtils.getProxyNodeTypeProperties(service, dataTypes);
- Assert.assertFalse(proxyNodeTypeProperties.isPresent());
- }
-
- @Test
- public void testGetProxyNodeTypeProperties() {
- Component service = getTestComponent();
- service.setProperties(Arrays.asList(createMockProperty("componentPropStr", "Default String Prop"),
- createMockProperty("componentPropInt", null)));
- Optional<Map<String, ToscaProperty>> proxyNodeTypeProperties =
- ToscaExportUtils.getProxyNodeTypeProperties(service, dataTypes);
- Assert.assertTrue(proxyNodeTypeProperties.isPresent());
- Map<String, ToscaProperty> componentProperties = proxyNodeTypeProperties.get();
- Assert.assertNotNull(componentProperties);
- Assert.assertEquals(2, componentProperties.size());
- }
-
- @Test
- public void testAddInputsToPropertiesNoInputs() {
- Component service = getTestComponent();
- service.setProperties(Arrays.asList(createMockProperty("componentPropStr", "Default String Prop"),
- createMockProperty("componentPropInt", null)));
- Optional<Map<String, ToscaProperty>> proxyNodeTypePropertiesResult =
- ToscaExportUtils.getProxyNodeTypeProperties(service, dataTypes);
-
- Assert.assertTrue(proxyNodeTypePropertiesResult.isPresent());
- Map<String, ToscaProperty> proxyNodeTypeProperties = proxyNodeTypePropertiesResult.get();
- ToscaExportUtils.addInputsToProperties(dataTypes, null, proxyNodeTypeProperties);
- Assert.assertNotNull(proxyNodeTypeProperties);
- Assert.assertEquals(2, proxyNodeTypeProperties.size());
- ToscaExportUtils.addInputsToProperties(dataTypes, new ArrayList<>(), proxyNodeTypeProperties);
- Assert.assertEquals(2, proxyNodeTypeProperties.size());
- }
-
- @Test
- public void testAddInputsToPropertiesWithInputs() {
- Component service = getTestComponent();
- service.setProperties(Arrays.asList(createMockProperty("componentPropStr", "Default String Prop"),
- createMockProperty("componentPropInt", null)));
- service.setInputs(Arrays.asList(createMockInput("componentInputStr1",
- "Default String Input1"), createMockInput("componentInputStr2", "Default String Input2")));
- Optional<Map<String, ToscaProperty>> proxyNodeTypePropertiesResult =
- ToscaExportUtils.getProxyNodeTypeProperties(service, dataTypes);
-
- Assert.assertTrue(proxyNodeTypePropertiesResult.isPresent());
- Map<String, ToscaProperty> proxyNodeTypeProperties = proxyNodeTypePropertiesResult.get();
- ToscaExportUtils.addInputsToProperties(dataTypes, service.getInputs(), proxyNodeTypeProperties);
- Assert.assertNotNull(proxyNodeTypeProperties);
- Assert.assertEquals(4, proxyNodeTypeProperties.size());
- Assert.assertNotNull(proxyNodeTypeProperties.get("componentInputStr1"));
- Assert.assertNotNull(proxyNodeTypeProperties.get("componentInputStr2"));
- }
-
- @Test
- public void testAddInputsToPropertiesOnlyInputs() {
- Component service = getTestComponent();
- service.setInputs(Arrays.asList(createMockInput("componentInputStr1",
- "Default String Input1"), createMockInput("componentInputStr2", "Default String Input2")));
- Optional<Map<String, ToscaProperty>> proxyNodeTypePropertiesResult =
- ToscaExportUtils.getProxyNodeTypeProperties(service, dataTypes);
-
- Assert.assertTrue(proxyNodeTypePropertiesResult.isPresent());
- Map<String, ToscaProperty> proxyNodeTypeProperties = proxyNodeTypePropertiesResult.get();
- ToscaExportUtils.addInputsToProperties(dataTypes, service.getInputs(), proxyNodeTypeProperties);
- Assert.assertNotNull(proxyNodeTypeProperties);
- Assert.assertEquals(2, proxyNodeTypeProperties.size());
- Assert.assertNotNull(proxyNodeTypeProperties.get("componentInputStr1"));
- Assert.assertNotNull(proxyNodeTypeProperties.get("componentInputStr2"));
- }
-
- @Test
- public void testOperationImplementationInProxyNodeTypeNotPresent() {
- Component service = getTestComponent();
- InterfaceDefinition interfaceDefinition =
- service.getInterfaces().get("normalizedServiceComponentName-interface");
- interfaceDefinition.setOperations(new HashMap<>());
- final OperationDataDefinition operation = new OperationDataDefinition();
- operation.setName("start");
- operation.setDescription("op description");
- final ArtifactDataDefinition implementation = new ArtifactDataDefinition();
- implementation.setArtifactName("createBPMN.bpmn");
- operation.setImplementation(implementation);
- 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")));
- Optional<Map<String, Object>> proxyNodeTypeInterfaces =
- ToscaExportUtils.getProxyNodeTypeInterfaces(service, dataTypes);
- Assert.assertTrue(proxyNodeTypeInterfaces.isPresent());
- Map<String, Object> componentInterfaces = proxyNodeTypeInterfaces.get();
- Assert.assertNotNull(componentInterfaces);
- Assert.assertEquals(1, componentInterfaces.size());
- Map<String, Object> proxyInterfaceDefinition =
- (Map<String, Object>) componentInterfaces.get("serviceName");
- Map<String, Object> startOperationDefinition = (Map<String, Object>) proxyInterfaceDefinition.get("start");
- Assert.assertNotNull(startOperationDefinition);
- Assert.assertNull(startOperationDefinition.get("implementation"));
- }
-
- private Component getTestComponent() {
- Component component = new Service();
- component.setNormalizedName("normalizedServiceComponentName");
- InterfaceDefinition addedInterface = new InterfaceDefinition();
- addedInterface.setType("com.some.service.or.other.serviceName");
- final String interfaceType = "normalizedServiceComponentName-interface";
- component.setInterfaces(new HashMap<>());
- component.getInterfaces().put(interfaceType, addedInterface);
- return component;
- }
-
- private PropertyDefinition createMockProperty(String propertyName, String defaultValue){
- PropertyDefinition propertyDefinition = new PropertyDefinition();
- propertyDefinition.setName(propertyName);
- propertyDefinition.setType("string");
- propertyDefinition.setDefaultValue(defaultValue);
- return propertyDefinition;
- }
-
- private InputDefinition createMockInput(String inputName, String defaultValue){
- InputDefinition inputDefinition = new InputDefinition();
- inputDefinition.setName(inputName);
- inputDefinition.setType("string");
- inputDefinition.setDefaultValue(defaultValue);
- return inputDefinition;
- }
-}
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtilTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsConverterTest.java
index d6a7b86f16..13bc009d32 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtilTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsConverterTest.java
@@ -24,6 +24,8 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.sdc.tosca.services.YamlUtil;
import org.openecomp.sdc.be.DummyConfigurationManager;
import org.openecomp.sdc.be.config.Configuration;
@@ -40,6 +42,8 @@ import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.ServiceMetadataDefinition;
import org.openecomp.sdc.be.model.tosca.ToscaFunctions;
+import org.openecomp.sdc.be.tosca.InterfacesOperationsConverter;
+import org.openecomp.sdc.be.tosca.PropertyConvertor;
import org.openecomp.sdc.be.tosca.ToscaExportHandler;
import org.openecomp.sdc.be.tosca.ToscaRepresentation;
import org.openecomp.sdc.be.tosca.model.ToscaNodeType;
@@ -55,11 +59,10 @@ import java.util.Objects;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import static org.openecomp.sdc.be.tosca.utils.InterfacesOperationsToscaUtil.SELF;
-import static org.openecomp.sdc.be.tosca.utils.InterfacesOperationsToscaUtil.addInterfaceDefinitionElement;
-import static org.openecomp.sdc.be.tosca.utils.InterfacesOperationsToscaUtil.addInterfaceTypeElement;
-
-public class InterfacesOperationsToscaUtilTest {
+import static org.openecomp.sdc.be.tosca.InterfacesOperationsConverter.SELF;
+import static org.openecomp.sdc.be.tosca.InterfacesOperationsConverter.addInterfaceTypeElement;
+@RunWith(MockitoJUnitRunner.class)
+public class InterfacesOperationsConverterTest {
private static final String MAPPED_PROPERTY_NAME = "mapped_property";
private static final String INPUT_NAME_PREFIX = "input_";
@@ -71,21 +74,20 @@ public class InterfacesOperationsToscaUtilTest {
DummyConfigurationManager dummyConfigurationManager = new DummyConfigurationManager();
private static final Map<String, DataTypeDefinition> dataTypes = new HashMap<>();
+ private InterfacesOperationsConverter interfacesOperationsConverter;
@BeforeClass
public static void setUp() {
mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-
}
+
@Before
- public void beforeTest() {
- when(environmentContext.getDefaultValue()).thenReturn("General_Revenue-Bearing");
- when(dummyConfigurationManager.getConfigurationMock().getEnvironmentContext())
- .thenReturn(environmentContext);
+ public void setUpBeforeTest() {
+ interfacesOperationsConverter =
+ new InterfacesOperationsConverter(new PropertyConvertor());
}
-
@Test
public void addInterfaceTypeElementToResource() {
Component component = new Resource();
@@ -102,7 +104,8 @@ public class InterfacesOperationsToscaUtilTest {
final Map<String, Object> interfaceTypeElement =
addInterfaceTypeElement(component, new ArrayList<>());
- ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null);
+ ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null, null,
+ interfacesOperationsConverter);
ToscaTemplate template = new ToscaTemplate("test");
template.setInterface_types(interfaceTypeElement);
final ToscaRepresentation toscaRepresentation = handler.createToscaRepresentation(template);
@@ -127,7 +130,8 @@ public class InterfacesOperationsToscaUtilTest {
final Map<String, Object> interfaceTypeElement =
addInterfaceTypeElement(component, new ArrayList<>());
- ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null);
+ ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null, null,
+ interfacesOperationsConverter);
ToscaTemplate template = new ToscaTemplate("testService");
template.setInterface_types(interfaceTypeElement);
final ToscaRepresentation toscaRepresentation = handler.createToscaRepresentation(template);
@@ -148,9 +152,10 @@ public class InterfacesOperationsToscaUtilTest {
component.setInterfaces(new HashMap<>());
component.getInterfaces().put(interfaceType, addedInterface);
ToscaNodeType nodeType = new ToscaNodeType();
- addInterfaceDefinitionElement(component, nodeType, dataTypes, false);
+ interfacesOperationsConverter.addInterfaceDefinitionElement(component, nodeType, dataTypes, false);
- ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null);
+ ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null, null,
+ interfacesOperationsConverter);
ToscaTemplate template = new ToscaTemplate(NODE_TYPE_NAME);
Map<String, ToscaNodeType> nodeTypes = new HashMap<>();
nodeTypes.put(NODE_TYPE_NAME, nodeType);
@@ -179,9 +184,10 @@ public class InterfacesOperationsToscaUtilTest {
component.setInterfaces(new HashMap<>());
component.getInterfaces().put(interfaceType, addedInterface);
ToscaNodeType nodeType = new ToscaNodeType();
- addInterfaceDefinitionElement(component, nodeType, dataTypes, false);
+ interfacesOperationsConverter.addInterfaceDefinitionElement(component, nodeType, dataTypes, false);
- ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null);
+ ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null, null,
+ interfacesOperationsConverter);
ToscaTemplate template = new ToscaTemplate("testService");
Map<String, ToscaNodeType> nodeTypes = new HashMap<>();
nodeTypes.put(NODE_TYPE_NAME, nodeType);
@@ -210,7 +216,7 @@ public class InterfacesOperationsToscaUtilTest {
final String interfaceType = "normalizedComponentName-interface";
component.setInterfaces(new HashMap<>());
component.getInterfaces().put(interfaceType, addedInterface);
- Map<String, Object> interfacesMap = InterfacesOperationsToscaUtil
+ Map<String, Object> interfacesMap = interfacesOperationsConverter
.getInterfacesMap(component, null, component.getInterfaces(), null, false, true);
ToscaNodeType nodeType = new ToscaNodeType();
nodeType.setInterfaces(interfacesMap);
@@ -243,9 +249,10 @@ public class InterfacesOperationsToscaUtilTest {
component.setInterfaces(new HashMap<>());
component.getInterfaces().put(interfaceType, addedInterface);
ToscaNodeType nodeType = new ToscaNodeType();
- addInterfaceDefinitionElement(component, nodeType, null, false);
+ interfacesOperationsConverter.addInterfaceDefinitionElement(component, nodeType, null, false);
- ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null);
+ ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null, null,
+ interfacesOperationsConverter);
ToscaTemplate template = new ToscaTemplate("test");
Map<String, ToscaNodeType> nodeTypes = new HashMap<>();
nodeTypes.put("test", nodeType);
@@ -278,9 +285,10 @@ public class InterfacesOperationsToscaUtilTest {
component.setInterfaces(new HashMap<>());
component.getInterfaces().put(addedInterfaceType, addedInterface);
ToscaNodeType nodeType = new ToscaNodeType();
- addInterfaceDefinitionElement(component, nodeType, dataTypes, false);
+ interfacesOperationsConverter.addInterfaceDefinitionElement(component, nodeType, dataTypes, false);
- ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null);
+ ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null, null,
+ interfacesOperationsConverter);
ToscaTemplate template = new ToscaTemplate("test");
Map<String, ToscaNodeType> nodeTypes = new HashMap<>();
nodeTypes.put("test", nodeType);
@@ -325,9 +333,10 @@ public class InterfacesOperationsToscaUtilTest {
component.getInterfaces().put(secondInterfaceType, secondInterface);
ToscaNodeType nodeType = new ToscaNodeType();
- addInterfaceDefinitionElement(component, nodeType, dataTypes, false);
+ interfacesOperationsConverter.addInterfaceDefinitionElement(component, nodeType, dataTypes, false);
- ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null);
+ ToscaExportHandler handler = new ToscaExportHandler(null,null,null,null,null,null, null, null,
+ interfacesOperationsConverter);
ToscaTemplate template = new ToscaTemplate("test");
Map<String, ToscaNodeType> nodeTypes = new HashMap<>();
nodeTypes.put("test", nodeType);
@@ -519,7 +528,7 @@ public class InterfacesOperationsToscaUtilTest {
service.getComponentMetadataDefinition().getMetadataDataDefinition().setSystemName("LocalInterface");
service.setInterfaces(Collections.singletonMap("Local", new InterfaceDefinition("Local", null, new HashMap<>())));
- Map<String, Object> resultMap = InterfacesOperationsToscaUtil.addInterfaceTypeElement(service,
+ Map<String, Object> resultMap = InterfacesOperationsConverter.addInterfaceTypeElement(service,
Collections.singletonList("org.openecomp.interfaces.node.lifecycle.Standard"));
Assert.assertTrue(MapUtils.isNotEmpty(resultMap)
@@ -534,7 +543,7 @@ public class InterfacesOperationsToscaUtilTest {
service.setInterfaces(Collections.singletonMap("NotLocal", new InterfaceDefinition("NotLocal", null,
new HashMap<>())));
- Map<String, Object> resultMap = InterfacesOperationsToscaUtil.getInterfacesMap(service, null,
+ Map<String, Object> resultMap = interfacesOperationsConverter.getInterfacesMap(service, null,
service.getInterfaces(), null, false, false);
Assert.assertTrue(MapUtils.isNotEmpty(resultMap)