vertx/src/test/java/eu/internetofus/common/vertx/AbstractMainTest.java
/**
   * Check configuration load from properties.
   *
   * @param testContext test context over the event bus.
   *
   * @throws Throwable if can not create the temporal files.
   */
Check configuration load from properties.
@param testContext test context over the event bus.

@throws Throwable if can not create the temporal files.
Check configuration load from properties . @param testContext test context over the event bus . @throws Throwable if can not create the temporal files .
@Test
  public void shouldLoadConfigurationProperties(final VertxTestContext testContext) throws Throwable {
    testContext.assertComplete(this.main.startWith("-" + AbstractMain.PROPERTY_OPTION + "api.host=\"HOST\"",
        "-" + AbstractMain.PROPERTY_OPTION + "api.port=80", "-" + AbstractMain.PROPERTY_OPTION,
        "persistence.db_name=profile-manager", "-" + AbstractMain.PROPERTY_OPTION, "persistence.username=db-user-name",
        "-" + AbstractMain.PROPERTY_OPTION + " persistence.host=phost",
        "-" + AbstractMain.PROPERTY_OPTION + "persistence.port=27", "-" + AbstractMain.PROPERTY_OPTION,
        "persistence.db_name=DB_NAME", "-" + AbstractMain.PROPERTY_OPTION + "persistence.username=USER_NAME",
        "-" + AbstractMain.PROPERTY_OPTION + " persistence.password=PASSWORD", "-" + AbstractMain.PROPERTY_OPTION,
        "webClient.keepAlive=false", "-" + AbstractMain.PROPERTY_OPTION, "webClient.pipelining=true",
        "-" + AbstractMain.VERSION_OPTION)).onComplete(handler -> {
          final var retriever = ConfigRetriever.create(Vertx.vertx(), this.main.retrieveOptions);
          retriever.getConfig(testContext.succeeding(conf -> testContext.verify(() -> {
            assertThat(conf.getJsonObject("api")).isNotNull();
            assertThat(conf.getJsonObject("api").getString("host")).isEqualTo("HOST");
            assertThat(conf.getJsonObject("api").getInteger("port")).isEqualTo(80);
            assertThat(conf.getJsonObject("persistence")).isNotNull();
            assertThat(conf.getJsonObject("persistence").getString("host")).isEqualTo("phost");
            assertThat(conf.getJsonObject("persistence").getInteger("port")).isEqualTo(27);
            assertThat(conf.getJsonObject("persistence").getString("db_name")).isEqualTo("DB_NAME");
            assertThat(conf.getJsonObject("persistence").getString("username")).isEqualTo("USER_NAME");
            assertThat(conf.getJsonObject("persistence").getString("password")).isEqualTo("PASSWORD");
            assertThat(conf.getJsonObject("webClient")).isNotNull();
            assertThat(conf.getJsonObject("webClient").getBoolean("keepAlive", true)).isFalse();
            assertThat(conf.getJsonObject("webClient").getBoolean("pipelining", false)).isTrue();
            assertThat(conf.getJsonObject("webClient").getBoolean("pipelining", false)).isTrue();
            testContext.completeNow();
          })));
        });
  }
@ Test public void shouldLoadConfigurationProperties ( final VertxTestContext testContext ) throws Throwable { testContext . assertComplete ( this . main . startWith ( "-" + AbstractMain . PROPERTY_OPTION + "api.host=\"HOST\"" , "-" + AbstractMain . PROPERTY_OPTION + "api.port=80" , "-" + AbstractMain . PROPERTY_OPTION , "persistence.db_name=profile-manager" , "-" + AbstractMain . PROPERTY_OPTION , "persistence.username=db-user-name" , "-" + AbstractMain . PROPERTY_OPTION + " persistence.host=phost" , "-" + AbstractMain . PROPERTY_OPTION + "persistence.port=27" , "-" + AbstractMain . PROPERTY_OPTION , "persistence.db_name=DB_NAME" , "-" + AbstractMain . PROPERTY_OPTION + "persistence.username=USER_NAME" , "-" + AbstractMain . PROPERTY_OPTION + " persistence.password=PASSWORD" , "-" + AbstractMain . PROPERTY_OPTION , "webClient.keepAlive=false" , "-" + AbstractMain . PROPERTY_OPTION , "webClient.pipelining=true" , "-" + AbstractMain . VERSION_OPTION ) ) . onComplete ( handler -> { final var retriever = ConfigRetriever . create ( Vertx . vertx ( ) , this . main . retrieveOptions ) ; retriever . getConfig ( testContext . succeeding ( conf -> testContext . verify ( ( ) -> { assertThat ( conf . getJsonObject ( "api" ) ) . isNotNull ( ) ; assertThat ( conf . getJsonObject ( "api" ) . getString ( "host" ) ) . isEqualTo ( "HOST" ) ; assertThat ( conf . getJsonObject ( "api" ) . getInteger ( "port" ) ) . isEqualTo ( 80 ) ; assertThat ( conf . getJsonObject ( "persistence" ) ) . isNotNull ( ) ; assertThat ( conf . getJsonObject ( "persistence" ) . getString ( "host" ) ) . isEqualTo ( "phost" ) ; assertThat ( conf . getJsonObject ( "persistence" ) . getInteger ( "port" ) ) . isEqualTo ( 27 ) ; assertThat ( conf . getJsonObject ( "persistence" ) . getString ( "db_name" ) ) . isEqualTo ( "DB_NAME" ) ; assertThat ( conf . getJsonObject ( "persistence" ) . getString ( "username" ) ) . isEqualTo ( "USER_NAME" ) ; assertThat ( conf . getJsonObject ( "persistence" ) . getString ( "password" ) ) . isEqualTo ( "PASSWORD" ) ; assertThat ( conf . getJsonObject ( "webClient" ) ) . isNotNull ( ) ; assertThat ( conf . getJsonObject ( "webClient" ) . getBoolean ( "keepAlive" , true ) ) . isFalse ( ) ; assertThat ( conf . getJsonObject ( "webClient" ) . getBoolean ( "pipelining" , false ) ) . isTrue ( ) ; assertThat ( conf . getJsonObject ( "webClient" ) . getBoolean ( "pipelining" , false ) ) . isTrue ( ) ; testContext . completeNow ( ) ; } ) ) ) ; } ) ; }
Check configuration load from properties.
Check configuration load from properties .