From 218cbcd7ee3b2b02acd59a831536cf811df7d400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Alcarraz?= Date: Tue, 27 Dec 2022 12:53:26 -0500 Subject: [PATCH] Allow fields to be resolved by environment properties. In ClientSimulator message templates. --- .../src/main/java/org/jpos/simulator/TestRunner.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/client-simulator/src/main/java/org/jpos/simulator/TestRunner.java b/modules/client-simulator/src/main/java/org/jpos/simulator/TestRunner.java index f3e84f96d2..50ffb5b5ec 100644 --- a/modules/client-simulator/src/main/java/org/jpos/simulator/TestRunner.java +++ b/modules/client-simulator/src/main/java/org/jpos/simulator/TestRunner.java @@ -23,6 +23,7 @@ import java.io.FileInputStream; import java.util.*; +import org.jpos.core.Environment; import org.jpos.iso.*; import org.jpos.iso.packager.XMLPackager; import org.jpos.util.Logger; @@ -352,7 +353,7 @@ private ISOMsg applyRequestProps (ISOMsg m, Interpreter bsh) if (c instanceof ISOMsg) { applyRequestProps ((ISOMsg) c, bsh); } else if (c instanceof ISOField) { - String value = (String) c.getValue(); + String value = Environment.get((String) c.getValue()); if (value.length() > 0) { try { if (value.charAt (0) == '!') { @@ -360,6 +361,9 @@ private ISOMsg applyRequestProps (ISOMsg m, Interpreter bsh) } else if (value.charAt (0) == '#') { m.set (i, ISOUtil.hex2byte(bsh.eval (value.substring(1)).toString())); + } + else if (!value.equals(c.getValue())) { + m.set (i, value); } } catch (NullPointerException e) { m.unset (i);