Search in sources :

Example 1 with BlacklistedEP

use of usercodedeployment.blacklisted.BlacklistedEP in project hazelcast by hazelcast.

the class UserCodeDeploymentSmokeTest method givenTheEPButItIsBlacklisted_whenTheEPIsFilteredLocally_thenItWillFailToLoadIt.

@Test(expected = HazelcastSerializationException.class)
public void givenTheEPButItIsBlacklisted_whenTheEPIsFilteredLocally_thenItWillFailToLoadIt() {
    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).setBlacklistedPrefixes("usercodedeployment.blacklisted").setClassCacheMode(classCacheMode);
    EntryProcessor<Integer, Integer> myEP = new BlacklistedEP();
    executeSimpleTestScenario(i1Config, i2Config, myEP);
}
Also used : Config(com.hazelcast.config.Config) UserCodeDeploymentConfig(com.hazelcast.config.UserCodeDeploymentConfig) FilteringClassLoader(com.hazelcast.util.FilteringClassLoader) BlacklistedEP(usercodedeployment.blacklisted.BlacklistedEP) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 2 with BlacklistedEP

use of usercodedeployment.blacklisted.BlacklistedEP in project hazelcast by hazelcast.

the class UserCodeDeploymentBasicTest method givenTheEPButItIsBlacklisted_whenTheEPIsFilteredLocally_thenItWillFailToLoadIt.

@Test
public void givenTheEPButItIsBlacklisted_whenTheEPIsFilteredLocally_thenItWillFailToLoadIt() {
    Config i1Config = new Config();
    i1Config.getUserCodeDeploymentConfig().setEnabled(true).setClassCacheMode(classCacheMode);
    Config i2Config = new Config();
    FilteringClassLoader filteringCL = new FilteringClassLoader(singletonList("usercodedeployment"), null);
    i2Config.setClassLoader(filteringCL);
    i2Config.getUserCodeDeploymentConfig().setEnabled(true).setBlacklistedPrefixes("usercodedeployment.blacklisted").setClassCacheMode(classCacheMode);
    EntryProcessor<Integer, Integer, Integer> myEP = new BlacklistedEP();
    try {
        executeSimpleTestScenario(i1Config, i2Config, myEP);
        fail();
    } catch (Exception e) {
        assertInstanceOfByClassName(HazelcastSerializationException.class.getName(), e);
    }
}
Also used : UserCodeDeploymentConfig(com.hazelcast.config.UserCodeDeploymentConfig) Config(com.hazelcast.config.Config) FilteringClassLoader(com.hazelcast.internal.util.FilteringClassLoader) BlacklistedEP(usercodedeployment.blacklisted.BlacklistedEP) HazelcastSerializationException(com.hazelcast.nio.serialization.HazelcastSerializationException) 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 QuickTest (com.hazelcast.test.annotation.QuickTest)2 Test (org.junit.Test)2 BlacklistedEP (usercodedeployment.blacklisted.BlacklistedEP)2 FilteringClassLoader (com.hazelcast.internal.util.FilteringClassLoader)1 HazelcastSerializationException (com.hazelcast.nio.serialization.HazelcastSerializationException)1 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)1 ParallelTest (com.hazelcast.test.annotation.ParallelTest)1 FilteringClassLoader (com.hazelcast.util.FilteringClassLoader)1