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-330) Can't use YAML dsl expressions for config of HttpRequestSensor inside brooklyn.initializers
Date Tue, 06 Sep 2016 14:18:20 GMT

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

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

Github user neykov commented on the issue:

    https://github.com/apache/brooklyn-server/pull/302
  
    Thanks @aledsage, merging.


> Can't use YAML dsl expressions for config of HttpRequestSensor inside brooklyn.initializers
> -------------------------------------------------------------------------------------------
>
>                 Key: BROOKLYN-330
>                 URL: https://issues.apache.org/jira/browse/BROOKLYN-330
>             Project: Brooklyn
>          Issue Type: Bug
>            Reporter: Aled Sage
>
> With 0.10.0-SNAPSHOT...
> It seems that, when using {{HttpRequestSensor}} inside a {{brooklyn.initializers}}, it
does not resolve the config.
> For example, if I use {{$brooklyn:config(...)}} to set URI of the HttpRequestSensor,
then it fails with the error:
> {noformat}
> Failed to create instance of class org.apache.brooklyn.core.sensor.http.HttpRequestSensor:
Cannot coerce type org.apache.brooklyn.camp.brooklyn.spi.dsl.methods.DslComponent.DslConfigSupplier
to java.lang.String (config("server.username")): no adapter known
> {noformat}
> I have reproduced that in the simple test case below (which I'll add to {{HttpRequestSensorYamlTest}}):
> {noformat}
>     @Test(groups="Broken")
>     public void testHttpSensorWithDeferredSuppliers() throws Exception {
>         Entity app = createAndStartApplication(
>             "services:",
>             "- type: " + TestEntity.class.getName(),
>             "  brooklyn.config:",
>             "    server.username: myusername",
>             "    server.password: mypassword",
>             "  brooklyn.initializers:",
>             "  - type: "+HttpRequestSensor.class.getName(),
>             "    brooklyn.config:",
>             "      "+HttpRequestSensor.SENSOR_PERIOD.getName()+": 100ms",
>             "      "+HttpRequestSensor.SENSOR_NAME.getName()+": " + SENSOR_STRING.getName(),
>             "      "+HttpRequestSensor.SENSOR_TYPE.getName()+": " + TARGET_TYPE,
>             "      "+HttpRequestSensor.JSON_PATH.getName()+": " + "$.myKey",
>             "      "+HttpRequestSensor.USERNAME.getName()+": $brooklyn:config(\"server.username\")",
>             "      "+HttpRequestSensor.PASSWORD.getName()+": $brooklyn:config(\"server.password\")",
>             "      "+HttpRequestSensor.SENSOR_URI.getName()+":",
>             "          $brooklyn:formatString:",
>             "            - \"%s/myKey/myValue\"",
>             "            - $brooklyn:attributeWhenReady(\"main.uri\")");
>         waitForApplicationTasks(app);
>         Entity entity = Iterables.getOnlyElement(app.getChildren());
>         entity.sensors().set(Attributes.MAIN_URI, URI.create(serverUrl));
>         entity.sensors().set(Attributes.SERVICE_UP, true);
>         EntityAsserts.assertAttributeEqualsEventually(entity, SENSOR_STRING, "myValue");
>     }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message