You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2021/08/06 13:27:35 UTC
[brooklyn-server] 02/09: add test which fails for scope root -
about to fix
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 f062ce7dc8da2f2ebeaf3dc275a1380e779a42f6
Author: Alex Heneveld <al...@cloudsoftcorp.com>
AuthorDate: Fri Aug 6 11:40:27 2021 +0100
add test which fails for scope root - about to fix
relying on catalog item id is not reliable to determine the containing definition;
it works if there is no catalog item id (eg we refer to a class),
but if we refer to another catalog item id the scope root / containment check is not correct.
instead we should use the "depth_in_ancestor" tag -- PR to follow
---
.../brooklyn/camp/brooklyn/EntitiesYamlTest.java | 38 +++++++++++++++-------
1 file changed, 27 insertions(+), 11 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 8aa75ef..44cdfe0 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
@@ -526,59 +526,58 @@ public class EntitiesYamlTest extends AbstractYamlTest {
}
}
}
-
- @Test
- public void testScopeReferences() throws Exception {
+
+ private void doTestScopeReferences(String reference) throws Exception {
addCatalogItems(
"brooklyn.catalog:",
" itemType: entity",
" items:",
" - id: ref_child",
" item:",
- " type: " + ReferencingYamlTestEntity.class.getName(),
+ " type: " + reference,
" name: RC",
" test.reference.root: $brooklyn:root()",
" test.reference.scope_root: $brooklyn:scopeRoot()",
" brooklyn.children:",
- " - type: " + ReferencingYamlTestEntity.class.getName(),
+ " - type: " + reference,
" name: RC-child",
" test.reference.root: $brooklyn:root()",
" test.reference.scope_root: $brooklyn:scopeRoot()",
" - id: ref_parent",
" item:",
- " type: " + ReferencingYamlTestEntity.class.getName(),
+ " type: " + reference,
" name: RP",
" test.reference.root: $brooklyn:root()",
" test.reference.scope_root: $brooklyn:scopeRoot()",
" brooklyn.children:",
- " - type: " + ReferencingYamlTestEntity.class.getName(),
+ " - type: " + reference,
" name: RP-child",
" test.reference.root: $brooklyn:root()",
" test.reference.scope_root: $brooklyn:scopeRoot()",
" brooklyn.children:",
" - 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(),
+ "- type: " + reference,
" name: APP-child",
" test.reference.root: $brooklyn:root()",
" test.reference.scope_root: $brooklyn:scopeRoot()",
" brooklyn.children:",
- " - type: " + ReferencingYamlTestEntity.class.getName(),
+ " - type: " + reference,
" name: APP-grandchild",
" test.reference.root: $brooklyn:root()",
" test.reference.scope_root: $brooklyn:scopeRoot()",
" brooklyn.children:",
" - type: ref_parent",
" name: APP-greatgrandchild=RP");
-
+
assertScopes(app, "APP", app, app);
Entity e1 = nextChild(app);
assertScopes(e1, "APP-child", app, app);
@@ -593,6 +592,23 @@ public class EntitiesYamlTest extends AbstractYamlTest {
Entity e6 = nextChild(e5);
assertScopes(e6, "RC-child", app, e5);
}
+ @Test
+ public void testScopeReferences() throws Exception {
+ doTestScopeReferences(ReferencingYamlTestEntity.class.getName());
+ }
+
+ @Test(groups="WIP")
+ public void testScopeReferencesComplex() throws Exception {
+ addCatalogItems(
+ "brooklyn.catalog:",
+ " itemType: entity",
+ " items:",
+ " - id: ref_entity",
+ " item:",
+ " type: " + ReferencingYamlTestEntity.class.getName(),
+ " name: RE");
+ doTestScopeReferences("ref_entity");
+ }
private static Entity nextChild(Entity entity) {
return Iterables.getOnlyElement(entity.getChildren());