Search in sources :

Example 6 with ServerConfiguration

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);
    }
}
Also used : ServerConfiguration(com.canoo.dp.impl.server.config.ServerConfiguration) Test(org.testng.annotations.Test)

Example 7 with ServerConfiguration

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);
    }
}
Also used : ServerConfiguration(com.canoo.dp.impl.server.config.ServerConfiguration) Test(org.testng.annotations.Test)

Example 8 with ServerConfiguration

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);
}
Also used : ServerConfiguration(com.canoo.dp.impl.server.config.ServerConfiguration) PlatformBootstrap(com.canoo.dp.impl.server.bootstrap.PlatformBootstrap)

Example 9 with ServerConfiguration

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);
}
Also used : ServerConfiguration(com.canoo.dp.impl.server.config.ServerConfiguration) PlatformBootstrap(com.canoo.dp.impl.server.bootstrap.PlatformBootstrap)

Example 10 with ServerConfiguration

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);
}
Also used : CrossSiteOriginFilter(com.canoo.dp.impl.server.servlet.CrossSiteOriginFilter) ServerConfiguration(com.canoo.dp.impl.server.config.ServerConfiguration) Test(org.testng.annotations.Test)

Aggregations

ServerConfiguration (com.canoo.dp.impl.server.config.ServerConfiguration)12 Test (org.testng.annotations.Test)10 PlatformBootstrap (com.canoo.dp.impl.server.bootstrap.PlatformBootstrap)2 CrossSiteOriginFilter (com.canoo.dp.impl.server.servlet.CrossSiteOriginFilter)2 RemotingConfiguration (com.canoo.dp.impl.server.config.RemotingConfiguration)1 DefaultClasspathScanner (com.canoo.dp.impl.server.scanner.DefaultClasspathScanner)1 DocumentAnnotatedClass (com.canoo.impl.server.classpathscan.documented.DocumentAnnotatedClass)1 AnnotatedClassForClasspathScan (com.canoo.impl.server.util.AnnotatedClassForClasspathScan)1 AnnotationForClasspathScanTest (com.canoo.impl.server.util.AnnotationForClasspathScanTest)1 Properties (java.util.Properties)1 Set (java.util.Set)1