use of cn.taketoday.core.env.ConfigurableEnvironment in project today-infrastructure by TAKETODAY.
the class ConfigDataEnvironmentPostProcessorIntegrationTests method runWhenHasProfileSpecificFileWithActiveOnProfileProperty.
@Test
// gh-24990
void runWhenHasProfileSpecificFileWithActiveOnProfileProperty() {
ConfigurableApplicationContext context = this.application.run("--context.config.name=application-activate-on-profile-in-profile-specific-file");
ConfigurableEnvironment environment = context.getEnvironment();
assertThat(environment.getProperty("test1")).isEqualTo("test1");
assertThat(environment.getProperty("test2")).isEqualTo("test2");
}
use of cn.taketoday.core.env.ConfigurableEnvironment in project today-infrastructure by TAKETODAY.
the class ConfigDataEnvironmentPostProcessorIntegrationTests method runWhenCustomDefaultProfileSameAsActiveFromFileActivatesProfile.
@Test
void runWhenCustomDefaultProfileSameAsActiveFromFileActivatesProfile() {
ConfigurableApplicationContext context = this.application.run("--context.config.location=classpath:configdata/profiles/", "--context.profiles.default=customdefault", "--context.config.name=customprofile");
ConfigurableEnvironment environment = context.getEnvironment();
assertThat(environment.containsProperty("customprofile")).isTrue();
assertThat(environment.containsProperty("customprofile-customdefault")).isTrue();
assertThat(environment.acceptsProfiles(Profiles.of("customdefault"))).isTrue();
}
use of cn.taketoday.core.env.ConfigurableEnvironment in project today-infrastructure by TAKETODAY.
the class ConfigDataEnvironmentPostProcessorIntegrationTests method runWhenHasProfileSpecificImportWithCustomImportResolvesProfileSpecific.
@Test
// gh-26960
void runWhenHasProfileSpecificImportWithCustomImportResolvesProfileSpecific() {
ConfigurableApplicationContext context = this.application.run("--context.config.name=application-profile-specific-import-with-custom-import");
ConfigurableEnvironment environment = context.getEnvironment();
assertThat(environment.containsProperty("test:boot")).isTrue();
assertThat(environment.containsProperty("test:boot:ps")).isTrue();
}
use of cn.taketoday.core.env.ConfigurableEnvironment in project today-infrastructure by TAKETODAY.
the class ConfigDataEnvironmentPostProcessorIntegrationTests method runWhenHasWildcardLocationLoadsFromAllMatchingLocations.
@Test
void runWhenHasWildcardLocationLoadsFromAllMatchingLocations() {
ConfigurableApplicationContext context = this.application.run("--context.config.location=file:src/test/resources/config/*/", "--context.config.name=testproperties");
ConfigurableEnvironment environment = context.getEnvironment();
assertThat(environment.getProperty("first.property")).isEqualTo("apple");
assertThat(environment.getProperty("second.property")).isEqualTo("ball");
}
use of cn.taketoday.core.env.ConfigurableEnvironment in project today-infrastructure by TAKETODAY.
the class ConfigDataEnvironmentPostProcessorIntegrationTests method runWhenHasProfileSpecificImportWithImportImportsSecondProfileSpecificFile.
@Test
// gh-26960
void runWhenHasProfileSpecificImportWithImportImportsSecondProfileSpecificFile() {
ConfigurableApplicationContext context = this.application.run("--context.config.name=application-profile-specific-import-with-import");
ConfigurableEnvironment environment = context.getEnvironment();
assertThat(environment.containsProperty("application-profile-specific-import-with-import")).isTrue();
assertThat(environment.containsProperty("application-profile-specific-import-with-import-p1")).isTrue();
assertThat(environment.containsProperty("application-profile-specific-import-with-import-p2")).isFalse();
assertThat(environment.containsProperty("application-profile-specific-import-with-import-import")).isTrue();
assertThat(environment.containsProperty("application-profile-specific-import-with-import-import-p1")).isTrue();
assertThat(environment.containsProperty("application-profile-specific-import-with-import-import-p2")).isTrue();
}
Aggregations