Skip to content

Commit

Permalink
Added unit test for detecting cluster failure
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 5671d7c commit 017ed28
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions src/test/java/io/vertx/test/core/VertxTest.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
package io.vertx.test.core;

import io.vertx.core.AsyncResult;
import io.vertx.core.Closeable;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.Vertx;
import io.vertx.core.*;
import io.vertx.core.impl.VertxInternal;
import io.vertx.core.shareddata.AsyncMap;
import io.vertx.core.shareddata.Counter;
import io.vertx.core.shareddata.Lock;
import io.vertx.core.spi.cluster.AsyncMultiMap;
import io.vertx.core.spi.cluster.ClusterManager;
import io.vertx.core.spi.cluster.NodeListener;
import io.vertx.test.fakecluster.FakeClusterManager;

import org.junit.Test;

import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

/**
Expand Down Expand Up @@ -88,4 +94,19 @@ public void close(Handler<AsyncResult<Void>> completionHandler) {
});
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()));
}

});
Future<Vertx> f = Future.future();
Vertx.clusteredVertx(options, f.completer());
assertFalse(f.succeeded());
}

}

0 comments on commit 017ed28

Please sign in to comment.