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.assertEquals;
 
   7 import static org.testng.Assert.assertNotNull;
 
   8 import static org.testng.Assert.assertNull;
 
   9 public class VLMExtractTest {
 
  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" +
 
  30         String extractedVlmId = new CustomExportSerializer().extractVlm(elemenet_info_string);
 
  31         assertNotNull(extractedVlmId);
 
  32         assertEquals(extractedVlmId,vlmId);
 
  36     @Test(expectedExceptions = IllegalStateException.class)
 
  37     public void failToExtractVLMBecauseJsonIsCorrupted(){
 
  38         String elemenet_info_string = "gfhhhghgh";
 
  39         new CustomExportSerializer().extractVlm(elemenet_info_string);
 
  42     private static final class CustomExportSerializer extends ExportSerializer{
 
  43         public String extractVlm(String injson) {
 
  44             return super.extractVlm(injson);