use of org.springframework.boot.autoconfigure.web.ServerProperties in project coffeenet-starter by coffeenet.
the class CoffeeNetDiscoveryInstancePropertiesTest method allowedAuthorities.
@Test
public void allowedAuthorities() {
String allowedAuthorities = "COFFEENET-ADMIN,COFFEENET-USER";
CoffeeNetConfigurationProperties coffeeNetConfigurationProperties = new CoffeeNetConfigurationProperties();
coffeeNetConfigurationProperties.setAllowedAuthorities(allowedAuthorities);
CoffeeNetDiscoveryInstanceProperties sut = new CoffeeNetDiscoveryInstanceProperties(new InetUtils(new InetUtilsProperties()), new ServerProperties(), coffeeNetConfigurationProperties);
sut.setEnvironment(new MockEnvironment());
assertThat(sut.getMetadataMap().get("allowedAuthorities"), is(allowedAuthorities));
}
use of org.springframework.boot.autoconfigure.web.ServerProperties in project coffeenet-starter by coffeenet.
the class CoffeeNetDiscoveryInstancePropertiesTest method applicationNameIsUnknown.
@Test
public void applicationNameIsUnknown() {
CoffeeNetConfigurationProperties coffeeNetConfigurationProperties = new CoffeeNetConfigurationProperties();
coffeeNetConfigurationProperties.setApplicationName("");
CoffeeNetDiscoveryInstanceProperties sut = new CoffeeNetDiscoveryInstanceProperties(new InetUtils(new InetUtilsProperties()), new ServerProperties(), coffeeNetConfigurationProperties);
sut.setEnvironment(new MockEnvironment());
String unknownApplicationName = "unknown";
assertThat(sut.getAppname(), is(unknownApplicationName));
assertThat(sut.getVirtualHostName(), is(unknownApplicationName));
assertThat(sut.getSecureVirtualHostName(), is(unknownApplicationName));
}
use of org.springframework.boot.autoconfigure.web.ServerProperties in project coffeenet-starter by coffeenet.
the class CoffeeNetDiscoveryInstancePropertiesTest method applicationName.
@Test
public void applicationName() {
String brandNewApplicationName = "BrandNewApplicationName";
CoffeeNetConfigurationProperties coffeeNetConfigurationProperties = new CoffeeNetConfigurationProperties();
coffeeNetConfigurationProperties.setApplicationName(brandNewApplicationName);
CoffeeNetDiscoveryInstanceProperties sut = new CoffeeNetDiscoveryInstanceProperties(new InetUtils(new InetUtilsProperties()), new ServerProperties(), coffeeNetConfigurationProperties);
sut.setEnvironment(new MockEnvironment());
assertThat(sut.getAppname(), is(brandNewApplicationName));
assertThat(sut.getVirtualHostName(), is(brandNewApplicationName));
assertThat(sut.getSecureVirtualHostName(), is(brandNewApplicationName));
}
use of org.springframework.boot.autoconfigure.web.ServerProperties in project coffeenet-starter by coffeenet.
the class CoffeeNetDiscoveryInstancePropertiesTest method allowedAuthoritiesNotProvided.
@Test
public void allowedAuthoritiesNotProvided() {
CoffeeNetDiscoveryInstanceProperties sut = new CoffeeNetDiscoveryInstanceProperties(new InetUtils(new InetUtilsProperties()), new ServerProperties(), new CoffeeNetConfigurationProperties());
sut.getMetadataMap().put("allowedAuthorities", "alreadySetAndNoneFromCoffeeNet");
sut.setEnvironment(new MockEnvironment());
assertThat(sut.getMetadataMap().get("allowedAuthorities"), is("alreadySetAndNoneFromCoffeeNet"));
}
use of org.springframework.boot.autoconfigure.web.ServerProperties in project free-framework by a601942905git.
the class Application method onApplicationEvent.
@Override
public void onApplicationEvent(EmbeddedServletContainerInitializedEvent event) {
port = event.getEmbeddedServletContainer().getPort();
ServerProperties serverProperties = (ServerProperties) ApplicationContextUtils.getBean(ServerProperties.class);
applicationName = serverProperties.getDisplayName();
}
Aggregations