Github user aledsage commented on the issue:
https://github.com/apache/brooklyn-server/pull/280
@grkvlt when will you have a chance to look at this PR again?
I tried writing a test for you (adding it to `ConfigParametersYamlTest`),
but it fails:
```
@Test
public void testConfigParameterWithEntitySpecAsDefault() throws
Exception {
addCatalogItems(
"brooklyn.catalog:",
" itemType: entity",
" items:",
" - id: entity-with-keys",
" item:",
" type: "+TestEntity.class.getName(),
" brooklyn.parameters:",
" - name: my.param.key",
" type: "+EntitySpec.class.getName(),
" default: ",
" $brooklyn:entitySpec:",
" - type: "+BasicApplication.class.getName());
String yaml = Joiner.on("\n").join(
"services:",
"- type: entity-with-keys");
Entity app = createStartWaitAndLogApplication(yaml);
TestEntity entity = (TestEntity)
Iterables.getOnlyElement(app.getChildren());
Object defaultVal =
entity.config().get(entity.getEntityType().getConfigKey("my.param.key"));
assertEquals(defaultVal instanceof EntitySpec,
"defaultVal="+defaultVal);
assertEquals(((EntitySpec<?>)defaultVal).getType(),
BasicApplication.class, "defaultVal="+defaultVal);
Entity child = entity.addChild((EntitySpec<?>)defaultVal);
assertTrue(child instanceof BasicApplication, "child="+child);
}
```
The error I get is:
```
org.apache.brooklyn.util.javalang.coerce.ClassCoercionException: Cannot
coerce type
org.apache.brooklyn.camp.brooklyn.spi.creation.EntitySpecConfiguration to
org.apache.brooklyn.api.entity.EntitySpec
(org.apache.brooklyn.camp.brooklyn.spi.creation.EntitySpecConfiguration@5a35672e):
no adapter known
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---