From 71a1f3d02dea30f2a9c6de646122831ede817bda Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Tue, 10 Oct 2017 18:40:42 +0300 Subject: remove licensing risks Change-Id: I85c69b3ba4f034eeae72894e87d8d90b3b22a533 Issue-Id: SDC-446 Signed-off-by: Michael Lando --- .../sdc/impl/ToscaParserNodeTemplateTest.java | 11 +++- .../sdc/impl/ToscaParserValidationIssueTest.java | 60 +++++++++++++++++++++ .../jtosca-validation-issue-configuration.yaml | 57 ++++++++++++++++++++ .../csars/service-Ipassignservice-csar.csar | Bin 50084 -> 49044 bytes .../resources/csars/service-PortMirroring.csar | Bin 56821 -> 55678 bytes .../service-ServiceForToscaParserTests-csar.csar | Bin 78543 -> 77413 bytes .../resources/csars/service-nested-vfc-csar.csar | Bin 47690 -> 46662 bytes .../csars/service-resolve-get-input-csar.csar | Bin 50501 -> 49461 bytes .../csars/service-resolve-get-input-csar_QA.csar | Bin 50447 -> 50447 bytes 9 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 src/test/java/org/openecomp/sdc/impl/ToscaParserValidationIssueTest.java create mode 100644 src/test/resources/config/jtosca-validation-issue-configuration.yaml (limited to 'src/test') diff --git a/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java b/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java index ad240b1..7cb99e3 100644 --- a/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java +++ b/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java @@ -924,7 +924,16 @@ public class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest { assertEquals("VF_1_V_port_1", vfList.get(0).getMetaData().getValue("name")); } // endregion Added by QA - Continue with testings of resolve get_input - + + + @Test + public void testResolveGetInputArrayStructure() { + List vfcs = resolveGetInputCsarQA.getVfcListByVf("b5190df2-7880-4d6f-836f-56ab17e1b85b"); + Object propertyAsObject = resolveGetInputCsarQA.getNodeTemplatePropertyAsObject(vfcs.get(0), "compute_pd_server_name"); + assertEquals( ((ArrayList)propertyAsObject).get(0).toString(), "\"ZRDM1MOGX01MPD001\""); + propertyAsObject = resolveGetInputCsarQA.getNodeTemplatePropertyAsObject(vfcs.get(0), "port_pd01_port_ip_requirements"); + assertEquals( ((ArrayList)propertyAsObject).get(1), null); + } } diff --git a/src/test/java/org/openecomp/sdc/impl/ToscaParserValidationIssueTest.java b/src/test/java/org/openecomp/sdc/impl/ToscaParserValidationIssueTest.java new file mode 100644 index 0000000..72bb5df --- /dev/null +++ b/src/test/java/org/openecomp/sdc/impl/ToscaParserValidationIssueTest.java @@ -0,0 +1,60 @@ +package org.openecomp.sdc.impl; + +import static org.testng.Assert.assertEquals; + +import java.util.List; +import java.util.stream.Collectors; + +import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper; +import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException; +import org.openecomp.sdc.toscaparser.api.common.JToscaValidationIssue; +import org.testng.annotations.Test; + +public class ToscaParserValidationIssueTest extends SdcToscaParserBasicTest { + + @Test + public void testNoValidationIssues() throws SdcToscaParserException { + ISdcCsarHelper rainyCsarHelper = getCsarHelper("csars/service-ServiceFdnt-csar-rainy.csar");//conformance level 3.0 + + //List notAnalyzedReport = factory.getNotAnalyzadExceptions(); + //assertEquals( notAnalyzedReport.size(),0); + List warningsReport = factory.getWarningExceptions(); + assertEquals( warningsReport.size(),0); + List criticalsReport = factory.getCriticalExceptions(); + assertEquals( criticalsReport.size(),0); + } + @Test + public void testGetLowSinceConformanceLevel() throws SdcToscaParserException { + ISdcCsarHelper fdntCsarHelperWithInputs = getCsarHelper("csars/service-NfodService-csar.csar");//conformance level 3.0 + //Service level + + List notAnalyzedReport = factory.getNotAnalyzadExceptions(); + assertEquals( notAnalyzedReport.size(),10); + //JE003 high CL 4.0 + assertEquals( notAnalyzedReport.stream().filter(n->n.getCode().equals("JE003")).collect(Collectors.toList()).size(), 2); + assertEquals( notAnalyzedReport.stream().filter(n->n.getCode().equals("JE235")).collect(Collectors.toList()).size(), 7); + assertEquals( notAnalyzedReport.stream().filter(n->n.getCode().equals("JE236")).collect(Collectors.toList()).size(), 1); + List warningsReport = factory.getWarningExceptions(); + assertEquals( warningsReport.size(),14); + assertEquals( warningsReport.stream().filter(w->w.getCode().equals("JE006")).collect(Collectors.toList()).size(), 13); + //JE004 low CL 2.0 + assertEquals( warningsReport.stream().filter(w->w.getCode().equals("JE004")).collect(Collectors.toList()).size(), 1); + List criticalsReport = factory.getCriticalExceptions(); + assertEquals( criticalsReport.size(),0); + } + @Test + public void testMultiSinceConformanceLevelIssues() throws SdcToscaParserException { + ISdcCsarHelper Nfod2images = getCsarHelper("csars/service-Nfod2images-csar.csar");//conformance level 4.0 + List notAnalyzedReport = factory.getNotAnalyzadExceptions(); + assertEquals( notAnalyzedReport.size(),17); + List warningsReport = factory.getWarningExceptions(); + assertEquals( warningsReport.size(),0); + List criticalsReport = factory.getCriticalExceptions(); + assertEquals( criticalsReport.size(),24); + //JE006 multy values sinceCsarConformanceLevel + assertEquals( criticalsReport.stream().filter(c->c.getCode().equals("JE006")).collect(Collectors.toList()).size(), 18); + assertEquals( criticalsReport.stream().filter(c->c.getCode().equals("JE003")).collect(Collectors.toList()).size(), 6); + } + + +} diff --git a/src/test/resources/config/jtosca-validation-issue-configuration.yaml b/src/test/resources/config/jtosca-validation-issue-configuration.yaml new file mode 100644 index 0000000..1378ca7 --- /dev/null +++ b/src/test/resources/config/jtosca-validation-issue-configuration.yaml @@ -0,0 +1,57 @@ +# jTosca validation issues +#by error code, type the validation issue to be CRITICAL/WARNING +# since Conformance level considered to this type. for example: +#JE001: +# - type: WARNING, +# sinceCsarConformanceLevel: 3.0 +# - type: WARNING, +# sinceCsarConformanceLevel: 5.0 +validationIssues: + # TypeMismatchError + JE001: + - issueType: WARNING + sinceCsarConformanceLevel: 3.0 + - issueType: CRITICAL + sinceCsarConformanceLevel: 4.0 + - issueType: WARNING + sinceCsarConformanceLevel: 5.0 + # MissingType + JE002: + - issueType: WARNING + sinceCsarConformanceLevel: 3.0 + #MissingRequiredFieldError + JE003: + - issueType: CRITICAL + sinceCsarConformanceLevel: 4.0 + #MissingRequiredFieldError2 + JE004: + - issueType: WARNING + sinceCsarConformanceLevel: 2.0 + #InvalidGroupTargetException + JE005: + - issueType: WARNING + sinceCsarConformanceLevel: 3.0 + #Schema definition of \"%s\" has \"status\" attribute with an invalid value + JE006: + - issueType: WARNING + sinceCsarConformanceLevel: 3.0 + - issueType: CRITICAL + sinceCsarConformanceLevel: 4.0 + - issueType: WARNING + sinceCsarConformanceLevel: 5.0 + #The unit \"%s\" is not valid + JE007: + - issueType: WARNING + sinceCsarConformanceLevel: 3.0 + #ValidationError + JE008: + - issueType: WARNING + sinceCsarConformanceLevel: 3.0 + #ValueError: Expected max 2 arguments for function \"get_input\" but received \"%s\"",args.size()) + JE009: + - issueType: WARNING + sinceCsarConformanceLevel: 3.0 + #MissingRequiredFieldError3 + JE010: + - issueType: WARNING + sinceCsarConformanceLevel: 3.0 \ No newline at end of file diff --git a/src/test/resources/csars/service-Ipassignservice-csar.csar b/src/test/resources/csars/service-Ipassignservice-csar.csar index abdcd3e..c065fea 100644 Binary files a/src/test/resources/csars/service-Ipassignservice-csar.csar and b/src/test/resources/csars/service-Ipassignservice-csar.csar differ diff --git a/src/test/resources/csars/service-PortMirroring.csar b/src/test/resources/csars/service-PortMirroring.csar index 6186291..b90f3b1 100644 Binary files a/src/test/resources/csars/service-PortMirroring.csar and b/src/test/resources/csars/service-PortMirroring.csar differ diff --git a/src/test/resources/csars/service-ServiceForToscaParserTests-csar.csar b/src/test/resources/csars/service-ServiceForToscaParserTests-csar.csar index f6c7769..a3e6f70 100644 Binary files a/src/test/resources/csars/service-ServiceForToscaParserTests-csar.csar and b/src/test/resources/csars/service-ServiceForToscaParserTests-csar.csar differ diff --git a/src/test/resources/csars/service-nested-vfc-csar.csar b/src/test/resources/csars/service-nested-vfc-csar.csar index 0275520..5ee0802 100644 Binary files a/src/test/resources/csars/service-nested-vfc-csar.csar and b/src/test/resources/csars/service-nested-vfc-csar.csar differ diff --git a/src/test/resources/csars/service-resolve-get-input-csar.csar b/src/test/resources/csars/service-resolve-get-input-csar.csar index fe433f6..7c14159 100644 Binary files a/src/test/resources/csars/service-resolve-get-input-csar.csar and b/src/test/resources/csars/service-resolve-get-input-csar.csar differ 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 index c35c890..37cb0f0 100644 Binary files a/src/test/resources/csars/service-resolve-get-input-csar_QA.csar and b/src/test/resources/csars/service-resolve-get-input-csar_QA.csar differ -- cgit 1.2.3-korg