mirror of
https://github.com/jlengrand/vert.x.git
synced 2026-03-10 08:51:19 +00:00
Fixes incomplete promise when a child verticle could not be deployed … (#3186)
* Fixes incomplete promise when a child verticle could not be deployed because its parent has been undeployed Signed-off-by: zenios <dimitris.zenios@gmail.com> * Added tests Signed-off-by: zenios <dimitris.zenios@gmail.com> * Fail the promise after undeploy is completed Signed-off-by: zenios <dimitris.zenios@gmail.com> * Simplify test using onSuccess / onFailure Signed-off-by: zenios <dimitris.zenios@gmail.com> * Use await / testComplete instead of CountDownLatch Signed-off-by: zenios <dimitris.zenios@gmail.com>
This commit is contained in:
@@ -463,7 +463,7 @@ public class DeploymentManager {
|
||||
deployment.child = true;
|
||||
} else {
|
||||
// Orphan
|
||||
deployment.undeploy(null);
|
||||
deployment.undeploy(event -> promise.fail("Verticle deployment failed.Could not be added as child of parent verticle"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1234,6 +1234,22 @@ public class DeploymentTest extends VertxTestBase {
|
||||
vertx = null;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeployChildOnParentUndeploy() {
|
||||
class ParentVerticle extends AbstractVerticle {
|
||||
@Override
|
||||
public void stop(Promise<Void> stopPromise) {
|
||||
vertx.deployVerticle(ChildVerticle.class.getName())
|
||||
.<Void>mapEmpty()
|
||||
.setHandler(stopPromise);
|
||||
}
|
||||
}
|
||||
|
||||
vertx.deployVerticle(new ParentVerticle(), onSuccess(id ->
|
||||
vertx.undeploy(id, onFailure(u -> testComplete()))));
|
||||
await();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUndeployAllFailureInUndeploy() throws Exception {
|
||||
int numVerticles = 10;
|
||||
|
||||
Reference in New Issue
Block a user