Fix the new tosca converter
[clamp.git] / src / test / java / org / onap / clamp / clds / tosca / ToscaYamlToJsonConvertorTestItCase.java
index f426c76..a32d499 100644 (file)
@@ -24,6 +24,9 @@
 
 package org.onap.clamp.clds.tosca;
 
+import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
 import com.google.gson.JsonObject;
 import java.io.IOException;
 import javax.transaction.Transactional;
@@ -39,9 +42,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
-import static org.junit.Assert.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
 @RunWith(SpringJUnit4ClassRunner.class)
 @SpringBootTest(classes = Application.class)
 public class ToscaYamlToJsonConvertorTestItCase {
@@ -57,7 +57,7 @@ public class ToscaYamlToJsonConvertorTestItCase {
      * Schema.
      *
      * @throws IOException In case of issue when opening the tosca yaml file and
-     *         converted json file
+     *                     converted json file
      */
     @Test
     public final void testParseToscaYaml() throws IOException {
@@ -65,11 +65,11 @@ public class ToscaYamlToJsonConvertorTestItCase {
         ToscaYamlToJsonConvertor convertor = new ToscaYamlToJsonConvertor();
 
         String parsedJsonSchema =
-            convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.cdap.tca.hi.lo.app");
+                convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.cdap.tca.hi.lo.app");
         assertNotNull(parsedJsonSchema);
         JSONAssert.assertEquals(
-            ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json.json"),
-            parsedJsonSchema, true);
+                ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json.json"),
+                parsedJsonSchema, true);
     }
 
     /**
@@ -77,20 +77,20 @@ public class ToscaYamlToJsonConvertorTestItCase {
      * based on JSON Editor Schema.
      *
      * @throws IOException In case of issue when opening the tosca yaml file and
-     *         converted json file
+     *                     converted json file
      */
     @Test
     public final void testParseToscaYamlWithConstraints() throws IOException {
         String toscaModelYaml =
-            ResourceFileUtil.getResourceAsString("tosca/tosca-with-constraints.yaml");
+                ResourceFileUtil.getResourceAsString("tosca/tosca-with-constraints.yaml");
         ToscaYamlToJsonConvertor convertor = new ToscaYamlToJsonConvertor();
 
         String parsedJsonSchema =
-            convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.example.app");
+                convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.example.app");
         assertNotNull(parsedJsonSchema);
         JSONAssert.assertEquals(
-            ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json-with-constraints.json"),
-            parsedJsonSchema, true);
+                ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json-with-constraints.json"),
+                parsedJsonSchema, true);
     }
 
     /**
@@ -98,20 +98,20 @@ public class ToscaYamlToJsonConvertorTestItCase {
      * conversion based on JSON Editor Schema.
      *
      * @throws IOException In case of issue when opening the tosca yaml file and
-     *         converted json file
+     *                     converted json file
      */
     @Test
     public final void testParseToscaYamlWithTypes() throws IOException {
         String toscaModelYaml =
-            ResourceFileUtil.getResourceAsString("tosca/tosca-with-datatypes.yaml");
+                ResourceFileUtil.getResourceAsString("tosca/tosca-with-datatypes.yaml");
         ToscaYamlToJsonConvertor convertor = new ToscaYamlToJsonConvertor();
 
         String parsedJsonSchema =
-            convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.example.app");
+                convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.example.app");
         assertNotNull(parsedJsonSchema);
         JSONAssert.assertEquals(
-            ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json-with-datatypes.json"),
-            parsedJsonSchema, true);
+                ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json-with-datatypes.json"),
+                parsedJsonSchema, true);
     }
 
     /**
@@ -119,7 +119,7 @@ public class ToscaYamlToJsonConvertorTestItCase {
      * parameters which defines the Tosca Policy name and its short name.
      *
      * @throws IOException In case of issue when opening the tosca yaml file and
-     *         converted json file
+     *                     converted json file
      */
     @Test
     @Transactional
@@ -165,24 +165,24 @@ public class ToscaYamlToJsonConvertorTestItCase {
         dictionaryService.saveOrUpdateDictionary(dictionaryTest2);
 
         String toscaModelYaml =
-            ResourceFileUtil.getResourceAsString("tosca/tosca_metadata_clamp_possible_values.yaml");
+                ResourceFileUtil.getResourceAsString("tosca/tosca_metadata_clamp_possible_values.yaml");
 
         JsonObject jsonObject = toscaYamlToJsonConvertor.validateAndConvertToJson(toscaModelYaml);
         assertNotNull(jsonObject);
         String policyModelType = toscaYamlToJsonConvertor.getValueFromMetadata(jsonObject,
-            ToscaSchemaConstants.METADATA_POLICY_MODEL_TYPE);
+                ToscaSchemaConstants.METADATA_POLICY_MODEL_TYPE);
         String acronym = toscaYamlToJsonConvertor.getValueFromMetadata(jsonObject,
-            ToscaSchemaConstants.METADATA_ACRONYM);
+                ToscaSchemaConstants.METADATA_ACRONYM);
         String parsedJsonSchema =
-            toscaYamlToJsonConvertor.parseToscaYaml(toscaModelYaml, policyModelType);
+                toscaYamlToJsonConvertor.parseToscaYaml(toscaModelYaml, policyModelType);
 
         assertNotNull(parsedJsonSchema);
         assertEquals("onap.policies.monitoring.cdap.tca.hi.lo.app", policyModelType);
         assertEquals("tca", acronym);
         JSONAssert.assertEquals(
-            ResourceFileUtil
-                .getResourceAsString("tosca/tosca_metadata_clamp_possible_values_json_schema.json"),
-            parsedJsonSchema, true);
+                ResourceFileUtil
+                        .getResourceAsString("tosca/tosca_metadata_clamp_possible_values_json_schema.json"),
+                parsedJsonSchema, true);
     }
 
 }