Search in sources :

Example 56 with RootCauseMatcher

use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.

the class YamlClientConfigImportVariableReplacementTest method testImportNodeSequenceVsMappingThrows.

@Test
public void testImportNodeSequenceVsMappingThrows() throws Exception {
    String importedYaml = "" + "hazelcast-client:\n" + "  cluster-name:\n" + "    - seqname";
    String configPath = helper.givenConfigFileInWorkDir("foo.bar", importedYaml).getAbsolutePath();
    String yaml = "" + "hazelcast-client:\n" + "  import:\n" + "    - ${config.location}\n" + "  cluster-name: {}";
    rule.expect(new RootCauseMatcher(InvalidConfigurationException.class, "hazelcast-client/cluster-name"));
    buildConfig(yaml, "config.location", configPath);
}
Also used : RootCauseMatcher(com.hazelcast.internal.util.RootCauseMatcher) InvalidConfigurationException(com.hazelcast.config.InvalidConfigurationException) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 57 with RootCauseMatcher

use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.

the class YamlClientConfigBuilderTest method testExplicitNullScalarThrows.

@Test
public void testExplicitNullScalarThrows() {
    String yaml = "" + "hazelcast-client:\n" + "  group:\n" + "   name: !!null";
    expected.expect(new RootCauseMatcher(InvalidConfigurationException.class, "hazelcast-client/group/name"));
    buildConfig(yaml);
}
Also used : RootCauseMatcher(com.hazelcast.internal.util.RootCauseMatcher) InvalidConfigurationException(com.hazelcast.config.InvalidConfigurationException) QuickTest(com.hazelcast.test.annotation.QuickTest) YamlConfigBuilderTest(com.hazelcast.config.YamlConfigBuilderTest) Test(org.junit.Test)

Example 58 with RootCauseMatcher

use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.

the class ClientInvocationFutureTest method test_exceptionalCompletion_withJoin.

@Test
public void test_exceptionalCompletion_withJoin() {
    invocationFuture.completeExceptionally(new IllegalArgumentException());
    expected.expect(CompletionException.class);
    expected.expectCause(new RootCauseMatcher(IllegalArgumentException.class));
    invocationFuture.join();
}
Also used : RootCauseMatcher(com.hazelcast.internal.util.RootCauseMatcher) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 59 with RootCauseMatcher

use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.

the class ClientDelegatingFutureTest method join_whenCompletedExceptionally.

@Test
public void join_whenCompletedExceptionally() {
    invocationFuture.completeExceptionally(new IllegalArgumentException());
    expected.expect(CompletionException.class);
    expected.expectCause(new RootCauseMatcher(IllegalArgumentException.class));
    delegatingFuture.join();
}
Also used : RootCauseMatcher(com.hazelcast.internal.util.RootCauseMatcher) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 60 with RootCauseMatcher

use of com.hazelcast.internal.util.RootCauseMatcher in project hazelcast by hazelcast.

the class ClientDelegatingFutureTest method whenComplete_whenExceptional.

@Test
public void whenComplete_whenExceptional() {
    CompletableFuture<String> nextStage = delegatingFuture.whenComplete((v, t) -> {
        assertInstanceOf(IllegalArgumentException.class, t);
    });
    invocationFuture.completeExceptionally(new IllegalArgumentException());
    assertTrueEventually(() -> assertTrue(nextStage.isDone()));
    expected.expect(CompletionException.class);
    expected.expectCause(new RootCauseMatcher(IllegalArgumentException.class));
    delegatingFuture.join();
}
Also used : RootCauseMatcher(com.hazelcast.internal.util.RootCauseMatcher) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

RootCauseMatcher (com.hazelcast.internal.util.RootCauseMatcher)122 QuickTest (com.hazelcast.test.annotation.QuickTest)118 Test (org.junit.Test)118 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)106 ExpectedRuntimeException (com.hazelcast.test.ExpectedRuntimeException)64 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)31 CompletableFutureTestUtil (com.hazelcast.spi.impl.operationservice.impl.CompletableFutureTestUtil)26 CancellationException (java.util.concurrent.CancellationException)25 CountDownLatch (java.util.concurrent.CountDownLatch)25 CALLER_RUNS (com.hazelcast.internal.util.ConcurrencyUtil.CALLER_RUNS)24 InternalCompletableFuture.newCompletedFuture (com.hazelcast.spi.impl.InternalCompletableFuture.newCompletedFuture)24 CountingExecutor (com.hazelcast.spi.impl.operationservice.impl.CompletableFutureTestUtil.CountingExecutor)24 CompletableFutureTestUtil.ignore (com.hazelcast.spi.impl.operationservice.impl.CompletableFutureTestUtil.ignore)24 HazelcastParallelClassRunner (com.hazelcast.test.HazelcastParallelClassRunner)24 HazelcastTestSupport.assertInstanceOf (com.hazelcast.test.HazelcastTestSupport.assertInstanceOf)24 HazelcastTestSupport.assertOpenEventually (com.hazelcast.test.HazelcastTestSupport.assertOpenEventually)24 HazelcastTestSupport.assertTrueEventually (com.hazelcast.test.HazelcastTestSupport.assertTrueEventually)24 CompletableFuture (java.util.concurrent.CompletableFuture)24 CompletionException (java.util.concurrent.CompletionException)24 CompletionStage (java.util.concurrent.CompletionStage)24