Aled Sage created BROOKLYN-328:
----------------------------------
Summary: 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)