aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test
diff options
context:
space:
mode:
authorojasdubey <ojas.dubey@amdocs.com>2018-05-29 17:58:56 +0530
committerOren Kleks <orenkle@amdocs.com>2018-05-31 14:01:02 +0000
commita8d58165f25ff2cde93ed623f0ebbf78fcd82057 (patch)
tree4cbefda35217f2c75dbe16e1041ee8b815bdd4ad /openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test
parentba61c887dbcb1b81e31e15b18a44f68ff344b2fb (diff)
Refactor Onboarding Function Translation code
1. Fixed sonar violations and static analysis issues for function translation 2. Refactored methods for code smells Note: The below files are modified to keep successful compilation and will be handled separately in a different commit (i) HeatToToscaUtil (ii) TranslatorHeatToToscaParameterConverter (iii) TranslatorHeatToToscaPropertyConverter Change-Id: I75472c2848d1eb812468e7d6457c8da96d6c0e4e Issue-ID: SDC-1331 Signed-off-by: ojasdubey <ojas.dubey@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test')
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetAttrImplTest.java20
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetFileImplTest.java42
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetParamImplTest.java225
3 files changed, 139 insertions, 148 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetAttrImplTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetAttrImplTest.java
index 878183b239..a7bcf04e4b 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetAttrImplTest.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetAttrImplTest.java
@@ -1,12 +1,28 @@
+/*
+ * Copyright © 2016-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.
+ */
+
package org.openecomp.sdc.translator.services.heattotosca.impl.functiontranslation;
+import java.io.IOException;
+
import org.junit.Before;
import org.junit.Test;
import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants;
import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseResourceTranslationTest;
-import java.io.IOException;
-
public class FunctionTranslationGetAttrImplTest extends BaseResourceTranslationTest {
@Override
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetFileImplTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetFileImplTest.java
index 023c0f5937..76f0c61eb0 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetFileImplTest.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetFileImplTest.java
@@ -1,43 +1,37 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-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.translator.services.heattotosca.impl.functiontranslation;
+import static org.openecomp.sdc.translator.services.heattotosca.impl.functiontranslation.FunctionTranslator.getFunctionTranslateTo;
+
+import java.util.HashMap;
+import java.util.List;
+
import org.junit.Assert;
import org.junit.Test;
+import org.onap.sdc.tosca.datatypes.model.NodeTemplate;
import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.sdc.heat.datatypes.model.HeatOrchestrationTemplate;
-import org.onap.sdc.tosca.datatypes.model.NodeTemplate;
import org.openecomp.sdc.tosca.services.ToscaConstants;
import org.openecomp.sdc.tosca.services.ToscaFileOutputService;
import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl;
import org.openecomp.sdc.translator.datatypes.heattotosca.TranslationContext;
import org.openecomp.sdc.translator.services.heattotosca.FunctionTranslationFactory;
-import java.util.HashMap;
-import java.util.List;
-
-/**
- * @author SHIRIA
- * @since December 18, 2016.
- */
public class FunctionTranslationGetFileImplTest {
@Test
public void testGetFileWithExtensionFunction() {
@@ -71,18 +65,18 @@ public class FunctionTranslationGetFileImplTest {
HeatOrchestrationTemplate heatOrchestrationTemplate,
NodeTemplate nodeTemplate,
TranslationContext context) {
- Assert.assertEquals(true, FunctionTranslationFactory.getInstance(functionName).isPresent());
+ Assert.assertTrue(FunctionTranslationFactory.getInstance(functionName).isPresent());
if(FunctionTranslationFactory.getInstance(functionName).isPresent()) {
+ FunctionTranslator functionTranslator = new FunctionTranslator(getFunctionTranslateTo(null, null, heatFileName,
+ heatOrchestrationTemplate, context), null, function, nodeTemplate);
Object result = FunctionTranslationFactory.getInstance(functionName).get()
- .translateFunction(null, null, null, functionName, function, heatFileName,
- heatOrchestrationTemplate,
- nodeTemplate, context);
+ .translateFunction(functionTranslator);
Assert.assertNotNull(((HashMap) result).get("get_artifact"));
List artifactParameters = (List) ((HashMap) result).get("get_artifact");
Assert.assertNotNull(artifactParameters);
- Assert.assertEquals(artifactParameters.size(), 2);
- Assert.assertEquals(artifactParameters.get(0), ToscaConstants.MODELABLE_ENTITY_NAME_SELF);
- Assert.assertEquals(artifactParameters.get(1), ((String) function).split("\\.")[0]);
+ Assert.assertEquals(2, artifactParameters.size());
+ Assert.assertEquals(ToscaConstants.MODELABLE_ENTITY_NAME_SELF, artifactParameters.get(0));
+ Assert.assertEquals(((String) function).split("\\.")[0], artifactParameters.get(1));
Assert.assertNotNull(nodeTemplate.getArtifacts());
Assert.assertNotNull(
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetParamImplTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetParamImplTest.java
index 860074ba70..d29e4af4e8 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetParamImplTest.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/functiontranslation/FunctionTranslationGetParamImplTest.java
@@ -1,28 +1,25 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-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.translator.services.heattotosca.impl.functiontranslation;
-import org.junit.Before;
-import org.junit.Test;
-import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseResourceTranslationTest;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.openecomp.sdc.translator.services.heattotosca.impl.functiontranslation.FunctionTranslator.getFunctionTranslateTo;
import java.io.IOException;
import java.util.ArrayList;
@@ -30,8 +27,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import org.junit.Before;
+import org.junit.Test;
+import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseResourceTranslationTest;
public class FunctionTranslationGetParamImplTest extends BaseResourceTranslationTest {
@@ -42,150 +40,136 @@ public class FunctionTranslationGetParamImplTest extends BaseResourceTranslation
}
@Test
- public void testStringGetParamFuncValue() throws Exception {
+ public void testStringGetParamFuncValue() {
FunctionTranslationGetParamImpl translationImpl = new FunctionTranslationGetParamImpl();
String functionValue = "parameter1";
- Object translatedFunc = translationImpl.translateFunction(null, null, null, "get_param",
- functionValue, "dummy", null, null, null);
+ FunctionTranslator functionTranslator = new FunctionTranslator(getFunctionTranslateTo(null, null, "dummy", null,
+ null), null, functionValue, null);
+ Object translatedFunc = translationImpl.translateFunction(functionTranslator);
- assertEquals(true, translatedFunc instanceof Map);
- if (translatedFunc instanceof Map) {
- assertNotNull(((Map) translatedFunc).get("get_input"));
- assertEquals(functionValue, ((Map) translatedFunc).get("get_input"));
- }
+ assertTrue(translatedFunc instanceof Map);
+ assertNotNull(((Map) translatedFunc).get("get_input"));
+ assertEquals(functionValue, ((Map) translatedFunc).get("get_input"));
}
@Test
- public void testListGetParamFuncValue() throws Exception {
+ public void testListGetParamFuncValue() {
FunctionTranslationGetParamImpl translationImpl = new FunctionTranslationGetParamImpl();
- List functionValue = new ArrayList();
+ List<Object> functionValue = new ArrayList<>();
functionValue.add("parameter1");
functionValue.add(0);
functionValue.add("key1");
- Object translatedFunc = translationImpl.translateFunction(null, null, null,"get_param",
- functionValue, "dummy", null, null, null);
+ FunctionTranslator functionTranslator = new FunctionTranslator(getFunctionTranslateTo(null, null, "dummy", null,
+ null), null, functionValue, null);
+ Object translatedFunc = translationImpl.translateFunction(functionTranslator);
- assertEquals(true, translatedFunc instanceof Map);
- if (translatedFunc instanceof Map) {
- assertNotNull(((Map) translatedFunc).get("get_input"));
- Object translatedFunValue = ((Map) translatedFunc).get("get_input");
- assertEquals(true, translatedFunValue instanceof List);
- if (translatedFunValue instanceof List) {
+ assertTrue(translatedFunc instanceof Map);
+ assertNotNull(((Map) translatedFunc).get("get_input"));
+ Object translatedFunValue = ((Map) translatedFunc).get("get_input");
+ assertTrue(translatedFunValue instanceof List);
- assertEquals(functionValue.get(0), ((List) translatedFunValue).get(0));
- assertEquals(functionValue.get(1), ((List) translatedFunValue).get(1));
- assertEquals(functionValue.get(2), ((List) translatedFunValue).get(2));
- }
- }
+ assertEquals(functionValue.get(0), ((List) translatedFunValue).get(0));
+ assertEquals(functionValue.get(1), ((List) translatedFunValue).get(1));
+ assertEquals(functionValue.get(2), ((List) translatedFunValue).get(2));
}
@Test
- public void testMapGetParamFuncValue() throws Exception {
+ public void testMapGetParamFuncValue() {
// input heat function expression
//{get_param: [parameter1, {get_param:indexParam}, key1]}
// output translated function expression
//{get_input: [parameter1, {get_input:indexParam}, key1]}
FunctionTranslationGetParamImpl translationImpl = new FunctionTranslationGetParamImpl();
- List functionValue = new ArrayList();
+ List<Object> functionValue = new ArrayList<>();
functionValue.add("parameter1");
- Map innerParamMap = new HashMap();
+ Map<String, String> innerParamMap = new HashMap<>();
innerParamMap.put("get_param", "indexParam");
functionValue.add(innerParamMap);
functionValue.add("key1");
- Object translatedFunc = translationImpl.translateFunction(null, null, null, "get_param",
- functionValue, "dummy", null, null, null);
-
- assertEquals(true, translatedFunc instanceof Map);
- if (translatedFunc instanceof Map) {
- assertNotNull(((Map) translatedFunc).get("get_input"));
- Object translatedFunValue = ((Map) translatedFunc).get("get_input");
- assertEquals(true, translatedFunValue instanceof List);
- if (translatedFunValue instanceof List) {
- assertEquals(functionValue.get(0), ((List) translatedFunValue).get(0));
- assertEquals(functionValue.get(2), ((List) translatedFunValue).get(2));
- assertEquals(true, ((List) translatedFunValue).get(1) instanceof Map);
- if (((List) translatedFunValue).get(1) instanceof Map) {
- assertEquals(innerParamMap.get("get_param"), ((Map) ((List) translatedFunValue).get(1))
+ FunctionTranslator functionTranslator = new FunctionTranslator(getFunctionTranslateTo(null, null, "dummy", null,
+ null), null, functionValue, null);
+ Object translatedFunc = translationImpl.translateFunction(functionTranslator);
+
+ assertTrue(translatedFunc instanceof Map);
+ assertNotNull(((Map) translatedFunc).get("get_input"));
+ Object translatedFunValue = ((Map) translatedFunc).get("get_input");
+ assertTrue(translatedFunValue instanceof List);
+ assertEquals(functionValue.get(0), ((List) translatedFunValue).get(0));
+ assertEquals(functionValue.get(2), ((List) translatedFunValue).get(2));
+ assertTrue(((List) translatedFunValue).get(1) instanceof Map);
+ if (((List) translatedFunValue).get(1) instanceof Map) {
+ assertEquals(innerParamMap.get("get_param"), ((Map) ((List) translatedFunValue).get(1))
.get("get_input"));
- }
- }
-
}
+
}
@Test
- public void testMapWithMapGetParamFuncValue() throws Exception {
+ public void testMapWithMapGetParamFuncValue() {
// input heat function expression
//{get_param: [parameter1, {get_param:[parameter2, {get_param:indexParam}]}, key1]}
// output translated function expression
//{get_input: [parameter1, {get_input:[parameter2, {get_input:indexParam}]}, key1]}
FunctionTranslationGetParamImpl translationImpl = new FunctionTranslationGetParamImpl();
- List functionValue = new ArrayList();
+ List<Object> functionValue = new ArrayList<>();
functionValue.add("parameter1");
- Map firstInnerParamMap = new HashMap();
- Map secondInnerParamMap = new HashMap();
+ Map<String, Object> firstInnerParamMap = new HashMap<>();
+ Map<String, String> secondInnerParamMap = new HashMap<>();
secondInnerParamMap.put("get_param", "indexParam");
- List innerfunction = new ArrayList();
+ List<Object> innerfunction = new ArrayList<>();
innerfunction.add("parameter2");
innerfunction.add(secondInnerParamMap);
firstInnerParamMap.put("get_param", innerfunction);
functionValue.add(firstInnerParamMap);
functionValue.add("key1");
- Object translatedFunc = translationImpl.translateFunction(null, null, null, "get_param",
- functionValue, "dummy", null, null, null);
-
- assertEquals(true, translatedFunc instanceof Map);
- if (translatedFunc instanceof Map) {
- assertNotNull(((Map) translatedFunc).get("get_input"));
- Object translatedFunValue = ((Map) translatedFunc).get("get_input");
- assertEquals(true, translatedFunValue instanceof List);
- if (translatedFunValue instanceof List) {
- assertEquals(functionValue.get(0), ((List) translatedFunValue).get(0));
- assertEquals(functionValue.get(2), ((List) translatedFunValue).get(2));
- assertEquals(true, ((List) translatedFunValue).get(1) instanceof Map);
- if (((List) translatedFunValue).get(1) instanceof Map) {
- assertEquals(true, ((Map) ((List) translatedFunValue).get(1)).get("get_input")
- instanceof List);
- List innerTranslatedFunction =
- (List) ((Map) ((List) translatedFunValue).get(1)).get("get_input");
- assertEquals(innerfunction.get(0), innerTranslatedFunction.get(0));
- assertEquals(true, innerTranslatedFunction.get(1) instanceof Map);
- assertEquals(secondInnerParamMap.get("get_param"),
- ((Map) innerTranslatedFunction.get(1)).get("get_input"));
- }
- }
-
+ FunctionTranslator functionTranslator = new FunctionTranslator(getFunctionTranslateTo(null, null, "dummy", null,
+ null), null, functionValue, null);
+ Object translatedFunc = translationImpl.translateFunction(functionTranslator);
+
+ assertTrue(translatedFunc instanceof Map);
+ assertNotNull(((Map) translatedFunc).get("get_input"));
+ Object translatedFunValue = ((Map) translatedFunc).get("get_input");
+ assertTrue(translatedFunValue instanceof List);
+ assertEquals(functionValue.get(0), ((List) translatedFunValue).get(0));
+ assertEquals(functionValue.get(2), ((List) translatedFunValue).get(2));
+ assertTrue(((List) translatedFunValue).get(1) instanceof Map);
+ if (((List) translatedFunValue).get(1) instanceof Map) {
+ assertTrue(((Map) ((List) translatedFunValue).get(1)).get("get_input") instanceof List);
+ List innerTranslatedFunction = (List) ((Map) ((List) translatedFunValue).get(1)).get("get_input");
+ assertEquals(innerfunction.get(0), innerTranslatedFunction.get(0));
+ assertTrue(innerTranslatedFunction.get(1) instanceof Map);
+ assertEquals(secondInnerParamMap.get("get_param"), ((Map) innerTranslatedFunction.get(1)).get("get_input"));
}
}
@Test
- public void testInnerNotSupportedFuncGetParamFuncValue() throws Exception {
+ public void testInnerNotSupportedFuncGetParamFuncValue() {
// input heat function expression
//{get_param: [parameter1, {str_replace: {template:$AAkgiru, AA:{get_param:prameter2}}}, key1]}
// output translated function expression
//{get_input: [parameter1, {str_replace: {template:$AAkgiru, AA:{get_input:parameter2}}}, key1]}
FunctionTranslationGetParamImpl translationImpl = new FunctionTranslationGetParamImpl();
- List functionValue = new ArrayList();
+ List<Object> functionValue = new ArrayList<>();
functionValue.add("parameter1");
- Map templateMap = new HashMap();
+ Map<String, Object> templateMap = new HashMap<>();
templateMap.put("template", "$AAkgiru");
- Map strReplaceFuncMap = new HashMap();
- Map getParamMapInner = new HashMap();
+ Map<String, Object> strReplaceFuncMap = new HashMap<>();
+ Map<String, Object> getParamMapInner = new HashMap<>();
getParamMapInner.put("get_param", "parameter2");
templateMap.put("AA", getParamMapInner);
- Map innerParamValue = new HashMap();
+ Map<String, Object> innerParamValue = new HashMap<>();
innerParamValue.putAll(templateMap);
innerParamValue.putAll(strReplaceFuncMap);
@@ -194,34 +178,31 @@ public class FunctionTranslationGetParamImplTest extends BaseResourceTranslation
functionValue.add("key1");
- Object translatedFunc = translationImpl.translateFunction(null, null, null, "get_param",
- functionValue, "dummy", null, null, null);
-
- assertEquals(true, translatedFunc instanceof Map);
- if (translatedFunc instanceof Map) {
- assertNotNull(((Map) translatedFunc).get("get_input"));
- Object translatedFunValue = ((Map) translatedFunc).get("get_input");
- assertEquals(true, translatedFunValue instanceof List);
- if (translatedFunValue instanceof List) {
- assertEquals(functionValue.get(0), ((List) translatedFunValue).get(0));
- assertEquals(functionValue.get(2), ((List) translatedFunValue).get(2));
- assertEquals(true, ((List) translatedFunValue).get(1) instanceof Map);
- if (((List) translatedFunValue).get(1) instanceof Map) {
- assertEquals(strReplaceFuncMap.get("get_param"),
+ FunctionTranslator functionTranslator = new FunctionTranslator(getFunctionTranslateTo(null, null, "dummy", null,
+ null), null, functionValue, null);
+ Object translatedFunc = translationImpl.translateFunction(functionTranslator);
+
+ assertTrue(translatedFunc instanceof Map);
+ assertNotNull(((Map) translatedFunc).get("get_input"));
+ Object translatedFunValue = ((Map) translatedFunc).get("get_input");
+ assertTrue(translatedFunValue instanceof List);
+ assertEquals(functionValue.get(0), ((List) translatedFunValue).get(0));
+ assertEquals(functionValue.get(2), ((List) translatedFunValue).get(2));
+ assertTrue(((List) translatedFunValue).get(1) instanceof Map);
+ if (((List) translatedFunValue).get(1) instanceof Map) {
+ assertEquals(strReplaceFuncMap.get("get_param"),
((Map) ((List) translatedFunValue).get(1))
- .get("get_input"));
- }
- assertEquals(true, ((List) translatedFunValue).get(1) instanceof Map);
- if (((List) translatedFunValue).get(1) instanceof Map) {
- assertEquals(true, ((Map) ((List) translatedFunValue).get(1)).get("str_replace") instanceof Map);
- Map strReplacefunctionValue = (Map) ((Map) ((List) translatedFunValue).get(1)).get("str_replace");
- assertEquals(templateMap.get("template"), strReplacefunctionValue.get("template"));
- assertEquals(true, strReplacefunctionValue.get("AA") instanceof Map);
- if (strReplacefunctionValue.get("AA") instanceof Map) {
- assertEquals(getParamMapInner.get("get_param"), ((Map) strReplacefunctionValue.get
+ .get("get_input"));
+ }
+ assertTrue(((List) translatedFunValue).get(1) instanceof Map);
+ if (((List) translatedFunValue).get(1) instanceof Map) {
+ assertTrue(((Map) ((List) translatedFunValue).get(1)).get("str_replace") instanceof Map);
+ Map strReplacefunctionValue = (Map) ((Map) ((List) translatedFunValue).get(1)).get("str_replace");
+ assertEquals(templateMap.get("template"), strReplacefunctionValue.get("template"));
+ assertTrue(strReplacefunctionValue.get("AA") instanceof Map);
+ if (strReplacefunctionValue.get("AA") instanceof Map) {
+ assertEquals(getParamMapInner.get("get_param"), ((Map) strReplacefunctionValue.get
("AA")).get("get_input"));
- }
- }
}
}
}
@@ -229,9 +210,9 @@ public class FunctionTranslationGetParamImplTest extends BaseResourceTranslation
@Test
public void testTranslateHeatPseudoParamUsedFromMainHeat() throws Exception {
inputFilesPath =
- "/mock/services/heattotosca/heatPseudoParameters/usedFromMainHeat/inputfiles";
+ "/mock/services/heattotosca/heatPseudoParameters/usedFromMainHeat/inputfiles";
outputFilesPath =
- "/mock/services/heattotosca/heatPseudoParameters/usedFromMainHeat/expectedoutputfiles";
+ "/mock/services/heattotosca/heatPseudoParameters/usedFromMainHeat/expectedoutputfiles";
initTranslatorAndTranslate();
testTranslation();
}
@@ -239,9 +220,9 @@ public class FunctionTranslationGetParamImplTest extends BaseResourceTranslation
@Test
public void testTranslateHeatPseudoParamUsedFromNestedHeat() throws Exception {
inputFilesPath =
- "/mock/services/heattotosca/heatPseudoParameters/usedFromNestedHeat/inputfiles";
+ "/mock/services/heattotosca/heatPseudoParameters/usedFromNestedHeat/inputfiles";
outputFilesPath =
- "/mock/services/heattotosca/heatPseudoParameters/usedFromNestedHeat/expectedoutputfiles";
+ "/mock/services/heattotosca/heatPseudoParameters/usedFromNestedHeat/expectedoutputfiles";
initTranslatorAndTranslate();
testTranslation();
}