Github user neykov commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/462#discussion_r94785585
--- Diff:
camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterUnwrappingTest.java
---
@@ -169,19 +175,23 @@ public void
testDependantCatalogsInheritParameters(Class<? extends BrooklynObjec
CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME,
TEST_VERSION);
AbstractBrooklynObjectSpec<?,?> spec = catalog.peekSpec(item);
List<SpecParameter<?>> params = spec.getParameters();
- switch (type.getSimpleName()) {
- case "ConfigEntityForTest":
- assertEquals(params.size(), 3);
- break;
- case "ConfigPolicyForTest":
- assertEquals(params.size(), 2);
- break;
- case "ConfigLocationForTest":
- assertEquals(params.size(), 7);
- break;
- }
+ // should have simple in parent yaml type and sample from parent
java type
+ Asserts.assertSize(params, getDefaultsFor(type.getSimpleName()) +
2);
assertTrue(Iterables.tryFind(params,
nameEqualTo("simple")).isPresent());
assertTrue(Iterables.tryFind(params,
labelEqualTo("simple")).isPresent());
+ assertTrue(Iterables.tryFind(params,
nameEqualTo(SHARED_CONFIG.getName())).isPresent());
+ }
+
+ private int getDefaultsFor(String simpleName) {
--- End diff --
Good cleanup, could include it as a second parameter in the provider, this
works as well.
---
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.
---