From d187e9e689fe39cbabe9cb82ea6959e49ff64354 Mon Sep 17 00:00:00 2001 From: sebdet Date: Thu, 23 Apr 2020 00:44:32 +0200 Subject: Fix refresh action Fix the refresh action so that it well retriggered cds call when required, otherwise the refresh button is useless + get out the cds code from service installer Issue-ID: CLAMP-818 Signed-off-by: sebdet Change-Id: Ia5784d75e1bd158ff775674fe6bf0c2c39b55ad4 --- src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java | 2 -- src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java | 8 ++++++-- .../operational/OperationalPolicyRepresentationBuilderTest.java | 9 +++++---- 3 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src/test/java/org') diff --git a/src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java b/src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java index ec39fc3db..9fdc727bc 100644 --- a/src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java +++ b/src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java @@ -23,9 +23,7 @@ package org.onap.clamp.clds.client; import com.google.gson.JsonObject; - import java.io.IOException; - import org.junit.Test; import org.onap.clamp.clds.util.JsonUtils; import org.onap.clamp.clds.util.ResourceFileUtil; diff --git a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java index ac7b236e8..d14975238 100644 --- a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java +++ b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java @@ -50,6 +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.cds.CdsDataInstaller; import org.onap.clamp.loop.service.ServicesRepository; import org.onap.clamp.loop.template.LoopTemplate; import org.onap.clamp.loop.template.LoopTemplateLoopElementModel; @@ -180,8 +181,7 @@ public class CsarInstallerItCase { CsarHandler csarHandler = new CsarHandler(notificationData, "", ""); csarHandler .setFilePath(Thread.currentThread().getContextClassLoader().getResource(CSAR_ARTIFACT_NAME).getFile()); - Optional testyaml = csarHandler.getPolicyModelYaml(); - Assert.assertEquals(testyaml, Optional + Assert.assertEquals(csarHandler.getPolicyModelYaml(), Optional .ofNullable(ResourceFileUtil.getResourceAsString("example/sdc/expected-result/policy-data.yaml"))); } @@ -205,6 +205,10 @@ public class CsarInstallerItCase { CsarHandler csar = buildFakeCsarHandler(generatedName); csarInstaller.installTheCsar(csar); assertThat(serviceRepository.existsById("63cac700-ab9a-4115-a74f-7eac85e3fce0")).isTrue(); + // We should have CDS info + assertThat(serviceRepository.findById("63cac700-ab9a-4115-a74f-7eac85e3fce0").get().getResourceByType("VF") + .getAsJsonObject("vLoadBalancerMS 0").getAsJsonObject( + CdsDataInstaller.CONTROLLER_PROPERTIES)).isNotNull(); assertThat(loopTemplatesRepo.existsById(LoopTemplate.generateLoopTemplateName(generatedName, "1.0", RESOURCE_INSTANCE_NAME_RESOURCE1, "tca.yaml"))).isTrue(); assertThat(loopTemplatesRepo.existsById(LoopTemplate.generateLoopTemplateName(generatedName, "1.0", diff --git a/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java b/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java index a6a496821..b90a28616 100644 --- a/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java +++ b/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java @@ -55,12 +55,13 @@ public class OperationalPolicyRepresentationBuilderTest { JsonObject jsonModel = new GsonBuilder().create() .fromJson(ResourceFileUtil.getResourceAsString("tosca/model-properties-cds.json"), JsonObject.class); Service service = new Service(jsonModel.get("serviceDetails").getAsJsonObject(), - jsonModel.get("resourceDetails").getAsJsonObject(), - "1.0"); + jsonModel.get("resourceDetails").getAsJsonObject(), + "1.0"); JsonObject jsonSchema = OperationalPolicyRepresentationBuilder.generateOperationalPolicySchema(service); assertThat(jsonSchema).isNotNull(); - JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/operational-policy-cds-payload-with-list.json"), - new GsonBuilder().create().toJson(jsonSchema), false); + JSONAssert.assertEquals( + ResourceFileUtil.getResourceAsString("tosca/operational-policy-cds-payload-with-list.json"), + new GsonBuilder().create().toJson(jsonSchema), false); } } -- cgit 1.2.3-korg