This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git
commit ad3691956221e1a57faabab074f2b9bb38f6e4e6 Author: Alex Heneveld <[email protected]> AuthorDate: Fri Aug 6 11:35:53 2021 +0100 clearer test for scope root -- add names --- .../brooklyn/camp/brooklyn/EntitiesYamlTest.java | 30 ++++++++++++++-------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntitiesYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntitiesYamlTest.java index 3da5fe3..8aa75ef 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntitiesYamlTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/EntitiesYamlTest.java @@ -536,59 +536,69 @@ public class EntitiesYamlTest extends AbstractYamlTest { " - id: ref_child", " item:", " type: " + ReferencingYamlTestEntity.class.getName(), + " name: RC", " test.reference.root: $brooklyn:root()", " test.reference.scope_root: $brooklyn:scopeRoot()", " brooklyn.children:", " - type: " + ReferencingYamlTestEntity.class.getName(), + " name: RC-child", " test.reference.root: $brooklyn:root()", " test.reference.scope_root: $brooklyn:scopeRoot()", " - id: ref_parent", " item:", " type: " + ReferencingYamlTestEntity.class.getName(), + " name: RP", " test.reference.root: $brooklyn:root()", " test.reference.scope_root: $brooklyn:scopeRoot()", " brooklyn.children:", " - type: " + ReferencingYamlTestEntity.class.getName(), + " name: RP-child", " test.reference.root: $brooklyn:root()", " test.reference.scope_root: $brooklyn:scopeRoot()", " brooklyn.children:", - " - type: ref_child"); + " - type: ref_child", + " name: RP-grandchild=RC"); Entity app = createAndStartApplication( "brooklyn.config:", " test.reference.root: $brooklyn:root()", " test.reference.scope_root: $brooklyn:scopeRoot()", + "name: APP", "services:", "- type: " + ReferencingYamlTestEntity.class.getName(), + " name: APP-child", " test.reference.root: $brooklyn:root()", " test.reference.scope_root: $brooklyn:scopeRoot()", " brooklyn.children:", " - type: " + ReferencingYamlTestEntity.class.getName(), + " name: APP-grandchild", " test.reference.root: $brooklyn:root()", " test.reference.scope_root: $brooklyn:scopeRoot()", " brooklyn.children:", - " - type: ref_parent"); + " - type: ref_parent", + " name: APP-greatgrandchild=RP"); - assertScopes(app, app, app); + assertScopes(app, "APP", app, app); Entity e1 = nextChild(app); - assertScopes(e1, app, app); + assertScopes(e1, "APP-child", app, app); Entity e2 = nextChild(e1); - assertScopes(e2, app, app); + assertScopes(e2, "APP-grandchild", app, app); Entity e3 = nextChild(e2); - assertScopes(e3, app, e3); + assertScopes(e3, "APP-greatgrandchild=RP", app, e3); Entity e4 = nextChild(e3); - assertScopes(e4, app, e3); + assertScopes(e4, "RP-child", app, e3); Entity e5 = nextChild(e4); - assertScopes(e5, app, e5); + assertScopes(e5, "RP-grandchild=RC", app, e5); Entity e6 = nextChild(e5); - assertScopes(e6, app, e5); + assertScopes(e6, "RC-child", app, e5); } private static Entity nextChild(Entity entity) { return Iterables.getOnlyElement(entity.getChildren()); } - private static void assertScopes(Entity entity, Entity root, Entity scopeRoot) { + private static void assertScopes(Entity entity, String name, Entity root, Entity scopeRoot) { + if (name!=null) assertEquals(entity.getDisplayName(), name); assertEquals(entity.config().get(ReferencingYamlTestEntity.TEST_REFERENCE_ROOT), root); assertEquals(entity.config().get(ReferencingYamlTestEntity.TEST_REFERENCE_SCOPE_ROOT), scopeRoot); }
