use of io.vertx.core.spi.launcher.ExecutionContext in project vert.x by eclipse.
the class ClasspathHandlerTest method testCPInRunCommand.
@Test
public void testCPInRunCommand() {
run = new RunCommand();
run.setExecutionContext(new ExecutionContext(run, null, null));
run.setClasspath("." + File.pathSeparator + "target/externals");
run.setMainVerticle(VERTICLE);
run.setInstances(1);
run.run();
waitUntil(() -> {
try {
return getHttpCode() == 200;
} catch (IOException e) {
return false;
}
});
}
use of io.vertx.core.spi.launcher.ExecutionContext in project vert.x by eclipse.
the class ClasspathHandlerTest method testCPInBareCommand.
@Test
public void testCPInBareCommand() {
bare = new BareCommand();
bare.setExecutionContext(new ExecutionContext(bare, null, null));
bare.setClasspath("." + File.pathSeparator + "target/externals");
bare.setQuorum(1);
bare.run();
waitUntil(() -> bare.vertx != null);
// Do reproduce the verticle fail-over, set the TCCL
final ClassLoader originalClassloader = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(bare.createClassloader());
bare.vertx.deployVerticle(VERTICLE, new DeploymentOptions().setHa(true));
} finally {
Thread.currentThread().setContextClassLoader(originalClassloader);
}
waitUntil(() -> {
try {
return getHttpCode() == 200;
} catch (IOException e) {
return false;
}
});
}
use of io.vertx.core.spi.launcher.ExecutionContext in project vert.x by eclipse.
the class DefaultCommandTest method testSystemProperties.
@Test
public void testSystemProperties() throws CLIException {
CLI cli = CLIConfigurator.define(command.getClass());
VertxCommandLauncher launcher = new VertxCommandLauncher();
CommandLine evaluatedCLI = parse(cli, "--name=vert.x", "-Dfoo=bar", "--systemProp=x=y");
CLIConfigurator.inject(evaluatedCLI, command);
command.setUp(new ExecutionContext(command, launcher, evaluatedCLI));
assertThat(System.getProperty("foo")).isEqualToIgnoringCase("bar");
assertThat(System.getProperty("x")).isEqualToIgnoringCase("y");
command.tearDown();
// System properties are not removed by the tearDown.
assertThat(System.getProperty("foo")).isEqualToIgnoringCase("bar");
assertThat(System.getProperty("x")).isEqualToIgnoringCase("y");
}
Aggregations