use of io.vertx.core.Launcher in project vert.x by eclipse.
the class LauncherExtensibilityTest method testThatCustomLauncherCanCustomizeTheClusteredOption.
@Test
public void testThatCustomLauncherCanCustomizeTheClusteredOption() {
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 beforeStartingVertx(VertxOptions options) {
options.setClustered(true);
}
};
myLauncher.dispatch(new String[0]);
waitUntil(() -> {
try {
return RunCommandTest.getHttpCode() == 200;
} catch (IOException e) {
return false;
}
});
assertThat(this.vertx.isClustered()).isTrue();
}
use of io.vertx.core.Launcher in project vert.x by eclipse.
the class RunCommandTest method testFatJarWithHTTPVerticle.
@Test
public void testFatJarWithHTTPVerticle() throws IOException, InterruptedException {
setManifest("MANIFEST-Launcher-Http-Verticle.MF");
cli.dispatch(new Launcher(), new String[] {});
assertWaitUntil(() -> {
try {
return getHttpCode() == 200;
} catch (IOException e) {
return false;
}
});
assertThat(getContent().getBoolean("clustered")).isFalse();
}
use of io.vertx.core.Launcher in project vert.x by eclipse.
the class RunCommandTest method testThatHADeploysVerticle.
@Test
public void testThatHADeploysVerticle() throws IOException {
setManifest("MANIFEST-Launcher-Http-Verticle.MF");
cli.dispatch(new Launcher(), new String[] { "-ha", "-cluster" });
assertWaitUntil(() -> {
try {
return getHttpCode() == 200;
} catch (IOException e) {
return false;
}
});
assertThat(getContent().getBoolean("clustered")).isTrue();
}
use of io.vertx.core.Launcher in project vert.x by eclipse.
the class RunCommandTest method testMetricsEnabledFromCommandLine.
@Test
public void testMetricsEnabledFromCommandLine() throws IOException {
setManifest("MANIFEST-Launcher-Http-Verticle.MF");
cli.dispatch(new Launcher(), new String[] { "-Dvertx.metrics.options.enabled=true" });
assertWaitUntil(() -> {
try {
return getHttpCode() == 200;
} catch (IOException e) {
return false;
}
});
// Check that the metrics are enabled
// We cannot use the response from the verticle as it uses the DymmyVertxMetrics (no metrics provider)
assertThat(((RunCommand) cli.getExistingCommandInstance("run")).options.getMetricsOptions().isEnabled()).isTrue();
}
use of io.vertx.core.Launcher in project vert.x by eclipse.
the class RunCommandTest method testWithConfProvidedInline.
@Test
public void testWithConfProvidedInline() throws IOException {
long someNumber = new Random().nextLong();
setManifest("MANIFEST-Launcher-Http-Verticle.MF");
cli.dispatch(new Launcher(), new String[] { "--conf={\"random\":" + someNumber + "}" });
assertWaitUntil(() -> {
try {
return getHttpCode() == 200;
} catch (IOException e) {
return false;
}
});
assertThat(getContent().getJsonObject("conf").getLong("random")).isEqualTo(someNumber);
}
Aggregations