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 2018/09/04 23:44:21 UTC

[2/3] brooklyn-server git commit: Adds testDslLocationIndexOutOfBounds

Adds testDslLocationIndexOutOfBounds


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

Branch: refs/heads/master
Commit: f996bfe9757bb8f98f353d19c637fcce6bf2dbc1
Parents: 6b157a3
Author: Aled Sage <al...@gmail.com>
Authored: Mon Sep 3 14:55:27 2018 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Tue Sep 4 15:38:49 2018 +0100

----------------------------------------------------------------------
 .../camp/brooklyn/DslAndRebindYamlTest.java     | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f996bfe9/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/DslAndRebindYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/DslAndRebindYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/DslAndRebindYamlTest.java
index 7567885..67cb48f 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/DslAndRebindYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/DslAndRebindYamlTest.java
@@ -468,6 +468,28 @@ public class DslAndRebindYamlTest extends AbstractYamlRebindTest {
     }
 
     @Test
+    public void testDslLocationIndexOutOfBounds() throws Exception {
+        String yaml = Joiner.on("\n").join(
+                "location: localhost",
+                "services:",
+                "- type: " + BasicApplication.class.getName(),
+                "  brooklyn.config:",
+                "    config1: $brooklyn:location(\"1\")");
+
+        Application app = (Application) createStartWaitAndLogApplication(yaml);
+
+        try {
+            getConfigInTask(app, ConfigKeys.newConfigKey(Object.class, "config1"));
+            Asserts.shouldHaveFailedPreviously();
+        } catch (Exception e) {
+            Asserts.expectedFailureContains(e, "has 1 location", "but requested index 1");
+            if (Exceptions.getFirstThrowableOfType(e, IndexOutOfBoundsException.class) == null) {
+                throw e;
+            }
+        }
+    }
+
+    @Test
     public void testDslLocationInEntity() throws Exception {
         String yaml = Joiner.on("\n").join(
                 "services:",