Github user grkvlt commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/229#discussion_r69386810
--- Diff:
camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterUnwrappingTest.java
---
@@ -173,17 +173,128 @@ public void
testDepentantCatalogsOverrideParameters(Class<? extends BrooklynObje
" - simple",
" - id: " + SYMBOLIC_NAME,
" item:",
- // Don't set explicit version, not supported by locations
" type: paramItem",
" brooklyn.parameters:",
" - override");
CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME,
TEST_VERSION);
AbstractBrooklynObjectSpec<?,?> spec = createSpec(item);
- List<SpecParameter<?>> inputs = spec.getParameters();
- assertEquals(inputs.size(), 1);
- SpecParameter<?> firstInput = inputs.get(0);
- assertEquals(firstInput.getLabel(), "override");
+ List<SpecParameter<?>> params = spec.getParameters();
+ assertEquals(params.size(), 2);
+ assertTrue(Iterables.tryFind(params,
nameEqualTo("simple")).isPresent());
+ assertTrue(Iterables.tryFind(params,
nameEqualTo("override")).isPresent());
+ }
+
+ @Test(dataProvider="brooklynTypes")
+ public void testDependantCatalogMergesParameters(Class<? extends
BrooklynObject> type) {
+ addCatalogItems(
+ "brooklyn.catalog:",
+ " version: " + TEST_VERSION,
+ " items:",
+ " - id: paramItem",
+ " item:",
+ " type: " + type.getName(),
+ " brooklyn.parameters:",
+ " - name: simple",
+ " label: simple",
+ " - id: " + SYMBOLIC_NAME,
+ " item:",
+ " type: paramItem",
+ " brooklyn.parameters:",
+ " - name: simple",
+ " label: override");
+
+ CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME,
TEST_VERSION);
+ AbstractBrooklynObjectSpec<?,?> spec = createSpec(item);
+ List<SpecParameter<?>> params = spec.getParameters();
+ assertEquals(params.size(), 1);
+ assertTrue(Iterables.tryFind(params,
nameEqualTo("simple")).isPresent());
+ assertTrue(Iterables.tryFind(params,
labelEqualTo("override")).isPresent());
+ }
+
+ @Test
+ public void testDependantCatalogConfigOverridesParameters() {
--- End diff --
Note only for entities, as `brooklyn.config` is split into flags and config
for policies and locations, so the parameter logic does not allow detection of
existing config here.
---
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.
---