Ejemplo n.º 1
0
  @Test
  public void testRun_Help() throws InterruptedException {

    BQDaemonTestRuntime runtime = app.newRuntime().startupAndWaitCheck().start("--help");

    String help = runtime.getStdout();

    assertTrue(help.contains("--server"));
    assertTrue(help.contains("--help"));
    assertTrue(help.contains("--config"));
  }
Ejemplo n.º 2
0
    /**
     * Starts the test app in a background thread.
     *
     * @param args String[] emulating command-line arguments passed to a Java app.
     * @return {@link BQDaemonTestRuntime} instance created by the builder. The caller doesn't need
     *     to shut it down. Usually JUnit lifecycle takes care of it.
     */
    public BQDaemonTestRuntime start(String... args) {

      Consumer<Bootique> localConfigurator = configurator;

      if (!properties.isEmpty()) {

        Consumer<Bootique> propsConfigurator =
            bootique ->
                bootique.module(
                    binder -> {
                      MapBinder<String, String> mapBinder =
                          BQCoreModule.contributeProperties(binder);
                      properties.forEach((k, v) -> mapBinder.addBinding(k).toInstance(v));
                    });

        localConfigurator = localConfigurator.andThen(propsConfigurator);
      }

      BQDaemonTestRuntime runtime = new BQDaemonTestRuntime(localConfigurator, startupCheck, args);
      runtimes.add(runtime);
      runtime.start(startupTimeout, startupTimeoutTimeUnit);
      return runtime;
    }