Search in sources :

Example 26 with Launcher

use of io.vertx.core.Launcher in project vert.x by eclipse.

the class RunCommandTest method testDeploymentOfJavaVerticleWithCluster.

@Test
public void testDeploymentOfJavaVerticleWithCluster() throws IOException {
    cli.dispatch(new Launcher(), new String[] { "run", HttpTestVerticle.class.getName(), "-cluster" });
    assertWaitUntil(() -> {
        try {
            return getHttpCode() == 200;
        } catch (IOException e) {
            return false;
        }
    });
    assertThat(getContent().getBoolean("clustered")).isTrue();
}
Also used : Launcher(io.vertx.core.Launcher) Test(org.junit.Test)

Example 27 with Launcher

use of io.vertx.core.Launcher in project vert.x by eclipse.

the class RunCommandTest method testWithConfProvidedAsFile.

@Test
public void testWithConfProvidedAsFile() throws IOException {
    setManifest("MANIFEST-Launcher-Http-Verticle.MF");
    cli.dispatch(new Launcher(), new String[] { "--conf", "target/test-classes/conf.json" });
    assertWaitUntil(() -> {
        try {
            return getHttpCode() == 200;
        } catch (IOException e) {
            return false;
        }
    });
    assertThat(getContent().getJsonObject("conf").getString("name")).isEqualToIgnoringCase("vertx");
}
Also used : Launcher(io.vertx.core.Launcher) Test(org.junit.Test)

Example 28 with Launcher

use of io.vertx.core.Launcher in project vert.x by eclipse.

the class RunCommandTest method testFatJarWithHTTPVerticleWithCluster.

@Test
public void testFatJarWithHTTPVerticleWithCluster() throws IOException, InterruptedException {
    setManifest("MANIFEST-Launcher-Http-Verticle.MF");
    cli.dispatch(new Launcher(), new String[] { "-cluster" });
    assertWaitUntil(() -> {
        try {
            return getHttpCode() == 200;
        } catch (IOException e) {
            return false;
        }
    });
    assertThat(getContent().getBoolean("clustered")).isTrue();
}
Also used : Launcher(io.vertx.core.Launcher) Test(org.junit.Test)

Example 29 with Launcher

use of io.vertx.core.Launcher in project vert.x by eclipse.

the class StartStopListCommandsTest method testStartListStopWithJVMOptions.

@Test
public void testStartListStopWithJVMOptions() throws InterruptedException, IOException {
    record();
    cli.dispatch(new String[] { "start", "run", HttpTestVerticle.class.getName(), "--launcher-class", Launcher.class.getName(), "--java-opts=-Dfoo=bar -Dbaz=bar", "--redirect-output" });
    waitForStartup();
    assertThat(output.toString()).contains("Starting vert.x application");
    JsonObject content = RunCommandTest.getContent();
    assertThat(content.getString("foo")).isEqualToIgnoringCase("bar");
    assertThat(content.getString("baz")).isEqualToIgnoringCase("bar");
    output.reset();
    cli.dispatch(new String[] { "list" });
    assertThat(output.toString()).hasLineCount(2);
    // Extract id.
    String[] lines = output.toString().split(System.lineSeparator());
    String id = lines[1].trim().substring(0, lines[1].trim().indexOf("\t"));
    output.reset();
    // pass --redeploy to not call system.exit
    cli.dispatch(new String[] { "stop", id, "--redeploy" });
    assertThat(output.toString()).contains("Stopping vert.x application '" + id + "'").contains("Application '" + id + "' terminated with status 0");
    waitForShutdown();
    assertWaitUntil(() -> {
        output.reset();
        cli.dispatch(new String[] { "list" });
        return !output.toString().contains(id);
    });
    assertThat(output.toString()).hasLineCount(2).contains("No vert.x application found");
}
Also used : Launcher(io.vertx.core.Launcher) JsonObject(io.vertx.core.json.JsonObject) Test(org.junit.Test)

Example 30 with Launcher

use of io.vertx.core.Launcher in project vert.x by eclipse.

the class RunCommandTest method testThatHADeploysVerticleWhenCombinedWithCluster.

@Test
public void testThatHADeploysVerticleWhenCombinedWithCluster() 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();
}
Also used : Launcher(io.vertx.core.Launcher) Test(org.junit.Test)

Aggregations

Launcher (io.vertx.core.Launcher)31 Test (org.junit.Test)31 IOException (java.io.IOException)16 JsonObject (io.vertx.core.json.JsonObject)9 RunCommandTest (io.vertx.core.impl.launcher.commands.RunCommandTest)8 Vertx (io.vertx.core.Vertx)6 File (java.io.File)4 VertxOptions (io.vertx.core.VertxOptions)3 FakeClusterManager (io.vertx.test.fakecluster.FakeClusterManager)1 FakeMetricsFactory (io.vertx.test.fakemetrics.FakeMetricsFactory)1 Random (java.util.Random)1