final Vertigo vertigo = new Vertigo(this);
vertigo.deployCluster("vertigo", new Handler<AsyncResult<Cluster>>() {
@Override
public void handle(AsyncResult<Cluster> result) {
assertTrue(result.succeeded());
final NetworkContext context = DefaultNetworkContext.Builder.newBuilder()
.setName("test-coordinator-pause")
.setAddress("test")
.setStatusAddress("test.__status")
.setCluster("test")
.addComponent(DefaultVerticleContext.Builder.newBuilder()
.setName("test")
.setAddress("test.test")
.setStatusAddress("test.test.__status")
.addInstance(DefaultInstanceContext.Builder.newBuilder()
.setAddress("test.test-1")
.setStatusAddress("test.test-1.__status")
.setInput(DefaultInputContext.Builder.newBuilder().build())
.setOutput(DefaultOutputContext.Builder.newBuilder().build()).build()).build()).build();
final InstanceContext instance = context.component("test").instances().iterator().next();
final Cluster cluster = new DefaultCluster("vertigo", vertx, container);
final WatchableAsyncMap<String, String> data = new WrappedWatchableAsyncMap<String, String>(cluster.<String, String>getMap("test"), vertx);
data.put(instance.address(), Contexts.serialize(instance).encode(), new Handler<AsyncResult<String>>() {
@Override
public void handle(AsyncResult<String> result) {
if (result.failed()) {
fail(result.cause().getMessage());
} else {
final ComponentCoordinator coordinator = new DefaultComponentCoordinator(instance, vertx, new DefaultCluster("vertigo", vertx, container));
coordinator.start(new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
if (result.failed()) {
fail(result.cause().getMessage());
} else {
coordinator.pauseHandler(new Handler<Void>() {
@Override
public void handle(Void _) {
testComplete();
}
});
data.remove(context.status());
}
}
});
data.put(context.status(), "ready");
}
}
});
}
});