use of cn.taketoday.framework.context.config.ConfigData.Options in project today-infrastructure by TAKETODAY.
the class ConfigDataTests method optionsOfUsesCopyOfOptions.
@Test
void optionsOfUsesCopyOfOptions() {
Option[] array = { Option.IGNORE_IMPORTS, Option.IGNORE_PROFILES };
Options options = Options.of(array);
array[0] = Option.PROFILE_SPECIFIC;
assertThat(options.asSet()).containsExactly(Option.IGNORE_IMPORTS, Option.IGNORE_PROFILES);
}
use of cn.taketoday.framework.context.config.ConfigData.Options in project today-infrastructure by TAKETODAY.
the class ConfigDataTests method optionsOfCreatesOptions.
@Test
void optionsOfCreatesOptions() {
Options options = Options.of(Option.IGNORE_IMPORTS, Option.IGNORE_PROFILES);
assertThat(options.asSet()).containsExactly(Option.IGNORE_IMPORTS, Option.IGNORE_PROFILES);
}
use of cn.taketoday.framework.context.config.ConfigData.Options in project today-infrastructure by TAKETODAY.
the class ConfigDataTests method getOptionsReturnsOptionsFromPropertySourceOptions.
@Test
void getOptionsReturnsOptionsFromPropertySourceOptions() {
MapPropertySource source1 = new MapPropertySource("test", Collections.emptyMap());
MapPropertySource source2 = new MapPropertySource("test", Collections.emptyMap());
Options options1 = Options.of(Option.IGNORE_IMPORTS);
Options options2 = Options.of(Option.IGNORE_PROFILES);
PropertySourceOptions propertySourceOptions = (source) -> (source != source1) ? options2 : options1;
ConfigData configData = new ConfigData(Arrays.asList(source1, source2), propertySourceOptions);
assertThat(configData.getOptions(source1)).isEqualTo(options1);
assertThat(configData.getOptions(source2)).isEqualTo(options2);
}
use of cn.taketoday.framework.context.config.ConfigData.Options in project today-infrastructure by TAKETODAY.
the class ConfigDataEnvironmentContributor method ofUnboundImport.
/**
* Factory method to create an {@link Kind#UNBOUND_IMPORT unbound import} contributor.
* This contributor has been actively imported from another contributor and may itself
* import further contributors later.
*
* @param location the location of this contributor
* @param resource the config data resource
* @param profileSpecific if the contributor is from a profile specific import
* @param configData the config data
* @param propertySourceIndex the index of the property source that should be used
* @return a new {@link ConfigDataEnvironmentContributor} instance
*/
static ConfigDataEnvironmentContributor ofUnboundImport(@Nullable ConfigDataLocation location, @Nullable ConfigDataResource resource, boolean profileSpecific, ConfigData configData, int propertySourceIndex) {
PropertySource<?> propertySource = configData.getPropertySources().get(propertySourceIndex);
Options options = configData.getOptions(propertySource);
ConfigurationPropertySource configurationPropertySource = ConfigurationPropertySource.from(propertySource);
return new ConfigDataEnvironmentContributor(Kind.UNBOUND_IMPORT, location, resource, profileSpecific, propertySource, configurationPropertySource, null, options, null);
}
use of cn.taketoday.framework.context.config.ConfigData.Options in project today-framework by TAKETODAY.
the class ConfigDataTests method optionsOfCreatesOptions.
@Test
void optionsOfCreatesOptions() {
Options options = Options.of(Option.IGNORE_IMPORTS, Option.IGNORE_PROFILES);
assertThat(options.asSet()).containsExactly(Option.IGNORE_IMPORTS, Option.IGNORE_PROFILES);
}
Aggregations