Fix pdp group info not there for legacy policy
[clamp.git] / src / test / java / org / onap / clamp / loop / CsarInstallerItCase.java
index a1499f7..ac7b236 100644 (file)
@@ -34,9 +34,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
-
 import javax.transaction.Transactional;
-
 import org.apache.commons.lang3.RandomStringUtils;
 import org.json.JSONException;
 import org.junit.Assert;
@@ -44,6 +42,7 @@ 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;
@@ -51,7 +50,7 @@ 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.loop.service.ServiceRepository;
+import org.onap.clamp.loop.service.ServicesRepository;
 import org.onap.clamp.loop.template.LoopTemplate;
 import org.onap.clamp.loop.template.LoopTemplateLoopElementModel;
 import org.onap.clamp.loop.template.LoopTemplatesRepository;
@@ -74,7 +73,7 @@ import org.springframework.test.context.junit4.SpringRunner;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest(classes = Application.class)
-@ActiveProfiles(profiles = "clamp-default,clamp-default-user,clamp-sdc-controller")
+@ActiveProfiles(profiles = "clamp-default,clamp-default-user,clamp-sdc-controller,legacy-operational-policy")
 public class CsarInstallerItCase {
 
     private static final String CSAR_ARTIFACT_NAME = "example/sdc/service_Vloadbalancerms_csar.csar";
@@ -88,7 +87,7 @@ public class CsarInstallerItCase {
     private LoopTemplatesRepository loopTemplatesRepo;
 
     @Autowired
-    ServiceRepository serviceRepository;
+    ServicesRepository serviceRepository;
 
     @Autowired
     PolicyModelsRepository policyModelsRepository;
@@ -98,7 +97,8 @@ public class CsarInstallerItCase {
     private CsarInstaller csarInstaller;
 
     private BlueprintArtifact buildFakeBuildprintArtifact(String instanceName, String invariantResourceUuid,
-            String blueprintFilePath, String artifactName, String invariantServiceUuid) throws IOException {
+                                                          String blueprintFilePath, String artifactName,
+                                                          String invariantServiceUuid) throws IOException {
         IResourceInstance resource = Mockito.mock(IResourceInstance.class);
         Mockito.when(resource.getResourceInstanceName()).thenReturn(instanceName);
         Mockito.when(resource.getResourceInvariantUUID()).thenReturn(invariantResourceUuid);
@@ -160,6 +160,13 @@ public class CsarInstallerItCase {
         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 {