Skip to content

Commit

Permalink
Merge pull request #6529 from benbc/3.0-clean-up-config
Browse files Browse the repository at this point in the history
3.0 clean up config
  • Loading branch information
benbc committed Feb 29, 2016
2 parents 7975b6c + c2daf86 commit 7ffd0f0
Show file tree
Hide file tree
Showing 101 changed files with 623 additions and 722 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import org.neo4j.helpers.HostnamePort;
import org.neo4j.helpers.Service;
import org.neo4j.kernel.configuration.Config;
import org.neo4j.kernel.configuration.ConfigGroups;
import org.neo4j.kernel.configuration.ConfigValues;
import org.neo4j.kernel.extension.KernelExtensionFactory;
import org.neo4j.kernel.impl.core.ThreadToStatementContextBridge;
Expand Down Expand Up @@ -89,7 +90,7 @@ public class BoltKernelExtension extends KernelExtensionFactory<BoltKernelExtens
public static class Settings
{
public static final Function<ConfigValues,List<Configuration>> connector_group =
Config.groups( "dbms.connector" );
ConfigGroups.groups( "dbms.connector" );

@Description( "Enable Neo4j Bolt" )
public static final Setting<Boolean> enabled = setting( "enabled", BOOLEAN, "false" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
*/
package org.neo4j.legacy.consistency;

import org.junit.Rule;
import org.junit.Test;

import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import org.junit.Rule;
import org.junit.Test;

import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Label;
import org.neo4j.graphdb.Node;
Expand All @@ -36,7 +36,6 @@
import org.neo4j.graphdb.factory.GraphDatabaseBuilder;
import org.neo4j.graphdb.factory.GraphDatabaseFactory;
import org.neo4j.graphdb.factory.GraphDatabaseSettings;
import org.neo4j.helpers.collection.MapUtil;
import org.neo4j.helpers.progress.ProgressMonitorFactory;
import org.neo4j.io.fs.DefaultFileSystemAbstraction;
import org.neo4j.kernel.api.exceptions.TransactionFailureException;
Expand All @@ -53,6 +52,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import static org.neo4j.helpers.collection.MapUtil.stringMap;
import static org.neo4j.legacy.consistency.ConsistencyCheckService.defaultLogFileName;
import static org.neo4j.test.Property.property;
Expand Down Expand Up @@ -164,9 +164,9 @@ public void shouldAllowGraphCheckDisabled() throws IOException, ConsistencyCheck
gds.shutdown();

ConsistencyCheckService service = new ConsistencyCheckService();
Config configuration = new Config( settings(), GraphDatabaseSettings.class, ConsistencyCheckSettings.class );
configuration.applyChanges( MapUtil.stringMap( ConsistencyCheckSettings.consistency_check_graph.name(),
Settings.FALSE ) );
Config configuration = new Config(
stringMap( ConsistencyCheckSettings.consistency_check_graph.name(), Settings.FALSE ),
GraphDatabaseSettings.class, ConsistencyCheckSettings.class );

// when
Result result = service.runFullConsistencyCheck( testDirectory.graphDbDir(), configuration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ public void shouldNotReportIndexInconsistenciesIfIndexIsFailed() throws Exceptio
IndexRule rule = rules.next();
IndexDescriptor descriptor = new IndexDescriptor( rule.getLabel(), rule.getPropertyKey() );
IndexConfiguration indexConfig = IndexConfiguration.NON_UNIQUE;
IndexSamplingConfig samplingConfig = new IndexSamplingConfig( new Config() );
IndexSamplingConfig samplingConfig = new IndexSamplingConfig( Config.empty() );
IndexPopulator populator =
storeAccess.indexes().getPopulator( rule.getId(), descriptor, indexConfig, samplingConfig );
populator.markAsFailed( "Oh noes! I was a shiny index and then I was failed" );
Expand Down Expand Up @@ -541,7 +541,7 @@ protected void transactionData( GraphStoreFixture.TransactionDataBuilder tx,
public void shouldReportNodesThatAreNotIndexed() throws Exception
{
// given
IndexSamplingConfig samplingConfig = new IndexSamplingConfig( new Config() );
IndexSamplingConfig samplingConfig = new IndexSamplingConfig( Config.empty() );
for ( IndexRule indexRule : loadAllIndexRules( fixture.directStoreAccess().nativeStores().getSchemaStore() ) )
{
IndexAccessor accessor = fixture.directStoreAccess().indexes().getOnlineAccessor(
Expand All @@ -565,7 +565,7 @@ public void shouldReportNodesWithDuplicatePropertyValueInUniqueIndex() throws Ex
{
// given
IndexConfiguration indexConfig = IndexConfiguration.NON_UNIQUE;
IndexSamplingConfig samplingConfig = new IndexSamplingConfig( new Config() );
IndexSamplingConfig samplingConfig = new IndexSamplingConfig( Config.empty() );
for ( IndexRule indexRule : loadAllIndexRules( fixture.directStoreAccess().nativeStores().getSchemaStore() ) )
{
IndexAccessor accessor = fixture.directStoreAccess()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public void shouldImportCsvData() throws Exception
ExecutionMonitor processorAssigner = eagerRandomSaturation( config.maxNumberOfProcessors() );
final BatchImporter inserter = new ParallelBatchImporter( directory.graphDbDir(),
new DefaultFileSystemAbstraction(), config, NullLogService.getInstance(),
processorAssigner, EMPTY, new Config() );
processorAssigner, EMPTY, Config.empty() );

boolean successful = false;
IdGroupDistribution groups = new IdGroupDistribution( NODE_COUNT, 5, random.random() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
*/
package org.neo4j.consistency;

import org.junit.Rule;
import org.junit.Test;

import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import org.junit.Rule;
import org.junit.Test;

import org.neo4j.consistency.ConsistencyCheckService.Result;
import org.neo4j.consistency.checking.GraphStoreFixture;
import org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException;
Expand All @@ -39,7 +39,6 @@
import org.neo4j.graphdb.factory.GraphDatabaseBuilder;
import org.neo4j.graphdb.factory.GraphDatabaseFactory;
import org.neo4j.graphdb.factory.GraphDatabaseSettings;
import org.neo4j.helpers.collection.MapUtil;
import org.neo4j.helpers.progress.ProgressMonitorFactory;
import org.neo4j.kernel.api.exceptions.TransactionFailureException;
import org.neo4j.kernel.configuration.Config;
Expand All @@ -52,6 +51,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import static org.neo4j.consistency.ConsistencyCheckService.defaultLogFileName;
import static org.neo4j.helpers.collection.MapUtil.stringMap;
import static org.neo4j.test.Property.property;
Expand Down Expand Up @@ -157,9 +157,9 @@ public void shouldAllowGraphCheckDisabled() throws IOException, ConsistencyCheck
gds.shutdown();

ConsistencyCheckService service = new ConsistencyCheckService();
Config configuration = new Config( settings(), GraphDatabaseSettings.class, ConsistencyCheckSettings.class );
configuration.applyChanges( MapUtil.stringMap( ConsistencyCheckSettings.consistency_check_graph.name(),
Settings.FALSE ) );
Config configuration = new Config(
stringMap( ConsistencyCheckSettings.consistency_check_graph.name(), Settings.FALSE ),
GraphDatabaseSettings.class, ConsistencyCheckSettings.class );

// when
Result result = runFullConsistencyCheck( service, configuration );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ public void shouldNotReportIndexInconsistenciesIfIndexIsFailed() throws Exceptio
IndexRule rule = rules.next();
IndexDescriptor descriptor = new IndexDescriptor( rule.getLabel(), rule.getPropertyKey() );
IndexConfiguration indexConfig = IndexConfiguration.NON_UNIQUE;
IndexSamplingConfig samplingConfig = new IndexSamplingConfig( new Config() );
IndexSamplingConfig samplingConfig = new IndexSamplingConfig( Config.empty() );
IndexPopulator populator =
storeAccess.indexes().getPopulator( rule.getId(), descriptor, indexConfig, samplingConfig );
populator.markAsFailed( "Oh noes! I was a shiny index and then I was failed" );
Expand Down Expand Up @@ -582,7 +582,7 @@ protected void transactionData( GraphStoreFixture.TransactionDataBuilder tx,
public void shouldReportNodesThatAreNotIndexed() throws Exception
{
// given
IndexSamplingConfig samplingConfig = new IndexSamplingConfig( new Config() );
IndexSamplingConfig samplingConfig = new IndexSamplingConfig( Config.empty() );
for ( IndexRule indexRule : loadAllIndexRules( fixture.directStoreAccess().nativeStores().getSchemaStore() ) )
{
IndexAccessor accessor = fixture.directStoreAccess().indexes().getOnlineAccessor(
Expand All @@ -606,7 +606,7 @@ public void shouldReportNodesWithDuplicatePropertyValueInUniqueIndex() throws Ex
{
// given
IndexConfiguration indexConfig = IndexConfiguration.NON_UNIQUE;
IndexSamplingConfig samplingConfig = new IndexSamplingConfig( new Config() );
IndexSamplingConfig samplingConfig = new IndexSamplingConfig( Config.empty() );
for ( IndexRule indexRule : loadAllIndexRules( fixture.directStoreAccess().nativeStores().getSchemaStore() ) )
{
IndexAccessor accessor = fixture.directStoreAccess()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@
*/
package org.neo4j.unsafe.impl.batchimport;

import org.apache.commons.lang3.mutable.MutableLong;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
Expand All @@ -40,6 +34,12 @@
import java.util.Set;
import java.util.UUID;

import org.apache.commons.lang3.mutable.MutableLong;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import org.neo4j.consistency.ConsistencyCheckService;
import org.neo4j.consistency.ConsistencyCheckService.Result;
import org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException;
Expand Down Expand Up @@ -72,6 +72,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import static org.neo4j.helpers.collection.IteratorUtil.asSet;
import static org.neo4j.helpers.collection.MapUtil.stringMap;
import static org.neo4j.unsafe.impl.batchimport.AdditionalInitialIds.EMPTY;
Expand Down Expand Up @@ -151,7 +152,7 @@ public void shouldImportCsvData() throws Exception
ExecutionMonitor processorAssigner = eagerRandomSaturation( config.maxNumberOfProcessors() );
final BatchImporter inserter = new ParallelBatchImporter( directory.graphDbDir(),
new DefaultFileSystemAbstraction(), config, NullLogService.getInstance(),
processorAssigner, EMPTY, new Config() );
processorAssigner, EMPTY, Config.empty() );

boolean successful = false;
IdGroupDistribution groups = new IdGroupDistribution( NODE_COUNT, 5, random.random() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class LazyTest extends ExecutionEngineFunSuite {
val dependencies = mock[DependencyResolver]
val bridge = mock[ThreadToStatementContextBridge]
val monitors = new org.neo4j.kernel.monitoring.Monitors()
val config = new Config()
val config = Config.empty()

val fakeDataStatement = mock[OperationsFacade]
val fakeReadStatement = mock[ReadOperations]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
import static org.neo4j.helpers.Exceptions.launderedException;
import static org.neo4j.helpers.Format.bytes;
import static org.neo4j.helpers.Strings.TAB;
import static org.neo4j.kernel.configuration.Config.defaults;
import static org.neo4j.kernel.impl.util.Converters.withDefault;
import static org.neo4j.unsafe.impl.batchimport.Configuration.BAD_FILE_NAME;
import static org.neo4j.unsafe.impl.batchimport.input.Collectors.badCollector;
Expand Down Expand Up @@ -430,7 +431,7 @@ public static void main( String[] incomingArguments, boolean defaultSettingsSuit

private static Config loadDbConfig( File file ) throws IOException
{
return file != null && file.exists() ? new Config( MapUtil.load( file ) ) : new Config();
return file != null && file.exists() ? new Config( MapUtil.load( file ) ) : Config.defaults();
}

private static void printOverview( File storeDir, Collection<Option<File[]>> nodesFiles,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import org.neo4j.unsafe.impl.batchimport.input.csv.Header;
import org.neo4j.unsafe.impl.batchimport.input.csv.IdType;

import static org.neo4j.kernel.configuration.Config.parseLongWithUnit;
import static org.neo4j.kernel.configuration.Settings.parseLongWithUnit;
import static org.neo4j.tooling.CsvDataGenerator.bareboneNodeHeader;
import static org.neo4j.tooling.CsvDataGenerator.bareboneRelationshipHeader;
import static org.neo4j.unsafe.impl.batchimport.Configuration.DEFAULT;
Expand Down Expand Up @@ -86,7 +86,7 @@ public static void main( String[] arguments ) throws IOException
COMMAS, nodeCount, relationshipCount, new Groups(), idType, labelCount, relationshipTypeCount,
silentBadCollector( 0 ));
BatchImporter importer = new ParallelBatchImporter( dir, DEFAULT,
new SimpleLogService( sysoutLogProvider, sysoutLogProvider ), defaultVisible(), new Config() );
new SimpleLogService( sysoutLogProvider, sysoutLogProvider ), defaultVisible(), Config.defaults() );
importer.doImport( input );
}

Expand Down

0 comments on commit 7ffd0f0

Please sign in to comment.