|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2020 the original author or authors. |
| 2 | + * Copyright 2012-2021 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -160,18 +160,39 @@ void isActiveWhenActivateIsNull() {
|
160 | 160 | @Test
|
161 | 161 | void isActiveAgainstBoundData() {
|
162 | 162 | MapConfigurationPropertySource source = new MapConfigurationPropertySource();
|
163 |
| - source.put("spring.config.import", "one,two,three"); |
164 | 163 | source.put("spring.config.activate.on-cloud-platform", "kubernetes");
|
165 | 164 | source.put("spring.config.activate.on-profile", "a | b");
|
166 | 165 | Binder binder = new Binder(source);
|
167 | 166 | ConfigDataProperties properties = ConfigDataProperties.get(binder);
|
168 | 167 | ConfigDataActivationContext context = new ConfigDataActivationContext(CloudPlatform.KUBERNETES,
|
169 | 168 | createTestProfiles());
|
170 |
| - assertThat(properties.getImports()).containsExactly(ConfigDataLocation.of("one"), ConfigDataLocation.of("two"), |
171 |
| - ConfigDataLocation.of("three")); |
172 | 169 | assertThat(properties.isActive(context)).isTrue();
|
173 | 170 | }
|
174 | 171 |
|
| 172 | + @Test |
| 173 | + void isActiveAgainstBoundDataWhenProfilesDontMatch() { |
| 174 | + MapConfigurationPropertySource source = new MapConfigurationPropertySource(); |
| 175 | + source.put("spring.config.activate.on-cloud-platform", "kubernetes"); |
| 176 | + source.put("spring.config.activate.on-profile", "x | z"); |
| 177 | + Binder binder = new Binder(source); |
| 178 | + ConfigDataProperties properties = ConfigDataProperties.get(binder); |
| 179 | + ConfigDataActivationContext context = new ConfigDataActivationContext(CloudPlatform.KUBERNETES, |
| 180 | + createTestProfiles()); |
| 181 | + assertThat(properties.isActive(context)).isFalse(); |
| 182 | + } |
| 183 | + |
| 184 | + @Test |
| 185 | + void isActiveAgainstBoundDataWhenCloudPlatformDoesntMatch() { |
| 186 | + MapConfigurationPropertySource source = new MapConfigurationPropertySource(); |
| 187 | + source.put("spring.config.activate.on-cloud-platform", "cloud-foundry"); |
| 188 | + source.put("spring.config.activate.on-profile", "a | b"); |
| 189 | + Binder binder = new Binder(source); |
| 190 | + ConfigDataProperties properties = ConfigDataProperties.get(binder); |
| 191 | + ConfigDataActivationContext context = new ConfigDataActivationContext(CloudPlatform.KUBERNETES, |
| 192 | + createTestProfiles()); |
| 193 | + assertThat(properties.isActive(context)).isFalse(); |
| 194 | + } |
| 195 | + |
175 | 196 | @Test
|
176 | 197 | void isActiveWhenBindingToLegacyProperty() {
|
177 | 198 | MapConfigurationPropertySource source = new MapConfigurationPropertySource();
|
|
0 commit comments