diff options
author | Michael Lando <ml636r@att.com> | 2017-11-01 13:36:30 +0200 |
---|---|---|
committer | Michael Lando <ml636r@att.com> | 2017-11-01 13:36:30 +0200 |
commit | 389c8ca07065e4e66c70ca33b10caf80ba608895 (patch) | |
tree | 73281b0b53a8bfa4ea2112a597075de243c9c888 | |
parent | e7675bd27de1f5fd047f53170c90ebcd71cde34e (diff) |
revert changesv1.1.321.0.0-ONAP1.0.0-Amsterdam
Change-Id: I7dc4f081ed609c5becf0145532bb833d540bd41f
Issue-Id: SDC-569
Signed-off-by: Michael Lando <ml636r@att.com>
-rw-r--r-- | pom.xml | 14 | ||||
-rw-r--r-- | src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcToscaParserFactory.java | 18 | ||||
-rw-r--r-- | src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java | 38 | ||||
-rw-r--r-- | src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java | 162 | ||||
-rw-r--r-- | src/test/resources/csars/service-resolve-get-input-csar.csar | bin | 49461 -> 0 bytes | |||
-rw-r--r-- | src/test/resources/csars/service-resolve-get-input-csar_QA.csar | bin | 49407 -> 0 bytes | |||
-rw-r--r-- | version.properties | 2 |
7 files changed, 38 insertions, 196 deletions
@@ -7,7 +7,7 @@ <artifactId>sdc-tosca</artifactId>
<name>sdc-sdc-tosca</name>
<description>SDC Tosca Parser JAR file for use by consumers</description>
- <version>1.1.34-SNAPSHOT</version>
+ <version>1.1.32-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
@@ -97,7 +97,7 @@ <dependency>
<groupId>org.openecomp.sdc.jtosca</groupId>
<artifactId>jtosca</artifactId>
- <version>1.1.3-SNAPSHOT</version>
+ <version>1.1.1</version>
</dependency>
@@ -116,13 +116,6 @@ <scope>test</scope>
</dependency>
- <!--<dependency> -->
- <!--<groupId>junit</groupId> -->
- <!--<artifactId>junit</artifactId> -->
- <!--<version>4.12</version> -->
- <!--<scope>test</scope> -->
- <!--</dependency> -->
-
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
@@ -137,9 +130,6 @@ <scope>test</scope>
</dependency>
- <!-- <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId>
- <version>1.1.2</version> <scope>test</scope> </dependency> -->
-
</dependencies>
<reporting>
diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcToscaParserFactory.java b/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcToscaParserFactory.java index 868b84f..2ddde1f 100644 --- a/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcToscaParserFactory.java +++ b/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcToscaParserFactory.java @@ -44,26 +44,10 @@ public class SdcToscaParserFactory { * @throws SdcToscaParserException - in case the path or CSAR are invalid.
*/
public ISdcCsarHelper getSdcCsarHelper(String csarPath) throws SdcToscaParserException {
- return init(csarPath, true);
- }
-
- /**
- * Get an ISdcCsarHelper object for this CSAR file.
- *
- * @param csarPath - the absolute path to CSAR file.
- * @param resolveGetInput - resolve get_input properties
- * @return ISdcCsarHelper object.
- * @throws SdcToscaParserException - in case the path or CSAR are invalid.
- */
- public ISdcCsarHelper getSdcCsarHelper(String csarPath, boolean resolveGetInput) throws SdcToscaParserException {
- return init(csarPath, resolveGetInput);
- }
-
- private ISdcCsarHelper init(String csarPath, boolean resolveGetInput) throws SdcToscaParserException {
synchronized (SdcToscaParserFactory.class) {
ToscaTemplate tosca = null;
try {
- tosca = new ToscaTemplate(csarPath, null, true, null, resolveGetInput);
+ tosca = new ToscaTemplate(csarPath, null, true, null);
} catch (JToscaException e) {
throwSdcToscaParserException(e);
}
diff --git a/src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java b/src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java index 4c1f84e..2789a93 100644 --- a/src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java +++ b/src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java @@ -12,6 +12,7 @@ import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException; import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory; import org.openecomp.sdc.toscaparser.api.common.JToscaException; +import org.openecomp.sdc.toscaparser.api.utils.ThreadLocalsHolder; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; @@ -27,10 +28,8 @@ public abstract class SdcToscaParserBasicTest { static ISdcCsarHelper nfodCsarHlper; static ISdcCsarHelper ipAssignCsarHelper; static ISdcCsarHelper nestedVfcCsarHlper; - static ISdcCsarHelper nfodNEWCsarHlper; - static ISdcCsarHelper resolveGetInputCsar; - static ISdcCsarHelper resolveGetInputCsarFalse; - static ISdcCsarHelper resolveGetInputCsarQA; + static ISdcCsarHelper nfodNEWCsarHlper; + static Map<String, HashMap<String, List<String>>> fdntCsarHelper_Data; @@ -38,18 +37,15 @@ public abstract class SdcToscaParserBasicTest { public static void init() throws SdcToscaParserException, JToscaException, IOException { factory = SdcToscaParserFactory.getInstance(); - fdntCsarHelper = getCsarHelper("csars/service-sunny-flow.csar", false); - rainyCsarHelperMultiVfs = getCsarHelper("csars/service-ServiceFdnt-csar-rainy.csar", false); - rainyCsarHelperSingleVf = getCsarHelper("csars/service-ServiceFdnt-csar.csar", false); - fdntCsarHelperWithInputs = getCsarHelper("csars/service-ServiceFdnt-with-get-input.csar", false); - nfodCsarHlper = getCsarHelper("csars/service-NfodService-csar.csar", false); - ipAssignCsarHelper = getCsarHelper("csars/service-Ipassignservice-csar.csar", false); - nestedVfcCsarHlper = getCsarHelper("csars/service-nested-vfc-csar.csar", false); - nfodNEWCsarHlper = getCsarHelper("csars/service-Nfod2images-csar.csar", false); - resolveGetInputCsar = getCsarHelper("csars/service-resolve-get-input-csar.csar"); - resolveGetInputCsarFalse = getCsarHelper("csars/service-resolve-get-input-csar.csar",false); - resolveGetInputCsarQA = getCsarHelper("csars/service-resolve-get-input-csar_QA.csar"); - + fdntCsarHelper = getCsarHelper("csars/service-sunny-flow.csar"); + rainyCsarHelperMultiVfs = getCsarHelper("csars/service-ServiceFdnt-csar-rainy.csar"); + rainyCsarHelperSingleVf = getCsarHelper("csars/service-ServiceFdnt-csar.csar"); + fdntCsarHelperWithInputs = getCsarHelper("csars/service-ServiceFdnt-with-get-input.csar"); + nfodCsarHlper = getCsarHelper("csars/service-NfodService-csar.csar"); + ipAssignCsarHelper = getCsarHelper("csars/service-Ipassignservice-csar.csar"); + nestedVfcCsarHlper = getCsarHelper("csars/service-nested-vfc-csar.csar"); + nfodNEWCsarHlper = getCsarHelper("csars/service-Nfod2images-csar.csar"); + fdntCsarHelper_Data = new HashMap<String, HashMap<String, List<String>>>(){ { HashMap<String, List<String>> FDNT ; @@ -119,15 +115,7 @@ public abstract class SdcToscaParserBasicTest { ISdcCsarHelper sdcCsarHelper = factory.getSdcCsarHelper(file1.getAbsolutePath()); return sdcCsarHelper; } - - protected static ISdcCsarHelper getCsarHelper(String path, boolean resolveGetInput) throws SdcToscaParserException { - System.out.println("Parsing CSAR "+path+"..."); - String fileStr1 = SdcToscaParserBasicTest.class.getClassLoader().getResource(path).getFile(); - File file1 = new File(fileStr1); - ISdcCsarHelper sdcCsarHelper = factory.getSdcCsarHelper(file1.getAbsolutePath(), resolveGetInput); - return sdcCsarHelper; - } - + @BeforeMethod public void setupTest(Method method) { System.out.println("#### Starting Test " + method.getName() + " ###########"); diff --git a/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java b/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java index 80bf1b9..e71e75c 100644 --- a/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java +++ b/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java @@ -6,7 +6,12 @@ import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; -import java.util.*; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.apache.commons.lang3.tuple.Pair; import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException; @@ -655,7 +660,7 @@ public class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest { assertEquals(0, children.size()); } //endregion - + // added by QA // Get specific VNF properties @Test @@ -663,43 +668,43 @@ public class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest { NodeTemplate vnfConfig = nfodCsarHlper.getVnfConfig("9bb2ef82-f8f6-4391-bc71-db063f15bf57"); assertNotNull(vnfConfig); assertEquals("vnfConfiguration", vnfConfig.getMetaData().getValue("name")); - + String manufacturer_reference_number = nfodCsarHlper.getNodeTemplatePropertyLeafValue(vnfConfig, "allowed_flavors#ATT_part_12345_for_FortiGate-VM00#vendor_info#manufacturer_reference_number"); String num_cpus = nfodCsarHlper.getNodeTemplatePropertyLeafValue(vnfConfig, "allowed_flavors#ATT_part_67890_for_FortiGate-VM01#compute_flavor#num_cpus"); String sp_part_number = nfodCsarHlper.getNodeTemplatePropertyLeafValue(vnfConfig, "allowed_flavors#ATT_part_67890_for_FortiGate-VM01#sp_part_number"); - + assertEquals("FortiGate-VM00",manufacturer_reference_number); assertEquals("10",num_cpus); assertEquals("ATT_part_67890_for_FortiGate-VM01",sp_part_number); } // added by QA - // Check that get vnfconfiguration not return as VFC + // Check that get vnfconfiguration not return as VFC @Test public void testGetVfcTypWithoutVnfCheckNames() { List<NodeTemplate> vfcList = nfodCsarHlper.getVfcListByVf("9bb2ef82-f8f6-4391-bc71-db063f15bf57"); assertNotNull(vfcList); assertEquals(2, vfcList.size()); for (int i = 0; i < vfcList.size(); i++) { - + String Name= vfcList.get(i).getName(); - + assertEquals(false, Name.equals("vFW_VNF_Configuration")); - + } } - + @Test public void testNewGetVnfConfigGetProperties() { NodeTemplate vnfConfig = nfodNEWCsarHlper.getVnfConfig("a6587663-b27f-4e88-8a86-604604302ce6"); assertNotNull(vnfConfig); assertEquals("vnfConfiguration", vnfConfig.getMetaData().getValue("name")); - + //Deployment flavor 1 String manufacturer_reference_number = nfodNEWCsarHlper.getNodeTemplatePropertyLeafValue(vnfConfig, "allowed_flavors#123456#vendor_info#manufacturer_reference_number"); String num_cpus = nfodNEWCsarHlper.getNodeTemplatePropertyLeafValue(vnfConfig, "allowed_flavors#123456#compute_flavor#num_cpus"); String sp_part_number = nfodNEWCsarHlper.getNodeTemplatePropertyLeafValue(vnfConfig, "allowed_flavors#123456#sp_part_number"); - + assertEquals("234567",manufacturer_reference_number); assertEquals("2",num_cpus); assertEquals("123456",sp_part_number); @@ -708,150 +713,25 @@ public class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest { manufacturer_reference_number = nfodNEWCsarHlper.getNodeTemplatePropertyLeafValue(vnfConfig, "allowed_flavors#FG_partNumbereJqQjUkteF1#vendor_info#manufacturer_reference_number"); num_cpus = nfodNEWCsarHlper.getNodeTemplatePropertyLeafValue(vnfConfig, "allowed_flavors#FG_partNumbereJqQjUkteF1#compute_flavor#num_cpus"); sp_part_number = nfodNEWCsarHlper.getNodeTemplatePropertyLeafValue(vnfConfig, "allowed_flavors#FG_partNumbereJqQjUkteF1#sp_part_number"); - + assertEquals("EP_manufacturerReferenceNumberkbAiqZZNzx1",manufacturer_reference_number); assertEquals("1",num_cpus); assertEquals("FG_partNumbereJqQjUkteF1",sp_part_number); } // added by QA - // Check that get vnfconfiguration not return as VFC + // Check that get vnfconfiguration not return as VFC @Test public void testNewGetVfcTypWithoutVnfCheckNames() { List<NodeTemplate> vfcList = nfodNEWCsarHlper.getVfcListByVf("a6587663-b27f-4e88-8a86-604604302ce6"); assertNotNull(vfcList); assertEquals(1, vfcList.size()); for (int i = 0; i < vfcList.size(); i++) { - + String Name= vfcList.get(i).getName(); - + assertEquals(false, Name.equals("name_6GkVrOjnGp1_VNF_Configuration")); } } - - //region resolve get_input - @Test - public void testResolveGetInputForComplexTypeAndList() { - //port_pd01_port_ip_requirements is of type list<org.openecomp.datatypes.network.IpRequirements> - //This test covers: - // 1) "default" resolving - // 2) complex type resolving - // 3) List access resolving - List<NodeTemplate> vfcs = resolveGetInputCsar.getVfcListByVf("b5190df2-7880-4d6f-836f-56ab17e1b85b"); - Object propertyAsObject = resolveGetInputCsar.getNodeTemplatePropertyAsObject(vfcs.get(0), "port_pd01_port_ip_requirements"); - assertTrue(propertyAsObject instanceof ArrayList); - assertEquals(2, ((ArrayList) propertyAsObject).size()); - //port_pd01_port_ip_requirements: - //- get_input: [ip_requirements, 0] - //- get_input: [ip_requirements, 1] - assertEquals("subnet_role_4", ((Map) ((ArrayList) propertyAsObject).get(0)).get("subnet_role")); - assertEquals("subnet_role_6", ((Map) ((ArrayList) propertyAsObject).get(1)).get("subnet_role")); - } - - @Test - public void testResolveGetInputForPrimitiveTypeString() { - //This test covers "default" resolving of primitive - as Object - List<NodeTemplate> vfcs = resolveGetInputCsar.getVfcListByVf("b5190df2-7880-4d6f-836f-56ab17e1b85b"); - Object propertyAsObject = resolveGetInputCsar.getNodeTemplatePropertyAsObject(vfcs.get(0), "port_pd01_port_network_role_tag"); - assertEquals("oam", propertyAsObject); - } - - @Test - public void testResolveGetInputForPrimitiveTypeInteger() { - //This test covers "default" resolving of primitive - as String - List<NodeTemplate> vfcs = resolveGetInputCsar.getVfcListByVf("b5190df2-7880-4d6f-836f-56ab17e1b85b"); - String propertyAsObject = resolveGetInputCsar.getNodeTemplatePropertyLeafValue(vfcs.get(0), "port_pd01_port_order"); - assertEquals("1", propertyAsObject); - } - - @Test - public void testResolveGetInputForMap() { - //This test covers "default" resolving of primitive - as Map - List<NodeTemplate> vfcs = resolveGetInputCsar.getVfcListByVf("b5190df2-7880-4d6f-836f-56ab17e1b85b"); - Object propertyAsObject = resolveGetInputCsar.getNodeTemplatePropertyAsObject(vfcs.get(0), "port_pd02_port_ip_requirements#ip_count_required"); - assertTrue(propertyAsObject instanceof Map); - assertEquals(false, ((Map)propertyAsObject).get("is_required")); - } - - @Test - public void testResolveGetInputForAllHierarchy() { - //This test covers "default" resolving from service level - List<NodeTemplate> vfs = resolveGetInputCsar.getServiceVfList(); - Object vfPropertyAsObject = resolveGetInputCsar.getNodeTemplatePropertyAsObject(vfs.get(0), "vm_count"); - assertEquals(2, vfPropertyAsObject); - //This test covers property assignment resolving on VFI level (service template), from Vf level - List<NodeTemplate> vfcs = resolveGetInputCsar.getNodeTemplateBySdcType(vfs.get(0), SdcTypes.VFC); - Object vfcPropertyAsObject = resolveGetInputCsar.getNodeTemplatePropertyAsObject(vfcs.get(0), "my_count"); - assertEquals(2, vfcPropertyAsObject); //takes it from upper level (VF) property - } - - @Test - public void testResolveGetInputNoDefValueInnerLevel() { - //This test covers resolving when no "default" value is supplied to the input - should be null - VF/VFCI level - List<NodeTemplate> vfcs = resolveGetInputCsar.getVfcListByVf("b5190df2-7880-4d6f-836f-56ab17e1b85b"); - String propertyAsObject = resolveGetInputCsar.getNodeTemplatePropertyLeafValue(vfcs.get(0), "index_value"); - assertNull(propertyAsObject); - - } - - @Test - public void testResolveGetInputNoDefValueServiceLevel() { - //This test covers resolving when no "default" value is supplied to the input - should be null - Service/VFI level - List<NodeTemplate> vfs = resolveGetInputCsar.getServiceVfList(); - Object vfPropertyAsObject = resolveGetInputCsar.getNodeTemplatePropertyAsObject(vfs.get(0), "port_order"); - assertNull(vfPropertyAsObject); - - } - //endregion - - // region Added by QA - Continue with testings of resolve get_input - - @Test - public void testResolveGetInputForComplexTypeAndListWithFalseValue() - { - List<NodeTemplate> vfcs = resolveGetInputCsarFalse.getVfcListByVf("b5190df2-7880-4d6f-836f-56ab17e1b85b"); - Object propertyAsObject = resolveGetInputCsarFalse.getNodeTemplatePropertyAsObject(vfcs.get(0), "port_pd01_port_ip_requirements"); - assertTrue(propertyAsObject instanceof ArrayList); - assertEquals(2, ((ArrayList) propertyAsObject).size()); - assertEquals("get_input:[ip_requirements, 0]", ((ArrayList) propertyAsObject).get(0).toString()); - assertEquals("get_input:[ip_requirements, 1]", ((ArrayList) propertyAsObject).get(1).toString()); - } - - @Test - public void testResolveGetInputForPrimitiveTypeStringWithFalseValue() { - List<NodeTemplate> vfcs = resolveGetInputCsarFalse.getVfcListByVf("b5190df2-7880-4d6f-836f-56ab17e1b85b"); - Object propertyAsObject = resolveGetInputCsarFalse.getNodeTemplatePropertyAsObject(vfcs.get(0), "port_pd01_port_network_role_tag"); - assertEquals("get_input:role_tag_oam", propertyAsObject.toString()); - } - - @Test - public void testResolveGetInputForPrimitiveTypeListWithFalseValue() { - List<NodeTemplate> vfcs = resolveGetInputCsarFalse.getVfcListByVf("b5190df2-7880-4d6f-836f-56ab17e1b85b"); - Object propertyAsObject = resolveGetInputCsarFalse.getNodeTemplatePropertyAsObject(vfcs.get(0), "compute_pd_server_name"); - assertEquals("[get_input:[pd_server_names, 0]]", propertyAsObject.toString()); - } - - //@Test // Maybe a bug here.... need to check with Esti - Mait was sent. - public void testResolveGetInputForPrimitiveTypeList() { - List<NodeTemplate> vfcs = resolveGetInputCsar.getVfcListByVf("b5190df2-7880-4d6f-836f-56ab17e1b85b"); - Object propertyAsObject = resolveGetInputCsar.getNodeTemplatePropertyAsObject(vfcs.get(0), "compute_pd_server_name"); - assertEquals("\"ZRDM1MOGX01MPD001\"", propertyAsObject.toString()); - } - - @Test - public void testResolveGetInputForPrimitiveNullValue() { - List<NodeTemplate> vfcs = resolveGetInputCsarQA.getVfcListByVf("b5190df2-7880-4d6f-836f-56ab17e1b85b"); - @SuppressWarnings("unchecked") - List<String>propertyAsObject = (List<String>) resolveGetInputCsarQA.getNodeTemplatePropertyAsObject(vfcs.get(0), "compute_pd_server_availability_zone"); - assertNull(propertyAsObject.get(0)); - } - @Test - public void testResolveGetInputForPrimitiveIPValue() { - List<NodeTemplate> vfcs = resolveGetInputCsarQA.getVfcListByVf("b5190df2-7880-4d6f-836f-56ab17e1b85b"); - Object propertyAsObject = resolveGetInputCsarQA.getNodeTemplatePropertyAsObject(vfcs.get(0), "vm_image_name"); - assertEquals("107.239.36.5", propertyAsObject.toString()); - } - - // endregion Added by QA - Continue with testings of resolve get_input - + } diff --git a/src/test/resources/csars/service-resolve-get-input-csar.csar b/src/test/resources/csars/service-resolve-get-input-csar.csar Binary files differdeleted file mode 100644 index 7c14159..0000000 --- a/src/test/resources/csars/service-resolve-get-input-csar.csar +++ /dev/null diff --git a/src/test/resources/csars/service-resolve-get-input-csar_QA.csar b/src/test/resources/csars/service-resolve-get-input-csar_QA.csar Binary files differdeleted file mode 100644 index d00dcbf..0000000 --- a/src/test/resources/csars/service-resolve-get-input-csar_QA.csar +++ /dev/null diff --git a/version.properties b/version.properties index d579fe6..c1f59ad 100644 --- a/version.properties +++ b/version.properties @@ -5,7 +5,7 @@ major=1 minor=1 -patch=34 +patch=32 base_version=${major}.${minor}.${patch} |