Search in sources :

Example 1 with DomainClassWithInnerClass

use of usercodedeployment.DomainClassWithInnerClass 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");
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) DomainClassWithInnerClass(usercodedeployment.DomainClassWithInnerClass) UserCodeDeploymentConfig(com.hazelcast.config.UserCodeDeploymentConfig) Config(com.hazelcast.config.Config) FilteringClassLoader(com.hazelcast.internal.util.FilteringClassLoader) DomainClassWithInnerClass(usercodedeployment.DomainClassWithInnerClass) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 2 with DomainClassWithInnerClass

use of usercodedeployment.DomainClassWithInnerClass in project hazelcast by hazelcast.

the class UserCodeDeploymentBasicTest method testMainClassFetchedFirst_thenInnerlassFetchedFromRemote.

@Test
public void testMainClassFetchedFirst_thenInnerlassFetchedFromRemote() {
    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("main");
    map2.get("inner");
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) DomainClassWithInnerClass(usercodedeployment.DomainClassWithInnerClass) UserCodeDeploymentConfig(com.hazelcast.config.UserCodeDeploymentConfig) Config(com.hazelcast.config.Config) FilteringClassLoader(com.hazelcast.internal.util.FilteringClassLoader) DomainClassWithInnerClass(usercodedeployment.DomainClassWithInnerClass) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

Config (com.hazelcast.config.Config)2 UserCodeDeploymentConfig (com.hazelcast.config.UserCodeDeploymentConfig)2 HazelcastInstance (com.hazelcast.core.HazelcastInstance)2 FilteringClassLoader (com.hazelcast.internal.util.FilteringClassLoader)2 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)2 QuickTest (com.hazelcast.test.annotation.QuickTest)2 Test (org.junit.Test)2 DomainClassWithInnerClass (usercodedeployment.DomainClassWithInnerClass)2