private static Config Config( Map<String,String> params ) { return Config.fromSettings( params ) .withConfigClasses( Arrays.asList( mySettingsWithDefaults, myMigratingSettings ) ).build(); }
private static Config createConfig() { Map<String, String> configProps = new HashMap<>(); configProps.put( new BoltConnector( CONNECTOR ).enabled.name(), "TRUE" ); configProps.put( new BoltConnector( CONNECTOR ).listen_address.name(), "localhost:0" ); configProps.put( new BoltConnector( CONNECTOR ).type.name(), BoltConnector.ConnectorType.BOLT.name() ); configProps.put( new BoltConnector( CONNECTOR ).thread_pool_min_size.name(), "5" ); configProps.put( new BoltConnector( CONNECTOR ).thread_pool_max_size.name(), "10" ); return Config.fromSettings( configProps ).build(); }
@Test void shouldDeriveListenAddressFromDefaultListenAddress() { // given Config config = Config.fromSettings( stringMap( "dbms.connector.https.enabled", "true", "dbms.connector.http.enabled", "true", "dbms.connectors.default_listen_address", "0.0.0.0" ) ).withServerDefaults().build(); // then assertEquals( 2, config.enabledHttpConnectors().size() ); config.enabledHttpConnectors().forEach( c -> assertEquals( "0.0.0.0", config.get( c.listen_address ).getHostname() ) ); }
private Config loadAdditionalConfigFile( Path path ) { try ( InputStream in = Files.newInputStream( path ) ) { return Config.fromSettings( MapUtil.load( in ) ).build(); } catch ( IOException e ) { throw new UncheckedIOException( "Could not read additional configuration from " + path + ". " + "The file either does not exist, is not a regular file, or is not readable.", e ); } } }