org.neo4j.kernel.impl.util.Dependencies.<init>()方法的使用及代码示例

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

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

Dependencies.<init>介绍

暂无

代码示例

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

private static DependencyResolver buildIndexDependencies( IndexProvider... providers )
{
  Dependencies dependencies = new Dependencies();
  dependencies.satisfyDependencies( (Object[]) providers );
  return dependencies;
}

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

public NeoStoreDataSource getDataSource( DatabaseLayout databaseLayout, FileSystemAbstraction fs, PageCache pageCache )
{
  return getDataSource( databaseLayout, fs, pageCache, new Dependencies() );
}

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

@Test
public void givenSatisfiedTypeInParentWhenResolveWithTypeInEmptyDependenciesThenInstanceReturned()
{
  // Given
  Dependencies parent = new Dependencies(  );
  Dependencies dependencies = new Dependencies( parent );
  Collection foo = new ArrayList( );
  dependencies.satisfyDependency( foo );
  // When
  Collection instance = dependencies.resolveDependency( Collection.class );
  // Then
  assertThat(instance, equalTo(foo));
}

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

TestKernelTransaction( CommitTrackingMonitor monitor )
{
  super( Config.defaults(), mock( StatementOperationParts.class ), mock( SchemaWriteGuard.class ), new TransactionHooks(),
      mock( ConstraintIndexCreator.class ), new Procedures(), TransactionHeaderInformationFactory.DEFAULT, mock( TransactionCommitProcess.class ),
      monitor, mock( AuxiliaryTransactionStateManager.class ), mock( Pool.class ), Clocks.fakeClock(),
      new AtomicReference<>( CpuClock.NOT_AVAILABLE ), new AtomicReference<>( HeapAllocation.NOT_AVAILABLE ), TransactionTracer.NULL,
      LockTracer.NONE, PageCursorTracerSupplier.NULL, mock( StorageEngine.class, RETURNS_MOCKS ), new CanWrite(), AutoIndexing.UNSUPPORTED,
      mock( ExplicitIndexStore.class ), EmptyVersionContextSupplier.EMPTY, ON_HEAP, new StandardConstraintSemantics(), mock( SchemaState.class ),
      mock( IndexingService.class ), mockedTokenHolders(), new Dependencies() );
  this.monitor = monitor;
}

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

public KernelTransactionImplementation newNotInitializedTransaction()
{
  return new KernelTransactionImplementation( Config.defaults(), statementOperations, schemaWriteGuard, hooks, null, null, headerInformationFactory,
      commitProcess, transactionMonitor, auxTxStateManager, txPool, clock, new AtomicReference<>( CpuClock.NOT_AVAILABLE ),
      new AtomicReference<>( HeapAllocation.NOT_AVAILABLE ), TransactionTracer.NULL, LockTracer.NONE, PageCursorTracerSupplier.NULL, storageEngine,
      new CanWrite(), AutoIndexing.UNSUPPORTED, mock( ExplicitIndexStore.class ), EmptyVersionContextSupplier.EMPTY, () -> collectionsFactory,
      new StandardConstraintSemantics(), mock( SchemaState.class ), mock( IndexingService.class ), mockedTokenHolders(), new Dependencies() );
}

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

@Test
public void givenSatisfiedTypeInParentAndDependenciesWhenResolveWithTypeInDependenciesThenInstanceReturned()
{
  // Given
  Dependencies parent = new Dependencies(  );
  Dependencies dependencies = new Dependencies( parent );
  Collection foo = new ArrayList( );
  dependencies.satisfyDependency( foo );
  parent.satisfyDependency( new ArrayList());
  // When
  Collection instance = dependencies.resolveDependency( Collection.class );
  // Then
  assertThat(instance, equalTo(foo));
}

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

@SuppressWarnings( "unchecked" )
  public static DatabaseKernelExtensions instantiateKernelExtensions(
      File databaseDirectory, FileSystemAbstraction fileSystem, Config config, LogService logService, PageCache pageCache, JobScheduler jobScheduler,
      RecoveryCleanupWorkCollector recoveryCollector, DatabaseInfo databaseInfo, Monitors monitors, TokenHolders tokenHolders )
  {
    Dependencies deps = new Dependencies();
    deps.satisfyDependencies( fileSystem, config, logService, pageCache, recoveryCollector, monitors, jobScheduler, tokenHolders );
    @SuppressWarnings( "rawtypes" )
    Iterable kernelExtensions = Service.load( KernelExtensionFactory.class );
    KernelContext kernelContext = new SimpleKernelContext( databaseDirectory, databaseInfo, deps );
    return new DatabaseKernelExtensions( kernelContext, kernelExtensions, deps, KernelExtensionFailureStrategies.ignore() );
  }
}

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

