diff --git a/ReleaseNotes.md b/ReleaseNotes.md
index 0fe220f3..1cb8f1ef 100644
--- a/ReleaseNotes.md
+++ b/ReleaseNotes.md
@@ -1,4 +1,8 @@
# Bridge Service - RELEASE NOTES
+## 2.11.18 In Progress
+* [#180 Headers not usable as environment variable](https://github.com/adobe/bridgeService/issues/180). We discovered that variable expansion of headers did not cover environment variables.
+
+
## 2.11.17
* **New Feature** [#160 Introduce Extraction Plugins](https://github.com/adobe/bridgeService/issues/160). We have now introduced a new plugin mechanism so you can define how an object you are expecting should be deserialized. Please refer to the chapter on ["Deserialization Plugins"](README.md#deserialization-plugins) in the README doc.
* **New Feature** [#162 Deserializing Date Objects](https://github.com/adobe/bridgeService/issues/162). We now allow the deserialization of Date objects. You can decide the formatting of the value. For more information please refer to [Formatting Dates](README.md#formatting-dates) in the README doc.
diff --git a/integroBridgeService/pom.xml b/integroBridgeService/pom.xml
index 00f1dc25..973f9d58 100644
--- a/integroBridgeService/pom.xml
+++ b/integroBridgeService/pom.xml
@@ -154,7 +154,7 @@
com.adobe.campaign.tests.bridge.testdata
bridgeService-data
${project.parent.version}
- ${demo.project.mode}
+ compile
org.mockito
diff --git a/integroBridgeService/src/main/java/com/adobe/campaign/tests/bridge/service/JavaCalls.java b/integroBridgeService/src/main/java/com/adobe/campaign/tests/bridge/service/JavaCalls.java
index f5a0d3d3..6238ccd8 100644
--- a/integroBridgeService/src/main/java/com/adobe/campaign/tests/bridge/service/JavaCalls.java
+++ b/integroBridgeService/src/main/java/com/adobe/campaign/tests/bridge/service/JavaCalls.java
@@ -137,8 +137,15 @@ private void updateEnvironmentVariables() {
"The given environment variables should only contain strings.\n" + badVariables);
}
+
+ //Expand header args
+ Properties l_expandedProperties = new Properties();
+ getEnvironmentVariables().forEach((k, v) -> {
+ l_expandedProperties.put(k, getLocalClassLoader().getCallResultCache().getOrDefault(v, v));
+ });
+
//Fetch all environment variables
- l_setEnvironmentVars.setArgs(new Object[] { environmentVariables });
+ l_setEnvironmentVars.setArgs(new Object[] { l_expandedProperties });
try {
l_setEnvironmentVars.call(this.getLocalClassLoader());
} catch (NonExistentJavaObjectException nejoe) {
diff --git a/integroBridgeService/src/test/java/com/adobe/campaign/tests/bridge/service/TestFetchCalls.java b/integroBridgeService/src/test/java/com/adobe/campaign/tests/bridge/service/TestFetchCalls.java
index 44456aae..b2147f97 100644
--- a/integroBridgeService/src/test/java/com/adobe/campaign/tests/bridge/service/TestFetchCalls.java
+++ b/integroBridgeService/src/test/java/com/adobe/campaign/tests/bridge/service/TestFetchCalls.java
@@ -1969,6 +1969,60 @@ public void testUsingHeaders_negativePassingSecrets()
.contains("value2"));
}
+ //Issue #180 problems using heades as environment variables
+ @Test
+ public void testUsingHeadersAsEnvironmentVariables_issue180() {
+ Map l_headerMap = Map.of("key1", "value1",
+ ConfigValueHandlerIBS.SECRETS_FILTER_PREFIX.defaultValue + "key2", "boom.com");
+
+ JavaCalls l_myJavaCalls = new JavaCalls();
+
+ CallContent l_cc = new CallContent();
+ l_cc.setClassName("com.adobe.campaign.tests.bridge.testdata.two.StaticMethodsIntegrity");
+ l_cc.setMethodName("assembleBySystemValues");
+
+ Properties l_envVars = new Properties();
+ l_envVars.put("PREFIX", "key1");
+ l_envVars.put("SUFFIX", ConfigValueHandlerIBS.SECRETS_FILTER_PREFIX.defaultValue +"key2");
+
+ l_myJavaCalls.addHeaders(l_headerMap);
+ l_myJavaCalls.setEnvironmentVariables(l_envVars);
+ l_myJavaCalls.getCallContent().put("call1", l_cc);
+
+ JavaCallResults returnedValue = l_myJavaCalls.submitCalls();
+
+ assertThat("We should get a good answer back from the call",
+ returnedValue.getReturnValues().get("call1").toString(),
+ Matchers.startsWith(l_headerMap.get("key1")));
+
+ assertThat("We should get a good answer back from the call even if it is a secret",
+ returnedValue.getReturnValues().get("call1").toString(),
+ Matchers.endsWith("boom.com"));
+ }
+
+
+ @Test
+ public void testValueReplacement_issue180() {
+ Map l_headerMap = Map.of("key1", "XXXX",
+ ConfigValueHandlerIBS.SECRETS_FILTER_PREFIX.defaultValue + "key2", "value2");
+
+ JavaCalls jc = new JavaCalls();
+
+ jc.addHeaders(l_headerMap);
+
+ IntegroBridgeClassLoader icl = jc.getLocalClassLoader();
+
+ CallContent l_cc1B = new CallContent();
+ l_cc1B.setClassName(SimpleStaticMethods.class.getTypeName());
+ l_cc1B.setMethodName("methodAcceptingTwoArguments");
+ l_cc1B.setArgs(new Object[] { "key1", "B" });
+
+ Object[] result = l_cc1B.expandArgs(icl);
+ assertThat("We should have replaced the value correctly", result.length, Matchers.equalTo(2));
+ assertThat("We should have replaced the value correctly", result[0].toString(), Matchers.equalTo("XXXX"));
+
+ }
+
//#111 Var args and list -array interoperability
@Test
public void testInListToArrayTransformation() throws NoSuchMethodException, ClassNotFoundException {