brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (BROOKLYN-565) brooklyn:object with nested DSL inside list is not resolved
Date Thu, 23 Nov 2017 16:17:00 GMT

    [ https://issues.apache.org/jira/browse/BROOKLYN-565?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16264548#comment-16264548
] 

ASF GitHub Bot commented on BROOKLYN-565:
-----------------------------------------

Github user aledsage commented on the issue:

    https://github.com/apache/brooklyn-server/pull/904
  
    retest this please


> brooklyn:object with nested DSL inside list is not resolved
> -----------------------------------------------------------
>
>                 Key: BROOKLYN-565
>                 URL: https://issues.apache.org/jira/browse/BROOKLYN-565
>             Project: Brooklyn
>          Issue Type: Bug
>            Reporter: Aled Sage
>
> When using {{$brooklyn:object}} with a nested DSL expression that is contained within
a list, it does not resolve the nested DSL expression.
> This is because it thinks that deferred-evaluation is not necessary. It constructs the
object immediately - we end up with a DSL object in the list rather than the resolved value.
> The workaround is to include {{deferred: true}} inside the brooklyn object.
> The problem does not happen if there are any other top-level values in {{brooklyn.fields}}
that are DSL expressions (it realises then that it must defer the evaluation).
> This is demonstrated by adding the following tests to {{ObjectsYamlTest}}:
> {noformat}
>     @Test
>     public void testFieldOfTypeListAsDeferredSuppliersExplicitlyDeferred() throws Exception
{
>         // Using explicit `deferred: true`
>         Entity testEntity = setupAndCheckTestEntityInBasicYamlWith(
>             "  brooklyn.config:",
>             "    mystring: myval",
>             "    myint: 123",
>             "    test.confObject:",
>             "      $brooklyn:object:",
>             "        type: "+ObjectsYamlTest.class.getName()+"$TestObject",
>             "        deferred: true",
>             "        object.fields:",
>             "          list: ",
>             "          - $brooklyn:config(\"mystring\")");
>         TestObject testObject = (TestObject) testEntity.getConfig(TestEntity.CONF_OBJECT);
>         Assert.assertEquals(testObject.getList(), ImmutableList.of("myval"));
>     }
>     
>     // Fails if don't include `deferred: true`
>     // see {@link #testFieldOfTypeListAsDeferredSuppliersExplicitlyDeferred()}
>     @Test(groups="Broken")
>     public void testFieldOfTypeListAsDeferredSuppliers() throws Exception {
>         // should defer evaluation automatically, and resolve config
>         Entity testEntity = setupAndCheckTestEntityInBasicYamlWith(
>             "  brooklyn.config:",
>             "    mystring: myval",
>             "    myint: 123",
>             "    test.confObject:",
>             "      $brooklyn:object:",
>             "        type: "+ObjectsYamlTest.class.getName()+"$TestObject",
>             "        object.fields:",
>             "          list: ",
>             "          - $brooklyn:config(\"mystring\")");
>         TestObject testObject = (TestObject) testEntity.getConfig(TestEntity.CONF_OBJECT);
>         Assert.assertEquals(testObject.getList(), ImmutableList.of("myval"));
>     }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message