@Test
public void givenSatisfiedTypeWhenResolveWithSubInterfaceThenInstanceReturned()
{
  // Given
  Dependencies dependencies = new Dependencies(  );
  Collection foo = new ArrayList( );
  dependencies.satisfyDependency( foo );
  // When
  Collection instance = dependencies.resolveDependency( Collection.class );
  // Then
  assertThat(instance, equalTo(foo));
}

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

@Test
public void givenSatisfiedTypeWhenResolveWithInterfaceThenInstanceReturned()
{
  // Given
  Dependencies dependencies = new Dependencies(  );
  List foo = new ArrayList( );
  dependencies.satisfyDependency( foo );
  // When
  List instance = dependencies.resolveDependency( List.class );
  // Then
  assertThat(instance, equalTo(foo));
}

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

private static KernelTransactions createTransactions( StorageEngine storageEngine,
    TransactionCommitProcess commitProcess, TransactionIdStore transactionIdStore, Tracers tracers,
    StatementLocksFactory statementLocksFactory, StatementOperationParts statementOperations,
    SystemNanoClock clock, AvailabilityGuard databaseAvailabilityGuard )
{
  return new KernelTransactions( Config.defaults(), statementLocksFactory, null, statementOperations,
      null, DEFAULT, commitProcess, mock( AuxiliaryTransactionStateManager.class ), new TransactionHooks(),
      mock( TransactionMonitor.class ), databaseAvailabilityGuard, tracers, storageEngine, new Procedures(), transactionIdStore, clock,
      new AtomicReference<>( CpuClock.NOT_AVAILABLE ), new AtomicReference<>( HeapAllocation.NOT_AVAILABLE ),
      new CanWrite(),
      AutoIndexing.UNSUPPORTED,
      mock( ExplicitIndexStore.class ), EmptyVersionContextSupplier.EMPTY, ON_HEAP,
      mock( ConstraintSemantics.class ), mock( SchemaState.class ),
      mock( IndexingProvidersService.class), mockedTokenHolders(), DEFAULT_DATABASE_NAME, new Dependencies() );
}

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

@Test
public void givenSatisfiedTypeWhenResolveWithSuperTypeThenInstanceReturned()
{
  // Given
  Dependencies dependencies = new Dependencies(  );
  AbstractList foo = new ArrayList( );
  dependencies.satisfyDependency( foo );
  // When
  AbstractList instance = dependencies.resolveDependency( AbstractList.class );
  // Then
  assertThat(instance, equalTo(foo));
}

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

private static TestKernelTransactions createTestTransactions( StorageEngine storageEngine,
    TransactionCommitProcess commitProcess, TransactionIdStore transactionIdStore, Tracers tracers,
    StatementLocksFactory statementLocksFactory, StatementOperationParts statementOperations,
    SystemNanoClock clock, AvailabilityGuard databaseAvailabilityGuard )
{
  return new TestKernelTransactions( statementLocksFactory, null, statementOperations, null, DEFAULT, commitProcess,
      mock( AuxiliaryTransactionStateManager.class ), new TransactionHooks(),
      mock( TransactionMonitor.class ), databaseAvailabilityGuard, tracers, storageEngine, new Procedures(), transactionIdStore, clock,
      new CanWrite(), AutoIndexing.UNSUPPORTED, EmptyVersionContextSupplier.EMPTY, mockedTokenHolders(), new Dependencies() );
}

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

@BeforeEach
void setUp()
{
  Dependencies dependencies = new Dependencies();
  dependencies.satisfyDependencies( new StubIdGeneratorFactory() );
  dependencies.satisfyDependencies( fileSystem );
  when( dataSource.getDependencyResolver() ).thenReturn( dependencies );
  when( dataSource.getDatabaseLayout() ).thenReturn( DatabaseLayout.of( new File( "database" ) ) );
  when( dataSource.getStoreId() ).thenReturn( StoreId.DEFAULT );
  dataSourceManager.start();
  dataSourceManager.register( dataSource );
}

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

@Test
public void givenSatisfiedTypeWhenResolveWithTypeThenInstanceReturned()
{
  // Given
  Dependencies dependencies = new Dependencies(  );
  String foo = "foo";
  dependencies.satisfyDependency( foo );
  // When
  String instance = dependencies.resolveDependency( String.class );
  // Then
  assertThat(instance, equalTo(foo));
}

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

