1 package org.openecomp.core.tools.commands.exportinfo.serialize;
3 import org.openecomp.core.tools.exportinfo.ExportSerializer;
4 import org.testng.annotations.Test;
6 import static org.testng.Assert.*;
7 public class VLMExtractTest {
12 public void extractVLM(){
13 String vlmId = "979a56c7b2fa41e6a5742137f53a5c1b";
14 String elemenet_info_string = "{\n" +
15 " \"name\": \"VendorSoftwareProduct\",\n" +
16 " \"properties\": {\n" +
17 " \"subCategory\": \"resourceNewCategory.dcae component.collector\",\n" +
18 " \"name\": \"vsp1\",\n" +
19 " \"icon\": \"icon\",\n" +
20 " \"onboardingMethod\": \"NetworkPackage\",\n" +
21 " \"description\": \"d\",\n" +
22 " \"vendorId\": \""+vlmId+"\",\n" +
23 " \"category\": \"resourceNewCategory.dcae component\",\n" +
24 " \"vendorName\": \"vlm1\",\n" +
25 " \"elementType\": \"VendorSoftwareProduct\"\n" +
28 String extractedVlmId = new CustomExportSerializer().extractVlm(elemenet_info_string);
29 assertNotNull(extractedVlmId);
30 assertEquals(extractedVlmId,vlmId);
34 @Test(expectedExceptions = IllegalStateException.class)
35 public void failToExtractVLMBecauseJsonIsCorrupted(){
36 String elemenet_info_string = "gfhhhghgh";
37 assertNull(new CustomExportSerializer().extractVlm(elemenet_info_string));
40 private static final class CustomExportSerializer extends ExportSerializer{
41 public String extractVlm(String inJson) {
42 return super.extractVlm(inJson);