APEXCORE-303 Added unit test

Project: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-apex-core/commit/42ac8ae0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/tree/42ac8ae0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-apex-core/diff/42ac8ae0

Branch: refs/heads/master
Commit: 42ac8ae05b1b4fb2cffc09dcc9dcb17e2c2665c7
Parents: ec0c88b
Author: David Yan <[email protected]>
Authored: Fri Jan 8 16:44:08 2016 -0800
Committer: David Yan <[email protected]>
Committed: Fri Jan 8 16:44:08 2016 -0800

----------------------------------------------------------------------
 .../stram/client/StramClientUtilsTest.java           | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-apex-core/blob/42ac8ae0/engine/src/test/java/com/datatorrent/stram/client/StramClientUtilsTest.java
----------------------------------------------------------------------
diff --git 
a/engine/src/test/java/com/datatorrent/stram/client/StramClientUtilsTest.java 
b/engine/src/test/java/com/datatorrent/stram/client/StramClientUtilsTest.java
index 51193ef..bb67020 100644
--- 
a/engine/src/test/java/com/datatorrent/stram/client/StramClientUtilsTest.java
+++ 
b/engine/src/test/java/com/datatorrent/stram/client/StramClientUtilsTest.java
@@ -76,6 +76,21 @@ public class StramClientUtilsTest
     Assert.assertEquals("1111 123 xxx foobar yyy", prop.get("var.result"));
   }
 
+  @Test
+  public void testEvalConfiguration() throws Exception
+  {
+    Configuration conf = new Configuration();
+    conf.set("a.b.c", "123");
+    conf.set("x.y.z", "foobar");
+    conf.set("sub.result", "1111 ${a.b.c} xxx ${x.y.z} yyy");
+    conf.set("script.result", "1111 {% (_prop[\"a.b.c\"] * 
_prop[\"a.b.c\"]).toFixed(0) %} xxx");
+
+    StramClientUtils.evalConfiguration(conf);
+
+    Assert.assertEquals("1111 123 xxx foobar yyy", conf.get("sub.result"));
+    Assert.assertEquals("1111 15129 xxx", conf.get("script.result"));
+  }
+
   private String getHostString(String host) throws UnknownHostException
   {
     InetAddress address = InetAddress.getByName(host);

Reply via email to