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
The following commit(s) were added to refs/heads/master by this push: new eeb806e4ae fix issue that guava predicates won't be deserialized as dsl predicates eeb806e4ae is described below commit eeb806e4ae01f043575e47c84985a8a944e0842d Author: Alex Heneveld <a...@cloudsoft.io> AuthorDate: Fri Dec 8 11:40:52 2023 +0000 fix issue that guava predicates won't be deserialized as dsl predicates --- .../apache/brooklyn/util/core/predicates/DslPredicates.java | 4 ++-- .../apache/brooklyn/util/core/predicates/DslPredicateTest.java | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/apache/brooklyn/util/core/predicates/DslPredicates.java b/core/src/main/java/org/apache/brooklyn/util/core/predicates/DslPredicates.java index 8dc29b47e3..574504cdad 100644 --- a/core/src/main/java/org/apache/brooklyn/util/core/predicates/DslPredicates.java +++ b/core/src/main/java/org/apache/brooklyn/util/core/predicates/DslPredicates.java @@ -927,10 +927,10 @@ public class DslPredicates { @Beta public static class DslPredicateJsonDeserializer extends JsonSymbolDependentDeserializer { public static final Set<Class> DSL_REGISTERED_CLASSES = ImmutableSet.<Class>of( - java.util.function.Predicate.class, Predicate.class, + java.util.function.Predicate.class, com.google.common.base.Predicate.class, DslPredicate.class, DslEntityPredicate.class); public static final Set<Class> DSL_RESTRICTED_CLASSES = ImmutableSet.<Class>of( - java.util.function.Predicate.class, Predicate.class); + java.util.function.Predicate.class, com.google.common.base.Predicate.class); public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { return super.createContextual(ctxt, property); diff --git a/core/src/test/java/org/apache/brooklyn/util/core/predicates/DslPredicateTest.java b/core/src/test/java/org/apache/brooklyn/util/core/predicates/DslPredicateTest.java index 08a3c77d86..61d5ca893c 100644 --- a/core/src/test/java/org/apache/brooklyn/util/core/predicates/DslPredicateTest.java +++ b/core/src/test/java/org/apache/brooklyn/util/core/predicates/DslPredicateTest.java @@ -52,8 +52,7 @@ public class DslPredicateTest extends BrooklynMgmtUnitTestSupport { @Test public void testSimpleEqualsAsPredicate() { - Predicate p = TypeCoercions.coerce(MutableMap.of( - "equals", "x"), Predicate.class); + Predicate p = TypeCoercions.coerce(MutableMap.of("equals", "x"), Predicate.class); Asserts.assertTrue(p.test("x")); Asserts.assertFalse(p.test("y")); } @@ -65,6 +64,13 @@ public class DslPredicateTest extends BrooklynMgmtUnitTestSupport { Asserts.assertFalse(p.test("y")); } + @Test + public void testImplicitEqualsAsGuavaPredicate() { + Predicate p = TypeCoercions.coerce(MutableMap.of("equals", "x"), com.google.common.base.Predicate.class); + Asserts.assertTrue(p.test("x")); + Asserts.assertFalse(p.test("y")); + } + @Test public void testImplicitEqualsAsRawPredicateNotSupported() { Asserts.assertFailsWith(() -> {