Search in sources :

Example 21 with MutablePropertyValues

use of org.springframework.beans.MutablePropertyValues in project spring-boot by spring-projects.

the class WebFilterHandlerTests method urlPatterns.

@Test
public void urlPatterns() throws IOException {
    BeanDefinition filterRegistrationBean = getBeanDefinition(UrlPatternsFilter.class);
    MutablePropertyValues propertyValues = filterRegistrationBean.getPropertyValues();
    assertThat((String[]) propertyValues.get("urlPatterns")).contains("alpha", "bravo");
}
Also used : MutablePropertyValues(org.springframework.beans.MutablePropertyValues) ScannedGenericBeanDefinition(org.springframework.context.annotation.ScannedGenericBeanDefinition) BeanDefinition(org.springframework.beans.factory.config.BeanDefinition) Test(org.junit.Test)

Example 22 with MutablePropertyValues

use of org.springframework.beans.MutablePropertyValues in project spring-boot by spring-projects.

the class WebServletHandlerTests method defaultServletConfiguration.

@SuppressWarnings("unchecked")
@Test
public void defaultServletConfiguration() throws IOException {
    ScannedGenericBeanDefinition scanned = new ScannedGenericBeanDefinition(new SimpleMetadataReaderFactory().getMetadataReader(DefaultConfigurationServlet.class.getName()));
    this.handler.handle(scanned, this.registry);
    BeanDefinition servletRegistrationBean = this.registry.getBeanDefinition(DefaultConfigurationServlet.class.getName());
    MutablePropertyValues propertyValues = servletRegistrationBean.getPropertyValues();
    assertThat(propertyValues.get("asyncSupported")).isEqualTo(false);
    assertThat(((Map<String, String>) propertyValues.get("initParameters"))).isEmpty();
    assertThat((Integer) propertyValues.get("loadOnStartup")).isEqualTo(-1);
    assertThat(propertyValues.get("name")).isEqualTo(DefaultConfigurationServlet.class.getName());
    assertThat((String[]) propertyValues.get("urlMappings")).isEmpty();
    assertThat(propertyValues.get("servlet")).isEqualTo(scanned);
}
Also used : SimpleMetadataReaderFactory(org.springframework.core.type.classreading.SimpleMetadataReaderFactory) ScannedGenericBeanDefinition(org.springframework.context.annotation.ScannedGenericBeanDefinition) MutablePropertyValues(org.springframework.beans.MutablePropertyValues) ScannedGenericBeanDefinition(org.springframework.context.annotation.ScannedGenericBeanDefinition) BeanDefinition(org.springframework.beans.factory.config.BeanDefinition) Test(org.junit.Test)

Example 23 with MutablePropertyValues

use of org.springframework.beans.MutablePropertyValues in project spring-boot by spring-projects.

the class WebServletHandlerTests method servletWithCustomName.

@Test
public void servletWithCustomName() throws IOException {
    ScannedGenericBeanDefinition scanned = new ScannedGenericBeanDefinition(new SimpleMetadataReaderFactory().getMetadataReader(CustomNameServlet.class.getName()));
    this.handler.handle(scanned, this.registry);
    BeanDefinition servletRegistrationBean = this.registry.getBeanDefinition("custom");
    MutablePropertyValues propertyValues = servletRegistrationBean.getPropertyValues();
    assertThat(propertyValues.get("name")).isEqualTo("custom");
}
Also used : SimpleMetadataReaderFactory(org.springframework.core.type.classreading.SimpleMetadataReaderFactory) ScannedGenericBeanDefinition(org.springframework.context.annotation.ScannedGenericBeanDefinition) MutablePropertyValues(org.springframework.beans.MutablePropertyValues) ScannedGenericBeanDefinition(org.springframework.context.annotation.ScannedGenericBeanDefinition) BeanDefinition(org.springframework.beans.factory.config.BeanDefinition) Test(org.junit.Test)

Example 24 with MutablePropertyValues

use of org.springframework.beans.MutablePropertyValues in project spring-boot by spring-projects.

the class WebServletHandlerTests method urlMappings.

@Test
public void urlMappings() throws IOException {
    BeanDefinition servletRegistrationBean = getBeanDefinition(UrlPatternsServlet.class);
    MutablePropertyValues propertyValues = servletRegistrationBean.getPropertyValues();
    assertThat((String[]) propertyValues.get("urlMappings")).contains("alpha", "bravo");
}
Also used : MutablePropertyValues(org.springframework.beans.MutablePropertyValues) ScannedGenericBeanDefinition(org.springframework.context.annotation.ScannedGenericBeanDefinition) BeanDefinition(org.springframework.beans.factory.config.BeanDefinition) Test(org.junit.Test)

Example 25 with MutablePropertyValues

use of org.springframework.beans.MutablePropertyValues in project spring-boot by spring-projects.

the class WebServletHandlerTests method asyncSupported.

@Test
public void asyncSupported() throws IOException {
    BeanDefinition servletRegistrationBean = getBeanDefinition(AsyncSupportedServlet.class);
    MutablePropertyValues propertyValues = servletRegistrationBean.getPropertyValues();
    assertThat(propertyValues.get("asyncSupported")).isEqualTo(true);
}
Also used : MutablePropertyValues(org.springframework.beans.MutablePropertyValues) ScannedGenericBeanDefinition(org.springframework.context.annotation.ScannedGenericBeanDefinition) BeanDefinition(org.springframework.beans.factory.config.BeanDefinition) Test(org.junit.Test)

Aggregations

MutablePropertyValues (org.springframework.beans.MutablePropertyValues)301 Test (org.junit.Test)268 TestBean (org.springframework.tests.sample.beans.TestBean)86 ITestBean (org.springframework.tests.sample.beans.ITestBean)82 IndexedTestBean (org.springframework.tests.sample.beans.IndexedTestBean)73 DerivedTestBean (org.springframework.tests.sample.beans.DerivedTestBean)68 RootBeanDefinition (org.springframework.beans.factory.support.RootBeanDefinition)35 DefaultListableBeanFactory (org.springframework.beans.factory.support.DefaultListableBeanFactory)24 PropertyEditorSupport (java.beans.PropertyEditorSupport)23 PropertyValue (org.springframework.beans.PropertyValue)16 RuntimeBeanReference (org.springframework.beans.factory.config.RuntimeBeanReference)16 NestedTestBean (org.springframework.tests.sample.beans.NestedTestBean)15 BeanDefinition (org.springframework.beans.factory.config.BeanDefinition)14 ScannedGenericBeanDefinition (org.springframework.context.annotation.ScannedGenericBeanDefinition)14 HashMap (java.util.HashMap)13 BeanWrapper (org.springframework.beans.BeanWrapper)12 BeanWrapperImpl (org.springframework.beans.BeanWrapperImpl)11 ParseException (java.text.ParseException)9 RelaxedDataBinder (org.springframework.boot.bind.RelaxedDataBinder)9 BooleanTestBean (org.springframework.tests.sample.beans.BooleanTestBean)9