summaryrefslogtreecommitdiffstats
path: root/csarvalidation/src/test
diff options
context:
space:
mode:
authorAdam Wudzinski <adam.wudzinski@nokia.com>2020-09-18 13:50:33 +0200
committerAdam Wudzinski <adam.wudzinski@nokia.com>2020-09-21 11:15:27 +0200
commitca4c0d939cdb3bcabec2bef0636bee4aa403cee3 (patch)
tree3965af916153c8c829d145e912e1f753426c5186 /csarvalidation/src/test
parentf0f62c9eaf9a152e6f7b3031f98a9e906f56bac5 (diff)
Add warnings field to oclip json response
Add new field called "warnings" to oclip json response. All ignored errors are now reported as warnings. Signed-off-by: Adam Wudzinski <adam.wudzinski@nokia.com> Issue-ID: VNFSDK-596 Change-Id: Ifebfb09b54156f0566858e942d73a7a5ef34721f
Diffstat (limited to 'csarvalidation/src/test')
-rw-r--r--csarvalidation/src/test/java/org/onap/cvc/csar/CsarValidatorTest.java21
-rw-r--r--csarvalidation/src/test/resources/pnf/r130206/csar-option1-warning-2.csarbin0 -> 8624 bytes
2 files changed, 21 insertions, 0 deletions
diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/CsarValidatorTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/CsarValidatorTest.java
index d742ca6..299aff2 100644
--- a/csarvalidation/src/test/java/org/onap/cvc/csar/CsarValidatorTest.java
+++ b/csarvalidation/src/test/java/org/onap/cvc/csar/CsarValidatorTest.java
@@ -29,6 +29,7 @@ import org.onap.cli.main.OnapCli;
import java.net.URISyntaxException;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.onap.cvc.csar.cc.sol004.IntegrationTestUtils.absoluteFilePath;
@@ -38,6 +39,26 @@ public class CsarValidatorTest {
private static final String OPERATION_STATUS_FAILED = "FAILED";
@Test
+ public void shouldReportErrorAsWarningWhenErrorIsIgnored() throws URISyntaxException {
+ // given
+ OnapCliWrapper cli = new OnapCliWrapper(new String[]{
+ "--product", "onap-dublin",
+ "csar-validate",
+ "--format", "json",
+ "--pnf",
+ "--csar", absoluteFilePath("pnf/r130206/csar-option1-warning-2.csar")});
+
+ // when
+ cli.handle();
+
+ // then
+ final OnapCommandResult onapCommandResult = cli.getCommandResult();
+ assertTrue(onapCommandResult.getOutput().toString().contains(
+ "\"warnings\":[{\"vnfreqNo\":\"R130206\",\"code\":\"0x1006\",\"message\":\"Warning. Consider adding package "
+ + "integrity and authenticity assurance according to ETSI NFV-SOL 004 Security Option 1\",\"file\":\"\",\"lineNumber\":-1}]}"));
+ }
+
+ @Test
public void shouldReportThanVnfValidationFailed() throws URISyntaxException {
// given
OnapCliWrapper cli = new OnapCliWrapper(new String[]{
diff --git a/csarvalidation/src/test/resources/pnf/r130206/csar-option1-warning-2.csar b/csarvalidation/src/test/resources/pnf/r130206/csar-option1-warning-2.csar
new file mode 100644
index 0000000..748efbb
--- /dev/null
+++ b/csarvalidation/src/test/resources/pnf/r130206/csar-option1-warning-2.csar
Binary files differ