use of org.springframework.core.env.StandardEnvironment in project Gaffer by gchq.
the class SwaggerConfigTest method shouldPullTitleFromSystemProperty.
@Test
public void shouldPullTitleFromSystemProperty() {
// Given
final String title = "My Gaffer Graph";
SwaggerConfig swaggerConfig = new SwaggerConfig();
swaggerConfig.setEnvironment(new StandardEnvironment());
System.setProperty(APP_TITLE, title);
// When
ApiInfo apiInfo = swaggerConfig.apiInfo();
// Then
assertEquals(title, apiInfo.getTitle());
}
use of org.springframework.core.env.StandardEnvironment in project java-chassis by ServiceComb.
the class TestConfigurationSpringInitializer method shoud_throw_exception_when_given_ignoreResolveFailure_false.
@Test(expected = RuntimeException.class)
public void shoud_throw_exception_when_given_ignoreResolveFailure_false() {
StandardEnvironment environment = newStandardEnvironment();
ConfigurationSpringInitializer configurationSpringInitializer = new ConfigurationSpringInitializer();
configurationSpringInitializer.setEnvironment(environment);
}
use of org.springframework.core.env.StandardEnvironment in project spring-framework by spring-projects.
the class ClassPathScanningCandidateComponentProviderTests method testWithInactiveProfile.
@Test
public void testWithInactiveProfile() {
ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(true);
ConfigurableEnvironment env = new StandardEnvironment();
env.setActiveProfiles("other");
provider.setEnvironment(env);
Set<BeanDefinition> candidates = provider.findCandidateComponents(TEST_PROFILE_PACKAGE);
assertThat(containsBeanClass(candidates, ProfileAnnotatedComponent.class)).isFalse();
}
use of org.springframework.core.env.StandardEnvironment in project spring-framework by spring-projects.
the class ClassPathScanningCandidateComponentProviderTests method testWithActiveProfile.
@Test
public void testWithActiveProfile() {
ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(true);
ConfigurableEnvironment env = new StandardEnvironment();
env.setActiveProfiles(ProfileAnnotatedComponent.PROFILE_NAME);
provider.setEnvironment(env);
Set<BeanDefinition> candidates = provider.findCandidateComponents(TEST_PROFILE_PACKAGE);
assertThat(containsBeanClass(candidates, ProfileAnnotatedComponent.class)).isTrue();
}
use of org.springframework.core.env.StandardEnvironment in project spring-framework by spring-projects.
the class ConfigurationClassPostProcessorTests method assertSupportForComposedAnnotationWithExclude.
private void assertSupportForComposedAnnotationWithExclude(RootBeanDefinition beanDefinition) {
beanFactory.registerBeanDefinition("config", beanDefinition);
ConfigurationClassPostProcessor pp = new ConfigurationClassPostProcessor();
pp.setEnvironment(new StandardEnvironment());
pp.postProcessBeanFactory(beanFactory);
assertThatExceptionOfType(NoSuchBeanDefinitionException.class).isThrownBy(() -> beanFactory.getBean(SimpleComponent.class));
}
Aggregations