Add collaboration feature
[sdc.git] / openecomp-be / tools / zusammen-tools / src / test / java / org / openecomp / core / tools / Commands / exportinfo / serialize / VLMExtractTest.java
1 package org.openecomp.core.tools.Commands.exportinfo.serialize;
2
3 import org.openecomp.core.tools.exportinfo.ExportSerializer;
4 import org.testng.annotations.Test;
5
6 import static org.testng.Assert.assertEquals;
7 import static org.testng.Assert.assertNotNull;
8 import static org.testng.Assert.assertNull;
9 public class VLMExtractTest {
10
11
12
13     @Test
14     public void extractVLM(){
15         String vlmId = "979a56c7b2fa41e6a5742137f53a5c1b";
16         String elemenet_info_string = "{\n" +
17                 "  \"name\": \"VendorSoftwareProduct\",\n" +
18                 "  \"properties\": {\n" +
19                 "    \"subCategory\": \"resourceNewCategory.dcae component.collector\",\n" +
20                 "    \"name\": \"vsp1\",\n" +
21                 "    \"icon\": \"icon\",\n" +
22                 "    \"onboardingMethod\": \"NetworkPackage\",\n" +
23                 "    \"description\": \"d\",\n" +
24                 "    \"vendorId\": \""+vlmId+"\",\n" +
25                 "    \"category\": \"resourceNewCategory.dcae component\",\n" +
26                 "    \"vendorName\": \"vlm1\",\n" +
27                 "    \"elementType\": \"VendorSoftwareProduct\"\n" +
28                 "  }\n" +
29                 "}\n"    ;
30         String extractedVlmId = new CustomExportSerializer().extractVlm(elemenet_info_string);
31         assertNotNull(extractedVlmId);
32         assertEquals(extractedVlmId,vlmId);
33
34     }
35
36     @Test
37     public void failToExtractVLMBecauseJsonIsCorrupted(){
38         String elemenet_info_string = "gfhhhghgh";
39         String extractedVlmId = new CustomExportSerializer().extractVlm(elemenet_info_string);
40         assertNull(extractedVlmId);
41     }
42
43     private static final class CustomExportSerializer extends ExportSerializer{
44         public String extractVlm(String injson) {
45             return super.extractVlm(injson);
46         }
47     }
48 }