Search in sources :

Example 21 with JavaSerializationFilterConfig

use of com.hazelcast.config.JavaSerializationFilterConfig in project hazelcast by hazelcast.

the class SerializationClassNameFilterTest method testClassInWhitelist.

/**
 * <pre>
 * Given: Default is disabled and explicit whitelist is used.
 * When: {@link SerializationClassNameFilter#filter(String)} is called for a whitelisted class.
 * Then: no exception is thrown
 * </pre>
 */
@Test
public void testClassInWhitelist() {
    JavaSerializationFilterConfig config = new JavaSerializationFilterConfig().setDefaultsDisabled(true);
    config.getWhitelist().addClasses("java.lang.Test1", "java.lang.Test2", "java.lang.Test3");
    new SerializationClassNameFilter(config).filter("java.lang.Test2");
}
Also used : SerializationClassNameFilter(com.hazelcast.internal.serialization.SerializationClassNameFilter) JavaSerializationFilterConfig(com.hazelcast.config.JavaSerializationFilterConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

JavaSerializationFilterConfig (com.hazelcast.config.JavaSerializationFilterConfig)21 Test (org.junit.Test)16 QuickTest (com.hazelcast.test.annotation.QuickTest)15 Config (com.hazelcast.config.Config)9 TestDeserialized (example.serialization.TestDeserialized)9 HazelcastInstance (com.hazelcast.core.HazelcastInstance)8 SerializationClassNameFilter (com.hazelcast.internal.serialization.SerializationClassNameFilter)7 ClientConfig (com.hazelcast.client.config.ClientConfig)6 ClassFilter (com.hazelcast.config.ClassFilter)5 HazelcastSerializationException (com.hazelcast.nio.serialization.HazelcastSerializationException)4 IndexConfig (com.hazelcast.config.IndexConfig)2 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)2 TestExternalizableDeserialized (example.serialization.TestExternalizableDeserialized)2 GlobalSerializerConfig (com.hazelcast.config.GlobalSerializerConfig)1 JoinConfig (com.hazelcast.config.JoinConfig)1 SerializationConfig (com.hazelcast.config.SerializationConfig)1 SerializerConfig (com.hazelcast.config.SerializerConfig)1 XMLConfigBuilderTest (com.hazelcast.config.XMLConfigBuilderTest)1 HazelcastTestSupport.smallInstanceConfig (com.hazelcast.test.HazelcastTestSupport.smallInstanceConfig)1 Node (org.w3c.dom.Node)1