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 7c4313353e8cff7ecb25056616ad0be74328c21a
Author: Alex Heneveld <[email protected]>
AuthorDate: Sat Mar 18 09:35:10 2023 +0000

    update tests so they show the new intended behaviour
---
 .../org/apache/brooklyn/camp/brooklyn/WorkflowYamlTest.java  |  2 +-
 .../BrooklynRegisteredTypeJacksonSerializationTest.java      | 12 +++++++-----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git 
a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlTest.java
 
b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlTest.java
index 88d1f3d126..765fe6eb2f 100644
--- 
a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlTest.java
+++ 
b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WorkflowYamlTest.java
@@ -151,7 +151,7 @@ public class WorkflowYamlTest extends AbstractYamlTest {
         String x;
     }
 
-    @Test(groups="WIP")
+    @Test
     public void testWorkflowComplexSensor() throws Exception {
         Entity app = createAndStartApplication(
                 "services:",
diff --git 
a/core/src/test/java/org/apache/brooklyn/core/resolve/jackson/BrooklynRegisteredTypeJacksonSerializationTest.java
 
b/core/src/test/java/org/apache/brooklyn/core/resolve/jackson/BrooklynRegisteredTypeJacksonSerializationTest.java
index 242dbf0a85..71429e36e4 100644
--- 
a/core/src/test/java/org/apache/brooklyn/core/resolve/jackson/BrooklynRegisteredTypeJacksonSerializationTest.java
+++ 
b/core/src/test/java/org/apache/brooklyn/core/resolve/jackson/BrooklynRegisteredTypeJacksonSerializationTest.java
@@ -36,6 +36,7 @@ import org.apache.brooklyn.test.Asserts;
 import org.apache.brooklyn.util.collections.MutableList;
 import org.apache.brooklyn.util.collections.MutableMap;
 import org.apache.brooklyn.util.core.config.ConfigBag;
+import org.apache.brooklyn.util.core.flags.TypeCoercions;
 import org.apache.brooklyn.util.text.Strings;
 import org.apache.brooklyn.util.time.Duration;
 import org.testng.Assert;
@@ -216,11 +217,9 @@ public class 
BrooklynRegisteredTypeJacksonSerializationTest extends BrooklynMgmt
         String deser3 = "{\"type\":\"" + OtherBean.class.getName() + 
"\",\"y\":\"hello\"}";
         Asserts.assertFailsWith(()->deser(deser3, OtherBean.class), e->true);  
// expected as y doesn't exist on OtherBean
         Asserts.assertInstanceOf(deser(deser3, SampleBeanWithType.class), 
SampleBeanWithType.class);
-        Asserts.assertFailsWith(()->deser(deser3), e->true);
-        // TODO above should satisfy the below instead, contianing the type
-        // Asserts.assertInstanceOf(deser(deser3), Map.class);
+        Asserts.assertInstanceOf(deser(deser3), Map.class);
 
-        // TODO would be nice to support this but that might break maps 
containing [type] ?? what happens if we serialize a map containing type as an 
object?
+        // might be nice to support this but that might break maps containing 
[type] ?? what happens if we serialize a map containing type as an object?
 //        String deser4 = "{\"[type]\":\"" + OtherBean.class.getName() + 
"\",\"y\":\"hello\"}";
 //        Asserts.assertFailsWith(()->deser(deser3, OtherBean.class), e->true);
 //        Asserts.assertInstanceOf(deser(deser3, SampleBeanWithType.class), 
SampleBeanWithType.class);
@@ -230,8 +229,11 @@ public class 
BrooklynRegisteredTypeJacksonSerializationTest extends BrooklynMgmt
 //        Asserts.assertInstanceOf(deser(deser3, Map.class), Map.class);
 //        Asserts.assertEquals( ((Map)deser(deser3)).get("[type]"), 
OtherBean.class.getName());
 //        Asserts.assertNull( ((Map)deser(deser3)).get("type") );
+        // above can't work due to ambiguity with below
+//        Asserts.assertEquals(ser(MutableList.of(MutableMap.of("type", 
OtherBean.class.getName(), "x", "hello"))), 
"[{\"type\":\""+OtherBean.class.getName()+"\",\"x\":\"hello\"}]");
 
-        Asserts.assertEquals(ser(MutableList.of(MutableMap.of("type", 
OtherBean.class.getName(), "x", "hello"))), 
"[{\"type\":\""+OtherBean.class.getName()+"\",\"x\":\"hello\"}]");
+        // TODO however we could allow this - coercer may try to serialize 
first then deserialize second if given two complex types where the second one 
has a field 'type'
+//        SampleBeanWithType redeser = TypeCoercions.coerce(deser(deser), 
SampleBeanWithType.class);
     }
 
     @Test

Reply via email to