aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp')
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/UnifiedCompositionServiceTest.java967
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifedCompositionDynamicPortsTest.java56
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionCatalogInstanceFullTest.java47
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionDynamicPortsTest.java36
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionMixPatternFullTest.java44
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionNestedPatternsFullTest.java98
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionNestedSingleComputeFullTest.java105
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionScalingInstancesFullTest.java94
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionSingleSubstitutionFullTest.java168
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java57
10 files changed, 566 insertions, 1106 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/UnifiedCompositionServiceTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/UnifiedCompositionServiceTest.java
index 642d7078ca..69db1b2d84 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/UnifiedCompositionServiceTest.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/UnifiedCompositionServiceTest.java
@@ -31,19 +31,60 @@ import java.net.URL;
import java.util.*;
public class UnifiedCompositionServiceTest {
+ private static final String BASE_DIRECTORY = "/mock/services/heattotosca/unifiedComposition/";
@InjectMocks
@Spy
UnifiedCompositionService unifiedCompositionService;
@Spy
TranslationContext context;
- String inputServiceTemplatesPath;
- String outputServiceTemplatesPath;
+ private static final String IN_PREFIX = "/in";
+ private static final String OUT_PREFIX = "/out";
+ private static final String FSB1_template = "FSB1_template";
+ private static final String FSB2_template = "FSB2_template";
+ private static final String FSB3_template = "FSB3_template";
+ private static final String FSB1_INTERNAL = "FSB1_Internal";
+ private static final String FSB2_INTERNAL = "FSB2_Internal";
+ private static final String FSB1_INTERNAL1 = "FSB1_Internal1";
+ private static final String FSB1_INTERNAL2 = "FSB1_Internal2";
+ private static final String FSB2_INTERNAL1 = "FSB2_Internal1";
+ private static final String FSB2_INTERNAL2 = "FSB2_Internal2";
+ private static final String PORT = "port";
+ private static final String PORT1 = "port1";
+ private static final String PORT2 = "port2";
+ private static final String FSB1_OAM = "FSB1_OAM";
+ private static final String ORG_OPENECOMP_RESOURCE_ABSTRACT_NODES_FSB1 = "org.openecomp.resource.abstract.nodes.FSB1";
+ private static final String ORG_OPENECOMP_RESOURCE_VFC_NODES_HEAT_FSB = "org.openecomp.resource.vfc.nodes.heat.FSB";
+ private static final String DEVICE_OWNER = "device_owner";
+ private static final String COMPLEX_OUTPUT1 = "complexOutput1";
+ private static final String COMPLEX_OUTPUT2 = "complexOutput2";
+ private static final String COMPLEX_OUTPUT3 = "complexOutput3";
+ private static final String USER_DATA_FORMAT = "user_data_format";
+ private static final String TENANT_ID = "tenant_id";
+ private static final String SIMPLE_OUTPUT1 = "simpleOutput1";
+ private static final String SIMPLE_OUTPUT2 = "simpleOutput2";
+ private static final String ADDRESSES = "addresses";
+ private static final String CMAUI_VOLUME1 = "cmaui_volume1";
+ private static final String CMAUI_VOLUME2 = "cmaui_volume2";
+ private static final String CMAUI_VOLUME3 = "cmaui_volume3";
+ private static final String ACCESS_IPv4 = "accessIPv4";
+ private static final String ACCESS_IPv6 = "accessIPv6";
+ private static final String FSB1 = "FSB1";
+ private static final String MYATTR = "myAttr";
+ private static final String VOLUME_TYPE = "volume_type";
+ private static final String SIZE = "size";
+ private static final String NETWORK_ID = "network_id";
+ private static final String JSA_NET1 = "jsa_net1";
+ private static final String STATUS = "status";
+ private static final String AVAILABILITY_ZONE = "availability_zone";
+ private static final String DEPENDENCY = "dependency";
+
Map<String, ServiceTemplate> inputServiceTemplates;
Map<String, ServiceTemplate> expectedOutserviceTemplates;
- private static String mainSTName = "MainServiceTemplate.yaml";
- private static String substitutionST = "SubstitutionServiceTemplate.yaml";
- private static String globalSubstitutionST = "GlobalSubstitutionTypesServiceTemplate.yaml";
+
+ private static final String MAIN_SERVICE_TEMPLATE_YAML = "MainServiceTemplate.yaml";
+ private static final String GLOBAL_SUBSTITUTION_TYPES_SERVICE_TEMPLATE_YAML =
+ "GlobalSubstitutionTypesServiceTemplate.yaml";
@Before
public void setUp() {
@@ -58,18 +99,15 @@ public class UnifiedCompositionServiceTest {
@Test
public void createSubstitutionStNoConsolidationData() throws Exception {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/creSubstitutionServiceTemplate/NoOutParamDuplicatePortType/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/creSubstitutionServiceTemplate/NoOutParamDuplicatePortType/out";
-
- loadInputAndOutputData();
+ String path = BASE_DIRECTORY + "creSubstitutionServiceTemplate/NoOutParamDuplicatePortType";
+ loadInputAndOutputData(path);
ServiceTemplate expectedServiceTemplate =
- TestUtils.loadServiceTemplate(outputServiceTemplatesPath);
+ TestUtils.loadServiceTemplate(BASE_DIRECTORY +
+ "creSubstitutionServiceTemplate/NoOutParamDuplicatePortType" + OUT_PREFIX);
List<UnifiedCompositionData> unifiedCompositionDataList = new ArrayList<>();
Optional<ServiceTemplate> substitutionServiceTemplate = unifiedCompositionService
- .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(mainSTName),
+ .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList,
context, "org.openecomp.resource.vfc.nodes.heat.FSB1", null);
assertEquals(false, substitutionServiceTemplate.isPresent());
@@ -77,27 +115,22 @@ public class UnifiedCompositionServiceTest {
@Test
public void createSubstitutionStNoOutputParamAndDuplicatePortType() throws Exception {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/creSubstitutionServiceTemplate/NoOutParamDuplicatePortType/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/creSubstitutionServiceTemplate/NoOutParamDuplicatePortType/out";
-
List<Pair<String, String>> portTypeToIdList = new ArrayList<>();
- portTypeToIdList.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal1"));
- portTypeToIdList.add(new ImmutablePair<>("FSB2_Internal", "FSB2_Internal2"));
- portTypeToIdList.add(new ImmutablePair<>("FSB2_Internal", "FSB2_Internal1"));
- portTypeToIdList.add(new ImmutablePair<>("FSB_OAM", "FSB1_OAM"));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL1));
+ portTypeToIdList.add(new ImmutablePair<>(FSB2_INTERNAL, FSB2_INTERNAL2));
+ portTypeToIdList.add(new ImmutablePair<>(FSB2_INTERNAL, FSB2_INTERNAL1));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_OAM, FSB1_OAM));
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "creSubstitutionServiceTemplate/NoOutParamDuplicatePortType");
UnifiedCompositionData unifiedCompositionData =
- createCompositionData("FSB1_template", portTypeToIdList);
+ createCompositionData(FSB1_template, portTypeToIdList);
List<UnifiedCompositionData> unifiedCompositionDataList = new ArrayList<>();
unifiedCompositionDataList.add(unifiedCompositionData);
Optional<ServiceTemplate> substitutionServiceTemplate = unifiedCompositionService
- .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(mainSTName),
+ .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList,
- context, "org.openecomp.resource.abstract.nodes.FSB1", null);
+ context, ORG_OPENECOMP_RESOURCE_ABSTRACT_NODES_FSB1, null);
assertEquals(true, substitutionServiceTemplate.isPresent());
substitutionServiceTemplate
.ifPresent(
@@ -107,29 +140,23 @@ public class UnifiedCompositionServiceTest {
@Test
public void createSubstitutionStWithOutputParamNoConsolidation() throws Exception {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/creSubstitutionServiceTemplate" +
- "/WithOutputParameters/noConsolidation/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/creSubstitutionServiceTemplate/WithOutputParameters/noConsolidation/out";
-
List<Pair<String, String>> portTypeToIdList = new ArrayList<>();
- portTypeToIdList.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal1"));
- portTypeToIdList.add(new ImmutablePair<>("FSB2_Internal", "FSB2_Internal2"));
- portTypeToIdList.add(new ImmutablePair<>("FSB_OAM", "FSB1_OAM"));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL1));
+ portTypeToIdList.add(new ImmutablePair<>(FSB2_INTERNAL, FSB2_INTERNAL2));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_OAM, FSB1_OAM));
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "creSubstitutionServiceTemplate/WithOutputParameters/noConsolidation");
UnifiedCompositionData unifiedCompositionData =
- createCompositionData("FSB1_template", portTypeToIdList);
+ createCompositionData(FSB1_template, portTypeToIdList);
addGetAttrForCompute(unifiedCompositionData);
addGetAttrForPort(unifiedCompositionData);
List<UnifiedCompositionData> unifiedCompositionDataList = new ArrayList<>();
unifiedCompositionDataList.add(unifiedCompositionData);
Optional<ServiceTemplate> substitutionServiceTemplate = unifiedCompositionService
- .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(mainSTName),
+ .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList,
- context, "org.openecomp.resource.abstract.nodes.FSB1", null);
+ context, ORG_OPENECOMP_RESOURCE_ABSTRACT_NODES_FSB1, null);
assertEquals(true, substitutionServiceTemplate.isPresent());
substitutionServiceTemplate
.ifPresent(
@@ -139,37 +166,32 @@ public class UnifiedCompositionServiceTest {
@Test
public void createSubstitutionStWithOutputParamWithConsolidation() throws Exception {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/creSubstitutionServiceTemplate/WithOutputParameters/consolidation/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/creSubstitutionServiceTemplate/WithOutputParameters/consolidation/out";
-
List<UnifiedCompositionData> unifiedCompositionDataList = new ArrayList<>();
List<Pair<String, String>> portTypeToIdList1 = new ArrayList<>();
- portTypeToIdList1.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal1"));
- portTypeToIdList1.add(new ImmutablePair<>("FSB2_Internal", "FSB2_Internal2"));
+ portTypeToIdList1.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL1));
+ portTypeToIdList1.add(new ImmutablePair<>(FSB2_INTERNAL, FSB2_INTERNAL2));
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "creSubstitutionServiceTemplate/WithOutputParameters/consolidation");
UnifiedCompositionData unifiedCompositionData1 =
- createCompositionData("FSB1_template", portTypeToIdList1);
+ createCompositionData(FSB1_template, portTypeToIdList1);
addGetAttrForCompute(unifiedCompositionData1);
addGetAttrForPort(unifiedCompositionData1);
unifiedCompositionDataList.add(unifiedCompositionData1);
List<Pair<String, String>> portTypeToIdList2 = new ArrayList<>();
- portTypeToIdList2.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal2"));
- portTypeToIdList2.add(new ImmutablePair<>("FSB2_Internal", "FSB2_Internal1"));
+ portTypeToIdList2.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL2));
+ portTypeToIdList2.add(new ImmutablePair<>(FSB2_INTERNAL, FSB2_INTERNAL1));
UnifiedCompositionData unifiedCompositionData2 =
- createCompositionData("FSB2_template", portTypeToIdList2);
+ createCompositionData(FSB2_template, portTypeToIdList2);
addGetAttrForCompute2(unifiedCompositionData2);
addGetAttrForPort2(unifiedCompositionData2);
unifiedCompositionDataList.add(unifiedCompositionData2);
Optional<ServiceTemplate> substitutionServiceTemplate = unifiedCompositionService
- .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(mainSTName),
+ .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList,
- context, "org.openecomp.resource.abstract.nodes.FSB1", null);
+ context, ORG_OPENECOMP_RESOURCE_ABSTRACT_NODES_FSB1, null);
assertEquals(true, substitutionServiceTemplate.isPresent());
substitutionServiceTemplate
.ifPresent(
@@ -179,24 +201,18 @@ public class UnifiedCompositionServiceTest {
@Test
public void createSubstitutionStNoPorts() throws Exception {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/creSubstitutionServiceTemplate/NoPorts/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/creSubstitutionServiceTemplate/NoPorts/out";
-
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "creSubstitutionServiceTemplate/NoPorts");
UnifiedCompositionData unifiedCompositionData = new UnifiedCompositionData();
- String computeNodeTemplateId = "FSB1_template";
unifiedCompositionData.setComputeTemplateConsolidationData(
- TestUtils.createComputeTemplateConsolidationData(computeNodeTemplateId, null, null));
+ TestUtils.createComputeTemplateConsolidationData(FSB1_template, null, null));
List<UnifiedCompositionData> unifiedCompositionDataList = new ArrayList<>();
unifiedCompositionDataList.add(unifiedCompositionData);
Optional<ServiceTemplate> substitutionServiceTemplate = unifiedCompositionService
- .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(mainSTName),
+ .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList,
- context, "org.openecomp.resource.abstract.nodes.FSB1", null);
+ context, ORG_OPENECOMP_RESOURCE_ABSTRACT_NODES_FSB1, null);
assertEquals(true, substitutionServiceTemplate.isPresent());
substitutionServiceTemplate
.ifPresent(
@@ -207,26 +223,21 @@ public class UnifiedCompositionServiceTest {
@Test
public void createSubstitutionStWithIndex() throws Exception {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/creSubstitutionServiceTemplate/WithIndex/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/creSubstitutionServiceTemplate/WithIndex/out";
-
List<Pair<String, String>> portTypeToIdList = new ArrayList<>();
- portTypeToIdList.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal1"));
- portTypeToIdList.add(new ImmutablePair<>("FSB2_Internal", "FSB2_Internal2"));
- portTypeToIdList.add(new ImmutablePair<>("FSB_OAM", "FSB1_OAM"));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL1));
+ portTypeToIdList.add(new ImmutablePair<>(FSB2_INTERNAL, FSB2_INTERNAL2));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_OAM, FSB1_OAM));
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "creSubstitutionServiceTemplate/WithIndex");
UnifiedCompositionData unifiedCompositionData =
- createCompositionData("FSB1_template", portTypeToIdList);
+ createCompositionData(FSB1_template, portTypeToIdList);
List<UnifiedCompositionData> unifiedCompositionDataList = new ArrayList<>();
unifiedCompositionDataList.add(unifiedCompositionData);
Optional<ServiceTemplate> substitutionServiceTemplate = unifiedCompositionService
- .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(mainSTName),
+ .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList,
- context,"org.openecomp.resource.abstract.nodes.FSB1", 2);
+ context,ORG_OPENECOMP_RESOURCE_ABSTRACT_NODES_FSB1, 2);
assertEquals(true, substitutionServiceTemplate.isPresent());
substitutionServiceTemplate
.ifPresent(
@@ -237,33 +248,28 @@ public class UnifiedCompositionServiceTest {
@Test
public void createAbstractSubstituteOneComputeMultiplePortsDifferentTypesTest() throws Exception {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/createAbstractSubstitute/oneComputeMultiplePortsDiffType/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/createAbstractSubstitute/oneComputeMultiplePortsDiffType/out";
+ loadInputAndOutputData(BASE_DIRECTORY + "createAbstractSubstitute/oneComputeMultiplePortsDiffType");
- loadInputAndOutputData();
-
- UnifiedCompositionData data = createComputeUnifiedCompositionData("FSB1_template");
+ UnifiedCompositionData data = createComputeUnifiedCompositionData(FSB1_template);
List<Pair<String, String>> portTypeToIdList = new ArrayList<>();
- portTypeToIdList.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal1"));
- portTypeToIdList.add(new ImmutablePair<>("FSB2_Internal", "FSB2_Internal2"));
- portTypeToIdList.add(new ImmutablePair<>("FSB_OAM", "FSB1_OAM"));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL1));
+ portTypeToIdList.add(new ImmutablePair<>(FSB2_INTERNAL, FSB2_INTERNAL2));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_OAM, FSB1_OAM));
addPortDataToCompositionData(portTypeToIdList, data);
List<UnifiedCompositionData> unifiedCompositionDataList = new LinkedList<>();
unifiedCompositionDataList.add(data);
Optional<ServiceTemplate> substitutionServiceTemplate = unifiedCompositionService
- .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(mainSTName),
+ .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList,
- context, "org.openecomp.resource.vfc.nodes.heat.FSB", null);
+ context, ORG_OPENECOMP_RESOURCE_VFC_NODES_HEAT_FSB, null);
assertEquals(true, substitutionServiceTemplate.isPresent());
if (substitutionServiceTemplate.isPresent()) {
String substitutionNodeTypeId =
- unifiedCompositionService.getSubstitutionNodeTypeId(inputServiceTemplates.get(mainSTName),
+ unifiedCompositionService.getSubstitutionNodeTypeId(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList.get(0), null, context);
String nodeTemplateId = unifiedCompositionService.createAbstractSubstituteNodeTemplate(
- inputServiceTemplates.get(mainSTName), substitutionServiceTemplate.get(),
+ inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), substitutionServiceTemplate.get(),
unifiedCompositionDataList, substitutionNodeTypeId,
context, null);
validateAbstractSubstitute();
@@ -273,33 +279,28 @@ public class UnifiedCompositionServiceTest {
@Test
public void createAbstractSubstituteOneComputeMultiplePortsSameTypesTest() throws Exception {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/createAbstractSubstitute/oneComputeMultiplePortsSameType/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/createAbstractSubstitute/oneComputeMultiplePortsSameType/out";
-
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "createAbstractSubstitute/oneComputeMultiplePortsSameType");
- UnifiedCompositionData data = createComputeUnifiedCompositionData("FSB1_template");
+ UnifiedCompositionData data = createComputeUnifiedCompositionData(FSB1_template);
List<Pair<String, String>> portTypeToIdList = new ArrayList<>();
- portTypeToIdList.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal1"));
- portTypeToIdList.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal2"));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL1));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL2));
addPortDataToCompositionData(portTypeToIdList, data);
List<UnifiedCompositionData> unifiedCompositionDataList = new LinkedList<>();
unifiedCompositionDataList.add(data);
Optional<ServiceTemplate> substitutionServiceTemplate = unifiedCompositionService
- .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(mainSTName),
+ .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList
- , context, "org.openecomp.resource.vfc.nodes.heat.FSB", null);
+ , context, ORG_OPENECOMP_RESOURCE_VFC_NODES_HEAT_FSB, null);
assertEquals(true, substitutionServiceTemplate.isPresent());
if (substitutionServiceTemplate.isPresent()) {
String substitutionNodeTypeId =
- unifiedCompositionService.getSubstitutionNodeTypeId(inputServiceTemplates.get(mainSTName),
+ unifiedCompositionService.getSubstitutionNodeTypeId(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList.get(0), null, context);
String nodeTemplateId = unifiedCompositionService.createAbstractSubstituteNodeTemplate(
- inputServiceTemplates.get(mainSTName), substitutionServiceTemplate.get(),
+ inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), substitutionServiceTemplate.get(),
unifiedCompositionDataList, substitutionNodeTypeId,
context, null);
validateAbstractSubstitute();
@@ -309,25 +310,20 @@ public class UnifiedCompositionServiceTest {
@Test
public void createAbstractSubstituteTwoComputesMultiplePorts() throws Exception {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/createAbstractSubstitute/twoComputesMultiplePorts/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/createAbstractSubstitute/twoComputesMultiplePorts/out";
-
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "createAbstractSubstitute/twoComputesMultiplePorts");
List<UnifiedCompositionData> unifiedCompositionDataList =
createAbstractSubstituteCompositionDataComputeAndPort();
Optional<ServiceTemplate> substitutionServiceTemplate = unifiedCompositionService
- .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(mainSTName),
+ .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList
- , context, "org.openecomp.resource.vfc.nodes.heat.FSB", null);
+ , context, ORG_OPENECOMP_RESOURCE_VFC_NODES_HEAT_FSB, null);
assertEquals(true, substitutionServiceTemplate.isPresent());
if (substitutionServiceTemplate.isPresent()) {
String substitutionNodeTypeId =
- unifiedCompositionService.getSubstitutionNodeTypeId(inputServiceTemplates.get(mainSTName),
+ unifiedCompositionService.getSubstitutionNodeTypeId(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList.get(0), null, context);
String nodeTemplateId = unifiedCompositionService.createAbstractSubstituteNodeTemplate(
- inputServiceTemplates.get(mainSTName), substitutionServiceTemplate.get(),
+ inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), substitutionServiceTemplate.get(),
unifiedCompositionDataList, substitutionNodeTypeId,
context, null);
validateAbstractSubstitute();
@@ -337,30 +333,25 @@ public class UnifiedCompositionServiceTest {
@Test
public void updNodesConnectedOutWithConsolidationTest() throws Exception {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/updNodesConnectedOut/consolidation/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/updNodesConnectedOut/consolidation/out";
-
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "updNodesConnectedOut/consolidation");
List<UnifiedCompositionData> unifiedCompositionDataList =
createAbstractSubstituteCompositionDataComputeAndPort();
Optional<ServiceTemplate> substitutionServiceTemplate = unifiedCompositionService
- .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(mainSTName),
+ .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList
- , context, "org.openecomp.resource.vfc.nodes.heat.FSB", null);
+ , context, ORG_OPENECOMP_RESOURCE_VFC_NODES_HEAT_FSB, null);
assertEquals(true, substitutionServiceTemplate.isPresent());
if (substitutionServiceTemplate.isPresent()) {
String substitutionNodeTypeId =
- unifiedCompositionService.getSubstitutionNodeTypeId(inputServiceTemplates.get(mainSTName),
+ unifiedCompositionService.getSubstitutionNodeTypeId(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList.get(0), null, context);
String nodeTemplateId = unifiedCompositionService.createAbstractSubstituteNodeTemplate(
- inputServiceTemplates.get(mainSTName), substitutionServiceTemplate.get(),
+ inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), substitutionServiceTemplate.get(),
unifiedCompositionDataList, substitutionNodeTypeId,
context, null);
unifiedCompositionService
- .updateCompositionConnectivity(inputServiceTemplates.get(mainSTName),
+ .updateCompositionConnectivity(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList, context);
validateAbstractSubstitute();
}
@@ -368,46 +359,41 @@ public class UnifiedCompositionServiceTest {
private void validateAbstractSubstitute() {
YamlUtil yamlUtil = new YamlUtil();
- assertEquals(yamlUtil.objectToYaml(expectedOutserviceTemplates.get(mainSTName)), yamlUtil
- .objectToYaml(inputServiceTemplates.get(mainSTName)));
+ assertEquals(yamlUtil.objectToYaml(expectedOutserviceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML)), yamlUtil
+ .objectToYaml(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML)));
}
@Test
public void updNodesConnectedOutNoConsolidationTest() throws Exception {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/updNodesConnectedOut/noConsolidation/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/updNodesConnectedOut/noConsolidation/out";
-
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "updNodesConnectedOut/noConsolidation");
- UnifiedCompositionData data = createComputeUnifiedCompositionData("FSB1_template");
+ UnifiedCompositionData data = createComputeUnifiedCompositionData(FSB1_template);
List<Pair<String, String>> portTypeToIdList = new ArrayList<>();
- portTypeToIdList.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal1"));
- portTypeToIdList.add(new ImmutablePair<>("FSB2_Internal", "FSB2_Internal2"));
- portTypeToIdList.add(new ImmutablePair<>("FSB_OAM", "FSB1_OAM"));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL1));
+ portTypeToIdList.add(new ImmutablePair<>(FSB2_INTERNAL, FSB2_INTERNAL2));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_OAM, FSB1_OAM));
addPortDataToCompositionData(portTypeToIdList, data);
List<UnifiedCompositionData> unifiedCompositionDataList = new LinkedList<>();
unifiedCompositionDataList.add(data);
Optional<ServiceTemplate> substitutionServiceTemplate = unifiedCompositionService
- .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(mainSTName),
+ .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList
- , context, "org.openecomp.resource.vfc.nodes.heat.FSB", null);
+ , context, ORG_OPENECOMP_RESOURCE_VFC_NODES_HEAT_FSB, null);
assertEquals(true, substitutionServiceTemplate.isPresent());
if (substitutionServiceTemplate.isPresent()) {
String substitutionNodeTypeId =
- unifiedCompositionService.getSubstitutionNodeTypeId(inputServiceTemplates.get(mainSTName),
+ unifiedCompositionService.getSubstitutionNodeTypeId(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList.get(0), null, context);
String nodeTemplateId = unifiedCompositionService.createAbstractSubstituteNodeTemplate(
- inputServiceTemplates.get(mainSTName), substitutionServiceTemplate.get(),
+ inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), substitutionServiceTemplate.get(),
unifiedCompositionDataList, substitutionNodeTypeId,
context, null);
unifiedCompositionService
- .updateCompositionConnectivity(inputServiceTemplates.get(mainSTName),
+ .updateCompositionConnectivity(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList, context);
validateAbstractSubstitute();
}
@@ -416,12 +402,7 @@ public class UnifiedCompositionServiceTest {
@Test
public void updNodesConnectedInNoConsolidationTest() throws Exception {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/updNodesConnectedIn/noConsolidation/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/updNodesConnectedIn/noConsolidation/out";
-
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "updNodesConnectedIn/noConsolidation");
UnifiedCompositionData data = createComputeUnifiedCompositionData("QRouter");
List<Pair<String, String>> portTypeToIdList = new ArrayList<>();
@@ -434,20 +415,20 @@ public class UnifiedCompositionServiceTest {
unifiedCompositionDataList.add(data);
Optional<ServiceTemplate> substitutionServiceTemplate = unifiedCompositionService
- .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(mainSTName),
+ .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList
, context, "org.openecomp.resource.abstract.nodes.QRouter", null);
String substitutionNodeTypeId =
- unifiedCompositionService.getSubstitutionNodeTypeId(inputServiceTemplates.get(mainSTName),
+ unifiedCompositionService.getSubstitutionNodeTypeId(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList.get(0), null, context);
String nodeTemplateId = unifiedCompositionService.createAbstractSubstituteNodeTemplate(
- inputServiceTemplates.get(mainSTName), substitutionServiceTemplate.get(),
+ inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), substitutionServiceTemplate.get(),
unifiedCompositionDataList, substitutionNodeTypeId,
context, null);
unifiedCompositionService
- .updateCompositionConnectivity(inputServiceTemplates.get(mainSTName),
+ .updateCompositionConnectivity(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList, context);
validateAbstractSubstitute();
}
@@ -455,31 +436,26 @@ public class UnifiedCompositionServiceTest {
@Test
public void updNodesConnectedInWithConsolidationTest() throws Exception {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/updNodesConnectedIn/consolidation/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/updNodesConnectedIn/consolidation/out";
-
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "updNodesConnectedIn/consolidation");
List<UnifiedCompositionData> unifiedCompositionDataList =
createAbstractSubstituteCompositionDataComputeAndPort();
Optional<ServiceTemplate> substitutionServiceTemplate = unifiedCompositionService
- .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(mainSTName),
+ .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList
, context, "org.openecomp.resource.abstract.nodes.FSB", null);
String substitutionNodeTypeId =
- unifiedCompositionService.getSubstitutionNodeTypeId(inputServiceTemplates.get(mainSTName),
+ unifiedCompositionService.getSubstitutionNodeTypeId(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList.get(0), null, context);
String nodeTemplateId = unifiedCompositionService.createAbstractSubstituteNodeTemplate(
- inputServiceTemplates.get(mainSTName), substitutionServiceTemplate.get(),
+ inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), substitutionServiceTemplate.get(),
unifiedCompositionDataList, substitutionNodeTypeId,
context, null);
unifiedCompositionService
- .updateCompositionConnectivity(inputServiceTemplates.get(mainSTName),
+ .updateCompositionConnectivity(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList, context);
validateAbstractSubstitute();
}
@@ -487,38 +463,33 @@ public class UnifiedCompositionServiceTest {
@Test
public void updVolumesNoConsolidationTest() throws Exception {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/updVolumes/noConsolidation/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/updVolumes/noConsolidation/out";
+ loadInputAndOutputData(BASE_DIRECTORY + "updVolumes/noConsolidation");
- loadInputAndOutputData();
-
- UnifiedCompositionData data = createComputeUnifiedCompositionData("FSB1_template");
+ UnifiedCompositionData data = createComputeUnifiedCompositionData(FSB1_template);
List<Pair<String, String>> portTypeToIdList = new ArrayList<>();
- portTypeToIdList.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal1"));
- portTypeToIdList.add(new ImmutablePair<>("FSB2_Internal", "FSB2_Internal2"));
- portTypeToIdList.add(new ImmutablePair<>("FSB_OAM", "FSB1_OAM"));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL1));
+ portTypeToIdList.add(new ImmutablePair<>(FSB2_INTERNAL, FSB2_INTERNAL2));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_OAM, FSB1_OAM));
addPortDataToCompositionData(portTypeToIdList, data);
List<UnifiedCompositionData> unifiedCompositionDataList = new LinkedList<>();
unifiedCompositionDataList.add(data);
Optional<ServiceTemplate> substitutionServiceTemplate = unifiedCompositionService
- .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(mainSTName),
+ .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList
- , context, "org.openecomp.resource.vfc.nodes.heat.FSB", null);
+ , context, ORG_OPENECOMP_RESOURCE_VFC_NODES_HEAT_FSB, null);
String substitutionNodeTypeId =
- unifiedCompositionService.getSubstitutionNodeTypeId(inputServiceTemplates.get(mainSTName),
+ unifiedCompositionService.getSubstitutionNodeTypeId(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList.get(0), null, context);
String nodeTemplateId = unifiedCompositionService.createAbstractSubstituteNodeTemplate(
- inputServiceTemplates.get(mainSTName), substitutionServiceTemplate.get(),
+ inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), substitutionServiceTemplate.get(),
unifiedCompositionDataList, substitutionNodeTypeId,
context, null);
unifiedCompositionService
- .updateCompositionConnectivity(inputServiceTemplates.get(mainSTName),
+ .updateCompositionConnectivity(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList, context);
validateAbstractSubstitute();
}
@@ -526,29 +497,24 @@ public class UnifiedCompositionServiceTest {
@Test
public void updVolumesWithConsolidationTest() throws Exception {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/updVolumes/consolidation/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/updVolumes/consolidation/out";
-
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "updVolumes/consolidation");
List<UnifiedCompositionData> unifiedCompositionDataList =
createAbstractSubstituteCompositionDataComputeAndPort();
Optional<ServiceTemplate> substitutionServiceTemplate = unifiedCompositionService
- .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(mainSTName),
+ .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList
- , context, "org.openecomp.resource.vfc.nodes.heat.FSB", null);
+ , context, ORG_OPENECOMP_RESOURCE_VFC_NODES_HEAT_FSB, null);
String substitutionNodeTypeId =
- unifiedCompositionService.getSubstitutionNodeTypeId(inputServiceTemplates.get(mainSTName),
+ unifiedCompositionService.getSubstitutionNodeTypeId(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList.get(0), null, context);
String nodeTemplateId = unifiedCompositionService.createAbstractSubstituteNodeTemplate(
- inputServiceTemplates.get(mainSTName), substitutionServiceTemplate.get(),
+ inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), substitutionServiceTemplate.get(),
unifiedCompositionDataList, substitutionNodeTypeId,
context, null);
unifiedCompositionService
- .updateCompositionConnectivity(inputServiceTemplates.get(mainSTName),
+ .updateCompositionConnectivity(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList, context);
validateAbstractSubstitute();
}
@@ -556,42 +522,36 @@ public class UnifiedCompositionServiceTest {
@Test
public void updGroupsNoConsolidationTest() throws Exception {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/updGroupsConnectivity/noConsolidation/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/updGroupsConnectivity/noConsolidation/out";
-
- loadInputAndOutputData();
-
+ loadInputAndOutputData(BASE_DIRECTORY + "updGroupsConnectivity/noConsolidation");
UnifiedCompositionData data = createComputeUnifiedCompositionData("server_smp1");
List<Pair<String, String>> portTypeToIdList = new ArrayList<>();
- portTypeToIdList.add(new ImmutablePair<>("port", "port1"));
- portTypeToIdList.add(new ImmutablePair<>("port", "port2"));
+ portTypeToIdList.add(new ImmutablePair<>(PORT, PORT1));
+ portTypeToIdList.add(new ImmutablePair<>(PORT, PORT2));
addPortDataToCompositionData(portTypeToIdList, data);
//Add groups
List<String> computeGroupIdList =
- TestUtils.getGroupsForNode(inputServiceTemplates.get(mainSTName), "server_smp1");
+ TestUtils.getGroupsForNode(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), "server_smp1");
data.getComputeTemplateConsolidationData().setGroupIds(computeGroupIdList);
List<UnifiedCompositionData> unifiedCompositionDataList = new LinkedList<>();
unifiedCompositionDataList.add(data);
Optional<ServiceTemplate> substitutionServiceTemplate = unifiedCompositionService
- .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(mainSTName),
+ .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList
, context, "org.openecomp.resource.abstract.nodes.smp", null);
String substitutionNodeTypeId =
- unifiedCompositionService.getSubstitutionNodeTypeId(inputServiceTemplates.get(mainSTName),
+ unifiedCompositionService.getSubstitutionNodeTypeId(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList.get(0), null, context);
String nodeTemplateId = unifiedCompositionService.createAbstractSubstituteNodeTemplate(
- inputServiceTemplates.get(mainSTName), substitutionServiceTemplate.get(),
+ inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), substitutionServiceTemplate.get(),
unifiedCompositionDataList, substitutionNodeTypeId,
context, null);
unifiedCompositionService
- .updateCompositionConnectivity(inputServiceTemplates.get(mainSTName),
+ .updateCompositionConnectivity(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList, context);
validateAbstractSubstitute();
}
@@ -599,122 +559,102 @@ public class UnifiedCompositionServiceTest {
@Test
public void updGroupsWithConsolidationTest() throws Exception {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/updGroupsConnectivity/consolidation/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/updGroupsConnectivity/consolidation/out";
-
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "updGroupsConnectivity/consolidation");
List<UnifiedCompositionData> unifiedCompositionDataList =
createAbstractSubstituteCompositionDataComputeAndPort();
Optional<ServiceTemplate> substitutionServiceTemplate = unifiedCompositionService
- .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(mainSTName),
+ .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList
- , context, "org.openecomp.resource.vfc.nodes.heat.FSB", null);
+ , context, ORG_OPENECOMP_RESOURCE_VFC_NODES_HEAT_FSB, null);
String substitutionNodeTypeId =
- unifiedCompositionService.getSubstitutionNodeTypeId(inputServiceTemplates.get(mainSTName),
+ unifiedCompositionService.getSubstitutionNodeTypeId(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList.get(0), null, context);
String nodeTemplateId = unifiedCompositionService.createAbstractSubstituteNodeTemplate(
- inputServiceTemplates.get(mainSTName), substitutionServiceTemplate.get(),
+ inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), substitutionServiceTemplate.get(),
unifiedCompositionDataList, substitutionNodeTypeId,
context, null);
unifiedCompositionService
- .updateCompositionConnectivity(inputServiceTemplates.get(mainSTName),
+ .updateCompositionConnectivity(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList, context);
validateAbstractSubstitute();
}
@Test
public void updOutParamGetAttrInNoConsolidationTest() throws Exception {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/updOutputGetAttrIn/noConsolidation/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/updOutputGetAttrIn/noConsolidation/out";
-
List<Pair<String, String>> portTypeToIdList = new ArrayList<>();
- portTypeToIdList.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal1"));
- portTypeToIdList.add(new ImmutablePair<>("FSB2_Internal", "FSB2_Internal2"));
- portTypeToIdList.add(new ImmutablePair<>("FSB_OAM", "FSB1_OAM"));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL1));
+ portTypeToIdList.add(new ImmutablePair<>(FSB2_INTERNAL, FSB2_INTERNAL2));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_OAM, FSB1_OAM));
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "updOutputGetAttrIn/noConsolidation");
UnifiedCompositionData unifiedCompositionData =
- createCompositionData("FSB1_template", portTypeToIdList);
+ createCompositionData(FSB1_template, portTypeToIdList);
addOutputGetAttrInForComputeNoConsolidation(unifiedCompositionData);
addOutputGetAttrInForPortNoConsolidation(unifiedCompositionData);
List<UnifiedCompositionData> unifiedCompositionDataList = new ArrayList<>();
unifiedCompositionDataList.add(unifiedCompositionData);
Mockito.doNothing().when(unifiedCompositionService).updNodesConnectedOutConnectivity
- (inputServiceTemplates.get(mainSTName), unifiedCompositionDataList, context);
- Mockito.doReturn("FSB1").when(context).getUnifiedAbstractNodeTemplateId(anyObject(),
+ (inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), unifiedCompositionDataList, context);
+ Mockito.doReturn(FSB1).when(context).getUnifiedAbstractNodeTemplateId(anyObject(),
anyString());
unifiedCompositionService
- .updateCompositionConnectivity(inputServiceTemplates.get(mainSTName),
+ .updateCompositionConnectivity(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList, context);
- checkSTResults(expectedOutserviceTemplates, null, null, inputServiceTemplates.get(mainSTName));
+ checkSTResults(expectedOutserviceTemplates, null, null, inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML));
}
@Test
public void updOutParamGetAttrInWithConsolidationTest() throws Exception {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/updOutputGetAttrIn/consolidation/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/updOutputGetAttrIn/consolidation/out";
-
List<UnifiedCompositionData> unifiedCompositionDataList = new ArrayList<>();
List<Pair<String, String>> portTypeToIdList1 = new ArrayList<>();
- portTypeToIdList1.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal1"));
- portTypeToIdList1.add(new ImmutablePair<>("FSB2_Internal", "FSB2_Internal2"));
+ portTypeToIdList1.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL1));
+ portTypeToIdList1.add(new ImmutablePair<>(FSB2_INTERNAL, FSB2_INTERNAL2));
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "updOutputGetAttrIn/consolidation");
UnifiedCompositionData unifiedCompositionData1 =
- createCompositionData("FSB1_template", portTypeToIdList1);
+ createCompositionData(FSB1_template, portTypeToIdList1);
addOutputGetAttrInForCompute1WithConsolidation(unifiedCompositionData1);
addOutputGetAttrInForPortWithConsolidation1(unifiedCompositionData1);
unifiedCompositionDataList.add(unifiedCompositionData1);
List<Pair<String, String>> portTypeToIdList2 = new ArrayList<>();
- portTypeToIdList2.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal2"));
- portTypeToIdList2.add(new ImmutablePair<>("FSB2_Internal", "FSB2_Internal1"));
+ portTypeToIdList2.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL2));
+ portTypeToIdList2.add(new ImmutablePair<>(FSB2_INTERNAL, FSB2_INTERNAL1));
UnifiedCompositionData unifiedCompositionData2 =
- createCompositionData("FSB2_template", portTypeToIdList2);
+ createCompositionData(FSB2_template, portTypeToIdList2);
unifiedCompositionDataList.add(unifiedCompositionData2);
addOutputGetAttrInForCompute2WithConsolidation(unifiedCompositionData2);
addOutputGetAttrInForPortWithConsolidation2(unifiedCompositionData2);
Mockito.doNothing().when(unifiedCompositionService).updNodesConnectedOutConnectivity
- (inputServiceTemplates.get(mainSTName), unifiedCompositionDataList, context);
- Mockito.doReturn("FSB1").when(context).getUnifiedAbstractNodeTemplateId(anyObject(),
+ (inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), unifiedCompositionDataList, context);
+ Mockito.doReturn(FSB1).when(context).getUnifiedAbstractNodeTemplateId(anyObject(),
anyString());
unifiedCompositionService
- .updateCompositionConnectivity(inputServiceTemplates.get(mainSTName),
+ .updateCompositionConnectivity(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList, context);
- checkSTResults(expectedOutserviceTemplates, null, null, inputServiceTemplates.get(mainSTName));
+ checkSTResults(expectedOutserviceTemplates, null, null, inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML));
}
@Test
public void updNodeGetAttrInNoConsolidationTest() throws Exception {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/updNodesGetAttrIn/noConsolidation/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/updNodesGetAttrIn/noConsolidation/out";
-
List<Pair<String, String>> portTypeToIdList = new ArrayList<>();
- portTypeToIdList.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal1"));
- portTypeToIdList.add(new ImmutablePair<>("FSB2_Internal", "FSB2_Internal2"));
- portTypeToIdList.add(new ImmutablePair<>("FSB_OAM", "FSB1_OAM"));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL1));
+ portTypeToIdList.add(new ImmutablePair<>(FSB2_INTERNAL, FSB2_INTERNAL2));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_OAM, FSB1_OAM));
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "updNodesGetAttrIn/noConsolidation");
UnifiedCompositionData unifiedCompositionData =
- createCompositionData("FSB1_template", portTypeToIdList);
+ createCompositionData(FSB1_template, portTypeToIdList);
addGetAttrForCompute(unifiedCompositionData);
addGetAttrForPort(unifiedCompositionData);
addGetAttrForPortInnerUC(unifiedCompositionData);
@@ -722,87 +662,78 @@ public class UnifiedCompositionServiceTest {
List<UnifiedCompositionData> unifiedCompositionDataList = new ArrayList<>();
unifiedCompositionDataList.add(unifiedCompositionData);
Mockito.doNothing().when(unifiedCompositionService).updNodesConnectedOutConnectivity
- (inputServiceTemplates.get(mainSTName), unifiedCompositionDataList, context);
- Mockito.doReturn("FSB1").when(context).getUnifiedAbstractNodeTemplateId(anyObject(),
+ (inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), unifiedCompositionDataList, context);
+ Mockito.doReturn(FSB1).when(context).getUnifiedAbstractNodeTemplateId(anyObject(),
anyString());
unifiedCompositionService
- .updateCompositionConnectivity(inputServiceTemplates.get(mainSTName),
+ .updateCompositionConnectivity(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList, context);
- checkSTResults(expectedOutserviceTemplates, null, null, inputServiceTemplates.get(mainSTName));
+ checkSTResults(expectedOutserviceTemplates, null, null, inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML));
}
@Test
public void updNodeGetAttrInWithConsolidationTest() throws Exception {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/updNodesGetAttrIn/consolidation/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/updNodesGetAttrIn/consolidation/out";
-
List<UnifiedCompositionData> unifiedCompositionDataList = new ArrayList<>();
List<Pair<String, String>> portTypeToIdList1 = new ArrayList<>();
- portTypeToIdList1.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal1"));
- portTypeToIdList1.add(new ImmutablePair<>("FSB2_Internal", "FSB2_Internal2"));
+ portTypeToIdList1.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL1));
+ portTypeToIdList1.add(new ImmutablePair<>(FSB2_INTERNAL, FSB2_INTERNAL2));
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "updNodesGetAttrIn/consolidation");
UnifiedCompositionData unifiedCompositionData1 =
- createCompositionData("FSB1_template", portTypeToIdList1);
+ createCompositionData(FSB1_template, portTypeToIdList1);
addGetAttrForCompute(unifiedCompositionData1);
addGetAttrForPort(unifiedCompositionData1);
unifiedCompositionDataList.add(unifiedCompositionData1);
List<Pair<String, String>> portTypeToIdList2 = new ArrayList<>();
- portTypeToIdList2.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal2"));
- portTypeToIdList2.add(new ImmutablePair<>("FSB2_Internal", "FSB2_Internal1"));
+ portTypeToIdList2.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL2));
+ portTypeToIdList2.add(new ImmutablePair<>(FSB2_INTERNAL, FSB2_INTERNAL1));
UnifiedCompositionData unifiedCompositionData2 =
- createCompositionData("FSB2_template", portTypeToIdList2);
+ createCompositionData(FSB2_template, portTypeToIdList2);
addGetAttrForCompute2(unifiedCompositionData2);
addGetAttrForPort2(unifiedCompositionData2);
unifiedCompositionDataList.add(unifiedCompositionData2);
Mockito.doNothing().when(unifiedCompositionService).updNodesConnectedOutConnectivity
- (inputServiceTemplates.get(mainSTName), unifiedCompositionDataList, context);
- Mockito.doReturn("FSB1").when(context).getUnifiedAbstractNodeTemplateId(anyObject(),
+ (inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), unifiedCompositionDataList, context);
+ Mockito.doReturn(FSB1).when(context).getUnifiedAbstractNodeTemplateId(anyObject(),
anyString());
unifiedCompositionService
- .updateCompositionConnectivity(inputServiceTemplates.get(mainSTName),
+ .updateCompositionConnectivity(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList, context);
- checkSTResults(expectedOutserviceTemplates, null, null, inputServiceTemplates.get(mainSTName));
+ checkSTResults(expectedOutserviceTemplates, null, null, inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML));
}
@Test
public void updNodesGetAttrFromInnerNodesTest() throws Exception {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/creSubstitutionServiceTemplate/updNodesGetAttrInFromInnerNodes/noConsolidation/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/creSubstitutionServiceTemplate/updNodesGetAttrInFromInnerNodes/noConsolidation/out";
-
List<Pair<String, String>> portTypeToIdList = new ArrayList<>();
- portTypeToIdList.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal1"));
- portTypeToIdList.add(new ImmutablePair<>("FSB2_Internal", "FSB2_Internal2"));
- portTypeToIdList.add(new ImmutablePair<>("FSB_OAM", "FSB1_OAM"));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL1));
+ portTypeToIdList.add(new ImmutablePair<>(FSB2_INTERNAL, FSB2_INTERNAL2));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_OAM, FSB1_OAM));
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY +
+ "creSubstitutionServiceTemplate/updNodesGetAttrInFromInnerNodes/noConsolidation");
UnifiedCompositionData unifiedCompositionData =
- createCompositionData("FSB1_template", portTypeToIdList);
+ createCompositionData(FSB1_template, portTypeToIdList);
addGetAttrForCompute(unifiedCompositionData);
addGetAttrForPort(unifiedCompositionData);
addGetAttrForPortInnerUC(unifiedCompositionData);
List<UnifiedCompositionData> unifiedCompositionDataList = new ArrayList<>();
unifiedCompositionDataList.add(unifiedCompositionData);
- Mockito.doReturn("FSB1").when(context).getUnifiedAbstractNodeTemplateId(anyObject(),
+ Mockito.doReturn(FSB1).when(context).getUnifiedAbstractNodeTemplateId(anyObject(),
anyString());
Optional<ServiceTemplate> substitutionServiceTemplate = unifiedCompositionService
- .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(mainSTName),
+ .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList,
- context, "org.openecomp.resource.abstract.nodes.FSB1", null);
+ context, ORG_OPENECOMP_RESOURCE_ABSTRACT_NODES_FSB1, null);
assertEquals(true, substitutionServiceTemplate.isPresent());
substitutionServiceTemplate
.ifPresent(
@@ -813,37 +744,33 @@ public class UnifiedCompositionServiceTest {
@Test
public void updNodesGetAttrFromConsolidationNodesTest() throws Exception {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/creSubstitutionServiceTemplate/updNodesGetAttrInFromInnerNodes/consolidation/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/creSubstitutionServiceTemplate/updNodesGetAttrInFromInnerNodes/consolidation/out";
-
List<UnifiedCompositionData> unifiedCompositionDataList = new ArrayList<>();
List<Pair<String, String>> portTypeToIdList1 = new ArrayList<>();
- portTypeToIdList1.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal1"));
- portTypeToIdList1.add(new ImmutablePair<>("FSB2_Internal", "FSB2_Internal2"));
+ portTypeToIdList1.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL1));
+ portTypeToIdList1.add(new ImmutablePair<>(FSB2_INTERNAL, FSB2_INTERNAL2));
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY +
+ "creSubstitutionServiceTemplate/updNodesGetAttrInFromInnerNodes/consolidation");
UnifiedCompositionData unifiedCompositionData1 =
- createCompositionData("FSB1_template", portTypeToIdList1);
+ createCompositionData(FSB1_template, portTypeToIdList1);
addGetAttrForCompute(unifiedCompositionData1);
addGetAttrForPort(unifiedCompositionData1);
unifiedCompositionDataList.add(unifiedCompositionData1);
List<Pair<String, String>> portTypeToIdList2 = new ArrayList<>();
- portTypeToIdList2.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal2"));
- portTypeToIdList2.add(new ImmutablePair<>("FSB2_Internal", "FSB2_Internal1"));
+ portTypeToIdList2.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL2));
+ portTypeToIdList2.add(new ImmutablePair<>(FSB2_INTERNAL, FSB2_INTERNAL1));
UnifiedCompositionData unifiedCompositionData2 =
- createCompositionData("FSB2_template", portTypeToIdList2);
+ createCompositionData(FSB2_template, portTypeToIdList2);
addGetAttrForCompute2(unifiedCompositionData2);
addGetAttrForPort2(unifiedCompositionData2);
unifiedCompositionDataList.add(unifiedCompositionData2);
Optional<ServiceTemplate> substitutionServiceTemplate = unifiedCompositionService
- .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(mainSTName),
+ .createUnifiedSubstitutionServiceTemplate(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList,
- context, "org.openecomp.resource.abstract.nodes.FSB1", null);
+ context, ORG_OPENECOMP_RESOURCE_ABSTRACT_NODES_FSB1, null);
assertEquals(true, substitutionServiceTemplate.isPresent());
substitutionServiceTemplate
.ifPresent(
@@ -853,19 +780,14 @@ public class UnifiedCompositionServiceTest {
@Test
public void cleanMainServiceTemplateTestNoConsolidation() throws IOException {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/cleanMainSt/noConsolidation/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/cleanMainSt/noConsolidation/out";
-
List<Pair<String, String>> portTypeToIdList = new ArrayList<>();
- portTypeToIdList.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal1"));
- portTypeToIdList.add(new ImmutablePair<>("FSB2_Internal", "FSB2_Internal2"));
- portTypeToIdList.add(new ImmutablePair<>("FSB_OAM", "FSB1_OAM"));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL1));
+ portTypeToIdList.add(new ImmutablePair<>(FSB2_INTERNAL, FSB2_INTERNAL2));
+ portTypeToIdList.add(new ImmutablePair<>("FSB_OAM", FSB1_OAM));
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "cleanMainSt/noConsolidation");
UnifiedCompositionData unifiedCompositionData =
- createCompositionData("FSB1_template", portTypeToIdList);
+ createCompositionData(FSB1_template, portTypeToIdList);
addGetAttrForCompute(unifiedCompositionData);
addGetAttrForPort(unifiedCompositionData);
@@ -873,168 +795,148 @@ public class UnifiedCompositionServiceTest {
unifiedCompositionDataList.add(unifiedCompositionData);
NodeTemplate abstractNodeTemplate = getMockNode(
- "/mock/services/heattotosca/unifiedComposition/cleanMainSt/mockAbstractNodeTemplate.yaml");
- inputServiceTemplates.get(mainSTName).getTopology_template().getNode_templates()
- .put("FSB1", abstractNodeTemplate);
+ BASE_DIRECTORY + "cleanMainSt/mockAbstractNodeTemplate.yaml");
+ inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML).getTopology_template().getNode_templates()
+ .put(FSB1, abstractNodeTemplate);
- Mockito.doReturn("FSB1").when(context).getUnifiedAbstractNodeTemplateId(anyObject(),
+ Mockito.doReturn(FSB1).when(context).getUnifiedAbstractNodeTemplateId(anyObject(),
anyString());
unifiedCompositionService.
- cleanUnifiedCompositionEntities(inputServiceTemplates.get(mainSTName),
+ cleanUnifiedCompositionEntities(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList, context);
- checkSTResults(expectedOutserviceTemplates, null, null, inputServiceTemplates.get(mainSTName));
+ checkSTResults(expectedOutserviceTemplates, null, null, inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML));
}
@Test
public void cleanMainServiceTemplateTestWithConsolidation() throws IOException {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/cleanMainSt/consolidation/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/cleanMainSt/consolidation/out";
-
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "cleanMainSt/consolidation");
List<UnifiedCompositionData> unifiedCompositionDataList = new ArrayList<>();
List<Pair<String, String>> portTypeToIdList1 = new ArrayList<>();
- portTypeToIdList1.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal1"));
- portTypeToIdList1.add(new ImmutablePair<>("FSB2_Internal", "FSB2_Internal2"));
+ portTypeToIdList1.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL1));
+ portTypeToIdList1.add(new ImmutablePair<>(FSB2_INTERNAL, FSB2_INTERNAL2));
UnifiedCompositionData unifiedCompositionData1 =
- createCompositionData("FSB1_template", portTypeToIdList1);
+ createCompositionData(FSB1_template, portTypeToIdList1);
addOutputGetAttrInForCompute1WithConsolidation(unifiedCompositionData1);
addOutputGetAttrInForPortWithConsolidation1(unifiedCompositionData1);
unifiedCompositionDataList.add(unifiedCompositionData1);
List<Pair<String, String>> portTypeToIdList2 = new ArrayList<>();
- portTypeToIdList2.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal2"));
- portTypeToIdList2.add(new ImmutablePair<>("FSB2_Internal", "FSB2_Internal1"));
+ portTypeToIdList2.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL2));
+ portTypeToIdList2.add(new ImmutablePair<>(FSB2_INTERNAL, FSB2_INTERNAL1));
UnifiedCompositionData unifiedCompositionData2 =
- createCompositionData("FSB2_template", portTypeToIdList2);
+ createCompositionData(FSB2_template, portTypeToIdList2);
addOutputGetAttrInForCompute2WithConsolidation(unifiedCompositionData2);
addOutputGetAttrInForPortWithConsolidation2(unifiedCompositionData2);
unifiedCompositionDataList.add(unifiedCompositionData2);
NodeTemplate abstractNodeTemplate = getMockNode(
- "/mock/services/heattotosca/unifiedComposition/cleanMainSt/mockAbstractNodeTemplate.yaml");
- inputServiceTemplates.get(mainSTName).getTopology_template().getNode_templates()
- .put("FSB1", abstractNodeTemplate);
+ BASE_DIRECTORY + "cleanMainSt/mockAbstractNodeTemplate.yaml");
+ inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML).getTopology_template().getNode_templates()
+ .put(FSB1, abstractNodeTemplate);
- Mockito.doReturn("FSB1").when(context).getUnifiedAbstractNodeTemplateId(anyObject(),
+ Mockito.doReturn(FSB1).when(context).getUnifiedAbstractNodeTemplateId(anyObject(),
anyString());
unifiedCompositionService.
- cleanUnifiedCompositionEntities(inputServiceTemplates.get(mainSTName),
+ cleanUnifiedCompositionEntities(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
unifiedCompositionDataList, context);
- checkSTResults(expectedOutserviceTemplates, null, null, inputServiceTemplates.get(mainSTName));
+ checkSTResults(expectedOutserviceTemplates, null, null, inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML));
}
@Test
public void updateNewAbstractNodeTemplateNoConsolidation() throws IOException {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/fixNewAbstractNodeTemplate/noConsolidation/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/fixNewAbstractNodeTemplate/noConsolidation/out";
-
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "fixNewAbstractNodeTemplate/noConsolidation");
List<Pair<String, String>> portTypeToIdList = new ArrayList<>();
- portTypeToIdList.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal1"));
- portTypeToIdList.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal2"));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL1));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL2));
NodeTemplate cleanedComputeNodeTemplate =
getMockNode(
- "/mock/services/heattotosca/unifiedComposition/fixNewAbstractNodeTemplate/mockComputeNodeTemplate.yaml");
+ BASE_DIRECTORY + "fixNewAbstractNodeTemplate/mockComputeNodeTemplate.yaml");
context.setConsolidationData(
- createConsolidationData(Arrays.asList("FSB1_template"), portTypeToIdList));
- context.addCleanedNodeTemplate(mainSTName, "FSB1_template",
+ createConsolidationData(Collections.singletonList(FSB1_template), portTypeToIdList));
+ context.addCleanedNodeTemplate(MAIN_SERVICE_TEMPLATE_YAML, FSB1_template,
UnifiedCompositionEntity.Compute, cleanedComputeNodeTemplate);
- context.addCleanedNodeTemplate(mainSTName, "FSB1_Internal1",
+ context.addCleanedNodeTemplate(MAIN_SERVICE_TEMPLATE_YAML, FSB1_INTERNAL1,
UnifiedCompositionEntity.Port, cleanedComputeNodeTemplate);
- context.addCleanedNodeTemplate(mainSTName, "FSB1_Internal2",
+ context.addCleanedNodeTemplate(MAIN_SERVICE_TEMPLATE_YAML, FSB1_INTERNAL2,
UnifiedCompositionEntity.Port, cleanedComputeNodeTemplate);
- setUnifiedCompositionData(Arrays.asList("FSB1_template", "FSB1_Internal1", "FSB1_Internal2"));
+ setUnifiedCompositionData(Arrays.asList(FSB1_template, FSB1_INTERNAL1, FSB1_INTERNAL2));
unifiedCompositionService
- .updateUnifiedAbstractNodesConnectivity(inputServiceTemplates.get(mainSTName), context);
+ .updateUnifiedAbstractNodesConnectivity(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), context);
- checkSTResults(expectedOutserviceTemplates, null, null, inputServiceTemplates.get(mainSTName));
+ checkSTResults(expectedOutserviceTemplates, null, null, inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML));
}
@Test
public void updateNewAbstractNodeTemplateWithConsolidation() throws IOException {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/fixNewAbstractNodeTemplate/consolidation/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/fixNewAbstractNodeTemplate/consolidation/out";
-
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "fixNewAbstractNodeTemplate/consolidation");
List<Pair<String, String>> portTypeToIdList = new ArrayList<>();
- portTypeToIdList.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal1"));
- portTypeToIdList.add(new ImmutablePair<>("FSB2_Internal", "FSB2_Internal1"));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL1));
+ portTypeToIdList.add(new ImmutablePair<>(FSB2_INTERNAL, FSB2_INTERNAL1));
NodeTemplate cleanedComputeNodeTemplate =
getMockNode(
- "/mock/services/heattotosca/unifiedComposition/fixNewAbstractNodeTemplate/mockComputeNodeTemplate.yaml");
+ BASE_DIRECTORY + "fixNewAbstractNodeTemplate/mockComputeNodeTemplate.yaml");
context.setConsolidationData(
createConsolidationData(Arrays.asList("FSB1_template_1", "FSB1_template_2"),
portTypeToIdList));
- context.addCleanedNodeTemplate(mainSTName, "FSB1_template_1",
+ context.addCleanedNodeTemplate(MAIN_SERVICE_TEMPLATE_YAML, "FSB1_template_1",
UnifiedCompositionEntity.Compute, cleanedComputeNodeTemplate);
- context.addCleanedNodeTemplate(mainSTName, "FSB1_template_2",
+ context.addCleanedNodeTemplate(MAIN_SERVICE_TEMPLATE_YAML, "FSB1_template_2",
UnifiedCompositionEntity.Compute, cleanedComputeNodeTemplate);
- context.addCleanedNodeTemplate(mainSTName, "FSB1_Internal1",
+ context.addCleanedNodeTemplate(MAIN_SERVICE_TEMPLATE_YAML, FSB1_INTERNAL1,
UnifiedCompositionEntity.Port, cleanedComputeNodeTemplate);
- context.addCleanedNodeTemplate(mainSTName, "FSB2_Internal1",
+ context.addCleanedNodeTemplate(MAIN_SERVICE_TEMPLATE_YAML, FSB2_INTERNAL1,
UnifiedCompositionEntity.Port, cleanedComputeNodeTemplate);
setUnifiedCompositionData(
- Arrays.asList("FSB1_template_1", "FSB1_template_2", "FSB1_Internal1", "FSB2_Internal1"));
+ Arrays.asList("FSB1_template_1", "FSB1_template_2", FSB1_INTERNAL1, FSB2_INTERNAL1));
unifiedCompositionService
- .updateUnifiedAbstractNodesConnectivity(inputServiceTemplates.get(mainSTName), context);
+ .updateUnifiedAbstractNodesConnectivity(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), context);
- checkSTResults(expectedOutserviceTemplates, null, null, inputServiceTemplates.get(mainSTName));
+ checkSTResults(expectedOutserviceTemplates, null, null, inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML));
}
@Ignore
public void testThreeNovaOfSameTypePreConditionFalse() throws IOException {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/pattern1b/noConsolidation/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/pattern1b/noConsolidation/out";
-
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "pattern1b/noConsolidation");
List<UnifiedCompositionData> unifiedCompositionDataList = new ArrayList<>();
List<Pair<String, String>> portTypeToIdList1 = new ArrayList<>();
- portTypeToIdList1.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal1"));
- portTypeToIdList1.add(new ImmutablePair<>("FSB2_Internal", "FSB2_Internal2"));
+ portTypeToIdList1.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL1));
+ portTypeToIdList1.add(new ImmutablePair<>(FSB2_INTERNAL, FSB2_INTERNAL2));
UnifiedCompositionData unifiedCompositionData1 =
- createCompositionData("FSB1_template", portTypeToIdList1);
+ createCompositionData(FSB1_template, portTypeToIdList1);
addOutputGetAttrInForCompute1WithConsolidation(unifiedCompositionData1);
addOutputGetAttrInForPortWithConsolidation1(unifiedCompositionData1);
unifiedCompositionDataList.add(unifiedCompositionData1);
UnifiedCompositionData unifiedCompositionData2 =
- createCompositionData("FSB2_template", portTypeToIdList1);
+ createCompositionData(FSB2_template, portTypeToIdList1);
addOutputGetAttrInForCompute1WithConsolidation(unifiedCompositionData2);
addOutputGetAttrInForPortWithConsolidation1(unifiedCompositionData2);
unifiedCompositionDataList.add(unifiedCompositionData2);
portTypeToIdList1.remove(1);
UnifiedCompositionData unifiedCompositionData3 =
- createCompositionData("FSB3_template", portTypeToIdList1);
+ createCompositionData(FSB3_template, portTypeToIdList1);
addOutputGetAttrInForCompute1WithConsolidation(unifiedCompositionData3);
addOutputGetAttrInForPortWithConsolidation1(unifiedCompositionData3);
unifiedCompositionDataList.add(unifiedCompositionData3);
@@ -1042,24 +944,19 @@ public class UnifiedCompositionServiceTest {
UnifiedCompositionSingleSubstitution unifiedCompositionSingleSubstitution =
new UnifiedCompositionSingleSubstitution();
unifiedCompositionSingleSubstitution
- .createUnifiedComposition(inputServiceTemplates.get(mainSTName), null,
+ .createUnifiedComposition(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), null,
unifiedCompositionDataList, context);
- checkSTResults(expectedOutserviceTemplates, null, null, inputServiceTemplates.get(mainSTName));
+ checkSTResults(expectedOutserviceTemplates, null, null, inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML));
}
@Test
public void testUnifiedNestedCompositionOneComputeInNested() throws IOException {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/pattern4/oneNestedNode/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/pattern4/oneNestedNode/out";
-
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "pattern4/oneNestedNode");
ConsolidationData consolidationData = new ConsolidationData();
String nestedFileName = "nested-pcm_v0.1ServiceTemplate.yaml";
- TestUtils.updateNestedConsolidationData(mainSTName, Arrays.asList("server_pcm_001"),
+ TestUtils.updateNestedConsolidationData(MAIN_SERVICE_TEMPLATE_YAML, Collections.singletonList("server_pcm_001"),
consolidationData);
TestUtils.initComputeNodeTypeInConsolidationData(nestedFileName,
@@ -1070,14 +967,14 @@ public class UnifiedCompositionServiceTest {
context.setConsolidationData(consolidationData);
context.getTranslatedServiceTemplates()
.put(Constants.GLOBAL_SUBSTITUTION_TYPES_TEMPLATE_NAME,
- inputServiceTemplates.get(globalSubstitutionST));
+ inputServiceTemplates.get(GLOBAL_SUBSTITUTION_TYPES_SERVICE_TEMPLATE_YAML));
context.getTranslatedServiceTemplates()
.put(nestedFileName, inputServiceTemplates.get(nestedFileName));
context.getTranslatedServiceTemplates()
- .put(mainSTName, inputServiceTemplates.get(mainSTName));
+ .put(MAIN_SERVICE_TEMPLATE_YAML, inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML));
UnifiedCompositionData unifiedComposition = createUnifiedCompositionOnlyNested("server_pcm_001");
- unifiedCompositionService.handleUnifiedNestedDefinition(inputServiceTemplates.get(mainSTName),
+ unifiedCompositionService.handleUnifiedNestedDefinition(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
inputServiceTemplates.get(nestedFileName), unifiedComposition, context);
checkSTResults(expectedOutserviceTemplates, nestedFileName,
@@ -1088,18 +985,13 @@ public class UnifiedCompositionServiceTest {
@Test
public void testTwoNestedWithOneCompute() throws IOException {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/pattern4/twoNestedWithOneCompute/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/pattern4/twoNestedWithOneCompute/out";
-
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "pattern4/twoNestedWithOneCompute");
ConsolidationData consolidationData = new ConsolidationData();
String nestedFileName1 = "nested-pcm_v0.1ServiceTemplate.yaml";
String nestedFileName2 = "nested-oam_v0.1ServiceTemplate.yaml";
- TestUtils.updateNestedConsolidationData(mainSTName,
+ TestUtils.updateNestedConsolidationData(MAIN_SERVICE_TEMPLATE_YAML,
Arrays.asList("server_pcm_001", "server_oam_001"), consolidationData);
TestUtils.initComputeNodeTypeInConsolidationData(nestedFileName1,
@@ -1114,20 +1006,20 @@ public class UnifiedCompositionServiceTest {
context.setConsolidationData(consolidationData);
context.getTranslatedServiceTemplates()
.put(Constants.GLOBAL_SUBSTITUTION_TYPES_TEMPLATE_NAME,
- inputServiceTemplates.get(globalSubstitutionST));
+ inputServiceTemplates.get(GLOBAL_SUBSTITUTION_TYPES_SERVICE_TEMPLATE_YAML));
context.getTranslatedServiceTemplates()
.put(nestedFileName1, inputServiceTemplates.get(nestedFileName1));
context.getTranslatedServiceTemplates()
.put(nestedFileName2, inputServiceTemplates.get(nestedFileName2));
context.getTranslatedServiceTemplates()
- .put(mainSTName, inputServiceTemplates.get(mainSTName));
+ .put(MAIN_SERVICE_TEMPLATE_YAML, inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML));
UnifiedCompositionData unifiedComposition =
createUnifiedCompositionOnlyNested("server_pcm_001");
- unifiedCompositionService.handleUnifiedNestedDefinition(inputServiceTemplates.get(mainSTName),
+ unifiedCompositionService.handleUnifiedNestedDefinition(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
inputServiceTemplates.get(nestedFileName1), unifiedComposition, context);
unifiedComposition = createUnifiedCompositionOnlyNested("server_oam_001");
- unifiedCompositionService.handleUnifiedNestedDefinition(inputServiceTemplates.get(mainSTName),
+ unifiedCompositionService.handleUnifiedNestedDefinition(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
inputServiceTemplates.get(nestedFileName2), unifiedComposition, context);
checkSTResults(expectedOutserviceTemplates, nestedFileName1,
@@ -1141,142 +1033,122 @@ public class UnifiedCompositionServiceTest {
@Test
public void testNestedCompositionNodesConnectedIn() throws IOException {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/pattern4/nestedNodesConnectedIn/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/pattern4/nestedNodesConnectedIn/out";
-
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "pattern4/nestedNodesConnectedIn");
ConsolidationData consolidationData = new ConsolidationData();
String nestedFileName = "nested-pcm_v0.1ServiceTemplate.yaml";
- TestUtils.updateNestedConsolidationData(mainSTName, Arrays.asList("server_pcm_001"),
+ TestUtils.updateNestedConsolidationData(MAIN_SERVICE_TEMPLATE_YAML, Collections.singletonList("server_pcm_001"),
consolidationData);
context.getTranslatedServiceTemplates()
.put(Constants.GLOBAL_SUBSTITUTION_TYPES_TEMPLATE_NAME,
- inputServiceTemplates.get(globalSubstitutionST));
+ inputServiceTemplates.get(GLOBAL_SUBSTITUTION_TYPES_SERVICE_TEMPLATE_YAML));
context.getTranslatedServiceTemplates()
.put(nestedFileName, inputServiceTemplates.get(nestedFileName));
context.getTranslatedServiceTemplates()
- .put(mainSTName, inputServiceTemplates.get(mainSTName));
- context.addUnifiedNestedNodeTemplateId(mainSTName, "server_pcm_001", "abstract_pcm_server_0");
+ .put(MAIN_SERVICE_TEMPLATE_YAML, inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML));
+ context.addUnifiedNestedNodeTemplateId(MAIN_SERVICE_TEMPLATE_YAML, "server_pcm_001", "abstract_pcm_server_0");
Map<String, List<RequirementAssignmentData>> nodeConnectedInList =
- TestUtils.getNodeConnectedInList("server_pcm_001", inputServiceTemplates.get(mainSTName),
- "dependency");
+ TestUtils.getNodeConnectedInList("server_pcm_001", inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
+ DEPENDENCY);
UnifiedCompositionData unifiedComposition =
createUnifiedCompositionOnlyNested("server_pcm_001");
unifiedComposition.getNestedTemplateConsolidationData()
.setNodesConnectedIn(nodeConnectedInList);
unifiedCompositionService.updNestedCompositionNodesConnectedInConnectivity
- (inputServiceTemplates.get(mainSTName), unifiedComposition, context);
+ (inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), unifiedComposition, context);
checkSTResults(expectedOutserviceTemplates, nestedFileName,
context.getTranslatedServiceTemplates().get(nestedFileName),
context.getTranslatedServiceTemplates()
.get(Constants.GLOBAL_SUBSTITUTION_TYPES_TEMPLATE_NAME), context
- .getTranslatedServiceTemplates().get(mainSTName));
+ .getTranslatedServiceTemplates().get(MAIN_SERVICE_TEMPLATE_YAML));
}
@Test
public void testNestedCompositionNodesGetAttrIn() throws IOException {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/pattern4/nestedNodesGetAttrIn/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/pattern4/nestedNodesGetAttrIn/out";
-
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "pattern4/nestedNodesGetAttrIn");
ConsolidationData consolidationData = new ConsolidationData();
String nestedFileName = "nested-pcm_v0.1ServiceTemplate.yaml";
- TestUtils.updateNestedConsolidationData(mainSTName, Arrays.asList("server_pcm_001"),
+ TestUtils.updateNestedConsolidationData(MAIN_SERVICE_TEMPLATE_YAML, Collections.singletonList("server_pcm_001"),
consolidationData);
context.getTranslatedServiceTemplates()
.put(Constants.GLOBAL_SUBSTITUTION_TYPES_TEMPLATE_NAME,
- inputServiceTemplates.get(globalSubstitutionST));
+ inputServiceTemplates.get(GLOBAL_SUBSTITUTION_TYPES_SERVICE_TEMPLATE_YAML));
context.getTranslatedServiceTemplates()
.put(nestedFileName, inputServiceTemplates.get(nestedFileName));
context.getTranslatedServiceTemplates()
- .put(mainSTName, inputServiceTemplates.get(mainSTName));
- context.addUnifiedNestedNodeTemplateId(mainSTName, "server_pcm_001", "abstract_pcm_server_0");
+ .put(MAIN_SERVICE_TEMPLATE_YAML, inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML));
+ context.addUnifiedNestedNodeTemplateId(MAIN_SERVICE_TEMPLATE_YAML, "server_pcm_001", "abstract_pcm_server_0");
Map<String, List<RequirementAssignmentData>> nodeConnectedInList =
- TestUtils.getNodeConnectedInList("server_pcm_001", inputServiceTemplates.get(mainSTName),
- "dependency");
+ TestUtils.getNodeConnectedInList("server_pcm_001", inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
+ DEPENDENCY);
UnifiedCompositionData unifiedComposition =
createUnifiedCompositionOnlyNested("server_pcm_001");
addGetAttInUnifiedCompositionData(unifiedComposition
- .getNestedTemplateConsolidationData(), "tenant_id", "oam_net_gw", "packet_mirror_network");
+ .getNestedTemplateConsolidationData(), TENANT_ID, "oam_net_gw", "packet_mirror_network");
addGetAttInUnifiedCompositionData(unifiedComposition
- .getNestedTemplateConsolidationData(), "user_data_format", "oam_net_gw",
+ .getNestedTemplateConsolidationData(), USER_DATA_FORMAT, "oam_net_gw",
"server_compute_get_attr_test");
addGetAttInUnifiedCompositionData(unifiedComposition
.getNestedTemplateConsolidationData(), "metadata", "server_pcm_id",
"server_compute_get_attr_test");
unifiedCompositionService.updNestedCompositionNodesGetAttrInConnectivity
- (inputServiceTemplates.get(mainSTName), unifiedComposition, context);
+ (inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), unifiedComposition, context);
checkSTResults(expectedOutserviceTemplates, nestedFileName,
context.getTranslatedServiceTemplates().get(nestedFileName),
context.getTranslatedServiceTemplates()
.get(Constants.GLOBAL_SUBSTITUTION_TYPES_TEMPLATE_NAME), context
- .getTranslatedServiceTemplates().get(mainSTName));
+ .getTranslatedServiceTemplates().get(MAIN_SERVICE_TEMPLATE_YAML));
}
@Test
public void testNestedCompositionOutputParamGetAttrIn() throws IOException {
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/pattern4/nestedOutputParamGetAttrIn/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/pattern4/nestedOutputParamGetAttrIn/out";
-
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "pattern4/nestedOutputParamGetAttrIn");
ConsolidationData consolidationData = new ConsolidationData();
String nestedFileName = "nested-pcm_v0.1ServiceTemplate.yaml";
- TestUtils.updateNestedConsolidationData(mainSTName, Arrays.asList("server_pcm_001"),
+ TestUtils.updateNestedConsolidationData(MAIN_SERVICE_TEMPLATE_YAML, Collections.singletonList("server_pcm_001"),
consolidationData);
context.getTranslatedServiceTemplates()
.put(Constants.GLOBAL_SUBSTITUTION_TYPES_TEMPLATE_NAME,
- inputServiceTemplates.get(globalSubstitutionST));
+ inputServiceTemplates.get(GLOBAL_SUBSTITUTION_TYPES_SERVICE_TEMPLATE_YAML));
context.getTranslatedServiceTemplates()
.put(nestedFileName, inputServiceTemplates.get(nestedFileName));
context.getTranslatedServiceTemplates()
- .put(mainSTName, inputServiceTemplates.get(mainSTName));
- context.addUnifiedNestedNodeTemplateId(mainSTName, "server_pcm_001", "abstract_pcm_server_0");
+ .put(MAIN_SERVICE_TEMPLATE_YAML, inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML));
+ context.addUnifiedNestedNodeTemplateId(MAIN_SERVICE_TEMPLATE_YAML, "server_pcm_001", "abstract_pcm_server_0");
Map<String, List<RequirementAssignmentData>> nodeConnectedInList =
- TestUtils.getNodeConnectedInList("server_pcm_001", inputServiceTemplates.get(mainSTName),
- "dependency");
+ TestUtils.getNodeConnectedInList("server_pcm_001", inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
+ DEPENDENCY);
UnifiedCompositionData unifiedComposition =
createUnifiedCompositionOnlyNested("server_pcm_001");
addOutputGetAttInUnifiedCompositionData(unifiedComposition
- .getNestedTemplateConsolidationData(), "output_attr_1", "accessIPv4");
+ .getNestedTemplateConsolidationData(), "output_attr_1", ACCESS_IPv4);
addOutputGetAttInUnifiedCompositionData(unifiedComposition
- .getNestedTemplateConsolidationData(), "output_attr_2", "accessIPv6");
+ .getNestedTemplateConsolidationData(), "output_attr_2", ACCESS_IPv6);
unifiedCompositionService.updNestedCompositionOutputParamGetAttrInConnectivity
- (inputServiceTemplates.get(mainSTName), unifiedComposition, context);
+ (inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), unifiedComposition, context);
checkSTResults(expectedOutserviceTemplates, nestedFileName,
context.getTranslatedServiceTemplates().get(nestedFileName),
context.getTranslatedServiceTemplates()
.get(Constants.GLOBAL_SUBSTITUTION_TYPES_TEMPLATE_NAME), context
- .getTranslatedServiceTemplates().get(mainSTName));
+ .getTranslatedServiceTemplates().get(MAIN_SERVICE_TEMPLATE_YAML));
}
@Test
public void testInputOutputParameterType() throws IOException{
- inputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/inputoutputparamtype/in";
- outputServiceTemplatesPath =
- "/mock/services/heattotosca/unifiedComposition/inputoutputparamtype/out";
-
- loadInputAndOutputData();
+ loadInputAndOutputData(BASE_DIRECTORY + "inputoutputparamtype");
ConsolidationData consolidationData = new ConsolidationData();
List<Pair<String, String>> portTypeToIdList = new ArrayList<>();
portTypeToIdList.add(new ImmutablePair<>("FSB1_Port", "FSB1_Port1"));
portTypeToIdList.add(new ImmutablePair<>("VMI", "VMI1"));
- UnifiedCompositionData unifiedCompositionData = createCompositionData("FSB1", portTypeToIdList);
+ UnifiedCompositionData unifiedCompositionData = createCompositionData(FSB1, portTypeToIdList);
Map<String, NodeTemplate> nodeTemplates =
- inputServiceTemplates.get(mainSTName).getTopology_template().getNode_templates();
+ inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML).getTopology_template().getNode_templates();
for (Map.Entry<String, NodeTemplate> nodeTemplateEntry : nodeTemplates.entrySet() ) {
String nodeTemplateId = nodeTemplateEntry.getKey();
if (nodeTemplateId.equals("cmaui_volume_test_compute_properties")) {
@@ -1307,9 +1179,9 @@ public class UnifiedCompositionServiceTest {
UnifiedCompositionSingleSubstitution unifiedCompositionSingleSubstitution =
new UnifiedCompositionSingleSubstitution();
unifiedCompositionSingleSubstitution
- .createUnifiedComposition(inputServiceTemplates.get(mainSTName), null,
+ .createUnifiedComposition(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), null,
unifiedCompositionDataList, context);
- checkSTResults(expectedOutserviceTemplates, null, null, inputServiceTemplates.get(mainSTName));
+ checkSTResults(expectedOutserviceTemplates, null, null, inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML));
System.out.println();
}
@@ -1327,14 +1199,14 @@ public class UnifiedCompositionServiceTest {
private void setUnifiedCompositionData(List<String> nodeTemplateIds) {
UnifiedSubstitutionData unifiedSubstitutionData =
- context.getUnifiedSubstitutionData().get(mainSTName) == null ? new UnifiedSubstitutionData()
- : context.getUnifiedSubstitutionData().get(mainSTName);
+ context.getUnifiedSubstitutionData().get(MAIN_SERVICE_TEMPLATE_YAML) == null ? new UnifiedSubstitutionData()
+ : context.getUnifiedSubstitutionData().get(MAIN_SERVICE_TEMPLATE_YAML);
Map<String, String> substitutionAbstractNodeIds = new HashMap<>();
for (String id : nodeTemplateIds) {
substitutionAbstractNodeIds.put(id, "FSB2");
}
- substitutionAbstractNodeIds.put("", "FSB1");
+ substitutionAbstractNodeIds.put("", FSB1);
unifiedSubstitutionData.setNodesRelatedAbstractNode(substitutionAbstractNodeIds);
}
@@ -1345,18 +1217,19 @@ public class UnifiedCompositionServiceTest {
ServiceTemplate gloablSubstitutionServiceTemplate, ServiceTemplate mainServiceTemplate) {
YamlUtil yamlUtil = new YamlUtil();
if (Objects.nonNull(substitutionServiceTemplate)) {
+ String substitutionST = "SubstitutionServiceTemplate.yaml";
assertEquals("difference substitution service template: ",
yamlUtil.objectToYaml(expectedOutserviceTemplates.get(substitutionST)),
yamlUtil.objectToYaml(substitutionServiceTemplate));
}
if (Objects.nonNull(gloablSubstitutionServiceTemplate)) {
assertEquals("difference global substitution service template: ",
- yamlUtil.objectToYaml(expectedOutserviceTemplates.get(globalSubstitutionST)),
+ yamlUtil.objectToYaml(expectedOutserviceTemplates.get(GLOBAL_SUBSTITUTION_TYPES_SERVICE_TEMPLATE_YAML)),
yamlUtil.objectToYaml(gloablSubstitutionServiceTemplate));
}
if (Objects.nonNull(mainServiceTemplate)) {
assertEquals("difference main service template: ",
- yamlUtil.objectToYaml(expectedOutserviceTemplates.get(mainSTName)),
+ yamlUtil.objectToYaml(expectedOutserviceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML)),
yamlUtil.objectToYaml(mainServiceTemplate));
}
}
@@ -1377,12 +1250,12 @@ public class UnifiedCompositionServiceTest {
}
- private void loadInputAndOutputData() throws IOException {
+ private void loadInputAndOutputData(String path) throws IOException {
inputServiceTemplates = new HashMap<>();
- TestUtils.loadServiceTemplates(inputServiceTemplatesPath, new ToscaExtensionYamlUtil(),
+ TestUtils.loadServiceTemplates(path + IN_PREFIX, new ToscaExtensionYamlUtil(),
inputServiceTemplates);
expectedOutserviceTemplates = new HashMap<>();
- TestUtils.loadServiceTemplates(outputServiceTemplatesPath, new ToscaExtensionYamlUtil(),
+ TestUtils.loadServiceTemplates(path + OUT_PREFIX, new ToscaExtensionYamlUtil(),
expectedOutserviceTemplates);
}
@@ -1412,22 +1285,22 @@ public class UnifiedCompositionServiceTest {
String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.FSB2";
TestUtils
- .initComputeNodeTypeInConsolidationData(mainSTName, computeNodeTypeName, consolidationData);
- TestUtils.initPortConsolidationData(mainSTName, consolidationData);
+ .initComputeNodeTypeInConsolidationData(MAIN_SERVICE_TEMPLATE_YAML, computeNodeTypeName, consolidationData);
+ TestUtils.initPortConsolidationData(MAIN_SERVICE_TEMPLATE_YAML, consolidationData);
for (String computeId : computeNodeIds) {
ComputeTemplateConsolidationData computeTemplateConsolidationData =
new ComputeTemplateConsolidationData();
TestUtils.updatePortsInComputeTemplateConsolidationData(portTypeToIdList,
computeTemplateConsolidationData);
- consolidationData.getComputeConsolidationData().getFileComputeConsolidationData(mainSTName)
+ consolidationData.getComputeConsolidationData().getFileComputeConsolidationData(MAIN_SERVICE_TEMPLATE_YAML)
.getTypeComputeConsolidationData(computeNodeTypeName)
.setComputeTemplateConsolidationData(computeId,
computeTemplateConsolidationData);
}
for (Pair<String, String> portTypeToId : portTypeToIdList) {
- consolidationData.getPortConsolidationData().getFilePortConsolidationData(mainSTName)
+ consolidationData.getPortConsolidationData().getFilePortConsolidationData(MAIN_SERVICE_TEMPLATE_YAML)
.setPortTemplateConsolidationData(portTypeToId.getRight(),
new PortTemplateConsolidationData());
}
@@ -1440,7 +1313,7 @@ public class UnifiedCompositionServiceTest {
UnifiedCompositionData unifiedCompositionData = new UnifiedCompositionData();
NodeTemplate computeNodeTemplate =
- DataModelUtil.getNodeTemplate(inputServiceTemplates.get(mainSTName), computeNodeTemplateId);
+ DataModelUtil.getNodeTemplate(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), computeNodeTemplateId);
Optional<List<RequirementAssignmentData>> requirementAssignmentDataList =
TestUtils.getRequirementAssignmentDataList(computeNodeTemplate, "local_storage");
List<RequirementAssignmentData> requirementAssignmentList =
@@ -1455,7 +1328,7 @@ public class UnifiedCompositionServiceTest {
if (portTypeToIdList != null) {
for (Pair<String, String> port : portTypeToIdList) {
NodeTemplate portNodeTemplate =
- DataModelUtil.getNodeTemplate(inputServiceTemplates.get(mainSTName), port.getRight());
+ DataModelUtil.getNodeTemplate(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), port.getRight());
Map<String, List<RequirementAssignmentData>> nodeConnectedOut =
TestUtils.getNodeConnectedOutList(portNodeTemplate, "link");
@@ -1470,21 +1343,21 @@ public class UnifiedCompositionServiceTest {
private List<UnifiedCompositionData> createAbstractSubstituteCompositionDataComputeAndPort() {
List<UnifiedCompositionData> unifiedCompositionDataList = new ArrayList<>();
- UnifiedCompositionData data1 = createComputeUnifiedCompositionData("FSB1_template");
- UnifiedCompositionData data2 = createComputeUnifiedCompositionData("FSB2_template");
+ UnifiedCompositionData data1 = createComputeUnifiedCompositionData(FSB1_template);
+ UnifiedCompositionData data2 = createComputeUnifiedCompositionData(FSB2_template);
List<Pair<String, String>> portTypeToIdList = new ArrayList<>();
- ImmutablePair<String, String> portTypePair1 = new ImmutablePair<>("FSB1_Internal",
- "FSB1_Internal1");
- ImmutablePair<String, String> portTypePair2 = new ImmutablePair<>("FSB2_Internal",
- "FSB2_Internal1");
+ ImmutablePair<String, String> portTypePair1 = new ImmutablePair<>(FSB1_INTERNAL,
+ FSB1_INTERNAL1);
+ ImmutablePair<String, String> portTypePair2 = new ImmutablePair<>(FSB2_INTERNAL,
+ FSB2_INTERNAL1);
portTypeToIdList.add(portTypePair1);
portTypeToIdList.add(portTypePair2);
addPortDataToCompositionData(portTypeToIdList, data1);
portTypeToIdList.remove(portTypePair1);
portTypeToIdList.remove(portTypePair2);
- portTypeToIdList.add(new ImmutablePair<>("FSB1_Internal", "FSB1_Internal2"));
- portTypeToIdList.add(new ImmutablePair<>("FSB2_Internal", "FSB2_Internal2"));
+ portTypeToIdList.add(new ImmutablePair<>(FSB1_INTERNAL, FSB1_INTERNAL2));
+ portTypeToIdList.add(new ImmutablePair<>(FSB2_INTERNAL, FSB2_INTERNAL2));
addPortDataToCompositionData(portTypeToIdList, data2);
unifiedCompositionDataList.add(data1);
@@ -1495,7 +1368,7 @@ public class UnifiedCompositionServiceTest {
private UnifiedCompositionData createComputeUnifiedCompositionData(String computeNodeTemplateId) {
NodeTemplate computeNodeTemplate =
- DataModelUtil.getNodeTemplate(inputServiceTemplates.get(mainSTName), computeNodeTemplateId);
+ DataModelUtil.getNodeTemplate(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), computeNodeTemplateId);
Optional<List<RequirementAssignmentData>> requirementAssignmentDataList =
TestUtils.getRequirementAssignmentDataList(computeNodeTemplate, "local_storage");
Map<String, List<RequirementAssignmentData>> volume = null;
@@ -1504,15 +1377,15 @@ public class UnifiedCompositionServiceTest {
}
UnifiedCompositionData data = new UnifiedCompositionData();
Map<String, List<RequirementAssignmentData>> computeNodeConnectedOut =
- TestUtils.getNodeConnectedOutList(computeNodeTemplate, "dependency");
+ TestUtils.getNodeConnectedOutList(computeNodeTemplate, DEPENDENCY);
Map<String, List<RequirementAssignmentData>> computeNodeConnectedIn =
TestUtils
- .getNodeConnectedInList(computeNodeTemplateId, inputServiceTemplates.get(mainSTName),
- "dependency");
+ .getNodeConnectedInList(computeNodeTemplateId, inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
+ DEPENDENCY);
ComputeTemplateConsolidationData computeTemplateConsolidationData = TestUtils
.createComputeTemplateConsolidationData(computeNodeTemplateId, null, volume);
List<String> computeNodeGroups =
- TestUtils.getGroupsForNode(inputServiceTemplates.get(mainSTName),
+ TestUtils.getGroupsForNode(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
computeNodeTemplateId);
if (!computeNodeGroups.isEmpty()) {
computeTemplateConsolidationData.setGroupIds(computeNodeGroups);
@@ -1530,7 +1403,7 @@ public class UnifiedCompositionServiceTest {
for (Pair<String, String> port : portTypeToIdList) {
NodeTemplate portNodeTemplate =
- DataModelUtil.getNodeTemplate(inputServiceTemplates.get(mainSTName), port.getRight());
+ DataModelUtil.getNodeTemplate(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), port.getRight());
Optional<List<RequirementAssignmentData>> bindingReqList =
TestUtils.getRequirementAssignmentDataList(portNodeTemplate, "binding");
@@ -1551,13 +1424,13 @@ public class UnifiedCompositionServiceTest {
//Add node connected in info to test data
Map<String, List<RequirementAssignmentData>> portNodeConnectedIn =
- TestUtils.getNodeConnectedInList(port.getRight(), inputServiceTemplates.get(mainSTName),
- "port");
+ TestUtils.getNodeConnectedInList(port.getRight(), inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML),
+ PORT);
portTemplateConsolidationData.setNodesConnectedIn(portNodeConnectedIn);
//Add group infromation for ports
List<String> portGroups =
- TestUtils.getGroupsForNode(inputServiceTemplates.get(mainSTName), port.getRight());
+ TestUtils.getGroupsForNode(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), port.getRight());
portTemplateConsolidationData.setGroupIds(portGroups);
data.addPortTemplateConsolidationData(portTemplateConsolidationData);
@@ -1580,21 +1453,21 @@ public class UnifiedCompositionServiceTest {
private void addGetAttrForPort(UnifiedCompositionData unifiedCompositionData) {
for (PortTemplateConsolidationData portTemplateConsolidationData : unifiedCompositionData
.getPortTemplateConsolidationDataList()) {
- if (portTemplateConsolidationData.getNodeTemplateId().equals("FSB1_Internal1")) {
+ if (portTemplateConsolidationData.getNodeTemplateId().equals(FSB1_INTERNAL1)) {
addGetAttInUnifiedCompositionData(portTemplateConsolidationData, "network_name",
- "network_id", "jsa_net1");
- addGetAttInUnifiedCompositionData(portTemplateConsolidationData, "size",
- "device_owner", "cmaui_volume1");
- } else if (portTemplateConsolidationData.getNodeTemplateId().equals("FSB2_Internal2")) {
- addGetAttInUnifiedCompositionData(portTemplateConsolidationData, "tenant_id",
- "network_id", "jsa_net1");
+ NETWORK_ID, JSA_NET1);
+ addGetAttInUnifiedCompositionData(portTemplateConsolidationData, SIZE,
+ DEVICE_OWNER, CMAUI_VOLUME1);
+ } else if (portTemplateConsolidationData.getNodeTemplateId().equals(FSB2_INTERNAL2)) {
+ addGetAttInUnifiedCompositionData(portTemplateConsolidationData, TENANT_ID,
+ NETWORK_ID, JSA_NET1);
addGetAttInUnifiedCompositionData(portTemplateConsolidationData, "qos_policy",
- "network_id", "jsa_net1");
- addGetAttInUnifiedCompositionData(portTemplateConsolidationData, "volume_type",
- "tenant_id", "cmaui_volume1");
- } else if (portTemplateConsolidationData.getNodeTemplateId().equals("FSB1_OAM")) {
- addGetAttInUnifiedCompositionData(portTemplateConsolidationData, "size",
- "status", "cmaui_volume1");
+ NETWORK_ID, JSA_NET1);
+ addGetAttInUnifiedCompositionData(portTemplateConsolidationData, VOLUME_TYPE,
+ TENANT_ID, CMAUI_VOLUME1);
+ } else if (portTemplateConsolidationData.getNodeTemplateId().equals(FSB1_OAM)) {
+ addGetAttInUnifiedCompositionData(portTemplateConsolidationData, SIZE,
+ STATUS, CMAUI_VOLUME1);
}
}
}
@@ -1602,14 +1475,14 @@ public class UnifiedCompositionServiceTest {
private void addGetAttrForPort2(UnifiedCompositionData unifiedCompositionData) {
for (PortTemplateConsolidationData portTemplateConsolidationData : unifiedCompositionData
.getPortTemplateConsolidationDataList()) {
- if (portTemplateConsolidationData.getNodeTemplateId().equals("FSB2_Internal1")) {
- addGetAttInUnifiedCompositionData(portTemplateConsolidationData, "volume_type",
- "tenant_id", "cmaui_volume3");
- } else if (portTemplateConsolidationData.getNodeTemplateId().equals("FSB1_Internal2")) {
- addGetAttInUnifiedCompositionData(portTemplateConsolidationData, "size",
- "device_owner", "cmaui_volume3");
- addGetAttInUnifiedCompositionData(portTemplateConsolidationData, "size",
- "status", "cmaui_volume1");
+ if (portTemplateConsolidationData.getNodeTemplateId().equals(FSB2_INTERNAL1)) {
+ addGetAttInUnifiedCompositionData(portTemplateConsolidationData, VOLUME_TYPE,
+ TENANT_ID, CMAUI_VOLUME3);
+ } else if (portTemplateConsolidationData.getNodeTemplateId().equals(FSB1_INTERNAL2)) {
+ addGetAttInUnifiedCompositionData(portTemplateConsolidationData, SIZE,
+ DEVICE_OWNER, CMAUI_VOLUME3);
+ addGetAttInUnifiedCompositionData(portTemplateConsolidationData, SIZE,
+ STATUS, CMAUI_VOLUME1);
}
}
}
@@ -1617,78 +1490,78 @@ public class UnifiedCompositionServiceTest {
private void addGetAttrForPortInnerUC(UnifiedCompositionData unifiedCompositionData) {
for (PortTemplateConsolidationData portTemplateConsolidationData : unifiedCompositionData
.getPortTemplateConsolidationDataList()) {
- if (portTemplateConsolidationData.getNodeTemplateId().equals("FSB1_Internal1")) {
- addGetAttInUnifiedCompositionData(portTemplateConsolidationData, "availability_zone",
- "myAttr", "FSB1_template");
+ if (portTemplateConsolidationData.getNodeTemplateId().equals(FSB1_INTERNAL1)) {
+ addGetAttInUnifiedCompositionData(portTemplateConsolidationData, AVAILABILITY_ZONE,
+ MYATTR, FSB1_template);
addGetAttInUnifiedCompositionData(portTemplateConsolidationData, "metadata",
- "myAttr", "FSB1_template");
+ MYATTR, FSB1_template);
addGetAttInUnifiedCompositionData(portTemplateConsolidationData, "name",
- "myAttr", "FSB1_template");
- addGetAttInUnifiedCompositionData(portTemplateConsolidationData, "availability_zone",
- "tenant_id", "FSB1_template");
+ MYATTR, FSB1_template);
+ addGetAttInUnifiedCompositionData(portTemplateConsolidationData, AVAILABILITY_ZONE,
+ TENANT_ID, FSB1_template);
}
}
}
private void addGetAttrForCompute(UnifiedCompositionData unifiedCompositionData) {
addGetAttInUnifiedCompositionData(unifiedCompositionData.getComputeTemplateConsolidationData(),
- "dhcp_agent_ids", "addresses", "jsa_net1");
+ "dhcp_agent_ids", ADDRESSES, JSA_NET1);
addGetAttInUnifiedCompositionData(unifiedCompositionData.getComputeTemplateConsolidationData(),
- "volume_type", "addresses", "cmaui_volume1");
+ VOLUME_TYPE, ADDRESSES, CMAUI_VOLUME1);
addGetAttInUnifiedCompositionData(unifiedCompositionData.getComputeTemplateConsolidationData(),
- "size", "accessIPv6", "cmaui_volume2");
+ SIZE, ACCESS_IPv6, CMAUI_VOLUME2);
}
private void addGetAttrForCompute2(UnifiedCompositionData unifiedCompositionData) {
addGetAttInUnifiedCompositionData(unifiedCompositionData.getComputeTemplateConsolidationData(),
- "volume_type", "addresses", "cmaui_volume3");
+ VOLUME_TYPE, ADDRESSES, CMAUI_VOLUME3);
addGetAttInUnifiedCompositionData(unifiedCompositionData.getComputeTemplateConsolidationData(),
- "size", "user_data_format", "cmaui_volume3");
+ SIZE, USER_DATA_FORMAT, CMAUI_VOLUME3);
}
private void addOutputGetAttrInForComputeNoConsolidation(
UnifiedCompositionData unifiedCompositionData) {
addOutputGetAttInUnifiedCompositionData(unifiedCompositionData
- .getComputeTemplateConsolidationData(), "simpleOutput1", "accessIPv4");
+ .getComputeTemplateConsolidationData(), SIMPLE_OUTPUT1, ACCESS_IPv4);
addOutputGetAttInUnifiedCompositionData(unifiedCompositionData
- .getComputeTemplateConsolidationData(), "simpleOutput2", "addresses");
+ .getComputeTemplateConsolidationData(), SIMPLE_OUTPUT2, ADDRESSES);
addOutputGetAttInUnifiedCompositionData(unifiedCompositionData
- .getComputeTemplateConsolidationData(), "complexOutput1", "addresses");
+ .getComputeTemplateConsolidationData(), COMPLEX_OUTPUT1, ADDRESSES);
addOutputGetAttInUnifiedCompositionData(unifiedCompositionData
- .getComputeTemplateConsolidationData(), "complexOutput3", "accessIPv6");
+ .getComputeTemplateConsolidationData(), COMPLEX_OUTPUT3, ACCESS_IPv6);
}
private void addOutputGetAttrInForCompute1WithConsolidation(
UnifiedCompositionData unifiedCompositionData) {
addOutputGetAttInUnifiedCompositionData(unifiedCompositionData
- .getComputeTemplateConsolidationData(), "simpleOutput1", "accessIPv4");
+ .getComputeTemplateConsolidationData(), SIMPLE_OUTPUT1, ACCESS_IPv4);
addOutputGetAttInUnifiedCompositionData(unifiedCompositionData
- .getComputeTemplateConsolidationData(), "complexOutput1", "addresses");
+ .getComputeTemplateConsolidationData(), COMPLEX_OUTPUT1, ADDRESSES);
}
private void addOutputGetAttrInForCompute2WithConsolidation(
UnifiedCompositionData unifiedCompositionData) {
addOutputGetAttInUnifiedCompositionData(unifiedCompositionData
- .getComputeTemplateConsolidationData(), "simpleOutput2", "addresses");
+ .getComputeTemplateConsolidationData(), SIMPLE_OUTPUT2, ADDRESSES);
}
private void addOutputGetAttrInForPortNoConsolidation(
UnifiedCompositionData unifiedCompositionData) {
for (PortTemplateConsolidationData portTemplateConsolidationData : unifiedCompositionData
.getPortTemplateConsolidationDataList()) {
- if (portTemplateConsolidationData.getNodeTemplateId().equals("FSB1_Internal1")) {
- addOutputGetAttInUnifiedCompositionData(portTemplateConsolidationData, "complexOutput2",
- "device_owner");
- addOutputGetAttInUnifiedCompositionData(portTemplateConsolidationData, "complexOutput3",
- "device_owner");
- } else if (portTemplateConsolidationData.getNodeTemplateId().equals("FSB2_Internal2")) {
- addOutputGetAttInUnifiedCompositionData(portTemplateConsolidationData, "complexOutput1",
- "tenant_id");
- } else if (portTemplateConsolidationData.getNodeTemplateId().equals("FSB1_OAM")) {
- addOutputGetAttInUnifiedCompositionData(portTemplateConsolidationData, "complexOutput2",
- "user_data_format");
+ if (portTemplateConsolidationData.getNodeTemplateId().equals(FSB1_INTERNAL1)) {
+ addOutputGetAttInUnifiedCompositionData(portTemplateConsolidationData, COMPLEX_OUTPUT2,
+ DEVICE_OWNER);
+ addOutputGetAttInUnifiedCompositionData(portTemplateConsolidationData, COMPLEX_OUTPUT3,
+ DEVICE_OWNER);
+ } else if (portTemplateConsolidationData.getNodeTemplateId().equals(FSB2_INTERNAL2)) {
+ addOutputGetAttInUnifiedCompositionData(portTemplateConsolidationData, COMPLEX_OUTPUT1,
+ TENANT_ID);
+ } else if (portTemplateConsolidationData.getNodeTemplateId().equals(FSB1_OAM)) {
+ addOutputGetAttInUnifiedCompositionData(portTemplateConsolidationData, COMPLEX_OUTPUT2,
+ USER_DATA_FORMAT);
}
}
}
@@ -1697,11 +1570,11 @@ public class UnifiedCompositionServiceTest {
UnifiedCompositionData unifiedCompositionData) {
for (PortTemplateConsolidationData portTemplateConsolidationData : unifiedCompositionData
.getPortTemplateConsolidationDataList()) {
- if (portTemplateConsolidationData.getNodeTemplateId().equals("FSB2_Internal2")) {
- addOutputGetAttInUnifiedCompositionData(portTemplateConsolidationData, "complexOutput1",
- "tenant_id");
- } else if (portTemplateConsolidationData.getNodeTemplateId().equals("FSB1_Internal1")) {
- addOutputGetAttInUnifiedCompositionData(portTemplateConsolidationData, "complexOutput3",
+ if (portTemplateConsolidationData.getNodeTemplateId().equals(FSB2_INTERNAL2)) {
+ addOutputGetAttInUnifiedCompositionData(portTemplateConsolidationData, COMPLEX_OUTPUT1,
+ TENANT_ID);
+ } else if (portTemplateConsolidationData.getNodeTemplateId().equals(FSB1_INTERNAL1)) {
+ addOutputGetAttInUnifiedCompositionData(portTemplateConsolidationData, COMPLEX_OUTPUT3,
"admin_state_up");
}
}
@@ -1711,12 +1584,12 @@ public class UnifiedCompositionServiceTest {
UnifiedCompositionData unifiedCompositionData) {
for (PortTemplateConsolidationData portTemplateConsolidationData : unifiedCompositionData
.getPortTemplateConsolidationDataList()) {
- if (portTemplateConsolidationData.getNodeTemplateId().equals("FSB2_Internal1")) {
- addOutputGetAttInUnifiedCompositionData(portTemplateConsolidationData, "complexOutput2",
- "user_data_format");
- } else if (portTemplateConsolidationData.getNodeTemplateId().equals("FSB1_Internal2")) {
- addOutputGetAttInUnifiedCompositionData(portTemplateConsolidationData, "complexOutput2",
- "device_owner");
+ if (portTemplateConsolidationData.getNodeTemplateId().equals(FSB2_INTERNAL1)) {
+ addOutputGetAttInUnifiedCompositionData(portTemplateConsolidationData, COMPLEX_OUTPUT2,
+ USER_DATA_FORMAT);
+ } else if (portTemplateConsolidationData.getNodeTemplateId().equals(FSB1_INTERNAL2)) {
+ addOutputGetAttInUnifiedCompositionData(portTemplateConsolidationData, COMPLEX_OUTPUT2,
+ DEVICE_OWNER);
}
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifedCompositionDynamicPortsTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifedCompositionDynamicPortsTest.java
deleted file mode 100644
index 58f17493d4..0000000000
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifedCompositionDynamicPortsTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.openecomp.sdc.translator.services.heattotosca.impl.fulltest;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseFullTranslationTest;
-
-import java.io.IOException;
-
-public class UnifedCompositionDynamicPortsTest extends BaseFullTranslationTest {
- private static final String baseDirectory = "/mock/services/heattotosca/fulltest/dynamicPorts";
- @Override
- @Before
- public void setUp() throws IOException {
- // do not delete this function. it prevents the superclass setup from running
- }
-
- @Test
- public void testDynamicPortWithDependsOn() throws IOException {
- testTranslationWithInit(
- baseDirectory + "/dynamicPortsWithDependsOn/in",
- baseDirectory + "/dynamicPortsWithDependsOn/out"
- );
- }
-
- @Test
- public void testDependsOnFromNovaToNestedPort() throws IOException {
- testTranslationWithInit(
- baseDirectory + "/dependsOnFromNovaToNestedPort/in",
- baseDirectory + "/dependsOnFromNovaToNestedPort/out"
- );
- }
-
- @Test
- public void testDependsOnFromPortToNested() throws IOException {
- testTranslationWithInit(
- baseDirectory + "/dependsOnFromPortToNested/in",
- baseDirectory + "/dependsOnFromPortToNested/out"
- );
- }
-
- @Test
- public void testDependsOnFromVfcToNested() throws IOException {
- testTranslationWithInit(
- baseDirectory + "/dependsOnFromVfcToNested/in",
- baseDirectory + "/dependsOnFromVfcToNested/out"
- );
- }
-
- @Test
- public void testDependsOnFromNestedToNested() throws IOException {
- testTranslationWithInit(
- baseDirectory + "/dependsOnFromNestedToNested/in",
- baseDirectory + "/dependsOnFromNestedToNested/out"
- );
- }
-}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionCatalogInstanceFullTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionCatalogInstanceFullTest.java
index 7036e23588..9064dc4edb 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionCatalogInstanceFullTest.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionCatalogInstanceFullTest.java
@@ -1,6 +1,5 @@
package org.openecomp.sdc.translator.services.heattotosca.impl.fulltest;
-import org.junit.Before;
import org.junit.Test;
import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseFullTranslationTest;
@@ -8,56 +7,30 @@ import java.io.IOException;
public class UnifiedCompositionCatalogInstanceFullTest extends BaseFullTranslationTest {
- @Override
- @Before
- public void setUp() throws IOException {
- // do not delete this function. it prevents the superclass setup from running
- }
+ private static final String BASE_DIRECTORY = "/mock/services/heattotosca/fulltest/catalogInstances/";
- @Test
+ @Test
public void testThreeNovaSameTypeDiffGetAttrFromSameEntitiesTypes() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/catalogInstances/threeComputesSameTypeGetAttrBetweenThem/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/catalogInstances/threeComputesSameTypeGetAttrBetweenThem/out";
-
- testTranslationWithUnifiedCondition();
+ testTranslationWithInit(BASE_DIRECTORY + "threeComputesSameTypeGetAttrBetweenThem");
}
@Test
public void testThreeNovaSameTypePortsConnectedToDiffNetworks() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/catalogInstances/threeComputesSameTypePortsConnectedToDiffNetworks/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/catalogInstances/threeComputesSameTypePortsConnectedToDiffNetworks/out";
+ testTranslationWithInit(BASE_DIRECTORY + "threeComputesSameTypePortsConnectedToDiffNetworks");
+ }
- testTranslationWithUnifiedCondition();
+ @Test
+ public void testComputeWithTwoSamePortTypesWithDiffPropVal() throws IOException {
+ testTranslationWithInit(BASE_DIRECTORY + "computewithtwosameporttypes");
}
@Test
public void testThreeNovaSameTypeDiffImageName() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/catalogInstances/threeComputesSameTypeDiffImageName/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/catalogInstances/threeComputesSameTypeDiffImageName/out";
-
- testTranslationWithUnifiedCondition();
+ testTranslationWithInit(BASE_DIRECTORY + "threeComputesSameTypeDiffImageName");
}
@Test
public void testTwoNovaWithDiffProperties() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/catalogInstances/twoNovaWithDiffProperties/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/catalogInstances/twoNovaWithDiffProperties/out";
-
- testTranslationWithUnifiedCondition();
- }
-
-
-
- private void testTranslationWithUnifiedCondition() throws IOException {
- initTranslatorAndTranslate();
- testTranslation();
+ testTranslationWithInit(BASE_DIRECTORY + "twoNovaWithDiffProperties");
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionDynamicPortsTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionDynamicPortsTest.java
new file mode 100644
index 0000000000..d908a3dabc
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionDynamicPortsTest.java
@@ -0,0 +1,36 @@
+package org.openecomp.sdc.translator.services.heattotosca.impl.fulltest;
+
+import org.junit.Test;
+import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseFullTranslationTest;
+
+import java.io.IOException;
+
+public class UnifiedCompositionDynamicPortsTest extends BaseFullTranslationTest {
+
+ private static final String BASE_DIRECTORY = "/mock/services/heattotosca/fulltest/dynamicPorts/";
+
+ @Test
+ public void testDynamicPortWithDependsOn() throws IOException {
+ testTranslationWithInit(BASE_DIRECTORY + "dynamicPortsWithDependsOn");
+ }
+
+ @Test
+ public void testDependsOnFromNovaToNestedPort() throws IOException {
+ testTranslationWithInit(BASE_DIRECTORY + "dependsOnFromNovaToNestedPort");
+ }
+
+ @Test
+ public void testDependsOnFromPortToNested() throws IOException {
+ testTranslationWithInit(BASE_DIRECTORY + "dependsOnFromPortToNested");
+ }
+
+ @Test
+ public void testDependsOnFromVfcToNested() throws IOException {
+ testTranslationWithInit(BASE_DIRECTORY + "dependsOnFromVfcToNested");
+ }
+
+ @Test
+ public void testDependsOnFromNestedToNested() throws IOException {
+ testTranslationWithInit(BASE_DIRECTORY + "dependsOnFromNestedToNested");
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionMixPatternFullTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionMixPatternFullTest.java
index 9399b91ce1..d256753b90 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionMixPatternFullTest.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionMixPatternFullTest.java
@@ -1,59 +1,34 @@
package org.openecomp.sdc.translator.services.heattotosca.impl.fulltest;
-import org.junit.Assert;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.openecomp.sdc.common.errors.CoreException;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseFullTranslationTest;
import java.io.IOException;
public class UnifiedCompositionMixPatternFullTest extends BaseFullTranslationTest {
- private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName());
-
- @Override
- @Before
- public void setUp() throws IOException {
- // do not delete this function. it prevents the superclass setup from running
- }
+ private static final String BASE_DIRECTORY = "/mock/services/heattotosca/fulltest/mixPatterns/";
@Rule
public ExpectedException exception = ExpectedException.none();
@Test
public void testMixPatterns() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/mixPatterns/oneAppearancePerPattern/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/mixPatterns/oneAppearancePerPattern/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "oneAppearancePerPattern");
}
@Test
public void testMixPatternsWithConnectivityBetweenPatterns() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/mixPatterns/connectivityBetweenPatterns/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/mixPatterns/connectivityBetweenPatterns/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "connectivityBetweenPatterns");
}
@Test
public void testMixPatternsWithConnectivityAndMoreThanOneOccurenceForEachPattern()
throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/mixPatterns/twoAppearancePerPatternWithConnectivities/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/mixPatterns/twoAppearancePerPatternWithConnectivities/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "twoAppearancePerPatternWithConnectivities");
}
@Test
@@ -62,19 +37,12 @@ public class UnifiedCompositionMixPatternFullTest extends BaseFullTranslationTes
exception.expectMessage("Resource with id lb_0_int_oam_int_0_port occurs more " +
"than once in different addOn files");
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/mixPatterns/duplicateResourceIdsInDiffAddOnFiles/in";
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "duplicateResourceIdsInDiffAddOnFiles");
}
@Test
public void testMixPatternsWithDependencyConnectivity() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/mixPatterns/dependencyConnectivity/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/mixPatterns/dependencyConnectivity/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "dependencyConnectivity");
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionNestedPatternsFullTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionNestedPatternsFullTest.java
index c9ef8433d9..eeaf758634 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionNestedPatternsFullTest.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionNestedPatternsFullTest.java
@@ -1,6 +1,5 @@
package org.openecomp.sdc.translator.services.heattotosca.impl.fulltest;
-import org.junit.Before;
import org.junit.Test;
import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseFullTranslationTest;
@@ -8,84 +7,45 @@ import java.io.IOException;
public class UnifiedCompositionNestedPatternsFullTest extends BaseFullTranslationTest {
- @Override
- @Before
- public void setUp() throws IOException {
- // do not delete this function. it prevents the superclass setup from running
- }
+ private static final String BASE_DIRECTORY = "/mock/services/heattotosca/fulltest/nestedOtherScenarios/";
@Test
public void testNestedWithOneLevelMultipleComputesSingleSubstitution() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedSingleSubstitution1B/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedSingleSubstitution1B/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "oneLevel/nestedSingleSubstitution1B");
}
@Test
public void testNestedWithOneLevelMultipleComputesScalingInstance() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedScalingInstance/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedScalingInstance/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "oneLevel/nestedScalingInstance");
}
@Test
public void testNestedWithOneLevelMultipleComputesCatalogInstance() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedCatalogInstance/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedCatalogInstance/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "oneLevel/nestedCatalogInstance");
}
@Test
public void testNestedWithOneLevelAllNonNestedPatterns() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedAllNonNestedPatterns/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedAllNonNestedPatterns/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "oneLevel/nestedAllNonNestedPatterns");
}
@Test
public void testNestedWithOneLevelNoCompute() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedNoCompute/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedNoCompute/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "oneLevel/nestedNoCompute");
}
@Test
public void testNestedWithOneLevelOtherPatternsNoComputeWithConnectivity() throws IOException {
//One nested resource with no Compute, one nested resource having all non nested patterns
// with connectivity between themo
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedAllPatternsConnectivity/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedAllPatternsConnectivity/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "oneLevel/nestedAllPatternsConnectivity");
}
@Test
public void testNestedWithOneLevelTwoSameFileOneOtherAllPattern1B() throws IOException {
// Heat file with 3 nested resources, while 2 point to the same nested heat file, and all
// nested heat file including pattern 1B.
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedTwoSameFileOneDiff/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedTwoSameFileOneDiff/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "oneLevel/nestedTwoSameFileOneDiff");
}
@Test
@@ -93,12 +53,7 @@ public class UnifiedCompositionNestedPatternsFullTest extends BaseFullTranslatio
IOException {
// Heat file with 3 nested resources, while 2 point to the same nested heat file, and all
// nested heat file including pattern 1B. + conectivity between all nested resources
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedTwoSameOneDiffWithConnectivity/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedTwoSameOneDiffWithConnectivity/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "oneLevel/nestedTwoSameOneDiffWithConnectivity");
}
//**************** NESTED MULTI-LEVEL TESTS ******************************
@@ -110,12 +65,7 @@ public class UnifiedCompositionNestedPatternsFullTest extends BaseFullTranslatio
// nested levels, network which will be connected from port in ALL nested level.
//nested heat level 1 - 1 nested resource + pattern 1B
//nested heat level 2 - 1 nested resource + pattern 1B
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/portSecurityGroupNetPattern1B/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/portSecurityGroupNetPattern1B/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "multiLevel/portSecurityGroupNetPattern1B");
}
@Test
@@ -133,42 +83,22 @@ public class UnifiedCompositionNestedPatternsFullTest extends BaseFullTranslatio
connectivity between them all
*/
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/allPatternsDependsOnConnectivity/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/allPatternsDependsOnConnectivity/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "multiLevel/allPatternsDependsOnConnectivity");
}
@Test
public void testThreeNestedLevelsDiffVmTypePattern1B() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/threeNestedLevelsDiffVmTypePattern1B/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/threeNestedLevelsDiffVmTypePattern1B/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "multiLevel/threeNestedLevelsDiffVmTypePattern1B");
}
@Test
public void testThreeNestedLevelsSameVmTypePattern1B() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/threeNestedLevelsSameVmTypePattern1B/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/threeNestedLevelsSameVmTypePattern1B/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "multiLevel/threeNestedLevelsSameVmTypePattern1B");
}
@Test
public void testTwoNestedLevelsWithAllPatternsAndConnectionsBetweenThem() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/twoNestedLevelsWithAllPatternsAndConnectivities/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/twoNestedLevelsWithAllPatternsAndConnectivities/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "multiLevel/twoNestedLevelsWithAllPatternsAndConnectivities");
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionNestedSingleComputeFullTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionNestedSingleComputeFullTest.java
index a0ef039100..e270765452 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionNestedSingleComputeFullTest.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionNestedSingleComputeFullTest.java
@@ -1,6 +1,5 @@
package org.openecomp.sdc.translator.services.heattotosca.impl.fulltest;
-import org.junit.Before;
import org.junit.Test;
import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseFullTranslationTest;
@@ -8,72 +7,38 @@ import java.io.IOException;
public class UnifiedCompositionNestedSingleComputeFullTest extends BaseFullTranslationTest {
- @Override
- @Before
- public void setUp() throws IOException {
- // do not delete this function. it prevents the superclass setup from running
- }
+ private static final String BASE_DIRECTORY = "/mock/services/heattotosca/fulltest/nestedSingleCompute/";
@Test
public void testNestedWithOneCompute() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedWithOneCompute/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedWithOneCompute/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "nestedWithOneCompute");
}
@Test
public void testNestedWithOneComputeSamePortType() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedWithOneComputeDiffPortType/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedWithOneComputeDiffPortType/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "nestedWithOneComputeDiffPortType");
}
@Test
public void testOneNestedWithTwoComputesOfSameType() throws IOException {
//Not pattern 4 (Complex VFC)
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedWithTwoComputesOfSameType/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedWithTwoComputesOfSameType/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "nestedWithTwoComputesOfSameType");
}
@Test
public void testOneNestedWithTwoDiffComputeTypes() throws IOException {
//Not pattern 4 (Complex VFC)
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedWithTwoDiffComputeTypes/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedWithTwoDiffComputeTypes/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "nestedWithTwoDiffComputeTypes");
}
@Test
public void testTwoNestedNodeTemplatesOfSameType() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/twoNestedNodeTemplatesWithSameComputeType/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/twoNestedNodeTemplatesWithSameComputeType/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "twoNestedNodeTemplatesWithSameComputeType");
}
@Test
public void testTwoDiffNestedFilesWithSameComputeType() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/diffNestedFilesWithSameComputeType/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/diffNestedFilesWithSameComputeType/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "diffNestedFilesWithSameComputeType");
}
@Test
@@ -88,12 +53,7 @@ public class UnifiedCompositionNestedSingleComputeFullTest extends BaseFullTrans
f. Security Rule to Port nested connection
g. Security Rule to Port nested shared connection
*/
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedNodesConnectedIn/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedNodesConnectedIn/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "nestedNodesConnectedIn");
}
@Test
@@ -108,12 +68,7 @@ public class UnifiedCompositionNestedSingleComputeFullTest extends BaseFullTrans
f. Get attribute in a non-consolidation entity resource from a nested compute resource
g. Get attribute in a non-consolidation entity resource from a non-nested compute resource
*/
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedNodesGetAttrIn/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedNodesGetAttrIn/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "nestedNodesGetAttrIn");
}
@Test
@@ -126,62 +81,32 @@ public class UnifiedCompositionNestedSingleComputeFullTest extends BaseFullTrans
d. From a non-nested consolidation entity resource
e. From a regular non-consolidation entity resource
*/
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedOutputParamGetAttrIn/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedOutputParamGetAttrIn/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "nestedOutputParamGetAttrIn");
}
@Test
public void testMultiLevelNestedComposition() throws IOException {
//Not pattern 4 (Multi level Complex VFC)
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedMultiLevels/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/nestedMultiLevels/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "nestedMultiLevels");
}
@Test
public void testThreeNestedSameTypeTwoPointingToSameNestedFile() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/threeNestedSameTypeTwoPointingOnSameNestedFile/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/threeNestedSameTypeTwoPointingOnSameNestedFile/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "threeNestedSameTypeTwoPointingOnSameNestedFile");
}
@Test
public void testThreeNestedSameTypePointingToDiffFiles() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/threeNestedPointingToThreeDiffNestedFilesSameComputeType/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/threeNestedPointingToThreeDiffNestedFilesSameComputeType/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "threeNestedPointingToThreeDiffNestedFilesSameComputeType");
}
@Test
public void testMultipleReferencesToSameNestedFilesWithSameComputeType() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/multipleReferencesToSameNestedFilesWithSameComputeType/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/multipleReferencesToSameNestedFilesWithSameComputeType/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "multipleReferencesToSameNestedFilesWithSameComputeType");
}
@Test
public void testDuplicateReq() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/duplicateReqs/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/nestedSingleCompute/duplicateReqs/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "duplicateReqs");
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionScalingInstancesFullTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionScalingInstancesFullTest.java
index ddff4ee477..74eacd9481 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionScalingInstancesFullTest.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionScalingInstancesFullTest.java
@@ -1,90 +1,50 @@
package org.openecomp.sdc.translator.services.heattotosca.impl.fulltest;
-import org.junit.Before;
import org.junit.Test;
import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseFullTranslationTest;
-
import java.io.IOException;
public class UnifiedCompositionScalingInstancesFullTest extends BaseFullTranslationTest {
- @Override
- @Before
- public void setUp() throws IOException {
- // do not delete this function. it prevents the superclass setup from running
- }
+ private static final String BASE_DIRECTORY = "/mock/services/heattotosca/fulltest/scalingInstances/";
@Test
public void testComputesSameTypeWithOnePortEach() throws IOException {
//1. Scenario #1 - Compute type 1 – 2 nova, each one with 1 port
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/scalingInstances/oneComputeTypeOnePort/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/scalingInstances/oneComputeTypeOnePort/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "oneComputeTypeOnePort");
}
@Test
public void testComputesTypesTwoComputesEachWithOnePort() throws IOException {
//2. Scenario #2 - 2 compute types, each type has 2 computes with one port per compute
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/scalingInstances/twoComputeTypesOnePort/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/scalingInstances/twoComputeTypesOnePort/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "twoComputeTypesOnePort");
}
@Test
public void testComputesTypesTwoComputesEachWithOnePortWithGetAttr() throws IOException {
//3. Scenario #2 + between the 2 nova which has diff types there is getAttr
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/scalingInstances/twoComputeTypesOnePortWithGetAttr/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/scalingInstances/twoComputeTypesOnePortWithGetAttr/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "twoComputeTypesOnePortWithGetAttr");
}
@Test
public void testComputesSameTypeWithOnePortOneGroupEach() throws IOException {
//4. Scenario #1 + group – NovaServerGroup, connected to both nova
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/scalingInstances/oneComputeTypeOnePortOneGroup/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/scalingInstances/oneComputeTypeOnePortOneGroup/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "oneComputeTypeOnePortOneGroup");
}
@Test
public void testComputesSameTypeWithOnePortEachAndNodesConnectedIn() throws IOException {
//5. Scenario #1 + node connected In – security Rule point to both port + “resource” with
// dependency (depends_on) to both computes
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/scalingInstances" +
- "/oneComputeTypeOnePortNodeConnectedIn/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/scalingInstances" +
- "/oneComputeTypeOnePortNodeConnectedIn/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "oneComputeTypeOnePortNodeConnectedIn");
}
@Test
public void testComputesSameTypeWithOnePortEachAndNodesConnectedOut() throws IOException {
//6. Scenario#1 + node connected Out – both port connected to same network + each compute
// connected to same volume
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/scalingInstances" +
- "/oneComputeTypeOnePortNodeConnectedOut/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/scalingInstances" +
- "/oneComputeTypeOnePortNodeConnectedOut/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "oneComputeTypeOnePortNodeConnectedOut");
}
@Test
@@ -95,15 +55,7 @@ public class UnifiedCompositionScalingInstancesFullTest extends BaseFullTranslat
b. Property with getAttr from Compute2
c. Property with getAttr from port
*/
-
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/scalingInstances" +
- "/oneComputeTypeOnePortGetAttrIn/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/scalingInstances" +
- "/oneComputeTypeOnePortGetAttrIn/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "oneComputeTypeOnePortGetAttrIn");
}
@Test
@@ -114,15 +66,7 @@ public class UnifiedCompositionScalingInstancesFullTest extends BaseFullTranslat
b. Compute2 with property2, that include getAttr from network
c. Port with property, that include getAttr from network
*/
-
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/scalingInstances" +
- "/oneComputeTypeOnePortGetAttrOut/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/scalingInstances" +
- "/oneComputeTypeOnePortGetAttrOut/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "oneComputeTypeOnePortGetAttrOut");
}
@@ -134,15 +78,7 @@ public class UnifiedCompositionScalingInstancesFullTest extends BaseFullTranslat
b. Output param with getAttr from Compute2
c. Output param with getAttr from Port
*/
-
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/scalingInstances" +
- "/oneComputeTypeOnePortOutputParamGetAttrIn/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/scalingInstances" +
- "/oneComputeTypeOnePortOutputParamGetAttrIn/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "oneComputeTypeOnePortOutputParamGetAttrIn");
}
@Test
@@ -155,15 +91,7 @@ public class UnifiedCompositionScalingInstancesFullTest extends BaseFullTranslat
c. Port1 with property, that include getAttr from compute1
d. Port2 with property, that include getAttr from compute2
*/
-
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/scalingInstances" +
- "/oneComputeTypeOnePortGetAttrOutComputePort/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/scalingInstances" +
- "/oneComputeTypeOnePortGetAttrOutComputePort/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "oneComputeTypeOnePortGetAttrOutComputePort");
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionSingleSubstitutionFullTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionSingleSubstitutionFullTest.java
index 1332814329..43199903e6 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionSingleSubstitutionFullTest.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/fulltest/UnifiedCompositionSingleSubstitutionFullTest.java
@@ -1,6 +1,5 @@
package org.openecomp.sdc.translator.services.heattotosca.impl.fulltest;
-import org.junit.Before;
import org.junit.Test;
import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseFullTranslationTest;
@@ -8,110 +7,71 @@ import java.io.IOException;
public class UnifiedCompositionSingleSubstitutionFullTest extends BaseFullTranslationTest {
- @Override
- @Before
- public void setUp() throws IOException {
- // do not delete this function. it prevents the superclass setup from running
- }
+ private static final String BASE_DIRECTORY = "/mock/services/heattotosca/fulltest/singleSubstitution/";
@Test
public void testComputeWithTwoDifferentPortTypes() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/computeWithDiffPortType/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/computeWithDiffPortType/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "computeWithDiffPortType");
}
@Test
public void testComputeWithTwoSamePortTypes() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/computewithtwosameporttypes/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/computewithtwosameporttypes/out";
+ testTranslationWithInit(BASE_DIRECTORY + "computewithtwosameporttypes");
+ }
- testTranslationWithInit();
+ @Test
+ public void testComputeWithTwoSamePortTypes2() throws IOException {
+ testTranslationWithInit(BASE_DIRECTORY + "computewithtwosameporttypes2");
}
@Test
- public void testComputeWithTwoDifferentPortTypesAndNested() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/computewithtwodiffporttypesandnested/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/computewithtwodiffporttypesandnested/out";
+ public void testComputeWithTwoSamePortTypes3() throws IOException {
+ testTranslationWithInit(BASE_DIRECTORY + "computewithtwosameporttypes3");
+ }
- testTranslationWithInit();
+ @Test
+ public void testComputeWithTwoSamePortTypes4() throws IOException {
+ testTranslationWithInit(BASE_DIRECTORY + "computewithtwosameporttypes4");
}
@Test
- public void testComputeWithTwoDifferentPortAndServerGroup() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/computeWithDiffPortTypeAndServerGroup/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/computeWithDiffPortTypeAndServerGroup/out";
+ public void testComputeWithTwoDifferentPortTypesAndNested() throws IOException {
+ testTranslationWithInit(BASE_DIRECTORY + "computewithtwodiffporttypesandnested");
+ }
- testTranslationWithInit();
+ @Test
+ public void testComputeWithTwoDifferentPortAndServerGroup() throws IOException {
+ testTranslationWithInit(BASE_DIRECTORY + "computeWithDiffPortTypeAndServerGroup");
}
@Test
public void testComputeWithTwoPortsDiffTypeAndNodeConnectedIn() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/computeWithDiffPortTypeNodeConnectedIn/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/computeWithDiffPortTypeNodeConnectedIn/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "computeWithDiffPortTypeNodeConnectedIn");
}
@Test
public void testComputeWithTwoPortsSameTypeAndNodeConnectedIn() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/computeWithSamePortTypeNodeConnectedIn/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/computeWithSamePortTypeNodeConnectedIn/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "computeWithSamePortTypeNodeConnectedIn");
}
@Test
public void testComputeWithTwoPortsDiffTypeAndNodeConnectedOut() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/computeWithDiffPortTypeNodeConnectedOut/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/computeWithDiffPortTypeNodeConnectedOut/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "computeWithDiffPortTypeNodeConnectedOut");
}
@Test
public void testComputeWithTwoPortsSameTypeAndNodeConnectedOut() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/computeWithSamePortTypeNodeConnectedOut/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/computeWithSamePortTypeNodeConnectedOut/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "computeWithSamePortTypeNodeConnectedOut");
}
@Test
public void testComputeWithTwoDifferentPortTypesAndOutParamGetAttIn() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/diffPortTypeAndOutParamGetAttrIn/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/diffPortTypeAndOutParamGetAttrIn/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "diffPortTypeAndOutParamGetAttrIn");
}
@Test
public void testComputeWithTwoSamePortTypesAndOutParamGetAttIn() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/samePortTypeAndOutParamGetAttrIn/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/samePortTypeAndOutParamGetAttrIn/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "samePortTypeAndOutParamGetAttrIn");
}
// @Test
@@ -126,112 +86,56 @@ public class UnifiedCompositionSingleSubstitutionFullTest extends BaseFullTransl
@Test
public void testTwoSetsOfSingle() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/twoSetsOfSingle/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/twoSetsOfSingle/out";
-
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "twoSetsOfSingle");
}
@Test
public void testTwoSetsOfSingleWithGetAttrBetweenThem() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/twoComputesWithGetAttrBetweenThem/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/twoComputesWithGetAttrBetweenThem/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "twoComputesWithGetAttrBetweenThem");
}
@Test
public void testOneComputeTwoDiffPortsAndGetAttrIn() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/oneComputeDiffPortTypesAndGetAttIn/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/oneComputeDiffPortTypesAndGetAttIn/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "oneComputeDiffPortTypesAndGetAttIn");
}
@Test
public void testOneComputeTwoSimilarPortsAndGetAttrIn() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/oneComputeSamePortsAndGetAttrIn/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/oneComputeSamePortsAndGetAttrIn/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "oneComputeSamePortsAndGetAttrIn");
}
@Test
public void testOneComputeTwoDiffPortsAndGetAttrOut() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/oneComputeDiffPortTypesAndGetAttOut/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/oneComputeDiffPortTypesAndGetAttOut/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "oneComputeDiffPortTypesAndGetAttOut");
}
@Test
public void testOneComputeTwoSimilarPortsAndGetAttrOut() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/oneComputeSamePortTypesAndGetAttOut/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/oneComputeSamePortTypesAndGetAttOut/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "oneComputeSamePortTypesAndGetAttOut");
}
@Test
public void testThreeNovaSameTypeNoConsolidation() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/threeSameComputesNoConsolidation/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/threeSameComputesNoConsolidation/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "threeSameComputesNoConsolidation");
}
@Test
public void testThreeNovaDiffTypeWithPorts() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/threeDiffComputesWithPorts/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/threeDiffComputesWithPorts/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "threeDiffComputesWithPorts");
}
@Test
public void testThreeNovaDiffTypeWithAllConnectivities() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/threeDiffComputesWithAllConnectivities/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/threeDiffComputesWithAllConnectivities/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "threeDiffComputesWithAllConnectivities");
}
@Test
public void testThreeNovaSameTypeWithGetAttrOutFromPort() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/threeNovaSameTypeWithGetAttrFromPort/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/threeNovaSameTypeWithGetAttrFromPort/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "threeNovaSameTypeWithGetAttrFromPort");
}
@Test
public void testInputOutputParameterTypes() throws IOException {
- inputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/inputOutputParamType/in";
- outputFilesPath =
- "/mock/services/heattotosca/fulltest/singleSubstitution/inputOutputParamType/out";
-
- testTranslationWithInit();
+ testTranslationWithInit(BASE_DIRECTORY + "inputOutputParamType");
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java
index d35b7dcec4..59dea8afb9 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java
@@ -20,11 +20,8 @@
package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation;
-import static org.junit.Assert.assertEquals;
-
import org.apache.commons.collections4.MapUtils;
import org.junit.Assert;
-import org.junit.Before;
import org.openecomp.core.translator.api.HeatToToscaTranslator;
import org.openecomp.core.translator.datatypes.TranslatorOutput;
import org.openecomp.core.translator.factory.HeatToToscaTranslatorFactory;
@@ -42,7 +39,6 @@ import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import org.openecomp.sdc.tosca.services.ToscaFileOutputService;
import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl;
import org.openecomp.sdc.translator.TestUtils;
-import org.openecomp.sdc.translator.datatypes.heattotosca.TranslationContext;
import java.io.BufferedInputStream;
import java.io.File;
@@ -58,47 +54,29 @@ import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
+import static org.junit.Assert.assertEquals;
-public class BaseFullTranslationTest {
-
- protected String inputFilesPath;
- protected String outputFilesPath;
- protected TranslationContext translationContext;
-
- private String zipFilename = "VSP.zip";
- private HeatToToscaTranslator heatToToscaTranslator;
- private File translatedZipFile;
-
- private Map<String, byte[]> expectedResultMap = new HashMap<>();
- private Set<String> expectedResultFileNameSet = new HashSet<>();
-
- @Before
- public void setUp() throws IOException {
- initTranslatorAndTranslate();
- }
- protected void testTranslationWithInit (String inputFilesPath,
- String outputFilesPath) throws IOException {
- this.inputFilesPath = inputFilesPath;
- this.outputFilesPath = outputFilesPath;
+public class BaseFullTranslationTest {
- testTranslationWithInit();
- }
+ public static final String IN_POSTFIX = "/in";
+ public static final String OUT_POSTFIX = "/out";
- protected void testTranslationWithInit() throws IOException {
- initTranslatorAndTranslate();
- testTranslation();
+ protected void testTranslationWithInit(String path) throws IOException {
+ File translatedZipFile = initTranslatorAndTranslate(path);
+ testTranslation(path, translatedZipFile);
}
- protected void initTranslatorAndTranslate() throws IOException {
- heatToToscaTranslator = HeatToToscaTranslatorFactory.getInstance().createInterface();
- translatedZipFile = translateZipFile();
+ protected File initTranslatorAndTranslate(String path) throws IOException {
+ HeatToToscaTranslator heatToToscaTranslator = HeatToToscaTranslatorFactory.getInstance().createInterface();
+ return translateZipFile(path, heatToToscaTranslator);
}
- protected void testTranslation() throws IOException {
+ protected void testTranslation(String basePath, File translatedZipFile) throws IOException {
- URL url = BaseFullTranslationTest.class.getResource(outputFilesPath);
- expectedResultFileNameSet = new HashSet<>();
+ URL url = BaseFullTranslationTest.class.getResource(basePath + OUT_POSTFIX);
+ Set<String> expectedResultFileNameSet = new HashSet<>();
+ Map<String, byte[]> expectedResultMap = new HashMap<>();
String path = url.getPath();
File pathFile = new File(path);
@@ -137,8 +115,8 @@ public class BaseFullTranslationTest {
assertEquals(0, expectedResultFileNameSet.size());
}
- private File translateZipFile() throws IOException {
- URL inputFilesUrl = this.getClass().getResource(inputFilesPath);
+ private File translateZipFile(String basePath, HeatToToscaTranslator heatToToscaTranslator) throws IOException {
+ URL inputFilesUrl = this.getClass().getResource(basePath + IN_POSTFIX);
String path = inputFilesUrl.getPath();
TestUtils.addFilesToTranslator(heatToToscaTranslator, path);
TranslatorOutput translatorOutput = heatToToscaTranslator.translate();
@@ -153,7 +131,8 @@ public class BaseFullTranslationTest {
"Error in validation " + getErrorAsString(translatorOutput.getErrorMessages()))
.withId("Validation Error").withCategory(ErrorCategory.APPLICATION).build());
}
- File file = new File(path + "/" + zipFilename);
+
+ File file = new File(path + "/VSP.zip");
file.createNewFile();
try (FileOutputStream fos = new FileOutputStream(file)) {