From 8e9c0653dd6c6862123c9609ae34e1206d86456e Mon Sep 17 00:00:00 2001 From: talig Date: Wed, 20 Dec 2017 14:30:43 +0200 Subject: Add collaboration feature Issue-ID: SDC-767 Change-Id: I14fb4c1f54086ed03a56a7ff7fab9ecd40381795 Signed-off-by: talig --- .../exportinfo/serialize/VLMExtractTest.java | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/Commands/exportinfo/serialize/VLMExtractTest.java (limited to 'openecomp-be/tools/zusammen-tools/src/test/java/org') diff --git a/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/Commands/exportinfo/serialize/VLMExtractTest.java b/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/Commands/exportinfo/serialize/VLMExtractTest.java new file mode 100644 index 0000000000..7b43c4624f --- /dev/null +++ b/openecomp-be/tools/zusammen-tools/src/test/java/org/openecomp/core/tools/Commands/exportinfo/serialize/VLMExtractTest.java @@ -0,0 +1,48 @@ +package org.openecomp.core.tools.Commands.exportinfo.serialize; + +import org.openecomp.core.tools.exportinfo.ExportSerializer; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertNull; +public class VLMExtractTest { + + + + @Test + public void extractVLM(){ + String vlmId = "979a56c7b2fa41e6a5742137f53a5c1b"; + String elemenet_info_string = "{\n" + + " \"name\": \"VendorSoftwareProduct\",\n" + + " \"properties\": {\n" + + " \"subCategory\": \"resourceNewCategory.dcae component.collector\",\n" + + " \"name\": \"vsp1\",\n" + + " \"icon\": \"icon\",\n" + + " \"onboardingMethod\": \"NetworkPackage\",\n" + + " \"description\": \"d\",\n" + + " \"vendorId\": \""+vlmId+"\",\n" + + " \"category\": \"resourceNewCategory.dcae component\",\n" + + " \"vendorName\": \"vlm1\",\n" + + " \"elementType\": \"VendorSoftwareProduct\"\n" + + " }\n" + + "}\n" ; + String extractedVlmId = new CustomExportSerializer().extractVlm(elemenet_info_string); + assertNotNull(extractedVlmId); + assertEquals(extractedVlmId,vlmId); + + } + + @Test + public void failToExtractVLMBecauseJsonIsCorrupted(){ + String elemenet_info_string = "gfhhhghgh"; + String extractedVlmId = new CustomExportSerializer().extractVlm(elemenet_info_string); + assertNull(extractedVlmId); + } + + private static final class CustomExportSerializer extends ExportSerializer{ + public String extractVlm(String injson) { + return super.extractVlm(injson); + } + } +} -- cgit 1.2.3-korg