summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-translator-lib
diff options
context:
space:
mode:
authortalio <talio@amdocs.com>2020-06-17 15:57:06 +0300
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-06-21 07:13:29 +0000
commita098edad859459ab116d4587af8262877f2b522a (patch)
treed5ac83bf0ef79e0d0b7de4c28ba2953acf238b9d /openecomp-be/lib/openecomp-sdc-translator-lib
parentb0140364e491df1009cf00e50c0207d2e9ca3453 (diff)
Toggle
Add toggling mechanism to catalog side. The first toggleable feature is healing - this was added to healing flow, in healJanusGraphDao Issue-ID: SDC-2874 Signed-off-by: talio <talio@amdocs.com> Change-Id: If386651cab8304ebaf13497ded3a7a50bd60e477 Signed-off-by: talio <talio@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-translator-lib')
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImpl.java1
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java34
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java444
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImplTest.java2
4 files changed, 245 insertions, 236 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImpl.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImpl.java
index 39ee8b7b3c..71dfeb9f53 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImpl.java
@@ -37,7 +37,6 @@ import org.onap.sdc.tosca.datatypes.model.RelationshipTemplate;
import org.onap.sdc.tosca.datatypes.model.RequirementAssignment;
import org.onap.sdc.tosca.datatypes.model.ServiceTemplate;
import org.onap.sdc.tosca.datatypes.model.CapabilityDefinition;
-import org.openecomp.sdc.common.togglz.ToggleableFeature;
import org.openecomp.sdc.heat.datatypes.HeatBoolean;
import org.openecomp.sdc.heat.datatypes.model.HeatOrchestrationTemplate;
import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes;
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java
index cae53f5695..31dbb21a4c 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java
@@ -16,6 +16,20 @@
package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation;
+import static org.junit.Assert.assertEquals;
+import static org.openecomp.sdc.translator.TestUtils.getErrorAsString;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.zip.ZipInputStream;
import org.apache.commons.collections4.MapUtils;
import org.junit.Assert;
import org.junit.BeforeClass;
@@ -24,27 +38,16 @@ import org.openecomp.core.translator.datatypes.TranslatorOutput;
import org.openecomp.core.translator.factory.HeatToToscaTranslatorFactory;
import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.core.validation.util.MessageContainerUtil;
+import org.openecomp.sdc.be.togglz.ToggleableFeature;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
-import org.openecomp.sdc.common.togglz.ToggleableFeature;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl;
import org.openecomp.sdc.translator.TestUtils;
import org.togglz.testing.TestFeatureManager;
import org.togglz.testing.TestFeatureManagerProvider;
-import java.io.*;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.zip.ZipInputStream;
-
-import static org.junit.Assert.assertEquals;
-import static org.openecomp.sdc.translator.TestUtils.getErrorAsString;
-
public class BaseFullTranslationTest {
@@ -88,8 +91,7 @@ public class BaseFullTranslationTest {
}
try (ByteArrayInputStream fis = new ByteArrayInputStream(translatedZipFile);
- BufferedInputStream bis = new BufferedInputStream(fis);
- ZipInputStream zis = new ZipInputStream(bis)) {
+ BufferedInputStream bis = new BufferedInputStream(fis); ZipInputStream zis = new ZipInputStream(bis)) {
TestUtils.compareTranslatedOutput(expectedResultFileNameSet, expectedResultMap, zis);
}
assertEquals(0, expectedResultFileNameSet.size());
@@ -105,8 +107,8 @@ public class BaseFullTranslationTest {
MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, translatorOutput.getErrorMessages()))) {
throw new CoreException((new ErrorCode.ErrorCodeBuilder()).withMessage(
"Error in validation " + getErrorAsString(translatorOutput.getErrorMessages()))
- .withId("Validation Error")
- .withCategory(ErrorCategory.APPLICATION).build());
+ .withId("Validation Error").withCategory(ErrorCategory.APPLICATION)
+ .build());
}
return new ToscaFileOutputServiceCsarImpl().createOutputFile(translatorOutput.getToscaServiceModel(), null);
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java
index 5e5bda3997..42f4cfdfd5 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java
@@ -16,6 +16,33 @@
package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation;
+import static org.junit.Assert.assertEquals;
+import static org.openecomp.sdc.common.utils.SdcCommon.MANIFEST_NAME;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateComputeConnectivityIn;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateComputeConnectivityOut;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateDependsOnInConsolidationData;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateGetAttr;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateGroupsInConsolidationData;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateNestedConsolidationData;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateNestedConsolidationDataNodeTemplateIds;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validatePortConnectivityIn;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validatePortConnectivityOut;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validatePortsInConsolidationData;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateVolumeInConsolidationData;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.zip.ZipInputStream;
import org.apache.commons.collections4.MapUtils;
import org.junit.Assert;
import org.junit.Before;
@@ -25,272 +52,253 @@ import org.openecomp.core.translator.datatypes.TranslatorOutput;
import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.core.utilities.json.JsonUtil;
import org.openecomp.core.validation.util.MessageContainerUtil;
+import org.openecomp.sdc.be.togglz.ToggleableFeature;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
-import org.openecomp.sdc.common.togglz.ToggleableFeature;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.heat.datatypes.manifest.FileData;
import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent;
import org.openecomp.sdc.heat.datatypes.manifest.ManifestFile;
-import org.openecomp.sdc.tosca.services.ToscaFileOutputService;
import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl;
import org.openecomp.sdc.translator.TestUtils;
import org.openecomp.sdc.translator.datatypes.heattotosca.TranslationContext;
-import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.*;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.ComputeTemplateConsolidationData;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.ConsolidationData;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.FileComputeConsolidationData;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.FilePortConsolidationData;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.PortTemplateConsolidationData;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.TypeComputeConsolidationData;
import org.openecomp.sdc.translator.services.heattotosca.TranslationService;
import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataValidationType;
import org.togglz.testing.TestFeatureManager;
import org.togglz.testing.TestFeatureManagerProvider;
-import java.io.*;
-import java.net.URL;
-import java.util.*;
-import java.util.zip.ZipInputStream;
-
-import static org.junit.Assert.assertEquals;
-import static org.openecomp.sdc.common.utils.SdcCommon.MANIFEST_NAME;
-import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.*;
-
public class BaseResourceTranslationTest {
- protected String inputFilesPath;
- protected String outputFilesPath;
- TranslationContext translationContext;
+ protected String inputFilesPath;
+ protected String outputFilesPath;
+ TranslationContext translationContext;
- private TranslationService translationService;
- private byte[] translatedZipFile;
+ private TranslationService translationService;
+ private byte[] translatedZipFile;
- private Map<String, byte[]> expectedResultMap = new HashMap<>();
- private Set<String> expectedResultFileNameSet = new HashSet<>();
+ private Map<String, byte[]> expectedResultMap = new HashMap<>();
+ private Set<String> expectedResultFileNameSet = new HashSet<>();
- protected static TestFeatureManager manager;
+ protected static TestFeatureManager manager;
- @BeforeClass
- public static void enableToggleableFeatures(){
- manager = new TestFeatureManager(ToggleableFeature.class);
- manager.enableAll();
- TestFeatureManagerProvider.setFeatureManager(manager);
- }
+ @BeforeClass
+ public static void enableToggleableFeatures() {
+ manager = new TestFeatureManager(ToggleableFeature.class);
+ manager.enableAll();
+ TestFeatureManagerProvider.setFeatureManager(manager);
+ }
- @Before
- public void setUp() throws IOException {
- initTranslatorAndTranslate();
- }
+ @Before
+ public void setUp() throws IOException {
+ initTranslatorAndTranslate();
+ }
- protected void initTranslatorAndTranslate() throws IOException {
- translationService = new TranslationService();
- translationContext = new TranslationContext();
- translatedZipFile = translateZipFile();
- }
+ protected void initTranslatorAndTranslate() throws IOException {
+ translationService = new TranslationService();
+ translationContext = new TranslationContext();
+ translatedZipFile = translateZipFile();
+ }
- protected void testTranslation() throws IOException {
+ protected void testTranslation() throws IOException {
- URL url = BaseResourceTranslationTest.class.getResource(outputFilesPath);
+ URL url = BaseResourceTranslationTest.class.getResource(outputFilesPath);
- String path = url.getPath();
- File pathFile = new File(path);
- File[] files = pathFile.listFiles();
- Assert.assertNotNull("manifest files is empty", files);
- for (File expectedFile : files) {
- expectedResultFileNameSet.add(expectedFile.getName());
- try (FileInputStream input = new FileInputStream(expectedFile)) {
- expectedResultMap.put(expectedFile.getName(), FileUtils.toByteArray(input));
- }
- }
+ String path = url.getPath();
+ File pathFile = new File(path);
+ File[] files = pathFile.listFiles();
+ Assert.assertNotNull("manifest files is empty", files);
+ for (File expectedFile : files) {
+ expectedResultFileNameSet.add(expectedFile.getName());
+ try (FileInputStream input = new FileInputStream(expectedFile)) {
+ expectedResultMap.put(expectedFile.getName(), FileUtils.toByteArray(input));
+ }
+ }
- try (ByteArrayInputStream fis = new ByteArrayInputStream(translatedZipFile);
- BufferedInputStream bis = new BufferedInputStream(fis);
- ZipInputStream zis = new ZipInputStream(bis)) {
- TestUtils.compareTranslatedOutput(expectedResultFileNameSet, expectedResultMap, zis);
+ try (ByteArrayInputStream fis = new ByteArrayInputStream(translatedZipFile);
+ BufferedInputStream bis = new BufferedInputStream(fis); ZipInputStream zis = new ZipInputStream(bis)) {
+ TestUtils.compareTranslatedOutput(expectedResultFileNameSet, expectedResultMap, zis);
+ }
+ assertEquals(0, expectedResultFileNameSet.size());
}
- assertEquals(0, expectedResultFileNameSet.size());
- }
-
- private byte[] translateZipFile() throws IOException {
- URL inputFilesUrl = this.getClass().getResource(inputFilesPath);
- String path = inputFilesUrl.getPath();
- addFilesToTranslator(translationContext, path);
- TranslatorOutput translatorOutput = translationService.translateHeatFiles(translationContext);
- Assert.assertNotNull(translatorOutput);
- if (MapUtils.isNotEmpty(translatorOutput.getErrorMessages()) && MapUtils.isNotEmpty(
- MessageContainerUtil
- .getMessageByLevel(ErrorLevel.ERROR, translatorOutput.getErrorMessages()))) {
- throw new CoreException((new ErrorCode.ErrorCodeBuilder()).withMessage(
- "Error in validation " + TestUtils.getErrorAsString(translatorOutput.getErrorMessages()))
- .withId("Validation Error").withCategory(ErrorCategory.APPLICATION).build());
+
+ private byte[] translateZipFile() throws IOException {
+ URL inputFilesUrl = this.getClass().getResource(inputFilesPath);
+ String path = inputFilesUrl.getPath();
+ addFilesToTranslator(translationContext, path);
+ TranslatorOutput translatorOutput = translationService.translateHeatFiles(translationContext);
+ Assert.assertNotNull(translatorOutput);
+ if (MapUtils.isNotEmpty(translatorOutput.getErrorMessages()) && MapUtils.isNotEmpty(
+ MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, translatorOutput.getErrorMessages()))) {
+ throw new CoreException((new ErrorCode.ErrorCodeBuilder()).withMessage(
+ "Error in validation " + TestUtils.getErrorAsString(translatorOutput.getErrorMessages()))
+ .withId("Validation Error").withCategory(ErrorCategory.APPLICATION)
+ .build());
+ }
+
+ return new ToscaFileOutputServiceCsarImpl().createOutputFile(translatorOutput.getToscaServiceModel(), null);
+
}
-
- return new ToscaFileOutputServiceCsarImpl().createOutputFile(translatorOutput.getToscaServiceModel(), null);
-
- }
- private void addFilesToTranslator(TranslationContext translationContext, String path)
- throws IOException {
- File manifestFile = new File(path);
- File[] files = manifestFile.listFiles();
- byte[] fileContent;
+ private void addFilesToTranslator(TranslationContext translationContext, String path) throws IOException {
+ File manifestFile = new File(path);
+ File[] files = manifestFile.listFiles();
+ byte[] fileContent;
- Assert.assertNotNull("manifest files is empty", files);
+ Assert.assertNotNull("manifest files is empty", files);
- for (File file : files) {
+ for (File file : files) {
- try (FileInputStream fis = new FileInputStream(file)) {
+ try (FileInputStream fis = new FileInputStream(file)) {
- fileContent = FileUtils.toByteArray(fis);
+ fileContent = FileUtils.toByteArray(fis);
- if (file.getName().equals(MANIFEST_NAME)) {
- addManifest(translationContext, fileContent);
- } else {
- String validationFilename = "validationOutput.json";
- String zipFilename = "VSP.zip";
- if (!file.getName().equals(zipFilename) && (!file.getName().equals(validationFilename))) {
- addFile(translationContext, file.getName(), fileContent);
- }
+ if (file.getName().equals(MANIFEST_NAME)) {
+ addManifest(translationContext, fileContent);
+ } else {
+ String validationFilename = "validationOutput.json";
+ String zipFilename = "VSP.zip";
+ if (!file.getName().equals(zipFilename) && (!file.getName().equals(validationFilename))) {
+ addFile(translationContext, file.getName(), fileContent);
+ }
+ }
+ }
}
- }
}
- }
-
- private static void addManifest(TranslationContext translationContext,
- byte[] content) {
- ManifestContent manifestData = JsonUtil.json2Object(new String(content), ManifestContent.class);
- ManifestFile manifest = new ManifestFile();
- manifest.setName(MANIFEST_NAME);
- manifest.setContent(manifestData);
- translationContext.setManifest(manifest);
- translationContext.addFile(MANIFEST_NAME, content);
- addFilesFromManifestToTranslationContextManifestFilesMap(translationContext, manifestData
- .getData());
- }
-
- private static void addFile(TranslationContext translationContext,
- String name, byte[] content) {
- translationContext.addFile(name, content);
- }
-
- private static void addFilesFromManifestToTranslationContextManifestFilesMap(
- TranslationContext translationContext, List<FileData> fileDataListFromManifest) {
- for (FileData fileFromManfiest : fileDataListFromManifest) {
- translationContext.addManifestFile(fileFromManfiest.getFile(), fileFromManfiest.getType());
+
+ private static void addManifest(TranslationContext translationContext, byte[] content) {
+ ManifestContent manifestData = JsonUtil.json2Object(new String(content), ManifestContent.class);
+ ManifestFile manifest = new ManifestFile();
+ manifest.setName(MANIFEST_NAME);
+ manifest.setContent(manifestData);
+ translationContext.setManifest(manifest);
+ translationContext.addFile(MANIFEST_NAME, content);
+ addFilesFromManifestToTranslationContextManifestFilesMap(translationContext, manifestData.getData());
+ }
+
+ private static void addFile(TranslationContext translationContext, String name, byte[] content) {
+ translationContext.addFile(name, content);
}
- }
-
- void validateNodeTemplateIdInNestedConsolidationData(){
- ConsolidationData consolidationData = translationContext.getConsolidationData();
- Map<String, ServiceTemplate> expectedServiceTemplateModels = TestUtils.getServiceTemplates
- (expectedResultMap);
- Assert.assertNotNull(consolidationData);
- validateNestedConsolidationDataNodeTemplateIds(consolidationData,expectedServiceTemplateModels);
- }
-
- protected void validateComputeTemplateConsolidationData(ConsolidationDataValidationType
- validationType,
- String testName) {
- ConsolidationData consolidationData = translationContext.getConsolidationData();
- Map<String, ServiceTemplate> expectedServiceTemplateModels = TestUtils.getServiceTemplates
- (expectedResultMap);
- Assert.assertNotNull(consolidationData);
- Assert.assertNotNull(consolidationData.getComputeConsolidationData());
- Set<String> serviceTemplateFileNames = consolidationData.getComputeConsolidationData()
- .getAllServiceTemplateFileNames();
- Assert.assertNotNull(serviceTemplateFileNames);
- for(String serviceTemplateName : serviceTemplateFileNames){
- Assert.assertTrue(expectedServiceTemplateModels.containsKey(serviceTemplateName));
- ServiceTemplate expectedServiceTemplate = expectedServiceTemplateModels.get
- (serviceTemplateName);
- FileComputeConsolidationData fileComputeConsolidationData = consolidationData
- .getComputeConsolidationData().getFileComputeConsolidationData(serviceTemplateName);
- Assert.assertNotNull(fileComputeConsolidationData);
- Set<String> computeTypes = fileComputeConsolidationData.getAllComputeTypes();
- Assert.assertNotNull(computeTypes);
- for(String computeType : computeTypes) {
- TypeComputeConsolidationData typeComputeConsolidationData = fileComputeConsolidationData
- .getTypeComputeConsolidationData(computeType);
- Assert.assertNotNull(typeComputeConsolidationData);
-
- Collection<String> computeNodeTemplateIds = typeComputeConsolidationData
- .getAllComputeNodeTemplateIds();
- Assert.assertNotNull(computeNodeTemplateIds);
- Assert.assertNotEquals(computeNodeTemplateIds.size(), 0);
-
- for(String computeNodeTemplateId : computeNodeTemplateIds) {
- ComputeTemplateConsolidationData computeTemplateConsolidationData =
- typeComputeConsolidationData.getComputeTemplateConsolidationData
- (computeNodeTemplateId);
- switch(validationType){
- case VALIDATE_GROUP:
- validateGroupsInConsolidationData(computeNodeTemplateId,
- computeTemplateConsolidationData, expectedServiceTemplate);
- break;
- case VALIDATE_PORT:
- validatePortsInConsolidationData(computeNodeTemplateId,
- computeTemplateConsolidationData,
- expectedServiceTemplate);
- break;
- case VALIDATE_VOLUME:
- validateVolumeInConsolidationData(computeNodeTemplateId,
- computeTemplateConsolidationData, expectedServiceTemplate, testName);
- break;
- case VALIDATE_CONNECTIVITY:
- validateComputeConnectivityIn(computeTemplateConsolidationData,
- expectedServiceTemplate);
- validateComputeConnectivityOut(computeNodeTemplateId, computeTemplateConsolidationData,
- expectedServiceTemplate);
- break;
- case VALIDATE_DEPENDS_ON:
- validateDependsOnInConsolidationData(computeNodeTemplateId,
- computeTemplateConsolidationData,
- expectedServiceTemplate, testName);
- break;
- }
+
+ private static void addFilesFromManifestToTranslationContextManifestFilesMap(TranslationContext translationContext,
+ List<FileData> fileDataListFromManifest) {
+ for (FileData fileFromManfiest : fileDataListFromManifest) {
+ translationContext.addManifestFile(fileFromManfiest.getFile(), fileFromManfiest.getType());
+ }
+ }
+
+ void validateNodeTemplateIdInNestedConsolidationData() {
+ ConsolidationData consolidationData = translationContext.getConsolidationData();
+ Map<String, ServiceTemplate> expectedServiceTemplateModels = TestUtils.getServiceTemplates(expectedResultMap);
+ Assert.assertNotNull(consolidationData);
+ validateNestedConsolidationDataNodeTemplateIds(consolidationData, expectedServiceTemplateModels);
+ }
+
+ protected void validateComputeTemplateConsolidationData(ConsolidationDataValidationType validationType,
+ String testName) {
+ ConsolidationData consolidationData = translationContext.getConsolidationData();
+ Map<String, ServiceTemplate> expectedServiceTemplateModels = TestUtils.getServiceTemplates(expectedResultMap);
+ Assert.assertNotNull(consolidationData);
+ Assert.assertNotNull(consolidationData.getComputeConsolidationData());
+ Set<String> serviceTemplateFileNames =
+ consolidationData.getComputeConsolidationData().getAllServiceTemplateFileNames();
+ Assert.assertNotNull(serviceTemplateFileNames);
+ for (String serviceTemplateName : serviceTemplateFileNames) {
+ Assert.assertTrue(expectedServiceTemplateModels.containsKey(serviceTemplateName));
+ ServiceTemplate expectedServiceTemplate = expectedServiceTemplateModels.get(serviceTemplateName);
+ FileComputeConsolidationData fileComputeConsolidationData = consolidationData.getComputeConsolidationData()
+ .getFileComputeConsolidationData(
+ serviceTemplateName);
+ Assert.assertNotNull(fileComputeConsolidationData);
+ Set<String> computeTypes = fileComputeConsolidationData.getAllComputeTypes();
+ Assert.assertNotNull(computeTypes);
+ for (String computeType : computeTypes) {
+ TypeComputeConsolidationData typeComputeConsolidationData =
+ fileComputeConsolidationData.getTypeComputeConsolidationData(computeType);
+ Assert.assertNotNull(typeComputeConsolidationData);
+
+ Collection<String> computeNodeTemplateIds = typeComputeConsolidationData.getAllComputeNodeTemplateIds();
+ Assert.assertNotNull(computeNodeTemplateIds);
+ Assert.assertNotEquals(computeNodeTemplateIds.size(), 0);
+
+ for (String computeNodeTemplateId : computeNodeTemplateIds) {
+ ComputeTemplateConsolidationData computeTemplateConsolidationData =
+ typeComputeConsolidationData.getComputeTemplateConsolidationData(computeNodeTemplateId);
+ switch (validationType) {
+ case VALIDATE_GROUP:
+ validateGroupsInConsolidationData(computeNodeTemplateId, computeTemplateConsolidationData,
+ expectedServiceTemplate);
+ break;
+ case VALIDATE_PORT:
+ validatePortsInConsolidationData(computeNodeTemplateId, computeTemplateConsolidationData,
+ expectedServiceTemplate);
+ break;
+ case VALIDATE_VOLUME:
+ validateVolumeInConsolidationData(computeNodeTemplateId, computeTemplateConsolidationData,
+ expectedServiceTemplate, testName);
+ break;
+ case VALIDATE_CONNECTIVITY:
+ validateComputeConnectivityIn(computeTemplateConsolidationData, expectedServiceTemplate);
+ validateComputeConnectivityOut(computeNodeTemplateId, computeTemplateConsolidationData,
+ expectedServiceTemplate);
+ break;
+ case VALIDATE_DEPENDS_ON:
+ validateDependsOnInConsolidationData(computeNodeTemplateId,
+ computeTemplateConsolidationData, expectedServiceTemplate, testName);
+ break;
+ }
+ }
+ }
}
- }
}
- }
protected void validateGetAttribute(String testName) {
validateGetAttr(translationContext, testName);
}
- protected void validateNestedTemplateConsolidationData(String testName){
- validateNestedConsolidationData(translationContext, testName);
- }
-
- void validatePortTemplateConsolidationData() {
- ConsolidationData consolidationData = translationContext.getConsolidationData();
- Map<String, ServiceTemplate> expectedServiceTemplateModels = TestUtils.getServiceTemplates
- (expectedResultMap);
- Assert.assertNotNull(consolidationData);
- Assert.assertNotNull(consolidationData.getPortConsolidationData());
- Set<String> serviceTemplateFileNames = consolidationData.getPortConsolidationData()
- .getAllServiceTemplateFileNames();
- Assert.assertNotNull(serviceTemplateFileNames);
- for(String serviceTemplateName : serviceTemplateFileNames){
- Assert.assertTrue(expectedServiceTemplateModels.containsKey(serviceTemplateName));
- ServiceTemplate expectedServiceTemplate = expectedServiceTemplateModels.get
- (serviceTemplateName);
- FilePortConsolidationData filePortConsolidationData = consolidationData
- .getPortConsolidationData().getFilePortConsolidationData(serviceTemplateName);
- Assert.assertNotNull(filePortConsolidationData);
-
- Set<String> portNodeTemplateIds = filePortConsolidationData.getAllPortNodeTemplateIds();
- Assert.assertNotNull(portNodeTemplateIds);
- Assert.assertNotEquals(portNodeTemplateIds.size(), 0);
-
- for(String portNodeTemplateId : portNodeTemplateIds) {
- PortTemplateConsolidationData portTemplateConsolidationData =
- filePortConsolidationData.getPortTemplateConsolidationData(portNodeTemplateId);
- switch(ConsolidationDataValidationType.VALIDATE_CONNECTIVITY){
- case VALIDATE_CONNECTIVITY:
- validatePortConnectivityIn(portTemplateConsolidationData,expectedServiceTemplate);
- validatePortConnectivityOut(portNodeTemplateId, portTemplateConsolidationData, expectedServiceTemplate);
- break;
+ protected void validateNestedTemplateConsolidationData(String testName) {
+ validateNestedConsolidationData(translationContext, testName);
+ }
+
+ void validatePortTemplateConsolidationData() {
+ ConsolidationData consolidationData = translationContext.getConsolidationData();
+ Map<String, ServiceTemplate> expectedServiceTemplateModels = TestUtils.getServiceTemplates(expectedResultMap);
+ Assert.assertNotNull(consolidationData);
+ Assert.assertNotNull(consolidationData.getPortConsolidationData());
+ Set<String> serviceTemplateFileNames =
+ consolidationData.getPortConsolidationData().getAllServiceTemplateFileNames();
+ Assert.assertNotNull(serviceTemplateFileNames);
+ for (String serviceTemplateName : serviceTemplateFileNames) {
+ Assert.assertTrue(expectedServiceTemplateModels.containsKey(serviceTemplateName));
+ ServiceTemplate expectedServiceTemplate = expectedServiceTemplateModels.get(serviceTemplateName);
+ FilePortConsolidationData filePortConsolidationData =
+ consolidationData.getPortConsolidationData().getFilePortConsolidationData(serviceTemplateName);
+ Assert.assertNotNull(filePortConsolidationData);
+
+ Set<String> portNodeTemplateIds = filePortConsolidationData.getAllPortNodeTemplateIds();
+ Assert.assertNotNull(portNodeTemplateIds);
+ Assert.assertNotEquals(portNodeTemplateIds.size(), 0);
+
+ for (String portNodeTemplateId : portNodeTemplateIds) {
+ PortTemplateConsolidationData portTemplateConsolidationData =
+ filePortConsolidationData.getPortTemplateConsolidationData(portNodeTemplateId);
+ switch (ConsolidationDataValidationType.VALIDATE_CONNECTIVITY) {
+ case VALIDATE_CONNECTIVITY:
+ validatePortConnectivityIn(portTemplateConsolidationData, expectedServiceTemplate);
+ validatePortConnectivityOut(portNodeTemplateId, portTemplateConsolidationData,
+ expectedServiceTemplate);
+ break;
+ }
+ }
}
- }
}
- }
}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImplTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImplTest.java
index b19c822d11..1d6e6b1a9e 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImplTest.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerImplTest.java
@@ -24,7 +24,7 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.openecomp.sdc.common.togglz.ToggleableFeature;
+import org.openecomp.sdc.be.togglz.ToggleableFeature;
import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataValidationType;
import org.togglz.testing.TestFeatureManagerProvider;