brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neykov <>
Subject [GitHub] incubator-brooklyn pull request: Flesh out type creation using the...
Date Tue, 17 Nov 2015 13:44:25 GMT
Github user neykov commented on a diff in the pull request:
    --- Diff: core/src/test/java/org/apache/brooklyn/core/catalog/internal/
    @@ -43,18 +49,40 @@
     public class SpecParameterInMetaTest {
         private ManagementContext mgmt;
         private BrooklynCatalog catalog;
    -    private String spec;
    +    private String specId;
         public void setUp() {
             mgmt = LocalManagementContextForTests.newInstanceWithOsgi();
             catalog = mgmt.getCatalog();
    -        spec = TestToSpecTransformer.registerSpec(EntitySpec.create(BasicEntity.class));
    +        StaticTypePlanTransformer.forceInstall();
    +        PlanToSpecFactory.forceAvailable(TestToSpecTransformer.class, JavaCatalogToSpecTransformer.class);
    +        specId = StaticTypePlanTransformer.registerSpec(EntitySpec.create(BasicEntity.class));
    +    @AfterMethod(alwaysRun=true)
    +    public void tearDown() {
    +        StaticTypePlanTransformer.clearForced();
    +        PlanToSpecFactory.clearForced();
    +    }
    +    @Test
    +    public void testCanRetrieveWithNew() {
    +        AbstractBrooklynObjectSpec<?, ?> spec = mgmt.getTypeRegistry().createSpecFromPlan(null,
specId, null, null);
    +        Assert.assertNotNull(spec);
    +    }
    +    // it's not actually added to the catalog; probably it would be cleaner if it is;
    --- End diff --
    The idea of `TestToSpecTransformer` is to convert a plan to a pre-registered spec. It's
not working on types but on plans. This means that it's able to convert a plan it understands
(be it coming from a catalog item or used as an app plan) to a spec. The plan itself may be
added as a catalog item, but it's a separate matter.
    A plan refers to a type, but is not itself a type, it's a composition of types. Calling
`registerSpec` tells the transformer how to interpret the plan, not what the spec for a specific
type is.

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 or file a JIRA ticket
with INFRA.

View raw message