@Deprecated @Override public Iterator<String> getKeys() { return config.getConfigValues().keySet().iterator(); }
ConfigurationBean( KernelData kernel, ManagementSupport support ) throws NotCompliantMBeanException { super( CONFIGURATION_MBEAN_NAME, kernel, support ); this.config = kernel.getConfig().getConfigValues(); }
@Admin @Description( "List the currently active config of Neo4j." ) @Procedure( name = "dbms.listConfig", mode = DBMS ) public Stream<ConfigResult> listConfig( @Name( value = "searchString", defaultValue = "" ) String searchString ) { Config config = graph.getDependencyResolver().resolveDependency( Config.class ); String lowerCasedSearchString = searchString.toLowerCase(); return config.getConfigValues().values().stream() .filter( c -> !c.internal() ) .filter( c -> c.name().toLowerCase().contains( lowerCasedSearchString ) ) .map( ConfigResult::new ) .sorted( Comparator.comparing( c -> c.name ) ); }
static HashMap<CoordinateReferenceSystem,EnvelopeSettings> envelopeSettingsFromConfig( Config config ) for ( Map.Entry<String,ConfigValue> entry : config.getConfigValues().entrySet() )
@Test public void configValuesContainsConnectors() { Config config = Config.builder().withServerDefaults().build(); List<String> connectorSettings = config.getConfigValues().entrySet().stream() .map( Entry::getKey ) .filter( c -> c.startsWith( "dbms.connector" ) ) .filter( c -> c.endsWith( ".enabled" ) ) .collect( toList() ); assertThat( connectorSettings, containsInAnyOrder( "dbms.connector.http.enabled", "dbms.connector.https.enabled", "dbms.connector.bolt.enabled" ) ); }
@Test public void webServerThreadCountDefaultShouldBeDocumented() { Config config = Config.builder().withServerDefaults().build(); String documentedDefaultValue = config.getConfigValues().entrySet().stream() .filter( c -> c.getKey().equals( ServerSettings.webserver_max_threads.name() ) ) .map( Entry::getValue ) .findAny() .orElseThrow( () -> new RuntimeException( "Setting not present!" ) ) .documentedDefaultValue() .orElseThrow( () -> new RuntimeException( "Default value not present!" ) ); assertEquals( "Number of available processors, or 500 for machines which have more than 500 processors.", documentedDefaultValue ); }
@Test public void shouldBeFoundInServerDefaults() { // given Config serverDefaultConfig = Config.builder().withServerDefaults().build(); // when Stream<ConfigValue> cvStream = serverDefaultConfig.getConfigValues().values().stream(); // then assertEquals( 1, cvStream.filter( c -> c.name().equals( certificates_directory.name() ) ).count() ); } }
@Test public void connectorSettingHasItsOwnValues() { Config config = Config.builder().withServerDefaults() .withSetting( new HttpConnector( "http" ).address, "localhost:123" ).build(); ConfigValue address = config.getConfigValues().entrySet().stream() .filter( c -> c.getKey().equals( "dbms.connector.http.address" ) ) .map( Entry::getValue ) .findAny() .orElseThrow( () -> new RuntimeException( "Setting not present!" ) ); assertTrue( address.deprecated() ); assertEquals( Optional.of( "dbms.connector.http.listen_address" ), address.replacement() ); } }
@Test public void shouldSetInternalParameter() { // Given Config config = Config.builder() .withSetting( MySettingsWithDefaults.secretSetting, "false" ) .withSetting( MySettingsWithDefaults.hello, "ABC" ) .withConfigClasses( Arrays.asList( mySettingsWithDefaults, myMigratingSettings ) ) .build(); // Then assertTrue( config.getConfigValues().get( MySettingsWithDefaults.secretSetting.name() ).internal() ); assertFalse( config.getConfigValues().get( MySettingsWithDefaults.hello.name() ).internal() ); }
@Test public void shouldSetDocumentedDefaultValue() { // Given Config config = Config.builder() .withSetting( MySettingsWithDefaults.secretSetting, "false" ) .withSetting( MySettingsWithDefaults.hello, "ABC" ) .withConfigClasses( Arrays.asList( new MySettingsWithDefaults(), myMigratingSettings ) ) .build(); // Then assertEquals( Optional.of( "<documented default value>" ), config.getConfigValues().get( MySettingsWithDefaults.secretSetting.name() ) .documentedDefaultValue() ); assertEquals( Optional.empty(), config.getConfigValues().get( MySettingsWithDefaults.hello.name() ).documentedDefaultValue() ); }
@Test public void shouldSetSecretParameter() { // Given Config config = Config.builder() .withSetting( MySettingsWithDefaults.password, "this should not be visible" ) .withSetting( MySettingsWithDefaults.hello, "ABC" ) .withConfigClasses( Arrays.asList( mySettingsWithDefaults, myMigratingSettings ) ) .build(); // Then assertTrue( config.getConfigValues().get( MySettingsWithDefaults.password.name() ).secret() ); assertFalse( config.getConfigValues().get( MySettingsWithDefaults.hello.name() ).secret() ); String configText = config.toString(); assertTrue( configText.contains( Secret.OBSFUCATED ) ); assertFalse( configText.contains( "this should not be visible" ) ); assertFalse( configText.contains( config.get( MySettingsWithDefaults.password ) ) ); }
@Deprecated @Override public Iterator<String> getKeys() { return config.getConfigValues().keySet().iterator(); }
ConfigurationBean( KernelData kernel, ManagementSupport support ) throws NotCompliantMBeanException { super( CONFIGURATION_MBEAN_NAME, kernel, support ); this.config = kernel.getConfig().getConfigValues(); }
@Admin @Description( "List the currently active config of Neo4j." ) @Procedure( name = "dbms.listConfig", mode = DBMS ) public Stream<ConfigResult> listConfig( @Name( value = "searchString", defaultValue = "" ) String searchString ) { Config config = graph.getDependencyResolver().resolveDependency( Config.class ); String lowerCasedSearchString = searchString.toLowerCase(); return config.getConfigValues().values().stream() .filter( c -> !c.internal() ) .filter( c -> c.name().toLowerCase().contains( lowerCasedSearchString ) ) .map( ConfigResult::new ) .sorted( Comparator.comparing( c -> c.name ) ); }
static HashMap<CoordinateReferenceSystem,EnvelopeSettings> envelopeSettingsFromConfig( Config config ) for ( Map.Entry<String,ConfigValue> entry : config.getConfigValues().entrySet() )