use of cn.taketoday.core.env.Environment in project today-infrastructure by TAKETODAY.
the class ConfigDataActivationContextTests method getCloudPlatformWhenCloudPropertyHasBeenContributedDuringInitialLoadDeducesCloudPlatform.
@Test
void getCloudPlatformWhenCloudPropertyHasBeenContributedDuringInitialLoadDeducesCloudPlatform() {
Environment environment = createKubernetesEnvironment();
Binder binder = new Binder(new MapConfigurationPropertySource(Collections.singletonMap("context.main.cloud-platform", "HEROKU")));
ConfigDataActivationContext context = new ConfigDataActivationContext(environment, binder);
assertThat(context.getCloudPlatform()).isEqualTo(CloudPlatform.HEROKU);
}
use of cn.taketoday.core.env.Environment in project today-infrastructure by TAKETODAY.
the class ConfigDataActivationContextTests method getCloudPlatformWhenCloudPropertyNotPresentDeducesCloudPlatform.
@Test
void getCloudPlatformWhenCloudPropertyNotPresentDeducesCloudPlatform() {
Environment environment = new MockEnvironment();
Binder binder = Binder.get(environment);
ConfigDataActivationContext context = new ConfigDataActivationContext(environment, binder);
assertThat(context.getCloudPlatform()).isNull();
}
use of cn.taketoday.core.env.Environment in project today-infrastructure by TAKETODAY.
the class ProfilesTests method getActiveWhenNoEnvironmentProfilesAndNoPropertyReturnsEmptyArray.
@Test
void getActiveWhenNoEnvironmentProfilesAndNoPropertyReturnsEmptyArray() {
Environment environment = new MockEnvironment();
Binder binder = Binder.get(environment);
Profiles profiles = new Profiles(environment, binder, null);
assertThat(profiles.getActive()).isEmpty();
}
use of cn.taketoday.core.env.Environment in project today-infrastructure by TAKETODAY.
the class ProfilesTests method getDefaultWhenNoEnvironmentProfilesAndNoPropertyReturnsEmptyArray.
@Test
void getDefaultWhenNoEnvironmentProfilesAndNoPropertyReturnsEmptyArray() {
Environment environment = new MockEnvironment();
Binder binder = Binder.get(environment);
Profiles profiles = new Profiles(environment, binder, null);
assertThat(profiles.getDefault()).containsExactly("default");
}
use of cn.taketoday.core.env.Environment in project today-infrastructure by TAKETODAY.
the class ProfilesTests method getActiveWhenNoEnvironmentProfilesAndBinderProperty.
@Test
void getActiveWhenNoEnvironmentProfilesAndBinderProperty() {
Environment environment = new MockEnvironment();
Binder binder = new Binder(new MapConfigurationPropertySource(Collections.singletonMap("context.profiles.active", "a,b,c")));
Profiles profiles = new Profiles(environment, binder, null);
assertThat(profiles.getActive()).containsExactly("a", "b", "c");
}
Aggregations