Skip to content

Commit

Permalink
move test of failed cluster join according to comments by tsegismont
Browse files Browse the repository at this point in the history
Signed-off-by: Oded Arbel <oded@geek.co.il>
  • Loading branch information
guss77 authored and vietj committed Feb 10, 2017
1 parent 1c3603e commit 37fcfa1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
21 changes: 19 additions & 2 deletions src/test/java/io/vertx/test/core/CreateVertxTest.java
Expand Up @@ -16,10 +16,11 @@


package io.vertx.test.core; package io.vertx.test.core;


import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import org.junit.Test; import org.junit.Test;


import io.vertx.core.*;
import io.vertx.test.fakecluster.FakeClusterManager;

/** /**
* @author <a href="http://tfox.org">Tim Fox</a> * @author <a href="http://tfox.org">Tim Fox</a>
*/ */
Expand Down Expand Up @@ -88,4 +89,20 @@ public void testCreateClusteredVertxAsyncDontSetClustered() {
await(); await();
} }



@Test
public void testCreateClusteredVertxAsyncDetectJoinFailure() {
VertxOptions options = new VertxOptions().setClusterManager(new FakeClusterManager(){
@Override
public void join(Handler<AsyncResult<Void>> resultHandler) {
resultHandler.handle(Future.failedFuture(new Exception("joinfailure")));
}
});
clusteredVertx(options, ar -> {
assertTrue(ar.failed());
assertEquals("joinfailure", ar.cause().getMessage());
testComplete();
});
await();
}
} }
16 changes: 0 additions & 16 deletions src/test/java/io/vertx/test/core/VertxTest.java
Expand Up @@ -96,20 +96,4 @@ public void close(Handler<AsyncResult<Void>> completionHandler) {
await(); await();
} }


@Test
public void testClusterManagerFailure() throws Exception {
VertxOptions options = new VertxOptions().setClusterManager(new FakeClusterManager(){
@Override
public void join(Handler<AsyncResult<Void>> resultHandler) {
resultHandler.handle(Future.failedFuture(new Exception("joinfailure")));
}
});
Vertx.clusteredVertx(options, ar -> {
assertTrue(ar.failed());
assertEquals("joinfailure", ar.cause().getMessage());
testComplete();
});
await();
}

} }

0 comments on commit 37fcfa1

Please sign in to comment.