brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grkvlt <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #229: Merge brooklyn.parameters in YAML files
Date Sun, 03 Jul 2016 07:22:53 GMT
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message