use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.
the class YamlOnlyConfigBuilderTest method testExplicitNullScalarThrows.
@Test
public void testExplicitNullScalarThrows() {
String yaml = "" + "hazelcast:\n" + " instance-name: !!null";
expected.expect(new RootCauseMatcher(InvalidConfigurationException.class, "hazelcast/instance-name"));
buildConfig(yaml);
}
use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.
the class YamlOnlyConfigBuilderTest method testNullInSequenceThrows.
@Test
public void testNullInSequenceThrows() {
String yaml = "" + "hazelcast:\n" + " listeners:\n" + " - com.package.SomeListener\n" + " -\n";
expected.expect(new RootCauseMatcher(InvalidConfigurationException.class, "hazelcast/listeners"));
buildConfig(yaml);
}
use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.
the class YamlConfigImportVariableReplacementTest method testImportRedefinesSameConfigScalarThrows.
@Test
public void testImportRedefinesSameConfigScalarThrows() throws Exception {
String importedYaml = "" + "hazelcast:\n" + " cluster-name: name1";
String path = helper.givenConfigFileInWorkDir("foo.bar", importedYaml).getAbsolutePath();
String yaml = "" + "hazelcast:\n" + " import:\n" + " - ${config.location}\n" + " cluster-name: name2";
rule.expect(new RootCauseMatcher(InvalidConfigurationException.class, "hazelcast/cluster-name"));
buildConfig(yaml, "config.location", path);
}
use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.
the class YamlConfigImportVariableReplacementTest method testImportNodeSequenceVsMappingThrows.
@Test
public void testImportNodeSequenceVsMappingThrows() throws Exception {
String importedYaml = "" + "hazelcast:\n" + " cluster-name:\n" + " - seqname";
String path = helper.givenConfigFileInWorkDir("foo.bar", importedYaml).getAbsolutePath();
String yaml = "" + "hazelcast:\n" + " import:\n" + " - ${config.location}\n" + " cluster-name: {}";
rule.expect(new RootCauseMatcher(InvalidConfigurationException.class, "hazelcast/cluster-name"));
buildConfig(yaml, "config.location", path);
}
use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.
the class CacheTypesConfigTest method cacheConfigShouldBeAddedOnJoiningMember_whenCacheLoaderFactoryNotResolvableWithClassLoaderSet.
// tests deferred resolution of factories, with context class loader set correctly
@Test
public void cacheConfigShouldBeAddedOnJoiningMember_whenCacheLoaderFactoryNotResolvableWithClassLoaderSet() throws InterruptedException {
HazelcastInstance hz1 = factory.newHazelcastInstance(getConfig());
CachingProvider cachingProvider = createServerCachingProvider(hz1);
CacheManager cacheManager1 = cachingProvider.getCacheManager(null, null, propertiesByInstanceItself(hz1));
CacheConfig<String, Person> cacheConfig = createCacheConfig();
cacheConfig.setCacheLoaderFactory(new PersonCacheLoaderFactory());
cacheManager1.createCache(cacheName, cacheConfig);
// joining member cannot resolve PersonCacheLoaderFactory class
HazelcastInstance hz2 = factory.newHazelcastInstance(getClassFilteringConfig());
assertClusterSize(2, hz1, hz2);
ICache<String, Person> cache = hz2.getCacheManager().getCache(cacheName);
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(hz2.getConfig().getClassLoader());
CacheProxy<String, Person> cacheProxy = (CacheProxy<String, Person>) cache;
CacheService cacheService = (CacheService) cacheProxy.getService();
expect.expectCause(new RootCauseMatcher(ClassNotFoundException.class, "classloading.domain.PersonCacheLoaderFactory - " + "Package excluded explicitly"));
cacheService.getCacheConfig(cache.getPrefixedName()).getCacheLoaderFactory();
String key = generateKeyOwnedBy(hz2);
cache.invoke(key, new PersonEntryProcessor());
} finally {
Thread.currentThread().setContextClassLoader(oldClassLoader);
}
}
Aggregations