Search in sources :

Example 26 with Config

use of io.helidon.config.Config in project helidon by oracle.

the class ConfigCreateDefaultFromMetaHoconTest method testCreateKeyFromSysProps.

@Test
@ExtendWith(RestoreSystemPropertiesExt.class)
public void testCreateKeyFromSysProps() {
    System.setProperty(KEY, PROP_VALUE);
    Config config = Config.create();
    assertThat(config.get(KEY).asString(), is(ConfigValues.simpleValue(PROP_VALUE)));
}
Also used : Config(io.helidon.config.Config) Test(org.junit.jupiter.api.Test) ExtendWith(org.junit.jupiter.api.extension.ExtendWith)

Example 27 with Config

use of io.helidon.config.Config in project helidon by oracle.

the class ConfigCreateDefaultFromMetaYamlTest method testCreateKeyFromSysProps.

@Test
@ExtendWith(RestoreSystemPropertiesExt.class)
public void testCreateKeyFromSysProps() {
    System.setProperty(KEY, PROP_VALUE);
    Config config = Config.create();
    assertThat(config.get(KEY).asString(), is(ConfigValues.simpleValue(PROP_VALUE)));
}
Also used : Config(io.helidon.config.Config) Test(org.junit.jupiter.api.Test) ExtendWith(org.junit.jupiter.api.extension.ExtendWith)

Example 28 with Config

use of io.helidon.config.Config in project helidon by oracle.

the class ConfigCreateDefaultFromMetaYamlTest method testCreate.

@Test
@ExtendWith(RestoreSystemPropertiesExt.class)
public void testCreate() {
    Config config = Config.create();
    assertThat(config.get(KEY).asString(), is(ConfigValues.simpleValue(CONFIG_VALUE)));
}
Also used : Config(io.helidon.config.Config) Test(org.junit.jupiter.api.Test) ExtendWith(org.junit.jupiter.api.extension.ExtendWith)

Example 29 with Config

use of io.helidon.config.Config in project helidon by oracle.

the class BuilderConfigMapperTest method testTransientBuilder.

@Test
public void testTransientBuilder() {
    Config config = Config.empty();
    assertThrows(ConfigMappingException.class, () -> config.as(TransientBuilderBean.class).get());
}
Also used : Config(io.helidon.config.Config) Test(org.junit.jupiter.api.Test)

Example 30 with Config

use of io.helidon.config.Config in project helidon by oracle.

the class AbstractComplexConfigTest method testStringDefault.

// 
// defaults
// 
@Test
public void testStringDefault() {
    Config node = getMissingConfig();
    String defaultValue = "default-value";
    String expected = defaultValue;
    assertThat(node.asString().orElse(defaultValue), is(expected));
    assertThat(node.as(String.class).orElse(defaultValue), is(expected));
}
Also used : Config(io.helidon.config.Config) Test(org.junit.jupiter.api.Test)

Aggregations

Config (io.helidon.config.Config)329 Test (org.junit.jupiter.api.Test)169 LogConfig (io.helidon.common.LogConfig)56 WebServer (io.helidon.webserver.WebServer)54 Routing (io.helidon.webserver.Routing)51 BeforeAll (org.junit.jupiter.api.BeforeAll)24 Security (io.helidon.security.Security)20 HealthSupport (io.helidon.health.HealthSupport)18 Single (io.helidon.common.reactive.Single)17 MetricsSupport (io.helidon.metrics.MetricsSupport)16 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)16 ConfigSources (io.helidon.config.ConfigSources)15 JsonpSupport (io.helidon.media.jsonp.JsonpSupport)15 SecurityContext (io.helidon.security.SecurityContext)15 Optional (java.util.Optional)15 TimeUnit (java.util.concurrent.TimeUnit)15 WebSecurity (io.helidon.security.integration.webserver.WebSecurity)13 HealthChecks (io.helidon.health.checks.HealthChecks)12 WebClient (io.helidon.webclient.WebClient)12 GrpcRouting (io.helidon.grpc.server.GrpcRouting)11