use of org.neo4j.bolt.dbapi.impl.BoltKernelDatabaseManagementServiceProvider in project neo4j by neo4j.
the class BoltStateMachineFactoryImplTest method newBoltFactory.
private static BoltStateMachineFactoryImpl newBoltFactory(DatabaseManagementService managementService) {
var config = Config.defaults(GraphDatabaseSettings.default_database, CUSTOM_DB_NAME);
var dbProvider = new BoltKernelDatabaseManagementServiceProvider(managementService, new Monitors(), CLOCK, Duration.ZERO);
return new BoltStateMachineFactoryImpl(dbProvider, mock(Authentication.class), CLOCK, config, NullLogService.getInstance(), mock(DefaultDatabaseResolver.class));
}
use of org.neo4j.bolt.dbapi.impl.BoltKernelDatabaseManagementServiceProvider in project neo4j by neo4j.
the class DefaultDatabaseTransactionStateMachineSPIProviderTest method newSpiProvider.
private TransactionStateMachineSPIProvider newSpiProvider(DatabaseManagementService managementService) {
var clock = mock(SystemNanoClock.class);
var dbProvider = new BoltKernelDatabaseManagementServiceProvider(managementService, new Monitors(), clock, Duration.ZERO);
return new AbstractTransactionStatementSPIProvider(dbProvider, mockBoltChannel, clock, mock(MemoryTracker.class, RETURNS_MOCKS)) {
@Override
protected TransactionStateMachineSPI newTransactionStateMachineSPI(BoltGraphDatabaseServiceSPI activeBoltGraphDatabaseServiceSPI, StatementProcessorReleaseManager resourceReleaseManger) {
return mock(TransactionStateMachineSPI.class);
}
@Override
public void releaseTransactionStateMachineSPI() {
}
};
}
use of org.neo4j.bolt.dbapi.impl.BoltKernelDatabaseManagementServiceProvider in project neo4j by neo4j.
the class TransactionStateMachineSPIProviderV4Test method newSpiProvider.
private TransactionStateMachineSPIProvider newSpiProvider(DatabaseManagementService managementService) {
var clock = mock(SystemNanoClock.class);
var dbProvider = new BoltKernelDatabaseManagementServiceProvider(managementService, new Monitors(), clock, Duration.ZERO);
return new TransactionStateMachineSPIProviderV4(dbProvider, mockBoltChannel, clock, mock(MemoryTracker.class, RETURNS_MOCKS));
}
use of org.neo4j.bolt.dbapi.impl.BoltKernelDatabaseManagementServiceProvider in project neo4j by neo4j.
the class TransactionStateMachineSPIProviderV4Test method shouldAllocateMemoryForTransactionStateMachineSPI.
@Test
void shouldAllocateMemoryForTransactionStateMachineSPI() throws BoltProtocolBreachFatality, BoltIOException {
String databaseName = "neo4j";
var clock = mock(SystemNanoClock.class);
DatabaseManagementService managementService = managementService(databaseName);
var memoryTracker = mock(MemoryTracker.class);
var scopedMemoryTracker = mock(MemoryTracker.class, RETURNS_MOCKS);
when(mockBoltChannel.defaultDatabase()).thenReturn("neo4j");
when(memoryTracker.getScopedMemoryTracker()).thenReturn(scopedMemoryTracker);
var dbProvider = new BoltKernelDatabaseManagementServiceProvider(managementService, new Monitors(), clock, Duration.ZERO);
var spiProvider = new TransactionStateMachineSPIProviderV4(dbProvider, mockBoltChannel, clock, memoryTracker);
spiProvider.getTransactionStateMachineSPI("", mock(StatementProcessorReleaseManager.class));
verify(memoryTracker).getScopedMemoryTracker();
verify(scopedMemoryTracker).allocateHeap(TransactionStateMachineV4SPI.SHALLOW_SIZE);
verify(scopedMemoryTracker).allocateHeap(BoltKernelGraphDatabaseServiceProvider.SHALLOW_SIZE);
verify(scopedMemoryTracker).getScopedMemoryTracker();
verifyNoMoreInteractions(memoryTracker);
verifyNoMoreInteractions(scopedMemoryTracker);
}
use of org.neo4j.bolt.dbapi.impl.BoltKernelDatabaseManagementServiceProvider in project neo4j by neo4j.
the class SessionExtension method beforeEach.
@Override
public void beforeEach(ExtensionContext extensionContext) {
managementService = builderFactory.get().impermanent().setConfig(GraphDatabaseSettings.auth_enabled, authEnabled).build();
gdb = (GraphDatabaseAPI) managementService.database(GraphDatabaseSettings.DEFAULT_DATABASE_NAME);
DependencyResolver resolver = gdb.getDependencyResolver();
Authentication authentication = authentication(resolver.resolveDependency(AuthManager.class));
Config config = resolver.resolveDependency(Config.class);
SystemNanoClock clock = Clocks.nanoClock();
DefaultDatabaseResolver defaultDatabaseResolver = new CommunityDefaultDatabaseResolver(config, () -> managementService.database(GraphDatabaseSettings.SYSTEM_DATABASE_NAME));
BoltGraphDatabaseManagementServiceSPI databaseManagementService = new BoltKernelDatabaseManagementServiceProvider(managementService, new Monitors(), clock, ofSeconds(30));
boltFactory = new BoltStateMachineFactoryImpl(databaseManagementService, authentication, clock, config, NullLogService.getInstance(), defaultDatabaseResolver);
}
Aggregations