use of io.vertx.core.Launcher in project vert.x by eclipse.
the class RunCommandTest method testFatJarWithoutMainVerticle.
@Test
public void testFatJarWithoutMainVerticle() throws IOException {
setManifest("MANIFEST-Launcher-No-Main-Verticle.MF");
record();
cli.dispatch(new Launcher(), new String[0]);
stop();
assertThat(output.toString()).contains("Usage:");
}
use of io.vertx.core.Launcher in project vert.x by eclipse.
the class RunCommandTest method testWithBrokenConfProvidedInline.
@Test
public void testWithBrokenConfProvidedInline() throws IOException {
setManifest("MANIFEST-Launcher-Http-Verticle.MF");
// There is a missing `}` in the json fragment. This is normal, as the test check that the configuration is not
// read in this case.
cli.dispatch(new Launcher(), new String[] { "--conf={\"name\":\"vertx\"" });
assertWaitUntil(() -> {
try {
return getHttpCode() == 200;
} catch (IOException e) {
return false;
}
});
assertThat(getContent().getJsonObject("conf").toString()).isEqualToIgnoringCase("{}");
}
use of io.vertx.core.Launcher in project vert.x by eclipse.
the class RedeployTest method testStartingApplicationInRedeployModeWithInlineConf.
@Test
public void testStartingApplicationInRedeployModeWithInlineConf() throws IOException {
int random = (int) (Math.random() * 100);
cli.dispatch(new Launcher(), new String[] { "run", HttpTestVerticle.class.getName(), "--redeploy=**" + File.separator + "*.txt", "--launcher-class=" + Launcher.class.getName(), "--conf", "{\"random\":" + random + "}" });
assertWaitUntil(() -> {
try {
return RunCommandTest.getHttpCode() == 200;
} catch (IOException e) {
return false;
}
});
JsonObject conf = RunCommandTest.getContent().getJsonObject("conf");
assertThat(conf).isNotNull().isNotEmpty();
assertThat(conf.getInteger("random")).isEqualTo(random);
}
use of io.vertx.core.Launcher in project vert.x by eclipse.
the class RedeployTest method testStartingApplicationInRedeployModeWithInlineConf2.
@Test
public void testStartingApplicationInRedeployModeWithInlineConf2() throws IOException {
int random = (int) (Math.random() * 100);
cli.dispatch(new Launcher(), new String[] { "run", HttpTestVerticle.class.getName(), "--redeploy=**" + File.separator + "*.txt", "--launcher-class=" + Launcher.class.getName(), "--conf={\"random\":" + random + "}" });
assertWaitUntil(() -> {
try {
return RunCommandTest.getHttpCode() == 200;
} catch (IOException e) {
return false;
}
});
JsonObject conf = RunCommandTest.getContent().getJsonObject("conf");
assertThat(conf).isNotNull().isNotEmpty();
assertThat(conf.getInteger("random")).isEqualTo(random);
}
use of io.vertx.core.Launcher in project vert.x by eclipse.
the class RedeployTest method testStartingApplicationInRedeployModeWithInlineOptions2.
@Test
public void testStartingApplicationInRedeployModeWithInlineOptions2() throws IOException {
cli.dispatch(new Launcher(), new String[] { "run", HttpTestVerticle.class.getName(), "--redeploy=**" + File.separator + "*.txt", "--launcher-class=" + OptionsRecordingLauncher.class.getName(), "--options={\"metricsOptions\":{\"enabled\":true}}" });
assertWaitUntil(() -> {
try {
return RunCommandTest.getHttpCode() == 200;
} catch (IOException e) {
return false;
}
});
JsonObject conf = RunCommandTest.getContent().getJsonObject("conf");
assertThat(conf).isNotNull().isNotEmpty();
JsonObject vertxOptions = conf.getJsonObject(OptionsRecordingLauncher.class.getName());
assertThat(vertxOptions).isNotNull().isNotEmpty();
JsonObject metricsOptions = vertxOptions.getJsonObject("metricsOptions");
assertThat(metricsOptions).isNotNull().isNotEmpty();
assertThat(metricsOptions.getBoolean("enabled")).isEqualTo(true);
}
Aggregations