use of com.hazelcast.internal.util.FilteringClassLoader in project hazelcast by hazelcast.
the class ClientUserCodeDeploymentExceptionTest method createNodeConfig.
private Config createNodeConfig() {
Config i2Config = new Config();
FilteringClassLoader filteringCL = new FilteringClassLoader(singletonList("usercodedeployment"), null);
i2Config.setClassLoader(filteringCL);
return i2Config;
}
use of com.hazelcast.internal.util.FilteringClassLoader in project hazelcast by hazelcast.
the class SqlClientCompactQueryTest method setup.
@Before
public void setup() {
MapConfig mapConfig = new MapConfig("default").setInMemoryFormat(inMemoryFormat);
Config config = smallInstanceConfig().addMapConfig(mapConfig);
config.getSerializationConfig().getCompactSerializationConfig().setEnabled(true);
if (!clusterHaveUserClasses) {
List<String> excludes = singletonList("example.serialization");
FilteringClassLoader classLoader = new FilteringClassLoader(excludes, null);
config.setClassLoader(classLoader);
}
factory.newHazelcastInstance(config);
factory.newHazelcastInstance(config);
}
use of com.hazelcast.internal.util.FilteringClassLoader in project hazelcast by hazelcast.
the class AbstractSplitBrainProtectionFunctionTest method initClockOffsetTest.
/**
* Sets up the test to use Hazelcast classes off a separate classloader so that the clock offset can be set to any arbitrary
* value. This is necessary for clock offset tests as {@link Clock} 's offset is initialized
* in a static context.
*/
protected void initClockOffsetTest(long offsetMillis) {
System.setProperty(ClockProperties.HAZELCAST_CLOCK_OFFSET, String.valueOf(offsetMillis));
Thread thread = currentThread();
tccl = thread.getContextClassLoader();
filteringClassloader = new FilteringClassLoader(Collections.<String>emptyList(), "com.hazelcast");
thread.setContextClassLoader(filteringClassloader);
}
use of com.hazelcast.internal.util.FilteringClassLoader in project hazelcast by hazelcast.
the class CompactFormatIntegrationTest method getConfig.
@Override
protected Config getConfig() {
Config config = super.smallInstanceConfig();
config.getMapConfig("test").setInMemoryFormat(inMemoryFormat);
if (serverDoesNotHaveClasses) {
List<String> excludes = singletonList("example.serialization");
FilteringClassLoader classLoader = new FilteringClassLoader(excludes, null);
config.setClassLoader(classLoader);
}
config.getSerializationConfig().getCompactSerializationConfig().setEnabled(true);
return config;
}
use of com.hazelcast.internal.util.FilteringClassLoader in project hazelcast by hazelcast.
the class UserCodeDeploymentBasicTest method testInnerClassFetchedFirst_thenMainClassFetchedFromRemote.
@Test
public void testInnerClassFetchedFirst_thenMainClassFetchedFromRemote() {
Config i1Config = new Config();
i1Config.getUserCodeDeploymentConfig().setEnabled(true).setClassCacheMode(classCacheMode);
Config filteredConfig = new Config();
FilteringClassLoader filteringCL = new FilteringClassLoader(singletonList("usercodedeployment"), null);
filteredConfig.setClassLoader(filteringCL);
filteredConfig.getUserCodeDeploymentConfig().setEnabled(true).setClassCacheMode(classCacheMode);
HazelcastInstance instanceWithClasses = factory.newHazelcastInstance(i1Config);
HazelcastInstance instanceWithoutTheClasses = factory.newHazelcastInstance(filteredConfig);
IMap<Object, Object> map = instanceWithClasses.getMap("test");
DomainClassWithInnerClass mainDomainObject = new DomainClassWithInnerClass(new DomainClassWithInnerClass.InnerClass(2));
map.put("main", mainDomainObject);
DomainClassWithInnerClass.InnerClass innerObject = new DomainClassWithInnerClass.InnerClass(1);
map.put("inner", innerObject);
IMap<Object, Object> map2 = instanceWithoutTheClasses.getMap("test");
map2.get("inner");
map2.get("main");
}
Aggregations