diff options
author | 2018-02-11 14:04:58 +0200 | |
---|---|---|
committer | 2018-02-11 14:04:58 +0200 | |
commit | 27fed258bd045e4af8cdc1181ebf3cef8d0822cc (patch) | |
tree | b6fcb62e3b8893783ecc7ad7e4b8be42ee332213 /openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java | |
parent | d5b4901c6a1ae136138c1300d377447e26bac4ef (diff) |
Artifact was not associated
ASDC is not associating get_file
Change-Id: I56cda457c061e5228012d43b5743ebfa24b4bb0d
Issue-ID: SDC-1016
Signed-off-by: eleonorali <eleonoral@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java')
-rw-r--r-- | openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java | 58 |
1 files changed, 47 insertions, 11 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java index e5d1a88821..c43c55721e 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java @@ -1,22 +1,18 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ +/* + * Copyright © 2018 European Support Limited + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ============LICENSE_END========================================================= - */ +*/ package org.openecomp.sdc.heat.services.tree; @@ -31,7 +27,7 @@ import org.testng.annotations.Test; import java.io.File; import java.io.FileInputStream; import java.io.IOException; -import java.net.URL; +import java.net.URL;; public class HeatTreeManagerTest { @@ -62,6 +58,46 @@ public class HeatTreeManagerTest { Assert.assertEquals(tree.getHeat().size(), 2); } + @Test + public void testHeatTreeArtifactsCreated() { + + FileContentHandler fileContentMap = new FileContentHandler(); + URL url = this.getClass().getResource("/heatTreeArtifactsValidationOutput"); + + File templateDir = new File(url.getFile()); + File[] files = templateDir.listFiles(); + + if (files == null || files.length == 0) { + return; + } + + for (File file : files) { + fileContentMap.addFile(file.getName(), getFileContent(file)); + } + + HeatTreeManager heatTreeManager = HeatTreeManagerUtil.initHeatTreeManager(fileContentMap); + heatTreeManager.createTree(); + HeatStructureTree tree = heatTreeManager.getTree(); + Assert.assertNotNull(tree); + Assert.assertEquals(tree.getHeat().size(), 3); + verifyHeatArtifacts(tree, "ocgmgr.yaml", 1); + verifyHeatArtifacts(tree, "ocgapp.yaml", 0); + verifyHeatArtifacts(tree, "base_ocg.yaml", 0); + + } + + private void verifyHeatArtifacts(HeatStructureTree tree, String heatName, int expectedArtifactNum ) { + HeatStructureTree heat = HeatStructureTree.getHeatStructureTreeByName(tree.getHeat(), heatName); + if(expectedArtifactNum > 0) { + Assert.assertNotNull(heat.getArtifacts()); + Assert.assertEquals(heat.getArtifacts().size(), expectedArtifactNum); + } else { + Assert.assertNull(heat.getArtifacts()); + } + + } + + private byte[] getFileContent(File file) { try { return FileUtils.toByteArray(new FileInputStream(file)); |