shishkovilja commented on code in PR #13236:
URL: https://github.com/apache/ignite/pull/13236#discussion_r3521378169


##########
modules/core/src/test/java/org/apache/ignite/internal/processors/query/schema/message/QueryEntityMessageSerializationTest.java:
##########
@@ -0,0 +1,193 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.query.schema.message;
+
+import java.io.Externalizable;
+import java.io.Serializable;
+import java.lang.reflect.Modifier;
+import java.math.BigDecimal;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cache.QueryIndex;
+import org.apache.ignite.cache.QueryIndexType;
+import org.apache.ignite.internal.CoreMessagesProvider;
+import org.apache.ignite.internal.direct.DirectMessageReader;
+import org.apache.ignite.internal.direct.DirectMessageWriter;
+import 
org.apache.ignite.internal.managers.communication.IgniteMessageFactoryImpl;
+import org.apache.ignite.internal.processors.query.QueryEntityEx;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.marshaller.Marshaller;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.plugin.extensions.communication.MessageFactory;
+import 
org.apache.ignite.plugin.extensions.communication.MessageFactoryProvider;
+import org.apache.ignite.plugin.extensions.communication.MessageSerializer;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+
+import static org.apache.ignite.marshaller.Marshallers.jdk;
+import static 
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.makeMessageType;
+
+/** Test for serialization round-trip of {@link QueryEntityMessage} and {@link 
QueryEntityExMessage}. */
+public class QueryEntityMessageSerializationTest extends 
GridCommonAbstractTest {
+    /** Error suffix. */
+    public static final String ERROR_SUFFIX = " count is not equal to the 
expected fields count. " +
+        "Has the number of fields in the `QueryEntity` or `QueryEntityEx` 
classes changed?";
+
+    /** */
+    private final Marshaller marsh = jdk();
+
+    /** */
+    private final MessageFactory msgFactory = new IgniteMessageFactoryImpl(
+        new MessageFactoryProvider[] {new CoreMessagesProvider(marsh, marsh, 
U.gridClassLoader())});
+
+    /** */
+    @Test
+    public void testQueryEntity() throws Exception {
+        QueryEntity entity = queryEntity();
+
+        assertEquals(entity, serializeAndDeserialize(entity, 
serializableFieldsCount(QueryEntity.class)));
+    }
+
+    /** */
+    @Test
+    public void testQueryEntityEx() throws Exception {
+        QueryEntityEx entity = queryEntityEx();
+
+        long expReadWriteCnt = serializableFieldsCount(QueryEntityEx.class) -
+            /* QueryEntityEx duplicates 'notNullFields', but 
'QueryEntityExMessage' doesn't */ 1;
+
+        QueryEntity res = serializeAndDeserialize(entity, expReadWriteCnt);
+
+        assertTrue(res instanceof QueryEntityEx);
+        assertEquals(entity, res);
+
+        // Not part of QueryEntityEx.equals(), so assert it explicitly.
+        assertEquals(entity.fillAbsentPKsWithDefaults(), 
((QueryEntityEx)res).fillAbsentPKsWithDefaults());
+    }

Review Comment:
   But, `TransfromCollectionView` implements `Serializable`!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to