Remove legacy operational Policy
[clamp.git] / src / test / java / org / onap / clamp / loop / CsarInstallerItCase.java
index 1c33d5e..aa8054c 100644 (file)
@@ -42,14 +42,13 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mockito;
 import org.onap.clamp.clds.Application;
-import org.onap.clamp.clds.config.LegacyOperationalPolicyController;
 import org.onap.clamp.clds.exception.sdc.controller.BlueprintParserException;
 import org.onap.clamp.clds.exception.sdc.controller.CsarHandlerException;
 import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException;
 import org.onap.clamp.clds.sdc.controller.installer.BlueprintArtifact;
 import org.onap.clamp.clds.sdc.controller.installer.CsarHandler;
 import org.onap.clamp.clds.util.JsonUtils;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 import org.onap.clamp.loop.cds.CdsDataInstaller;
 import org.onap.clamp.loop.service.ServicesRepository;
 import org.onap.clamp.loop.template.LoopTemplate;
@@ -74,7 +73,7 @@ import org.springframework.test.context.junit4.SpringRunner;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest(classes = Application.class)
-@ActiveProfiles({"clamp-default","clamp-default-user","clamp-sdc-controller","legacy-operational-policy"})
+@ActiveProfiles({"clamp-default", "clamp-default-user", "clamp-sdc-controller"})
 public class CsarInstallerItCase {
 
     private static final String CSAR_ARTIFACT_NAME_CDS = "example/sdc/service_Vloadbalancerms_cds.csar";
@@ -106,7 +105,7 @@ public class CsarInstallerItCase {
         Mockito.when(resource.getResourceInvariantUUID()).thenReturn(invariantResourceUuid);
         BlueprintArtifact blueprintArtifact = Mockito.mock(BlueprintArtifact.class);
         Mockito.when(blueprintArtifact.getDcaeBlueprint())
-                .thenReturn(ResourceFileUtil.getResourceAsString(blueprintFilePath));
+                .thenReturn(ResourceFileUtils.getResourceAsString(blueprintFilePath));
         Mockito.when(blueprintArtifact.getBlueprintArtifactName()).thenReturn(artifactName);
         Mockito.when(blueprintArtifact.getBlueprintInvariantServiceUuid()).thenReturn(invariantServiceUuid);
         Mockito.when(blueprintArtifact.getResourceAttached()).thenReturn(resource);
@@ -159,17 +158,10 @@ public class CsarInstallerItCase {
 
         // Mockito.when(csarHandler.getSdcCsarHelper()).thenReturn(csarHelper);
         Mockito.when(csarHandler.getPolicyModelYaml())
-                .thenReturn(Optional.ofNullable(ResourceFileUtil.getResourceAsString("tosca/tosca_example.yaml")));
+                .thenReturn(Optional.ofNullable(ResourceFileUtils.getResourceAsString("tosca/tosca_example.yaml")));
         return csarHandler;
     }
 
-    @Test
-    @Transactional
-    public void testPolicyModelAddedAtStartup() {
-        assertThat(policyModelsRepository.findByPolicyModelType(
-                LegacyOperationalPolicyController.OPERATIONAL_POLICY_LEGACY).get(0)).isNotNull();
-    }
-
     @Test
     @Transactional
     public void testGetPolicyModelYaml() throws IOException, SdcToscaParserException, CsarHandlerException {
@@ -182,9 +174,10 @@ public class CsarInstallerItCase {
 
         CsarHandler csarHandler = new CsarHandler(notificationData, "", "");
         csarHandler
-                .setFilePath(Thread.currentThread().getContextClassLoader().getResource(CSAR_ARTIFACT_NAME_CDS).getFile());
+                .setFilePath(Thread.currentThread().getContextClassLoader().getResource(CSAR_ARTIFACT_NAME_CDS).
+                        getFile());
         Assert.assertEquals(csarHandler.getPolicyModelYaml(), Optional
-                .ofNullable(ResourceFileUtil.getResourceAsString("example/sdc/expected-result/policy-data.yaml")));
+                .ofNullable(ResourceFileUtils.getResourceAsString("example/sdc/expected-result/policy-data.yaml")));
     }
 
     @Test
@@ -235,11 +228,11 @@ public class CsarInstallerItCase {
                 "1.0", RESOURCE_INSTANCE_NAME_RESOURCE1, "tca.yaml")).get();
         assertThat(loopTemplate.getLoopElementModelsUsed()).hasSize(1);
         assertThat(loopTemplate.getModelService().getServiceUuid()).isEqualTo("63cac700-ab9a-4115-a74f-7eac85e3fce0");
-        JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/model-properties.json"),
+        JSONAssert.assertEquals(ResourceFileUtils.getResourceAsString("tosca/model-properties.json"),
                 JsonUtils.GSON_JPA_MODEL.toJson(loopTemplate.getModelService()), true);
-        JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/service-details.json"),
+        JSONAssert.assertEquals(ResourceFileUtils.getResourceAsString("tosca/service-details.json"),
                 JsonUtils.GSON_JPA_MODEL.toJson(loopTemplate.getModelService().getServiceDetails()), true);
-        JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/resource-details.json"),
+        JSONAssert.assertEquals(ResourceFileUtils.getResourceAsString("tosca/resource-details.json"),
                 JsonUtils.GSON_JPA_MODEL.toJson(loopTemplate.getModelService().getResourceDetails()), true);
         assertThat(((LoopTemplateLoopElementModel) (loopTemplate.getLoopElementModelsUsed().toArray()[0]))
                 .getLoopElementModel().getName()).isNotEmpty();