use of org.springframework.beans.MutablePropertyValues in project spring-boot by spring-projects.
the class ServerPropertiesTests method testServerHeader.
@Test
public void testServerHeader() throws Exception {
RelaxedDataBinder binder = new RelaxedDataBinder(this.properties, "server");
binder.bind(new MutablePropertyValues(Collections.singletonMap("server.server-header", "Custom Server")));
assertThat(this.properties.getServerHeader()).isEqualTo("Custom Server");
}
use of org.springframework.beans.MutablePropertyValues in project spring-boot by spring-projects.
the class ServerPropertiesTests method testServletPathAsPrefix.
@Test
public void testServletPathAsPrefix() throws Exception {
RelaxedDataBinder binder = new RelaxedDataBinder(this.properties, "server");
binder.bind(new MutablePropertyValues(Collections.singletonMap("server.servlet.path", "/foo")));
assertThat(binder.getBindingResult().hasErrors()).isFalse();
assertThat(this.properties.getServlet().getServletMapping()).isEqualTo("/foo/*");
assertThat(this.properties.getServlet().getServletPrefix()).isEqualTo("/foo");
}
use of org.springframework.beans.MutablePropertyValues in project spring-boot by spring-projects.
the class ServerPropertiesTests method testSlashOfContextPathIsDefaultValue.
@Test
public void testSlashOfContextPathIsDefaultValue() {
new RelaxedDataBinder(this.properties, "server").bind(new MutablePropertyValues(Collections.singletonMap("server.servlet.contextPath", "/")));
assertThat(this.properties.getServlet().getContextPath()).isEqualTo("");
}
use of org.springframework.beans.MutablePropertyValues in project spring-boot by spring-projects.
the class EndpointMBeanExporterTests method testRegistrationWithDifferentDomain.
@Test
public void testRegistrationWithDifferentDomain() throws Exception {
this.context = new GenericApplicationContext();
this.context.registerBeanDefinition("endpointMbeanExporter", new RootBeanDefinition(EndpointMBeanExporter.class, null, new MutablePropertyValues(Collections.singletonMap("domain", "test-domain"))));
this.context.registerBeanDefinition("endpoint1", new RootBeanDefinition(TestEndpoint.class));
this.context.refresh();
MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class);
assertThat(mbeanExporter.getServer().getMBeanInfo(getObjectName("test-domain", "endpoint1", false, this.context))).isNotNull();
}
use of org.springframework.beans.MutablePropertyValues in project spring-boot by spring-projects.
the class EndpointMBeanExporterTests method testSkipRegistrationOfDisabledEndpoint.
@Test
public void testSkipRegistrationOfDisabledEndpoint() throws Exception {
this.context = new GenericApplicationContext();
this.context.registerBeanDefinition("endpointMbeanExporter", new RootBeanDefinition(EndpointMBeanExporter.class));
MutablePropertyValues mpv = new MutablePropertyValues();
mpv.add("enabled", Boolean.FALSE);
this.context.registerBeanDefinition("endpoint1", new RootBeanDefinition(TestEndpoint.class, null, mpv));
this.context.refresh();
MBeanExporter mbeanExporter = this.context.getBean(EndpointMBeanExporter.class);
assertThat(mbeanExporter.getServer().isRegistered(getObjectName("endpoint1", this.context))).isFalse();
}
Aggregations