@Test
void shouldNotSupportMultipleProvidersWithSameDescriptor()
{
  // given
  IndexProviderDescriptor descriptor = new IndexProviderDescriptor( "provider", "1.2" );
  IndexProvider provider1 = mock( IndexProvider.class );
  when( provider1.getProviderDescriptor() ).thenReturn( descriptor );
  IndexProvider provider2 = mock( IndexProvider.class );
  when( provider2.getProviderDescriptor() ).thenReturn( descriptor );
  Dependencies dependencies = new Dependencies();
  dependencies.satisfyDependency( provider1 );
  dependencies.satisfyDependency( provider2 );
  // when
  assertThrows( IllegalArgumentException.class, () -> createDefaultProviderMap( dependencies, descriptor ).init() );
}

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

@Test
  public void givenEmptyDependenciesWhenResolveWithTypeThenException()
  {
    // Given
    Dependencies dependencies = new Dependencies( );

    // When
    try
    {
      dependencies.resolveDependency( Collection.class );
      fail();
    }
    catch ( UnsatisfiedDependencyException e )
    {
      // Then
    }
  }
}

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

@Test
public void flushOfThePageCacheOnShutdownDoesNotHappenIfTheDbIsUnhealthy() throws Throwable
{
  DatabaseHealth health = mock( DatabaseHealth.class );
  when( health.isHealthy() ).thenReturn( false );
  PageCache pageCache = spy( pageCacheRule.getPageCache( fs.get() ) );
  Dependencies dependencies = new Dependencies();
  dependencies.satisfyDependency( health );
  NeoStoreDataSource ds = dsRule.getDataSource( dir.databaseLayout(), fs.get(), pageCache, dependencies );
  ds.start();
  verify( pageCache, never() ).flushAndForce();
  ds.stop();
  ds.shutdown();
  verify( pageCache, never() ).flushAndForce( IOLimiter.UNLIMITED );
}

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

@Test
void shouldThrowOnLookupOnUnknownProvider()
{
  // given
  IndexProvider provider = mock( IndexProvider.class );
  IndexProviderDescriptor descriptor = new IndexProviderDescriptor( "provider", "1.2" );
  when( provider.getProviderDescriptor() ).thenReturn( descriptor );
  Dependencies dependencies = new Dependencies();
  dependencies.satisfyDependency( provider );
  // when
  DefaultIndexProviderMap defaultIndexProviderMap = createDefaultProviderMap( dependencies, descriptor );
  defaultIndexProviderMap.init();
  assertThrows( IndexProviderNotFoundException.class, () -> defaultIndexProviderMap.lookup( new IndexProviderDescriptor( "provider2", "1.2" ) ) );
}

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

private void initializeStores( DatabaseLayout databaseLayout, Map<String,String> additionalConfig ) throws IOException
{
  Dependencies dependencies = new Dependencies();
  dependencies.satisfyDependency( Config.defaults( additionalConfig ) );
  ds = dsRule.getDataSource( databaseLayout, fs.get(), pageCache, dependencies );
  ds.start();
  NeoStores neoStores = ds.getDependencyResolver()
      .resolveDependency( RecordStorageEngine.class ).testAccessNeoStores();
  pStore = neoStores.getPropertyStore();
  rtStore = neoStores.getRelationshipTypeTokenStore();
  relStore = neoStores.getRelationshipStore();
  nodeStore = neoStores.getNodeStore();
  storageReader = ds.getDependencyResolver().resolveDependency( StorageEngine.class ).newReader();
}

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

@Test
public void buildDefaultContextWithDependencies() throws IOException
{
  SimpleLogVersionRepository logVersionRepository = new SimpleLogVersionRepository( 2 );
  SimpleTransactionIdStore transactionIdStore = new SimpleTransactionIdStore();
  Dependencies dependencies = new Dependencies();
  dependencies.satisfyDependency( logVersionRepository );
  dependencies.satisfyDependency( transactionIdStore );
  TransactionLogFilesContext context =
      builder( testDirectory.databaseLayout(), fileSystem ).withDependencies( dependencies ).buildContext();
  assertEquals( fileSystem, context.getFileSystem() );
  assertNotNull( context.getLogEntryReader() );
  assertSame( LogFileCreationMonitor.NO_MONITOR, context.getLogFileCreationMonitor() );
  assertEquals( ByteUnit.mebiBytes( 250 ), context.getRotationThreshold().get() );
  assertEquals( 1, context.getLastCommittedTransactionId() );
  assertEquals( 2, context.getLogVersionRepository().getCurrentLogVersion() );
}

相关文章