aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
authorPavel Aharoni <pa0916@att.com>2017-09-26 19:54:41 +0300
committerPavel Aharoni <pa0916@att.com>2017-09-26 19:54:41 +0300
commit1a7bee7cfccb7cb1c49e67410498da7e5e247a88 (patch)
tree12fc69d7a21ce343180756df345f6dfd82a7179a /src/test/java
parentd6a06de75b157ab7c0fed9ff60f3cee3e8cf06b8 (diff)
[SDC-380] jtosca errors cutomization
Change-Id: I18140d3f2703ff662ae4aa8c965e8137d1ad79c4 Signed-off-by: Pavel Aharoni <pa0916@att.com>
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/openecomp/sdc/impl/ToscaParserValidationIssueTest.java60
1 files changed, 60 insertions, 0 deletions
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<JToscaValidationIssue> notAnalyzedReport = factory.getNotAnalyzadExceptions();
+ //assertEquals( notAnalyzedReport.size(),0);
+ List<JToscaValidationIssue> warningsReport = factory.getWarningExceptions();
+ assertEquals( warningsReport.size(),0);
+ List<JToscaValidationIssue> 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<JToscaValidationIssue> 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<JToscaValidationIssue> 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<JToscaValidationIssue> 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<JToscaValidationIssue> notAnalyzedReport = factory.getNotAnalyzadExceptions();
+ assertEquals( notAnalyzedReport.size(),17);
+ List<JToscaValidationIssue> warningsReport = factory.getWarningExceptions();
+ assertEquals( warningsReport.size(),0);
+ List<JToscaValidationIssue> 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);
+ }
+
+
+}