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 5ebc7d5351f05be3b0164be85ae5c23d0196f4d2 Author: Alex Heneveld <[email protected]> AuthorDate: Tue Nov 17 17:49:26 2020 +0000 fix bug by distinguishing DslFuctionSupplier and DeferredSupplier --- .../brooklyn/camp/brooklyn/spi/dsl/DslYamlTest.java | 4 +++- .../camp/brooklyn/spi/dsl/methods/DslTestObjects.java | 15 +++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslYamlTest.java index a2922a1..342729c 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslYamlTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslYamlTest.java @@ -768,6 +768,9 @@ public class DslYamlTest extends AbstractYamlTest { assertEquals(getConfigEventually(app, DEST), Boolean.TRUE); } + // TODO this and the next method used to work with DslTestCallableAlsoSupplier; but now if it is a supplier we get it when resolving, + // otherwise we don't get the values we want in certain cases; things should be DslFunctionSource or DeferredSupplier but not both. + // that might however cause problems when we try to evaluate $brooklyn:component("xxx").attributeWhenReady() if we get the entity from the first one @Test public void testDeferredDslChainingWithCustomCallable() throws Exception { final Entity app = createAndStartApplication( @@ -779,7 +782,6 @@ public class DslYamlTest extends AbstractYamlTest { app.config().set(customCallableWrapperKey, new DslTestSupplierWrapper(new DslTestCallable())); assertEquals(getConfigEventually(app, DEST), Boolean.TRUE); } - @Test public void testDeferredDslChainingWithNestedEvaluation() throws Exception { final Entity app = createAndStartApplication( diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslTestObjects.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslTestObjects.java index 18c0c16..0646cdd 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslTestObjects.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslTestObjects.java @@ -66,8 +66,15 @@ public class DslTestObjects { } } - public static class DslTestCallable implements DslFunctionSource, DeferredSupplier<TestDslSupplier>, ImmediateSupplier<TestDslSupplier> { + public static class DslTestCallable implements DslFunctionSource { + @DslAccessible + public boolean isSupplierCallable() { + return true; + } + } + // see comments in DslYamlTest.testDeferredDslChainingWithCustomCallable + public static class DslTestCallableAlsoSupplier extends DslTestCallable implements DeferredSupplier<TestDslSupplier>, ImmediateSupplier<TestDslSupplier> { @Override @JsonIgnore public Maybe<TestDslSupplier> getImmediately() { throw new IllegalStateException("Not to be called"); @@ -75,13 +82,9 @@ public class DslTestObjects { @Override public TestDslSupplier get() { - throw new IllegalStateException("Not to be called"); + return getImmediately().get(); } - @DslAccessible - public boolean isSupplierCallable() { - return true; - } } }
