org.neo4j.kernel.configuration.Config.defaults()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中org.neo4j.kernel.configuration.Config.defaults()方法的一些代码示例,展示了Config.defaults()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.defaults()方法的具体详情如下:
包路径:org.neo4j.kernel.configuration.Config
类名称:Config
方法名:defaults

Config.defaults介绍

暂无

代码示例

代码示例来源:origin: neo4j/neo4j

@Test
public void shouldBeAbleToRecoverBrokenStoreWithLogsInSeparateRelativeLocation() throws Exception
{
  File customTransactionLogsLocation = new File( storeDir, "tx-logs" );
  Config config = Config.defaults( logical_logs_location, customTransactionLogsLocation.getName() );
  recoverBrokenStoreWithConfig( config );
}

代码示例来源:origin: neo4j/neo4j

@Test
  public void shouldAdjustURLToWithinImportDirectory() throws Exception
  {
    final URL url = new File( "/bar/baz.csv" ).toURI().toURL();
    final Config config = Config.defaults( GraphDatabaseSettings.load_csv_file_url_root, "/var/lib/neo4j/import" );
    URL accessURL = URLAccessRules.fileAccess().validate( config, url );
    URL expected = new File( "/var/lib/neo4j/import/bar/baz.csv" ).toURI().toURL();
    assertEquals( expected, accessURL );
  }
}

代码示例来源:origin: neo4j/neo4j

@Test
public void shouldStopCleanlyEvenWhenItHasntBeenStarted()
{
  new Jetty9WebServer( NullLogProvider.getInstance(), Config.defaults(), NetworkConnectionTracker.NO_OP ).stop();
}

代码示例来源:origin: neo4j/neo4j

@Test
  public void shouldAdvertiseServicesWhenAsked() throws Exception
  {
    UriInfo uriInfo = mock( UriInfo.class );
    URI uri = new URI( "http://example.org:7474/" );
    when( uriInfo.getBaseUri() ).thenReturn( uri );
    RootService svc = new RootService( new CommunityNeoServer( Config.defaults( stringMap(
        new HttpConnector( "http", Encryption.NONE ).type.name(), "HTTP",
        new HttpConnector( "http", Encryption.NONE ).enabled.name(), "true"
    ) ),
        GraphDatabaseDependencies.newDependencies().userLogProvider( NullLogProvider.getInstance() )
            .monitors( new Monitors() )
    ) );
    EntityOutputFormat output = new EntityOutputFormat( new JsonFormat(), null, null );
    Response serviceDefinition = svc.getServiceDefinition( uriInfo, output );
    assertEquals( 200, serviceDefinition.getStatus() );
    Map<String, Object> result = (Map<String, Object>) output.getResultAsMap().get( "services" );
    assertThat( result.get( "console" )
        .toString(), containsString( String.format( "%sserver/console", uri.toString() ) ) );
    assertThat( result.get( "jmx" )
        .toString(), containsString( String.format( "%sserver/jmx", uri.toString() ) ) );
  }
}

代码示例来源:origin: neo4j/neo4j

@Test
void shouldReadMultipleSettings()
{
  // given
  ConfiguredSpaceFillingCurveSettingsCache globalSettings = new ConfiguredSpaceFillingCurveSettingsCache( Config.defaults() );
  Map<CoordinateReferenceSystem,SpaceFillingCurveSettings> expectedSpecificSettings = new HashMap<>();
  rememberSettings( globalSettings, expectedSpecificSettings, WGS84, WGS84_3D, Cartesian );
  IndexSpecificSpaceFillingCurveSettingsCache specificSettings =
      new IndexSpecificSpaceFillingCurveSettingsCache( globalSettings, expectedSpecificSettings );
  SpaceFillingCurveSettingsWriter writer = new SpaceFillingCurveSettingsWriter( specificSettings );
  byte[] bytes = new byte[PageCache.PAGE_SIZE];
  writer.accept( new ByteArrayPageCursor( bytes ) );
  Map<CoordinateReferenceSystem,SpaceFillingCurveSettings> readExpectedSettings = new HashMap<>();
  SpaceFillingCurveSettingsReader reader = new SpaceFillingCurveSettingsReader( readExpectedSettings );
  // when
  reader.read( ByteBuffer.wrap( bytes ) );
  // then
  assertEquals( expectedSpecificSettings, readExpectedSettings );
}

代码示例来源:origin: neo4j/neo4j

