use of io.vertx.core.Launcher in project vert.x by eclipse.
the class RedeployTest method testRedeploymentWithSlash.
@Test
public void testRedeploymentWithSlash() throws IOException {
cli.dispatch(new Launcher(), new String[] { "run", // Use "/", on windows it gets replaced.
HttpTestVerticle.class.getName(), "--redeploy=**" + "/" + "*.txt", "--launcher-class=" + Launcher.class.getName(), ExecUtils.isWindows() ? "--redeploy-termination-period=3000" : "" });
assertWaitUntil(() -> {
try {
return RunCommandTest.getHttpCode() == 200;
} catch (IOException e) {
return false;
}
});
long start1 = RunCommandTest.getContent().getLong("startTime");
File file = new File("target/test-classes/foo.txt");
if (file.exists()) {
file.delete();
}
file.createNewFile();
assertWaitUntil(() -> {
try {
return RunCommandTest.getHttpCode() == 200 && start1 != RunCommandTest.getContent().getLong("startTime");
} catch (IOException e) {
return false;
}
}, 20000);
}
use of io.vertx.core.Launcher in project vert.x by eclipse.
the class LauncherExtensibilityTest method testExtendingMainVerticle.
@Test
public void testExtendingMainVerticle() {
Launcher myLauncher = new Launcher() {
@Override
protected String getMainVerticle() {
return HttpTestVerticle.class.getName();
}
@Override
public void afterStartingVertx(Vertx vertx) {
LauncherExtensibilityTest.this.vertx = vertx;
}
};
myLauncher.dispatch(new String[0]);
assertWaitUntil(() -> {
try {
return RunCommandTest.getHttpCode() == 200;
} catch (IOException e) {
return false;
}
});
}
use of io.vertx.core.Launcher in project vert.x by eclipse.
the class LauncherExtensibilityTest method testThatALauncherCanAddACommand.
@Test
public void testThatALauncherCanAddACommand() {
Launcher myLauncher = new Launcher() {
@Override
protected void load() {
super.load();
register(FooCommand.class);
}
};
myLauncher.dispatch(new String[] { "foo" });
assertThat(myLauncher.getCommandNames()).contains("foo");
assertWaitUntil(spy::get);
}
use of io.vertx.core.Launcher in project vert.x by eclipse.
the class LauncherExtensibilityTest method testThatCustomLauncherCanUpdateConfigurationWhenNoneArePassed.
@Test
public void testThatCustomLauncherCanUpdateConfigurationWhenNoneArePassed() throws IOException {
long time = System.nanoTime();
Launcher myLauncher = new Launcher() {
@Override
protected String getMainVerticle() {
return HttpTestVerticle.class.getName();
}
@Override
public void afterStartingVertx(Vertx vertx) {
LauncherExtensibilityTest.this.vertx = vertx;
}
@Override
public void afterConfigParsed(JsonObject config) {
config.put("time", time);
}
};
myLauncher.dispatch(new String[0]);
assertWaitUntil(() -> {
try {
return RunCommandTest.getHttpCode() == 200;
} catch (IOException e) {
return false;
}
});
assertThat(RunCommandTest.getContent().getJsonObject("conf").getLong("time")).isEqualTo(time);
}
use of io.vertx.core.Launcher in project vert.x by eclipse.
the class LauncherExtensibilityTest method testThatALauncherCanHideACommand.
@Test
public void testThatALauncherCanHideACommand() {
Launcher myLauncher = new Launcher() {
@Override
protected void load() {
super.load();
unregister("start");
}
};
record();
myLauncher.dispatch(new String[] { "start" });
stop();
assertThat(output.toString()).contains("The command 'start' is not a valid command.");
assertThat(myLauncher.getCommandNames()).doesNotContain("start");
}
Aggregations