diff options
author | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2018-05-11 18:29:37 +0200 |
---|---|---|
committer | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2018-05-11 18:29:37 +0200 |
commit | f92b38ddcb8b5eb80db55fa1ca6ebdb5af40d115 (patch) | |
tree | b4d9eedc3a03ddf1da2106a555b7348d2078a84f /src/test/java/org/onap | |
parent | 86848b8bf5182be52fff9346412743f92e3d9e6a (diff) |
Fix Sdc Controller
Add support to decode the entire input parameters provided in the
blueprints so that user see them in the Clamp UI + Unit tests
Issue-ID: CLAMP-151
Change-Id: I838e03375cb544fd91b0a1f86905d96239ffece2
Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
Diffstat (limited to 'src/test/java/org/onap')
-rw-r--r-- | src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java b/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java index e0f774b0b..222f757e0 100644 --- a/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/sdc/controller/installer/CsarInstallerItCase.java @@ -56,6 +56,7 @@ import org.onap.sdc.api.notification.IResourceInstance; import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException; import org.onap.sdc.toscaparser.api.elements.Metadata; +import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @@ -152,26 +153,42 @@ public class CsarInstallerItCase { String generatedName = RandomStringUtils.randomAlphanumeric(5); CsarHandler csar = buildFakeCsarHandler(generatedName); csarInstaller.installTheCsar(csar); + CldsModel cldsModel1 = verifyClosedLoopModelLoadedInDb(csar, generatedName, INSTANCE_NAME_RESOURCE1); + JSONAssert.assertEquals( + IOUtils.toString( + ResourceFileUtil.getResourceAsStream("example/sdc/blueprint-dcae/prop-text-for-tca.json")), + cldsModel1.getPropText(), true); + CldsModel cldsModel2 = verifyClosedLoopModelLoadedInDb(csar, generatedName, INSTANCE_NAME_RESOURCE2); + JSONAssert.assertEquals( + IOUtils.toString( + ResourceFileUtil.getResourceAsStream("example/sdc/blueprint-dcae/prop-text-for-tca-2.json")), + cldsModel2.getPropText(), true); + } + + private CldsModel verifyClosedLoopModelLoadedInDb(CsarHandler csar, String generatedName, + String instanceNameResource) throws SdcArtifactInstallerException { // Get the template back from DB - CldsTemplate templateFromDb = CldsTemplate.retrieve(cldsDao, CsarInstallerImpl.TEMPLATE_NAME_PREFIX - + CsarInstallerImpl.buildModelName(csar, INSTANCE_NAME_RESOURCE1), false); + CldsTemplate templateFromDb = CldsTemplate.retrieve(cldsDao, + CsarInstallerImpl.TEMPLATE_NAME_PREFIX + CsarInstallerImpl.buildModelName(csar, instanceNameResource), + false); assertNotNull(templateFromDb); assertNotNull(templateFromDb.getBpmnText()); assertNotNull(templateFromDb.getImageText()); assertNotNull(templateFromDb.getPropText()); assertTrue(templateFromDb.getPropText().contains("global") && templateFromDb.getPropText().contains("node_templates:")); - assertEquals(templateFromDb.getName(), CsarInstallerImpl.TEMPLATE_NAME_PREFIX - + CsarInstallerImpl.buildModelName(csar, INSTANCE_NAME_RESOURCE1)); + assertEquals(templateFromDb.getName(), + CsarInstallerImpl.TEMPLATE_NAME_PREFIX + CsarInstallerImpl.buildModelName(csar, instanceNameResource)); // Get the Model back from DB CldsModel modelFromDb = CldsModel.retrieve(cldsDao, - CsarInstallerImpl.buildModelName(csar, INSTANCE_NAME_RESOURCE2), true); + CsarInstallerImpl.buildModelName(csar, instanceNameResource), true); assertNotNull(modelFromDb); assertNotNull(modelFromDb.getBpmnText()); assertNotNull(modelFromDb.getImageText()); assertNotNull(modelFromDb.getPropText()); assertTrue(modelFromDb.getPropText().contains("policy_id")); - assertEquals(CsarInstallerImpl.buildModelName(csar, INSTANCE_NAME_RESOURCE2), modelFromDb.getName()); + assertEquals(CsarInstallerImpl.buildModelName(csar, instanceNameResource), modelFromDb.getName()); assertEquals(CsarInstallerImpl.CONTROL_NAME_PREFIX, modelFromDb.getControlNamePrefix()); + return modelFromDb; } } |