From 4622036d19b90a8e9176a00dfa63268b4125710e Mon Sep 17 00:00:00 2001 From: Ivan Fritzler Date: Wed, 16 Aug 2023 15:47:29 -0300 Subject: [PATCH 1/2] W-13588449: Parser template has different output between 4.3.0 to 4.4.0. --- ...plateLegacyDefaultTargetValueTestCase.java | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 integration/src/test/java/org/mule/test/processors/ParseTemplateLegacyDefaultTargetValueTestCase.java diff --git a/integration/src/test/java/org/mule/test/processors/ParseTemplateLegacyDefaultTargetValueTestCase.java b/integration/src/test/java/org/mule/test/processors/ParseTemplateLegacyDefaultTargetValueTestCase.java new file mode 100644 index 0000000000..ab28d760cb --- /dev/null +++ b/integration/src/test/java/org/mule/test/processors/ParseTemplateLegacyDefaultTargetValueTestCase.java @@ -0,0 +1,50 @@ +/* + * Copyright 2023 Salesforce, Inc. All rights reserved. + */ +package org.mule.test.processors; + +import io.qameta.allure.Feature; +import io.qameta.allure.Issue; +import io.qameta.allure.Story; +import org.junit.Test; +import org.mule.runtime.api.message.Message; +import org.mule.runtime.core.api.event.CoreEvent; +import org.mule.test.AbstractIntegrationTestCase; +import org.mule.test.runner.ArtifactClassLoaderRunnerConfig; +import org.mule.test.runner.RunnerConfigSystemProperty; + +import static org.junit.Assert.assertEquals; +import static org.mule.runtime.api.util.MuleSystemProperties.PARSE_TEMPLATE_USE_LEGACY_DEFAULT_TARGET_VALUE; +import static org.mule.test.allure.AllureConstants.ComponentsFeature.CORE_COMPONENTS; +import static org.mule.test.allure.AllureConstants.ComponentsFeature.ParseTemplateStory.PARSE_TEMPLATE; + +@Feature(CORE_COMPONENTS) +@Story(PARSE_TEMPLATE) +@ArtifactClassLoaderRunnerConfig( + systemProperties = { + @RunnerConfigSystemProperty( + key = PARSE_TEMPLATE_USE_LEGACY_DEFAULT_TARGET_VALUE, + value = "true") + }) +public class ParseTemplateLegacyDefaultTargetValueTestCase extends AbstractIntegrationTestCase { + + private static final String PARSED_DW_EXPRESSION = + "This template has a DW expression to parse from dw-expression flow. Remember, the name of the flow is dw-expression"; + + @Override + public String getConfigFile() { + return "org/mule/processors/parse-template-config.xml"; + } + + @Test + @Issue("W-13588449") + public void withTargetDefaultTargetValueDefinedInline() throws Exception { + String startingPayload = "Starting payload"; + CoreEvent event = flowRunner("with-target").withPayload(startingPayload).withVariable("flowName", "dw-expression").run(); + Message msg = (Message) event.getVariables().get("targetVar").getValue(); + String previousPayload = (String) event.getMessage().getPayload().getValue(); + assertEquals(PARSED_DW_EXPRESSION, msg.getPayload().getValue()); + assertEquals(previousPayload, startingPayload); + } + +} From d961cb945e2169332a4f465a2f4143ab6a1bed32 Mon Sep 17 00:00:00 2001 From: Ivan Fritzler Date: Fri, 18 Aug 2023 12:16:59 -0300 Subject: [PATCH 2/2] Moving from integration to unitary testing due to MuleArtifactFunctionalTestCase configuration limitations --- ...plateLegacyDefaultTargetValueTestCase.java | 50 ------------------- 1 file changed, 50 deletions(-) delete mode 100644 integration/src/test/java/org/mule/test/processors/ParseTemplateLegacyDefaultTargetValueTestCase.java diff --git a/integration/src/test/java/org/mule/test/processors/ParseTemplateLegacyDefaultTargetValueTestCase.java b/integration/src/test/java/org/mule/test/processors/ParseTemplateLegacyDefaultTargetValueTestCase.java deleted file mode 100644 index ab28d760cb..0000000000 --- a/integration/src/test/java/org/mule/test/processors/ParseTemplateLegacyDefaultTargetValueTestCase.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2023 Salesforce, Inc. All rights reserved. - */ -package org.mule.test.processors; - -import io.qameta.allure.Feature; -import io.qameta.allure.Issue; -import io.qameta.allure.Story; -import org.junit.Test; -import org.mule.runtime.api.message.Message; -import org.mule.runtime.core.api.event.CoreEvent; -import org.mule.test.AbstractIntegrationTestCase; -import org.mule.test.runner.ArtifactClassLoaderRunnerConfig; -import org.mule.test.runner.RunnerConfigSystemProperty; - -import static org.junit.Assert.assertEquals; -import static org.mule.runtime.api.util.MuleSystemProperties.PARSE_TEMPLATE_USE_LEGACY_DEFAULT_TARGET_VALUE; -import static org.mule.test.allure.AllureConstants.ComponentsFeature.CORE_COMPONENTS; -import static org.mule.test.allure.AllureConstants.ComponentsFeature.ParseTemplateStory.PARSE_TEMPLATE; - -@Feature(CORE_COMPONENTS) -@Story(PARSE_TEMPLATE) -@ArtifactClassLoaderRunnerConfig( - systemProperties = { - @RunnerConfigSystemProperty( - key = PARSE_TEMPLATE_USE_LEGACY_DEFAULT_TARGET_VALUE, - value = "true") - }) -public class ParseTemplateLegacyDefaultTargetValueTestCase extends AbstractIntegrationTestCase { - - private static final String PARSED_DW_EXPRESSION = - "This template has a DW expression to parse from dw-expression flow. Remember, the name of the flow is dw-expression"; - - @Override - public String getConfigFile() { - return "org/mule/processors/parse-template-config.xml"; - } - - @Test - @Issue("W-13588449") - public void withTargetDefaultTargetValueDefinedInline() throws Exception { - String startingPayload = "Starting payload"; - CoreEvent event = flowRunner("with-target").withPayload(startingPayload).withVariable("flowName", "dw-expression").run(); - Message msg = (Message) event.getVariables().get("targetVar").getValue(); - String previousPayload = (String) event.getMessage().getPayload().getValue(); - assertEquals(PARSED_DW_EXPRESSION, msg.getPayload().getValue()); - assertEquals(previousPayload, startingPayload); - } - -}