use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.
the class LoggingScheduledExecutorTest method throwsExecutionException_withCallable.
@Test
public void throwsExecutionException_withCallable() throws Exception {
executor = new LoggingScheduledExecutor(logger, 1, factory);
Future<Integer> future = executor.submit(new FailedCallable());
expectedException.expect(new RootCauseMatcher(RuntimeException.class));
future.get();
assertNull(logger.getThrowable());
}
use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.
the class DistributedObjectTest method testDistributedObjectDestroyed_whenDestroyDuringInitialization.
@Test
public void testDistributedObjectDestroyed_whenDestroyDuringInitialization() throws InterruptedException, ExecutionException {
final CountDownLatch initializationStarted = new CountDownLatch(1);
final CountDownLatch objectDestroyed = new CountDownLatch(1);
Config config = new Config();
ConfigAccessor.getServicesConfig(config).addServiceConfig(new ServiceConfig().setEnabled(true).setName(TestInitializingObjectService.NAME).setImplementation(new TestInitializingObjectService(() -> {
initializationStarted.countDown();
try {
objectDestroyed.await();
} catch (InterruptedException e) {
ignore(e);
}
})));
String serviceName = TestInitializingObjectService.NAME;
String objectName = "test-object";
HazelcastInstance instance = createHazelcastInstance(config);
Future f = spawn(() -> {
// must fail with DistributedObjectDestroyedException
instance.getDistributedObject(serviceName, objectName);
});
initializationStarted.await();
NodeEngineImpl nodeEngine = getNodeEngineImpl(instance);
UUID source = nodeEngine.getLocalMember().getUuid();
nodeEngine.getProxyService().destroyDistributedObject(serviceName, objectName, source);
objectDestroyed.countDown();
expectedException.expect(ExecutionException.class);
expectedException.expectCause(new RootCauseMatcher(DistributedObjectDestroyedException.class));
f.get();
}
use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.
the class YamlConfigImportVariableReplacementTest method testImportNodeScalarVsMappingThrows.
@Test
public void testImportNodeScalarVsMappingThrows() 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: {}";
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 testImportNodeScalarVsSequenceThrows.
@Test
public void testImportNodeScalarVsSequenceThrows() 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:\n" + " - seqName: {}";
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 YamlOnlyConfigBuilderTest method testNullInMapThrows.
@Test
public void testNullInMapThrows() {
String yaml = "" + "hazelcast:\n" + " map:\n" + " test:\n" + " query-caches: {}\n";
expected.expect(new RootCauseMatcher(InvalidConfigurationException.class, "hazelcast/map/test"));
buildConfig(yaml);
}
Aggregations