-
Notifications
You must be signed in to change notification settings - Fork 51
Catalog internal references #748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -127,13 +127,63 @@ public void testYamlUrlReferencingCatalog() throws Exception { | |
| checkChildEntitySpec(app, entityName); | ||
| } | ||
|
|
||
| @Test | ||
| public void testYamlReferencingEarlierItemShortForm() throws Exception { | ||
| addCatalogItems( | ||
| "brooklyn.catalog:", | ||
| " itemType: entity", | ||
| " items:", | ||
| " - id: yaml.basic", | ||
| " version: " + TEST_VERSION, | ||
| " item:", | ||
| " type: org.apache.brooklyn.entity.stock.BasicEntity", | ||
| " - id: yaml.reference", | ||
| " version: " + TEST_VERSION, | ||
| " item:", | ||
| " type: yaml.basic"); | ||
|
|
||
| String entityName = "YAML -> catalog item -> yaml url"; | ||
| Entity app = createAndStartApplication( | ||
| "services:", | ||
| "- name: " + entityName, | ||
| " type: " + ver("yaml.reference")); | ||
|
|
||
| checkChildEntitySpec(app, entityName); | ||
| } | ||
|
|
||
| @Test(groups="WIP") // references to earlier items only work with short form syntax | ||
| public void testYamlReferencingEarlierItemLongForm() throws Exception { | ||
| addCatalogItems( | ||
| "brooklyn.catalog:", | ||
| " itemType: entity", | ||
| " items:", | ||
| " - id: yaml.basic", | ||
| " version: " + TEST_VERSION, | ||
| " item:", | ||
| " services:", | ||
| " - type: org.apache.brooklyn.entity.stock.BasicEntity", | ||
| " - id: yaml.reference", | ||
| " version: " + TEST_VERSION, | ||
| " item:", | ||
| " services:", | ||
| " - type: yaml.basic"); | ||
|
|
||
| String entityName = "YAML -> catalog item -> yaml url"; | ||
| Entity app = createAndStartApplication( | ||
| "services:", | ||
| "- name: " + entityName, | ||
| " type: " + ver("yaml.reference")); | ||
|
|
||
| checkChildEntitySpec(app, entityName); | ||
| } | ||
|
|
||
| @Test(groups="WIP") //Not able to use caller provided catalog items when referencing entity specs (as opposed to catalog meta) | ||
| public void testYamlUrlReferencingCallerCatalogItem() throws Exception { | ||
| addCatalogItems( | ||
| "brooklyn.catalog:", | ||
| " itemType: entity", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above, can we use |
||
| " items:", | ||
| " - id: yaml.standalone", | ||
| " - id: yaml.basic", | ||
| " version: " + TEST_VERSION, | ||
| " item:", | ||
| " services:", | ||
|
|
@@ -142,7 +192,7 @@ public void testYamlUrlReferencingCallerCatalogItem() throws Exception { | |
| " version: " + TEST_VERSION, | ||
| " item:", | ||
| " services:", | ||
| " - type: classpath://yaml-ref-parent-catalog.yaml"); | ||
| " - type: classpath://yaml-ref-catalog.yaml"); // this references yaml.basic above | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wow, I didn't no we supported this. Why?! It looks like so it's not a catalog item. Should we really be able to reference it as a type in a catalog item like this? I'd have thought the right way of doing it (for an end-user) would be to re-write I suggest we deprecate this asap. I don't think we've documented it anywhere, so hopefully no-one is relying on it in anger. I therefore think it's not worth fixing this test. |
||
|
|
||
| String entityName = "YAML -> catalog item -> yaml url"; | ||
| Entity app = createAndStartApplication( | ||
|
|
@@ -152,7 +202,7 @@ public void testYamlUrlReferencingCallerCatalogItem() throws Exception { | |
|
|
||
| checkChildEntitySpec(app, entityName); | ||
| } | ||
|
|
||
| private void checkChildEntitySpec(Entity app, String entityName) { | ||
| Collection<Entity> children = app.getChildren(); | ||
| Assert.assertEquals(children.size(), 1); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've recommended in the docs (http://brooklyn.apache.org/v/0.11.0/ops/catalog/) that one should use
services:withitemType: template, and not withitemType: entity(because the latter only ever has one thing in it).Can you change this test to use
itemType: template, or indicate in a comment at the top that this is testing a discouraged catalog format?