use of cn.taketoday.context.properties.bind.Binder 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.context.properties.bind.Binder in project today-infrastructure by TAKETODAY.
the class ConfigDataActivationContextTests method getCloudPlatformWhenCloudPropertyInEnvironmentDeducesCloudPlatform.
@Test
void getCloudPlatformWhenCloudPropertyInEnvironmentDeducesCloudPlatform() {
MockEnvironment environment = createKubernetesEnvironment();
Binder binder = Binder.get(environment);
ConfigDataActivationContext context = new ConfigDataActivationContext(environment, binder);
assertThat(context.getCloudPlatform()).isEqualTo(CloudPlatform.KUBERNETES);
}
use of cn.taketoday.context.properties.bind.Binder in project today-infrastructure by TAKETODAY.
the class ConfigDataActivationContextTests method getProfilesWhenWithProfilesReturnsProfiles.
@Test
void getProfilesWhenWithProfilesReturnsProfiles() {
MockEnvironment environment = new MockEnvironment();
environment.setActiveProfiles("a", "b", "c");
Binder binder = Binder.get(environment);
ConfigDataActivationContext context = new ConfigDataActivationContext(environment, binder);
Profiles profiles = new Profiles(environment, binder, null);
context = context.withProfiles(profiles);
assertThat(context.getProfiles()).isEqualTo(profiles);
}
use of cn.taketoday.context.properties.bind.Binder 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.context.properties.bind.Binder in project today-infrastructure by TAKETODAY.
the class ProfilesTests method getActiveWhenNoEnvironmentProfilesAndEnvironmentProperty.
@Test
void getActiveWhenNoEnvironmentProfilesAndEnvironmentProperty() {
MockEnvironment environment = new MockEnvironment();
environment.setProperty("context.profiles.active", "a,b,c");
Binder binder = Binder.get(environment);
Profiles profiles = new Profiles(environment, binder, null);
assertThat(profiles.getActive()).containsExactly("a", "b", "c");
}
Aggregations