Implement policy element convertion during onboarding VSP
[sdc.git] / openecomp-be / lib / openecomp-tosca-converter-lib / openecomp-tosca-converter-core / src / test / java / org / openecomp / core / impl / ToscaConverterImplTest.java
index 3e4e62a..bcfc3d8 100644 (file)
@@ -40,6 +40,7 @@ import java.nio.file.NotDirectoryException;
 import java.util.*;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import static org.openecomp.core.converter.datatypes.Constants.globalStName;
 import static org.openecomp.core.converter.datatypes.Constants.mainStName;
 
@@ -134,6 +135,23 @@ public class ToscaConverterImplTest {
     Assert.assertEquals(1, occurrences[1]);
   }
 
+  @Test
+  public void testPoliciesBeenConverted() throws IOException {
+    String inputFilesPath = BASE_DIR + "/convertPolicies/in";
+    FileContentHandler fileContentHandler =
+            createFileContentHandlerFromInput(inputFilesPath);
+    ToscaServiceModel toscaServiceModel = toscaConverter.convert(fileContentHandler);
+    Optional<ServiceTemplate> st = toscaServiceModel.getServiceTemplate("MainServiceTemplate.yaml");
+
+    assertTrue(st.isPresent());
+
+    Map<String, PolicyDefinition> pds = st.get().getTopology_template().getPolicies();
+
+    assertEquals(2, pds.size());
+    assertTrue(pds.containsKey("scaling_aspects"));
+    assertTrue(pds.containsKey("instantiation_levels"));
+  }
+
   private Object[] buildOccurrences(String... bounds) {
     return buildOccurrences(Arrays.asList(bounds));
   }