use of com.canoo.dp.impl.server.config.ServerConfiguration in project dolphin-platform by canoo.
the class ConfigurationFileLoaderTest method testNullPropertyWillNotBeAdded.
@Test
public void testNullPropertyWillNotBeAdded() {
try {
// given:
final ServerConfiguration configuration = ConfigurationFileLoader.loadConfiguration();
// when:
configuration.setProperty("test-key", null);
// then:
assertEquals(configuration.getProperty("test-key", null), null);
assertEquals(configuration.getProperty("test-key", "a"), "a");
assertEquals(configuration.getProperty(TestConfigurationProvider.PROPERTY_3_NAME, null), null);
assertFalse(configuration.getPropertyKeys().contains("test-key"));
assertFalse(configuration.getPropertyKeys().contains(TestConfigurationProvider.PROPERTY_3_NAME));
} catch (Exception e) {
fail("Error in test", e);
}
}
use of com.canoo.dp.impl.server.config.ServerConfiguration in project dolphin-platform by canoo.
the class ConfigurationFileLoaderTest method testConfigurationProviderDoNotOverwrite.
@Test
public void testConfigurationProviderDoNotOverwrite() {
try {
// given:
final ServerConfiguration configuration = ConfigurationFileLoader.loadConfiguration();
// then:
assertEquals(configuration.getBooleanProperty(USE_CROSS_SITE_ORIGIN_FILTER, USE_CROSS_SITE_ORIGIN_FILTER_DEFAULT_VALUE), false);
assertEquals(configuration.getProperty(USE_CROSS_SITE_ORIGIN_FILTER, null), "false");
} catch (Exception e) {
fail("Error in test", e);
}
}
use of com.canoo.dp.impl.server.config.ServerConfiguration in project dolphin-platform by canoo.
the class DolphinPlatformJavaeeBootstrap method onStartup.
@Override
public void onStartup(final Set<Class<?>> c, final ServletContext servletContext) throws ServletException {
final ServerConfiguration configuration = ConfigurationFileLoader.loadConfiguration();
final PlatformBootstrap bootstrap = new PlatformBootstrap();
bootstrap.init(servletContext, configuration);
}
use of com.canoo.dp.impl.server.config.ServerConfiguration in project dolphin-platform by canoo.
the class DolphinPlatformSpringBootstrap method onStartup.
@Override
public void onStartup(final ServletContext servletContext) throws ServletException {
final ServerConfiguration configuration = Optional.ofNullable(injectedConfig).orElse(ConfigurationFileLoader.loadConfiguration());
updateConfigurationBySpring(configuration);
final PlatformBootstrap bootstrap = new PlatformBootstrap();
bootstrap.init(servletContext, configuration);
}
use of com.canoo.dp.impl.server.config.ServerConfiguration in project dolphin-platform by canoo.
the class CrossSiteOriginFilterTest method testCommaSeparatedStringWithValidList.
@Test
public void testCommaSeparatedStringWithValidList() {
final CrossSiteOriginFilter crossSiteOriginFilter = new CrossSiteOriginFilter(new ServerConfiguration());
final String commaSeparatedList = crossSiteOriginFilter.getAsCommaSeparatedList(Arrays.asList("origin", "authorization", "accept"));
assertEquals("origin,authorization,accept", commaSeparatedList);
}
Aggregations