You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by "Alex Heneveld (JIRA)" <ji...@apache.org> on 2016/12/02 10:04:58 UTC
[jira] [Commented] (BROOKLYN-328) brooklyn.parameter with same name
as java config key does not get default from yaml
[ https://issues.apache.org/jira/browse/BROOKLYN-328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15714676#comment-15714676 ]
Alex Heneveld commented on BROOKLYN-328:
----------------------------------------
Fixed by #440 ?
ConfigParametersYamlTest.testConfigParameterOverridingJavaConfig() now passing
[~aled.sage] can you confirm and close?
> brooklyn.parameter with same name as java config key does not get default from yaml
> -----------------------------------------------------------------------------------
>
> Key: BROOKLYN-328
> URL: https://issues.apache.org/jira/browse/BROOKLYN-328
> Project: Brooklyn
> Issue Type: Bug
> Reporter: Aled Sage
> Priority: Minor
>
> While using 0.10.0-SNAPSHOT...
> I wrote a YAML entity that declared a {{brooklyn.parameter}} with the same name as a config key on the Java entity that it referenced. In my case, this was {{download.url}} on VanillaSoftwareProcess so that I could specify my preferred default value.
> However, when I used that config key to set an environment variable, I got an empty string. i.e. it didn't pick up my default.
> I recreated this behaviour in the simpler test case below (which I'll add to {{ConfigParametersYamlTest}}). If you change the confName to something that doesn't clash, then the test passes.
> {noformat}
> public void testConfigParameterOverridingJavaConfig() throws Exception {
> String confName = TestEntity.CONF_OBJECT.getName();
> addCatalogItems(
> "brooklyn.catalog:",
> " itemType: entity",
> " items:",
> " - id: entity-with-keys",
> " item:",
> " type: "+TestEntity.class.getName(),
> " brooklyn.parameters:",
> " - name: "+confName,
> " type: java.lang.Object",
> " default: myDefaultObj",
> " brooklyn.config:",
> " my.other.obj: $brooklyn:config(\""+confName+"\")");
> String yaml = Joiner.on("\n").join(
> "services:",
> "- type: entity-with-keys");
> Entity app = createStartWaitAndLogApplication(yaml);
> TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
> assertEquals(entity.config().get(ConfigKeys.newStringConfigKey("my.other.obj")), "myDefaultObj");
> }
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)