use of com.hazelcast.internal.serialization.SerializationClassNameFilter in project hazelcast by hazelcast.
the class SerializationClassNameFilterTest method testPackageInWhitelist.
/**
* <pre>
* Given: Whitelist is set.
* When: {@link SerializationClassNameFilter#filter(String)} is called for a class which has whitelisted package.
* Then: no exception is thrown
* </pre>
*/
@Test
public void testPackageInWhitelist() {
JavaSerializationFilterConfig config = new JavaSerializationFilterConfig();
config.getWhitelist().addPackages("com.whitelisted");
new SerializationClassNameFilter(config).filter("com.whitelisted.Test2");
}
use of com.hazelcast.internal.serialization.SerializationClassNameFilter 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");
}
Aggregations