private void extractTransactionalInformationFromLogs( String path, File customLogLocation, DatabaseLayout databaseLayout, File storeDir ) throws IOException
{
  LogService logService = new SimpleLogService( NullLogProvider.getInstance(), NullLogProvider.getInstance() );
  File neoStore = databaseLayout.metadataStore();
  GraphDatabaseService database = new TestGraphDatabaseFactory().newEmbeddedDatabaseBuilder( storeDir )
      .setConfig( logical_logs_location, path ).newGraphDatabase();
  for ( int i = 0; i < 10; i++ )
  {
    try ( Transaction transaction = database.beginTx() )
    {
      Node node = database.createNode();
      transaction.success();
    }
  }
  database.shutdown();
  MetaDataStore.setRecord( pageCache, neoStore, MetaDataStore.Position.LAST_CLOSED_TRANSACTION_LOG_VERSION,
      MetaDataRecordFormat.FIELD_NOT_PRESENT );
  Config config = Config.defaults( logical_logs_location, path );
  StoreMigrator migrator = new StoreMigrator( fileSystemRule.get(), pageCache, config, logService, jobScheduler );
  LogPosition logPosition = migrator.extractTransactionLogPosition( neoStore, databaseLayout, 100 );
  File[] logFiles = customLogLocation.listFiles();
  assertNotNull( logFiles );
  assertEquals( 0, logPosition.getLogVersion() );
  assertEquals( logFiles[0].length(), logPosition.getByteOffset() );
}

代码示例来源:origin: neo4j/neo4j

private ConsistencyCheckService.Result checkConsistency() throws ConsistencyCheckIncompleteException
{
  Config config = Config.defaults();
  ConsistencyCheckService consistencyCheckService = new ConsistencyCheckService( new Date() );
  ConsistencyFlags checkConsistencyConfig = new ConsistencyFlags( config );
  return consistencyCheckService.runFullConsistencyCheck( testDirectory.databaseLayout(), config, ProgressMonitorFactory.NONE,
      NullLogProvider.getInstance(), true, checkConsistencyConfig );
}

代码示例来源:origin: neo4j/neo4j

@Test
public void shouldAdvertiseBoltIfExplicitlyConfigured() throws Exception
{
  DiscoverableURIs uris = communityDiscoverableURIs(
      Config.defaults( ServerSettings.bolt_discoverable_address, "bolt://banana.com:1234" ), null );
  assertEquals( "bolt://banana.com:1234", toMap(uris).get("bolt") );
}

代码示例来源:origin: neo4j/neo4j

@Test
public void shouldGetDefaultSpaceFillingCurveSettingsForWGS84()
{
  shouldGetSettingsFor( Config.defaults(), CoordinateReferenceSystem.WGS84, 2, 60, new Envelope( -180, 180, -90, 90 ) );
}

代码示例来源:origin: neo4j/neo4j

@Test
public void shouldReturnNullPolicyIfNullRequested()
{
  // given
  SslPolicyLoader sslPolicyLoader = SslPolicyLoader.create( Config.defaults(), NullLogProvider.getInstance() );
  // when
  SslPolicy sslPolicy = sslPolicyLoader.getPolicy( null );
  // then
  assertNull( sslPolicy );
}

代码示例来源:origin: neo4j/neo4j

@Test
public void shouldHaveConfigurableJettyThreadPoolSize() throws Exception
{
  Jetty9WebServer server = new Jetty9WebServer( NullLogProvider.getInstance(), Config.defaults(), NetworkConnectionTracker.NO_OP );
  int numCores = 1;
  int configuredMaxThreads = 12; // 12 is the new min max Threads value, for one core
  int acceptorThreads = 1; // In this configuration, 1 thread will become an acceptor...
  int selectorThreads = 1; // ... and 1 thread will become a selector...
  int jobThreads = configuredMaxThreads - acceptorThreads - selectorThreads; // ... and the rest are job threads
  server.setMaxThreads( numCores );
  server.setHttpAddress( new ListenSocketAddress( "localhost", 0 ) );
  try
  {
    server.start();
    QueuedThreadPool threadPool = (QueuedThreadPool) server.getJetty().getThreadPool();
    threadPool.start();
    CountDownLatch startLatch = new CountDownLatch( jobThreads );
    CountDownLatch endLatch = loadThreadPool( threadPool, configuredMaxThreads + 1, startLatch );
    startLatch.await(); // Wait for threadPool to create threads
    int threads = threadPool.getThreads();
    assertEquals( "Wrong number of threads in pool", configuredMaxThreads, threads );
    endLatch.countDown();
  }
  finally
  {
    server.stop();
  }
}

代码示例来源:origin: neo4j/neo4j

