From 17a1e0e30e3a35ed4ad2ef91960bb58799b208b3 Mon Sep 17 00:00:00 2001 From: mojahidi Date: Tue, 12 Sep 2017 18:53:34 +0530 Subject: validate mandatry vnfc vm info is absent in invent when the vnfc SMP is mandatory in the dependency-info block but its corresponding vm details/info is not present in the inventory info validation error should be thrown Issue-ID:APPC-204 Change-Id: I606da8ce086423cf3f23c87ab0166bfb9935875b Signed-off-by: mojahidi --- .../appc/seqgen/TestSequenceGeneratorPlugin.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'appc-sequence-generator/appc-sequence-generator-bundle/src/test/java/org') diff --git a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/java/org/openecomp/appc/seqgen/TestSequenceGeneratorPlugin.java b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/java/org/openecomp/appc/seqgen/TestSequenceGeneratorPlugin.java index e36b9f09d..5ab75b634 100644 --- a/appc-sequence-generator/appc-sequence-generator-bundle/src/test/java/org/openecomp/appc/seqgen/TestSequenceGeneratorPlugin.java +++ b/appc-sequence-generator/appc-sequence-generator-bundle/src/test/java/org/openecomp/appc/seqgen/TestSequenceGeneratorPlugin.java @@ -230,6 +230,22 @@ public class TestSequenceGeneratorPlugin { Assert.assertEquals(outputJSON.trim(),actualOutput.trim()); } + @Test + public void testGenerateSequenceVnfcNotPresentInInventory() throws URISyntaxException, IOException { + String inputJSON = readInput("/input/CheckVNfcInInventory.json"); + + Map params = new HashMap<>(); + SvcLogicContext context = new SvcLogicContext(); + context.setAttribute("inputJSON",inputJSON); + SequenceGeneratorPlugin plugin = new SequenceGeneratorPluginImpl(); + plugin.generateSequence(params,context); + + String outputJSON = context.getAttribute("output"); + String actualOutput = readOutput("/output/CheckVnfcInInventory.json"); + + Assert.assertEquals(outputJSON.trim(),actualOutput.trim()); + } + private String readInput(String inputFile) throws URISyntaxException, IOException { File file = new File(this.getClass().getResource(inputFile).toURI()); @@ -249,7 +265,7 @@ public class TestSequenceGeneratorPlugin { String output=new String(bFile); int start=output.indexOf("["); - int last=output.length()-1; + int last=output.length(); return output.substring(start,last); } -- cgit