Search in sources :

Example 6 with FilteringClassLoader

use of com.hazelcast.util.FilteringClassLoader in project hazelcast by hazelcast.

the class UserCodeDeploymentSmokeTest method givenSomeMemberCanAccessTheEP_whenTheEPIsFilteredLocally_thenItWillBeLoadedOverNetwork.

@Test
public void givenSomeMemberCanAccessTheEP_whenTheEPIsFilteredLocally_thenItWillBeLoadedOverNetwork() {
    Config i1Config = new Config();
    i1Config.getUserCodeDeploymentConfig().setEnabled(true).setClassCacheMode(classCacheMode);
    Config i2Config = new Config();
    FilteringClassLoader filteringCL = new FilteringClassLoader(asList("usercodedeployment"), null);
    i2Config.setClassLoader(filteringCL);
    i2Config.getUserCodeDeploymentConfig().setEnabled(true).setClassCacheMode(classCacheMode);
    IncrementingEntryProcessor incrementingEntryProcessor = new IncrementingEntryProcessor();
    executeSimpleTestScenario(i1Config, i2Config, incrementingEntryProcessor);
}
Also used : Config(com.hazelcast.config.Config) UserCodeDeploymentConfig(com.hazelcast.config.UserCodeDeploymentConfig) FilteringClassLoader(com.hazelcast.util.FilteringClassLoader) IncrementingEntryProcessor(usercodedeployment.IncrementingEntryProcessor) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 7 with FilteringClassLoader

use of com.hazelcast.util.FilteringClassLoader in project hazelcast by hazelcast.

the class UserCodeDeploymentSmokeTest method givenTheEPIsOnTheWhitelist_whenTheEPIsFilteredLocally_thenItWillLoadIt.

@Test
public void givenTheEPIsOnTheWhitelist_whenTheEPIsFilteredLocally_thenItWillLoadIt() {
    Config i1Config = new Config();
    i1Config.getUserCodeDeploymentConfig().setEnabled(true).setClassCacheMode(classCacheMode);
    Config i2Config = new Config();
    FilteringClassLoader filteringCL = new FilteringClassLoader(asList("usercodedeployment"), null);
    i2Config.setClassLoader(filteringCL);
    i2Config.getUserCodeDeploymentConfig().setEnabled(true).setWhitelistedPrefixes("usercodedeployment.whitelisted, usercodedeployment").setClassCacheMode(classCacheMode);
    EntryProcessor<Integer, Integer> myEP = new WhitelistedEP();
    executeSimpleTestScenario(i1Config, i2Config, myEP);
}
Also used : WhitelistedEP(usercodedeployment.whitelisted.WhitelistedEP) Config(com.hazelcast.config.Config) UserCodeDeploymentConfig(com.hazelcast.config.UserCodeDeploymentConfig) FilteringClassLoader(com.hazelcast.util.FilteringClassLoader) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

Config (com.hazelcast.config.Config)7 UserCodeDeploymentConfig (com.hazelcast.config.UserCodeDeploymentConfig)7 ParallelTest (com.hazelcast.test.annotation.ParallelTest)7 QuickTest (com.hazelcast.test.annotation.QuickTest)7 FilteringClassLoader (com.hazelcast.util.FilteringClassLoader)7 Test (org.junit.Test)7 IncrementingEntryProcessor (usercodedeployment.IncrementingEntryProcessor)5 BlacklistedEP (usercodedeployment.blacklisted.BlacklistedEP)1 WhitelistedEP (usercodedeployment.whitelisted.WhitelistedEP)1