use of com.ctrip.framework.apollo.spi.DefaultConfigFactory in project apollo by ctripcorp.
the class PureApolloConfigTest method testDefaultConfigWithEnvironmentVariables.
@Test
public void testDefaultConfigWithEnvironmentVariables() throws Exception {
SystemLambda.withEnvironmentVariable("SPRING_PROFILES_ACTIVE", "test-env").execute(() -> {
ApolloMockInjectorCustomizer.register(ConfigFactory.class, DefaultConfigFactory::new);
ConfigFactory configFactory = ApolloInjector.getInstance(ConfigFactory.class);
Config config = configFactory.create("application");
Assert.assertEquals("test-env", config.getProperty("SPRING_PROFILES_ACTIVE", null));
});
}
use of com.ctrip.framework.apollo.spi.DefaultConfigFactory in project apollo by ctripcorp.
the class PureApolloConfigTest method testDefaultConfigWithSystemProperties.
@Test
public void testDefaultConfigWithSystemProperties() {
System.setProperty("spring.profiles.active", "test");
ApolloMockInjectorCustomizer.register(ConfigFactory.class, DefaultConfigFactory::new);
ConfigFactory configFactory = ApolloInjector.getInstance(ConfigFactory.class);
Config config = configFactory.create("application");
Assert.assertEquals("test", config.getProperty("spring.profiles.active", null));
}
Aggregations