diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-translator-lib')
3 files changed, 62 insertions, 90 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/TestUtils.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/TestUtils.java index 6ddc2eda43..a0a6d12cb9 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/TestUtils.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/TestUtils.java @@ -1,5 +1,5 @@ /* - * Copyright © 2016-2017 European Support Limited + * Copyright © 2018 European Support Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -12,7 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */ +*/ package org.openecomp.sdc.translator; @@ -23,8 +23,6 @@ import org.junit.Assert; import org.openecomp.core.translator.api.HeatToToscaTranslator; import org.openecomp.core.utilities.file.FileUtils; import org.openecomp.sdc.common.utils.SdcCommon; -import org.openecomp.sdc.logging.api.Logger; -import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; import org.onap.sdc.tosca.datatypes.model.GroupDefinition; import org.onap.sdc.tosca.datatypes.model.NodeTemplate; @@ -52,9 +50,9 @@ import org.openecomp.sdc.translator.services.heattotosca.globaltypes.GlobalTypes import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; +import java.net.URISyntaxException; import java.net.URL; import java.nio.file.NotDirectoryException; import java.util.ArrayList; @@ -70,8 +68,6 @@ public class TestUtils { private static String zipFilename = "VSP.zip"; private static String validationFilename = "validationOutput.json"; - private static Logger logger = (Logger) LoggerFactory.getLogger(TestUtils.class); - private TestUtils() { } @@ -107,11 +103,11 @@ public class TestUtils { * @param baseDirPath base directory for the tosca file * @return Map of <ServiceTemplateFilename, ServiceTemplate> for the files in this directory */ - private static Map<String, ServiceTemplate> getServiceTemplates(String baseDirPath) { + private static Map<String, ServiceTemplate> getServiceTemplates(String baseDirPath) throws URISyntaxException{ Map<String, ServiceTemplate> serviceTemplateMap = new HashMap<>(); ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil(); baseDirPath = "." + baseDirPath + "/"; - try { + String[] fileList = {}; URL filesDirUrl = TestUtils.class.getClassLoader().getResource(baseDirPath); if (filesDirUrl != null && filesDirUrl.getProtocol().equals("file")) { @@ -123,17 +119,12 @@ public class TestUtils { URL resource = TestUtils.class.getClassLoader().getResource(baseDirPath + fileName); ServiceTemplate serviceTemplate = FileUtils.readViaInputStream(resource, - stream -> toscaExtensionYamlUtil.yamlToObject(stream, ServiceTemplate.class)); + stream -> toscaExtensionYamlUtil.yamlToObject(stream, ServiceTemplate.class)); serviceTemplateMap.put(fileName, serviceTemplate); } - } catch (Exception e) { - logger.debug("", e); - Assert.fail(e.getMessage()); - } return serviceTemplateMap; } - /** * Get tosca service template models * @@ -156,9 +147,8 @@ public class TestUtils { public static ToscaServiceModel loadToscaServiceModel(String serviceTemplatesPath, String globalServiceTemplatesPath, String entryDefinitionServiceTemplate) - throws IOException { - ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil(); - Map<String, ServiceTemplate> serviceTemplates = new HashMap<>(); + throws IOException, URISyntaxException { + Map<String, ServiceTemplate> serviceTemplates; if (entryDefinitionServiceTemplate == null) { entryDefinitionServiceTemplate = "MainServiceTemplate.yaml"; } @@ -185,15 +175,6 @@ public class TestUtils { toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class); createConcreteRequirementObjectsInServiceTemplate(serviceTemplateFromYaml, toscaExtensionYamlUtil); - try { - yamlFile.close(); - } catch (IOException ignore) { - logger.debug("", ignore); - } - } catch (FileNotFoundException e) { - throw e; - } catch (IOException e) { - throw e; } } } else { @@ -232,15 +213,6 @@ public class TestUtils { createConcreteRequirementObjectsInServiceTemplate(serviceTemplateFromYaml, toscaExtensionYamlUtil); serviceTemplates.put(file.getName(), serviceTemplateFromYaml); - try { - yamlFile.close(); - } catch (IOException ignore) { - logger.debug("", ignore); - } - } catch (FileNotFoundException e) { - throw e; - } catch (IOException e) { - throw e; } } } @@ -639,8 +611,6 @@ public class TestUtils { nodeTemplateId) { List<String> entityGroups = new ArrayList<>(); Map<String, GroupDefinition> groups = serviceTemplate.getTopology_template().getGroups(); - Map<String, NodeTemplate> nodeTemplates = - serviceTemplate.getTopology_template().getNode_templates(); for (Map.Entry<String, GroupDefinition> entry : groups.entrySet()) { String groupId = entry.getKey(); GroupDefinition groupDefinition = entry.getValue(); diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationServiceTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationServiceTest.java index 521b41f5ae..0a3ba44dba 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationServiceTest.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationServiceTest.java @@ -45,6 +45,7 @@ import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolida import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.GetAttrFuncData; import java.io.IOException; +import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -77,7 +78,7 @@ public class ConsolidationServiceTest { } @Test - public void testConsolidationValidPreCondition() throws IOException { + public void testConsolidationValidPreCondition() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; @@ -120,7 +121,7 @@ public class ConsolidationServiceTest { } @Test - public void testConsolidationFalsePreConditionOneComputeNode() throws IOException { + public void testConsolidationFalsePreConditionOneComputeNode() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -155,7 +156,7 @@ public class ConsolidationServiceTest { } @Test - public void testConsolidationFalsePreConditionMoreThanOnePortPerType() throws IOException { + public void testConsolidationFalsePreConditionMoreThanOnePortPerType() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -192,7 +193,7 @@ public class ConsolidationServiceTest { @Test public void testConsolidationFalsePreConditionDifferentPortTypesBetweenComputes() - throws IOException { + throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -236,7 +237,7 @@ public class ConsolidationServiceTest { } @Test - public void testConsolidationResultTrueWithMoreThanTwoCompute() throws IOException { + public void testConsolidationResultTrueWithMoreThanTwoCompute() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -284,7 +285,7 @@ public class ConsolidationServiceTest { } @Test - public void testConsolidationResultFalseWithMoreThanTwoComputeOneIsDiff() throws IOException { + public void testConsolidationResultFalseWithMoreThanTwoComputeOneIsDiff() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -334,7 +335,7 @@ public class ConsolidationServiceTest { @Test public void testConsolidationResultFalseForTwoTypesOfComputeWithOneInstanceEach() - throws IOException { + throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName1 = "org.openecomp.resource.vfc.nodes.heat.ps_server"; String computeNodeTypeName2 = "org.openecomp.resource.vfc.nodes.heat.cmaui"; @@ -381,7 +382,7 @@ public class ConsolidationServiceTest { @Test public void testConsolidationValidForTwoSimilarComputeAndFalseForSingleCompute() - throws IOException { + throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName1 = "org.openecomp.resource.vfc.nodes.heat.ps_server"; String computeNodeTypeName2 = "org.openecomp.resource.vfc.nodes.heat.cmaui"; @@ -431,7 +432,7 @@ public class ConsolidationServiceTest { } @Test - public void testValidComputeAndPortConsolidation() throws IOException { + public void testValidComputeAndPortConsolidation() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -478,7 +479,7 @@ public class ConsolidationServiceTest { } @Test - public void testFalseComputeConsolidationForTwoSimilarImageNamesAndOneDiff() throws IOException { + public void testFalseComputeConsolidationForTwoSimilarImageNamesAndOneDiff() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName1 = "org.openecomp.resource.vfc.nodes.heat.ps_server"; String computeNodeTypeName2 = "org.openecomp.resource.vfc.nodes.heat.pd_server"; @@ -547,7 +548,7 @@ public class ConsolidationServiceTest { } @Test - public void testFalseComputeConsolidationOneImageNameMissing() throws IOException { + public void testFalseComputeConsolidationOneImageNameMissing() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.pd_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -594,7 +595,7 @@ public class ConsolidationServiceTest { } @Test - public void testFalseComputeConsolidationForTwoSimilarFlavorNamesAndOneDiff() throws IOException { + public void testFalseComputeConsolidationForTwoSimilarFlavorNamesAndOneDiff() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -638,7 +639,7 @@ public class ConsolidationServiceTest { } @Test - public void testFalsePortConsolidationForOneDiffFixedIpsValue() throws IOException { + public void testFalsePortConsolidationForOneDiffFixedIpsValue() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -686,7 +687,7 @@ public class ConsolidationServiceTest { } @Test - public void testFalsePortConsolidationForTwoPortsWithFixedIpsAndOneWithout() throws IOException { + public void testFalsePortConsolidationForTwoPortsWithFixedIpsAndOneWithout() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -730,7 +731,7 @@ public class ConsolidationServiceTest { @Test public void testFalsePortConsolidationForTwoPortsWithAddressPairsAndOneWithout() - throws IOException { + throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -773,7 +774,7 @@ public class ConsolidationServiceTest { @Test public void testFalsePortConsolidationForTwoPortsWithMacAddressAndOneWithout() - throws IOException { + throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -816,7 +817,7 @@ public class ConsolidationServiceTest { @Test public void testValidPortConsolidationForPortsWithNoneOfTheCheckedProperties() - throws IOException { + throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -871,7 +872,7 @@ public class ConsolidationServiceTest { } @Test - public void testComputeRelationsSimilarBetweenComputeNodes() throws IOException { + public void testComputeRelationsSimilarBetweenComputeNodes() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -939,7 +940,7 @@ public class ConsolidationServiceTest { } @Test - public void testNodesInRelationsDiffBetweenThreeComputes() throws IOException { + public void testNodesInRelationsDiffBetweenThreeComputes() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -994,7 +995,7 @@ public class ConsolidationServiceTest { } @Test - public void testNodesOutRelationsDiffBetweenThreeComputes() throws IOException { + public void testNodesOutRelationsDiffBetweenThreeComputes() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -1049,7 +1050,7 @@ public class ConsolidationServiceTest { } @Test - public void testVolumeRelationsDiffBetweenThreeComputes() throws IOException { + public void testVolumeRelationsDiffBetweenThreeComputes() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -1104,7 +1105,7 @@ public class ConsolidationServiceTest { } @Test - public void testGroupRelationsDiffBetweenThreeComputes() throws IOException { + public void testGroupRelationsDiffBetweenThreeComputes() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -1160,7 +1161,7 @@ public class ConsolidationServiceTest { } @Test - public void testPortConsolidationDataRelationsSimilar() throws IOException { + public void testPortConsolidationDataRelationsSimilar() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -1228,7 +1229,7 @@ public class ConsolidationServiceTest { } @Test - public void testNodesInRelationsDiffBetweenThreePortConsolidationDatas() throws IOException { + public void testNodesInRelationsDiffBetweenThreePortConsolidationDatas() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -1296,7 +1297,7 @@ public class ConsolidationServiceTest { } @Test - public void testNodesOutRelationsDiffBetweenThreePortConsolidationDatas() throws IOException { + public void testNodesOutRelationsDiffBetweenThreePortConsolidationDatas() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -1364,7 +1365,7 @@ public class ConsolidationServiceTest { } @Test - public void testGroupIdsRelationsDiffBetweenThreePortConsolidationDatas() throws IOException { + public void testGroupIdsRelationsDiffBetweenThreePortConsolidationDatas() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -1429,7 +1430,7 @@ public class ConsolidationServiceTest { } @Test - public void testValidConsolidationForComputesWithValidGetAttr() throws IOException { + public void testValidConsolidationForComputesWithValidGetAttr() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -1495,7 +1496,7 @@ public class ConsolidationServiceTest { } @Test - public void testInvalidConsolidationForComputesWithGetAttrForEachOther() throws IOException { + public void testInvalidConsolidationForComputesWithGetAttrForEachOther() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -1561,7 +1562,7 @@ public class ConsolidationServiceTest { } @Test - public void testValidConsolidationForPortsWithValidGetAttr() throws IOException { + public void testValidConsolidationForPortsWithValidGetAttr() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -1638,7 +1639,7 @@ public class ConsolidationServiceTest { } @Test - public void testInvalidConsolidationForPortsWithGetAttrInForEachOther() throws IOException { + public void testInvalidConsolidationForPortsWithGetAttrInForEachOther() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -1717,7 +1718,7 @@ public class ConsolidationServiceTest { @Test public void testValidConsolidationForComputesWithSamePortTypesPointingByGetAttrIn() throws - IOException { + IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -1794,7 +1795,7 @@ public class ConsolidationServiceTest { } @Test - public void testValidGetAttrOutFromComputes() throws IOException { + public void testValidGetAttrOutFromComputes() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -1869,7 +1870,7 @@ public class ConsolidationServiceTest { } @Test - public void testInValidGetAttrOutFromComputesPortTypeDifferent() throws IOException { + public void testInValidGetAttrOutFromComputesPortTypeDifferent() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -1969,7 +1970,7 @@ public class ConsolidationServiceTest { } @Test - public void testValidGetAttrOutFromPorts() throws IOException { + public void testValidGetAttrOutFromPorts() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -2069,7 +2070,7 @@ public class ConsolidationServiceTest { } @Test - public void testInvalidGetAttrOutFromPorts() throws IOException { + public void testInvalidGetAttrOutFromPorts() throws IOException, URISyntaxException { ConsolidationData consolidationData = new ConsolidationData(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -2168,7 +2169,7 @@ public class ConsolidationServiceTest { } @Test - public void testSubstitutionConsolidationPreConditionTrue() throws IOException { + public void testSubstitutionConsolidationPreConditionTrue() throws IOException, URISyntaxException { translationContext = new TranslationContext(); String mainSTName = "MainServiceTemplate.yaml"; String nestedServiceTemplateName = "nested-pcm_v0.1ServiceTemplate.yaml"; @@ -2201,7 +2202,7 @@ public class ConsolidationServiceTest { @Test public void testSubstitutionConsolidationPreConditionFalseMoreThanOneComputeType() - throws IOException { + throws IOException, URISyntaxException { translationContext = new TranslationContext(); String mainSTName = "MainServiceTemplate.yaml"; String nestedServiceTemplateName = "nested-pcm_v0.1ServiceTemplate.yaml"; @@ -2243,7 +2244,7 @@ public class ConsolidationServiceTest { @Test public void testSubstitutionConsolidationPreConditionFalseMoreThanOneComputeOfSameType() - throws IOException { + throws IOException, URISyntaxException { translationContext = new TranslationContext(); String mainSTName = "MainServiceTemplate.yaml"; String nestedServiceTemplateName = "nested-pcm_v0.1ServiceTemplate.yaml"; @@ -2321,7 +2322,7 @@ public class ConsolidationServiceTest { } @Test - public void testConsolidationPreConditionFalseDiffSubportTypes() throws IOException { + public void testConsolidationPreConditionFalseDiffSubportTypes() throws IOException, URISyntaxException { translationContext = new TranslationContext(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -2363,7 +2364,7 @@ public class ConsolidationServiceTest { } @Test - public void testConsolidationPreConditionFalseDiffSubportNumber() throws IOException { + public void testConsolidationPreConditionFalseDiffSubportNumber() throws IOException, URISyntaxException { translationContext = new TranslationContext(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -2391,7 +2392,7 @@ public class ConsolidationServiceTest { } @Test - public void testConsolidationRuleFalseDifferentCountInResourceGroup() throws IOException { + public void testConsolidationRuleFalseDifferentCountInResourceGroup() throws IOException, URISyntaxException { translationContext = new TranslationContext(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -2416,7 +2417,7 @@ public class ConsolidationServiceTest { @Test public void testConsolidationRuleFalseDifferentNodesConnectedInToResourceGroup() - throws IOException { + throws IOException, URISyntaxException { translationContext = new TranslationContext(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -2442,7 +2443,7 @@ public class ConsolidationServiceTest { @Test public void testConsolidationRuleFalseDifferentNodesConnectedOutFromResourceGroup() - throws IOException { + throws IOException, URISyntaxException { translationContext = new TranslationContext(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -2468,7 +2469,7 @@ public class ConsolidationServiceTest { @Test public void testConsolidationRuleFalseGetAttrInBetweenSubInterfacesOfSameType() - throws IOException { + throws IOException, URISyntaxException { translationContext = new TranslationContext(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -2494,7 +2495,7 @@ public class ConsolidationServiceTest { @Test public void testConsolidationRuleFalseGetAttrOutBetweenSubInterfacesOfSameType() - throws IOException { + throws IOException, URISyntaxException { translationContext = new TranslationContext(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -2539,7 +2540,7 @@ public class ConsolidationServiceTest { } @Test - public void testConsolidationRuleFalseDifferentRoleInResourceGroup() throws IOException { + public void testConsolidationRuleFalseDifferentRoleInResourceGroup() throws IOException, URISyntaxException { translationContext = new TranslationContext(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel @@ -2562,7 +2563,7 @@ public class ConsolidationServiceTest { } @Test - public void testConsolidationRuleTrueForSubInterfaces() throws IOException { + public void testConsolidationRuleTrueForSubInterfaces() throws IOException, URISyntaxException { translationContext = new TranslationContext(); String computeNodeTypeName = "org.openecomp.resource.vfc.nodes.heat.ps_server"; ToscaServiceModel toscaServiceModel = TestUtils.loadToscaServiceModel diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/unifiedmodel/commands/SubInterfaceNewNodeTemplateIdGeneratorTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/unifiedmodel/commands/SubInterfaceNewNodeTemplateIdGeneratorTest.java index 97cc35fbae..84311e1ada 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/unifiedmodel/commands/SubInterfaceNewNodeTemplateIdGeneratorTest.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/unifiedmodel/commands/SubInterfaceNewNodeTemplateIdGeneratorTest.java @@ -34,6 +34,7 @@ import org.junit.BeforeClass; import org.junit.Test; import java.io.IOException; +import java.net.URISyntaxException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -57,7 +58,7 @@ public class SubInterfaceNewNodeTemplateIdGeneratorTest { } @Test - public void testGenerateNewSubInterfaceNodeTemplateId() throws IOException { + public void testGenerateNewSubInterfaceNodeTemplateId() throws IOException, URISyntaxException { UnifiedCompositionTo unifiedCompositionTo = new UnifiedCompositionTo(getTestInitSubInterfaceServiceTemplate(), null, getUnifiedCompositionDataListWithOnePortAndSubInterface(), getContext(false), null); Optional<String> @@ -70,7 +71,7 @@ public class SubInterfaceNewNodeTemplateIdGeneratorTest { } @Test - public void testGeneratePortIdMultipleSubInterfacesOfSameTypeToOnePort() throws IOException { + public void testGeneratePortIdMultipleSubInterfacesOfSameTypeToOnePort() throws IOException, URISyntaxException { UnifiedCompositionTo unifiedCompositionTo = new UnifiedCompositionTo(getTestSubInterfaceServiceTemplateMultipleVlan(), null, getUnifiedCompositionDataListWithTwoSubInterfacesOfSameType(), getContext(true), null); @@ -91,7 +92,7 @@ public class SubInterfaceNewNodeTemplateIdGeneratorTest { } @Test - public void testGenerateInvalidOriginalNodeTemplateId() throws IOException { + public void testGenerateInvalidOriginalNodeTemplateId() throws IOException, URISyntaxException { UnifiedCompositionTo unifiedCompositionTo = new UnifiedCompositionTo(getTestInitSubInterfaceServiceTemplate(), null, getUnifiedCompositionDataListWithOnePortAndSubInterface(), getContext(false), null); Optional<String> @@ -100,7 +101,7 @@ public class SubInterfaceNewNodeTemplateIdGeneratorTest { Assert.assertEquals(nodeTemplateId.isPresent(), false); } - private ServiceTemplate getTestInitSubInterfaceServiceTemplate() throws IOException { + private ServiceTemplate getTestInitSubInterfaceServiceTemplate() throws IOException, URISyntaxException { ToscaServiceModel serviceModel = TestUtils.loadToscaServiceModel ("/mock/services/heattotosca/unifiedComposition/commands/newnodetemplateidgenerator/oneportsubinterfacetype", null, null); @@ -108,7 +109,7 @@ public class SubInterfaceNewNodeTemplateIdGeneratorTest { return serviceTemplate.get(); } - private ServiceTemplate getTestSubInterfaceServiceTemplateMultipleVlan() throws IOException { + private ServiceTemplate getTestSubInterfaceServiceTemplateMultipleVlan() throws IOException, URISyntaxException { ToscaServiceModel serviceModel = TestUtils.loadToscaServiceModel ("/mock/services/heattotosca/unifiedComposition/commands/newnodetemplateidgenerator/multiplevlansametype", null, null); |