use of com.hazelcast.util.FilteringClassLoader in project hazelcast by hazelcast.
the class UserCodeDeploymentSmokeTest method givenProviderFilterUsesMemberAttribute_whenSomeMemberHasMatchingAttribute_thenClassLoadingRequestSucceed.
@Test
public void givenProviderFilterUsesMemberAttribute_whenSomeMemberHasMatchingAttribute_thenClassLoadingRequestSucceed() {
Config i1Config = new Config();
i1Config.getMemberAttributeConfig().setStringAttribute("foo", "bar");
i1Config.getUserCodeDeploymentConfig().setEnabled(true).setClassCacheMode(classCacheMode);
Config i2Config = new Config();
FilteringClassLoader filteringCL = new FilteringClassLoader(asList("usercodedeployment"), null);
i2Config.setClassLoader(filteringCL);
i2Config.getUserCodeDeploymentConfig().setEnabled(true).setProviderFilter("HAS_ATTRIBUTE:foo").setClassCacheMode(classCacheMode);
EntryProcessor<Integer, Integer> myEP = new IncrementingEntryProcessor();
executeSimpleTestScenario(i1Config, i2Config, myEP);
}
use of com.hazelcast.util.FilteringClassLoader in project hazelcast by hazelcast.
the class UserCodeDeploymentSmokeTest method givenTheEPButItIsNotOnTheWhitelist_whenTheEPIsFilteredLocally_thenItWillFailToLoadIt.
@Test(expected = HazelcastSerializationException.class)
public void givenTheEPButItIsNotOnTheWhitelist_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).setWhitelistedPrefixes("usercodedeployment.whitelisted").setClassCacheMode(classCacheMode);
EntryProcessor<Integer, Integer> myEP = new IncrementingEntryProcessor();
executeSimpleTestScenario(i1Config, i2Config, myEP);
}
use of com.hazelcast.util.FilteringClassLoader in project hazelcast by hazelcast.
the class UserCodeDeploymentSmokeTest method givenProviderFilterUsesMemberAttribute_whenNoMemberHasMatchingAttribute_thenClassLoadingRequestFails.
@Test(expected = HazelcastSerializationException.class)
public void givenProviderFilterUsesMemberAttribute_whenNoMemberHasMatchingAttribute_thenClassLoadingRequestFails() {
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).setProviderFilter("HAS_ATTRIBUTE:foo").setClassCacheMode(classCacheMode);
EntryProcessor<Integer, Integer> myEP = new IncrementingEntryProcessor();
executeSimpleTestScenario(i1Config, i2Config, myEP);
}
use of com.hazelcast.util.FilteringClassLoader 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);
}
use of com.hazelcast.util.FilteringClassLoader in project hazelcast by hazelcast.
the class UserCodeDeploymentSmokeTest method testUserCodeDeploymentIsDisabledByDefault.
@Test(expected = HazelcastSerializationException.class)
public void testUserCodeDeploymentIsDisabledByDefault() {
//this test also validate the EP is filtered locally and has to be loaded from the other member
Config i1Config = new Config();
Config i2Config = new Config();
FilteringClassLoader filteringCL = new FilteringClassLoader(asList("usercodedeployment"), null);
i2Config.setClassLoader(filteringCL);
IncrementingEntryProcessor incrementingEntryProcessor = new IncrementingEntryProcessor();
executeSimpleTestScenario(i1Config, i2Config, incrementingEntryProcessor);
}
Aggregations