use of cn.taketoday.core.env.Environment in project today-framework by TAKETODAY.
the class CloudPlatformTests method getActiveWhenHasEnforcedCloudPlatform.
@Test
void getActiveWhenHasEnforcedCloudPlatform() {
Environment environment = getEnvironmentWithEnvVariables(Collections.singletonMap("context.main.cloud-platform", "kubernetes"));
CloudPlatform platform = CloudPlatform.getActive(environment);
assertThat(platform).isEqualTo(CloudPlatform.KUBERNETES);
}
use of cn.taketoday.core.env.Environment in project today-framework by TAKETODAY.
the class CloudPlatformTests method getActiveWhenHasMissingWebsiteResourceGroupShouldNotReturnAzureAppService.
@Test
void getActiveWhenHasMissingWebsiteResourceGroupShouldNotReturnAzureAppService() {
Map<String, Object> envVars = new HashMap<>();
envVars.put("WEBSITE_SITE_NAME", "---");
envVars.put("WEBSITE_INSTANCE_ID", "1234");
envVars.put("WEBSITE_SKU", "1234");
Environment environment = getEnvironmentWithEnvVariables(envVars);
CloudPlatform platform = CloudPlatform.getActive(environment);
assertThat(platform).isNull();
}
use of cn.taketoday.core.env.Environment in project today-framework 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-framework by TAKETODAY.
the class ConfigDataActivationContextTests method getProfilesWhenWithoutProfilesReturnsNull.
@Test
void getProfilesWhenWithoutProfilesReturnsNull() {
Environment environment = new MockEnvironment();
Binder binder = Binder.get(environment);
ConfigDataActivationContext context = new ConfigDataActivationContext(environment, binder);
assertThat(context.getProfiles()).isNull();
}
use of cn.taketoday.core.env.Environment in project today-framework by TAKETODAY.
the class CloudPlatformTests method getActiveWhenHasKubernetesServicePortAndNoKubernetesServiceHostShouldNotReturnKubernetes.
@Test
void getActiveWhenHasKubernetesServicePortAndNoKubernetesServiceHostShouldNotReturnKubernetes() {
Environment environment = getEnvironmentWithEnvVariables(Collections.singletonMap("KUBERNETES_SERVICE_PORT", "8080"));
CloudPlatform platform = CloudPlatform.getActive(environment);
assertThat(platform).isNull();
}
Aggregations