tillrohrmann commented on a change in pull request #14902:
URL: https://github.com/apache/flink/pull/14902#discussion_r572274348



##########
File path: 
flink-queryable-state/flink-queryable-state-runtime/src/test/java/org/apache/flink/queryablestate/itcases/AbstractQueryableStateTestBase.java
##########
@@ -361,6 +372,65 @@ public Integer getKey(Tuple2<Integer, Long> value) {
         }
     }
 
+    /** This test checks if custom Kryo serializers are loaded with correct 
classloader. */
+    @Test
+    public void testCustomKryoSerializerHandling() throws Exception {
+        final Deadline deadline = Deadline.now().plus(TEST_TIMEOUT);
+        final long numElements = 1;
+        final String stateName = "teriberka";
+
+        final String customSerializerClassName = "CustomKryo";
+        final URLClassLoader userClassLoader =
+                
createLoaderWithCustomKryoSerializer(customSerializerClassName);
+
+        StreamExecutionEnvironment env = 
StreamExecutionEnvironment.getExecutionEnvironment();
+        env.setStateBackend(stateBackend);
+        env.setParallelism(maxParallelism);
+        // Very important, because cluster is shared between tests and we
+        // don't explicitly check that all slots are available before
+        // submitting.
+        
env.setRestartStrategy(RestartStrategies.fixedDelayRestart(Integer.MAX_VALUE, 
1000L));
+
+        // Custom serializer is not needed, it's used just to check if 
serialization works.
+        @SuppressWarnings("unchecked")
+        Class<Serializer<?>> customSerializerClass =
+                (Class<Serializer<?>>) 
userClassLoader.loadClass(customSerializerClassName);
+        env.getConfig().addDefaultKryoSerializer(Byte.class, 
customSerializerClass);

Review comment:
       I think we have to register a serializer instance to make this test 
work. If we only use a `Class`, then the system won't try to duplicate it.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to