This is an automated email from the ASF dual-hosted git repository. alexpl pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push: new 4544651 IGNITE-13096 Java thin client: Fix binary type schema registration for nested objects - Fixes #7878. 4544651 is described below commit 4544651850b283eed58919f8c682bfab465e09b1 Author: Aleksey Plekhanov <plehanov.a...@gmail.com> AuthorDate: Mon Jun 8 11:10:37 2020 +0300 IGNITE-13096 Java thin client: Fix binary type schema registration for nested objects - Fixes #7878. Signed-off-by: Aleksey Plekhanov <plehanov.a...@gmail.com> --- .../internal/binary/BinaryClassDescriptor.java | 2 +- .../org/apache/ignite/client/IgniteBinaryTest.java | 27 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java index da6b5e0..2cacd66 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java @@ -956,7 +956,7 @@ public class BinaryClassDescriptor { typeName, stableFieldsMeta, affKeyFieldName, - null, + stableSchema == null ? null : Collections.singleton(stableSchema), isEnum(), cls.isEnum() ? enumMap(cls) : null); } diff --git a/modules/core/src/test/java/org/apache/ignite/client/IgniteBinaryTest.java b/modules/core/src/test/java/org/apache/ignite/client/IgniteBinaryTest.java index 0f84c75..a201a6e 100644 --- a/modules/core/src/test/java/org/apache/ignite/client/IgniteBinaryTest.java +++ b/modules/core/src/test/java/org/apache/ignite/client/IgniteBinaryTest.java @@ -23,9 +23,11 @@ import java.util.Map; import java.util.stream.Collectors; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteBinary; +import org.apache.ignite.IgniteCache; import org.apache.ignite.Ignition; import org.apache.ignite.binary.BinaryObject; import org.apache.ignite.binary.BinaryType; +import org.apache.ignite.configuration.BinaryConfiguration; import org.apache.ignite.configuration.ClientConfiguration; import org.apache.ignite.testframework.GridTestUtils; import org.junit.Rule; @@ -121,6 +123,31 @@ public class IgniteBinaryTest { } /** + * Check that binary types are registered for nested types too. + * With enabled "CompactFooter" binary type schema also should be passed to server. + */ + @Test + public void testCompactFooterNestedTypeRegistration() throws Exception { + try (Ignite ignite = Ignition.start(Config.getServerConfiguration())) { + try (IgniteClient client = Ignition.startClient(new ClientConfiguration().setAddresses(Config.SERVER) + .setBinaryConfiguration(new BinaryConfiguration().setCompactFooter(true))) + ) { + IgniteCache<Integer, Person[]> igniteCache = ignite.getOrCreateCache(Config.DEFAULT_CACHE_NAME); + ClientCache<Integer, Person[]> clientCache = client.getOrCreateCache(Config.DEFAULT_CACHE_NAME); + + Integer key = 1; + Person[] val = new Person[] {new Person(1, "Joe")}; + + // Binary types should be registered for both "Person[]" and "Person" classes after this call. + clientCache.put(key, val); + + // Check that we can deserialize on server using registered binary types. + assertArrayEquals(val, igniteCache.get(key)); + } + } + } + + /** * Binary Object API: * {@link IgniteBinary#typeId(String)} * {@link IgniteBinary#toBinary(Object)}