You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2017/03/02 17:01:48 UTC

[04/19] brooklyn-server git commit: add (failing) test re config loop and immediate evaluation

add (failing) test re config loop and immediate evaluation


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/4121554d
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/4121554d
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/4121554d

Branch: refs/heads/master
Commit: 4121554d8664ee11ed989428e0e84992267da634
Parents: d7c6036
Author: Alex Heneveld <al...@Alexs-MacBook-Pro.local>
Authored: Tue Dec 6 16:09:20 2016 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Tue Feb 14 16:48:10 2017 +0000

----------------------------------------------------------------------
 .../brooklyn/camp/brooklyn/ConfigYamlTest.java    | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/4121554d/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java
index 013a6f7..64700de 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigYamlTest.java
@@ -100,6 +100,16 @@ public class ConfigYamlTest extends AbstractYamlTest {
 
     @Test
     public void testRecursiveConfigFailsGracefully() throws Exception {
+        doTestRecursiveConfigFailsGracefully(false);
+    }
+    
+    // TODO this test fails because entities aren't available when evaluating immediately
+    @Test
+    public void testRecursiveConfigImmediateFailsGracefully() throws Exception {
+        doTestRecursiveConfigFailsGracefully(true);
+    }
+    
+    protected void doTestRecursiveConfigFailsGracefully(boolean immediate) throws Exception {
         String yaml = Joiner.on("\n").join(
                 "services:",
                 "- type: org.apache.brooklyn.core.test.entity.TestEntity",
@@ -126,7 +136,13 @@ public class ConfigYamlTest extends AbstractYamlTest {
         });
         t.start();
         try {
-            String c = entity.config().get(ConfigKeys.newStringConfigKey("infinite_loop"));
+            String c;
+            if (immediate) {
+                // this should throw rather than return "absent", because the error is definitive (absent means couldn't resolve in time)
+                c = entity.config().getNonBlocking(ConfigKeys.newStringConfigKey("infinite_loop")).or("FAILED");
+            } else {
+                c = entity.config().get(ConfigKeys.newStringConfigKey("infinite_loop"));
+            }
             Asserts.shouldHaveFailedPreviously("Expected recursive error, instead got: "+c);
         } catch (Exception e) {
             Asserts.expectedFailureContainsIgnoreCase(e, "infinite_loop", "recursive");