use of org.springframework.cloud.commons.util.InetUtilsProperties 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.cloud.commons.util.InetUtilsProperties 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.cloud.commons.util.InetUtilsProperties 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.cloud.commons.util.InetUtilsProperties 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.cloud.commons.util.InetUtilsProperties in project coffeenet-starter by coffeenet.
the class CoffeeNetDiscoveryInstancePropertiesTest method setServerPort.
@Test
public void setServerPort() {
int port = 9999;
ServerProperties serverProperties = new ServerProperties();
serverProperties.setPort(port);
CoffeeNetDiscoveryInstanceProperties sut = new CoffeeNetDiscoveryInstanceProperties(new InetUtils(new InetUtilsProperties()), serverProperties, new CoffeeNetConfigurationProperties());
assertThat(sut.getNonSecurePort(), is(port));
}
Aggregations