use of classloading.domain.PersonExpiryPolicyFactory in project hazelcast by hazelcast.
the class CacheTypesConfigTest method cacheConfigShouldBeAddedOnJoiningMember_whenExpiryPolicyFactoryNotResolvable.
// tests deferred resolution of expiry policy factory
@Test
public void cacheConfigShouldBeAddedOnJoiningMember_whenExpiryPolicyFactoryNotResolvable() throws InterruptedException {
HazelcastInstance hz1 = factory.newHazelcastInstance(getConfig());
CachingProvider cachingProvider = createServerCachingProvider(hz1);
cachingProvider.getCacheManager().createCache(cacheName, createCacheConfig().setExpiryPolicyFactory(new PersonExpiryPolicyFactory()));
HazelcastInstance hz2 = factory.newHazelcastInstance(getClassFilteringConfig());
assertClusterSize(2, hz1, hz2);
ICache<String, Person> cache = hz2.getCacheManager().getCache(cacheName);
String key = generateKeyOwnedBy(hz2);
expect.expectCause(new RootCauseMatcher(ClassNotFoundException.class, "classloading.domain.PersonExpiryPolicyFactory - " + "Package excluded explicitly"));
cache.invoke(key, new PersonEntryProcessor());
}
use of classloading.domain.PersonExpiryPolicyFactory in project hazelcast by hazelcast.
the class PreJoinCacheConfigTest method serializationSucceeds_cacheExpiryFactory.
@Test
public void serializationSucceeds_cacheExpiryFactory() {
CacheConfig<String, Person> cacheConfig = newDefaultCacheConfig("test");
cacheConfig.setExpiryPolicyFactory(new PersonExpiryPolicyFactory());
PreJoinCacheConfig preJoinCacheConfig = new PreJoinCacheConfig(cacheConfig);
Data data = serializationService.toData(preJoinCacheConfig);
PreJoinCacheConfig deserialized = serializationService.toObject(data);
assertEquals(preJoinCacheConfig, deserialized);
assertEquals(cacheConfig, deserialized.asCacheConfig());
assertNull(deserialized.getCacheWriterFactory());
assertTrue("Invalid Factory Class", deserialized.getExpiryPolicyFactory() instanceof PersonExpiryPolicyFactory);
}
Aggregations