private StoreUpgrader newUpgrader( UpgradableDatabase upgradableDatabase, PageCache pageCache,
    MigrationProgressMonitor progressMonitor, SchemaIndexMigrator indexMigrator, StoreMigrator migrator )
{
  Config allowUpgrade = Config.defaults( GraphDatabaseSettings.allow_upgrade, "true" );
  StoreUpgrader upgrader = new StoreUpgrader( upgradableDatabase, progressMonitor, allowUpgrade, fs, pageCache,
      NullLogProvider.getInstance() );
  upgrader.addParticipant( indexMigrator );
  upgrader.addParticipant( migrator );
  return upgrader;
}

代码示例来源:origin: neo4j/neo4j

@Test
public void shouldOverrideBigPageCacheMemorySettingContainingUnit()
{
  // GIVEN
  Config dbConfig = Config.defaults( pagecache_memory, "2g" );
  Configuration config = new Configuration.Overridden( dbConfig );
  // WHEN
  long memory = config.pageCacheMemory();
  // THEN
  assertEquals( MAX_PAGE_CACHE_MEMORY, memory );
}

代码示例来源:origin: neo4j/neo4j

@Test
public void shouldGetDefaultSpaceFillingCurveSettingsForCartesian_3D()
{
  shouldGetSettingsFor( Config.defaults(), CoordinateReferenceSystem.Cartesian_3D, 3, 60,
      new Envelope( new double[]{-1000000, -1000000, -1000000}, new double[]{1000000, 1000000, 1000000} ) );
}

代码示例来源:origin: neo4j/neo4j

@Test
public void shouldBeAbleToUsePortZero() throws Exception
{
  // Given
  webServer = new Jetty9WebServer( NullLogProvider.getInstance(), Config.defaults(), NetworkConnectionTracker.NO_OP );
  webServer.setHttpAddress( new ListenSocketAddress( "localhost", 0 ) );
  // When
  webServer.start();
  // Then no exception
}

代码示例来源:origin: neo4j/neo4j

private StoreFactory factory( Integer customThreshold, PageCache pageCache )
{
  Map<String, String> customConfig = new HashMap<>();
  if ( customThreshold != null )
  {
    customConfig.put( GraphDatabaseSettings.dense_node_threshold.name(), "" + customThreshold );
  }
  return new StoreFactory( testDir.databaseLayout(), Config.defaults( customConfig ), new DefaultIdGeneratorFactory( fs ), pageCache,
      fs, NullLogProvider.getInstance(), EmptyVersionContextSupplier.EMPTY );
}

代码示例来源:origin: neo4j/neo4j

@Test
public void shouldAbleToAccessRegisteredPropertyByName()
{
  Config config = Config.defaults();
  ConfigAdapter wrappingConfiguration = new ConfigAdapter( config );
  assertEquals( Duration.ofSeconds( 60 ),
      wrappingConfiguration.getProperty( ServerSettings.transaction_idle_timeout.name() ) );
}

代码示例来源:origin: neo4j/neo4j

@Test
  public void createRegularCommitProcess()
  {
    CommunityCommitProcessFactory factory = new CommunityCommitProcessFactory();

    TransactionCommitProcess commitProcess = factory.create( mock( TransactionAppender.class ),
        mock( StorageEngine.class ), Config.defaults() );

    assertThat( commitProcess, instanceOf( TransactionRepresentationCommitProcess.class ) );
  }
}

代码示例来源:origin: neo4j/neo4j

@Test
  public void shouldRegisterASingleUri()
  {
    // Given
    WebServer webServer = mock( WebServer.class );

    Map<String, String> params = new HashMap<>();
    String path = "/db/data";
    params.put( ServerSettings.rest_api_path.name(), path );
    Config config = Config.defaults( params );

    // When
    RESTApiModule module = new RESTApiModule( webServer, config, () -> new UsageData( mock( JobScheduler.class ) ), NullLogProvider.getInstance() );
    module.start();

    // Then
    verify( webServer ).addJAXRSClasses( anyListOf( String.class ), anyString(), any() );
  }
}

代码示例来源:origin: neo4j/neo4j

@Before
public void setUp()
{
  config = Config.defaults();
  clock = Clocks.fakeClock();
  logPruning = LogPruning.NO_PRUNING;
  logProvider = NullLogProvider.getInstance();
  intervalTx = config.get( GraphDatabaseSettings.check_point_interval_tx );
  intervalTime = config.get( GraphDatabaseSettings.check_point_interval_time );
  triggerConsumer = new LinkedBlockingQueue<>();
  triggered = triggerConsumer::offer;
  notTriggered = s -> fail( "Should not have triggered: " + s );
}

相关文章