summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java
diff options
context:
space:
mode:
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.java58
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));