Search in sources :

Example 6 with Launcher

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

Example 7 with Launcher

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("{}");
}
Also used : Launcher(io.vertx.core.Launcher) Test(org.junit.Test)

Example 8 with Launcher

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);
}
Also used : Launcher(io.vertx.core.Launcher) JsonObject(io.vertx.core.json.JsonObject) IOException(java.io.IOException) Test(org.junit.Test)

Example 9 with Launcher

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);
}
Also used : Launcher(io.vertx.core.Launcher) JsonObject(io.vertx.core.json.JsonObject) IOException(java.io.IOException) Test(org.junit.Test)

Example 10 with Launcher

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);
}
Also used : Launcher(io.vertx.core.Launcher) JsonObject(io.vertx.core.json.JsonObject) IOException(java.io.IOException) 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