Search in sources :

Example 1 with BoltKernelDatabaseManagementServiceProvider

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));
}
Also used : BoltKernelDatabaseManagementServiceProvider(org.neo4j.bolt.dbapi.impl.BoltKernelDatabaseManagementServiceProvider) Authentication(org.neo4j.bolt.security.auth.Authentication) DefaultDatabaseResolver(org.neo4j.kernel.database.DefaultDatabaseResolver) Monitors(org.neo4j.monitoring.Monitors)

Example 2 with BoltKernelDatabaseManagementServiceProvider

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() {
        }
    };
}
Also used : StatementProcessorReleaseManager(org.neo4j.bolt.runtime.statemachine.StatementProcessorReleaseManager) BoltKernelDatabaseManagementServiceProvider(org.neo4j.bolt.dbapi.impl.BoltKernelDatabaseManagementServiceProvider) Monitors(org.neo4j.monitoring.Monitors) BoltGraphDatabaseServiceSPI(org.neo4j.bolt.dbapi.BoltGraphDatabaseServiceSPI) MemoryTracker(org.neo4j.memory.MemoryTracker)

Example 3 with BoltKernelDatabaseManagementServiceProvider

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));
}
Also used : BoltKernelDatabaseManagementServiceProvider(org.neo4j.bolt.dbapi.impl.BoltKernelDatabaseManagementServiceProvider) Monitors(org.neo4j.monitoring.Monitors) MemoryTracker(org.neo4j.memory.MemoryTracker)

Example 4 with BoltKernelDatabaseManagementServiceProvider

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);
}
Also used : StatementProcessorReleaseManager(org.neo4j.bolt.runtime.statemachine.StatementProcessorReleaseManager) BoltKernelDatabaseManagementServiceProvider(org.neo4j.bolt.dbapi.impl.BoltKernelDatabaseManagementServiceProvider) Monitors(org.neo4j.monitoring.Monitors) DatabaseManagementService(org.neo4j.dbms.api.DatabaseManagementService) Test(org.junit.jupiter.api.Test)

Example 5 with BoltKernelDatabaseManagementServiceProvider

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);
}
Also used : BoltStateMachineFactoryImpl(org.neo4j.bolt.runtime.statemachine.impl.BoltStateMachineFactoryImpl) SystemNanoClock(org.neo4j.time.SystemNanoClock) AuthManager(org.neo4j.kernel.api.security.AuthManager) BoltKernelDatabaseManagementServiceProvider(org.neo4j.bolt.dbapi.impl.BoltKernelDatabaseManagementServiceProvider) Authentication(org.neo4j.bolt.security.auth.Authentication) BasicAuthentication(org.neo4j.bolt.security.auth.BasicAuthentication) Config(org.neo4j.configuration.Config) DefaultDatabaseResolver(org.neo4j.kernel.database.DefaultDatabaseResolver) CommunityDefaultDatabaseResolver(org.neo4j.server.security.systemgraph.CommunityDefaultDatabaseResolver) CommunityDefaultDatabaseResolver(org.neo4j.server.security.systemgraph.CommunityDefaultDatabaseResolver) Monitors(org.neo4j.monitoring.Monitors) DependencyResolver(org.neo4j.common.DependencyResolver) BoltGraphDatabaseManagementServiceSPI(org.neo4j.bolt.dbapi.BoltGraphDatabaseManagementServiceSPI)

Aggregations

BoltKernelDatabaseManagementServiceProvider (org.neo4j.bolt.dbapi.impl.BoltKernelDatabaseManagementServiceProvider)5 Monitors (org.neo4j.monitoring.Monitors)5 StatementProcessorReleaseManager (org.neo4j.bolt.runtime.statemachine.StatementProcessorReleaseManager)2 Authentication (org.neo4j.bolt.security.auth.Authentication)2 DefaultDatabaseResolver (org.neo4j.kernel.database.DefaultDatabaseResolver)2 MemoryTracker (org.neo4j.memory.MemoryTracker)2 Test (org.junit.jupiter.api.Test)1 BoltGraphDatabaseManagementServiceSPI (org.neo4j.bolt.dbapi.BoltGraphDatabaseManagementServiceSPI)1 BoltGraphDatabaseServiceSPI (org.neo4j.bolt.dbapi.BoltGraphDatabaseServiceSPI)1 BoltStateMachineFactoryImpl (org.neo4j.bolt.runtime.statemachine.impl.BoltStateMachineFactoryImpl)1 BasicAuthentication (org.neo4j.bolt.security.auth.BasicAuthentication)1 DependencyResolver (org.neo4j.common.DependencyResolver)1 Config (org.neo4j.configuration.Config)1 DatabaseManagementService (org.neo4j.dbms.api.DatabaseManagementService)1 AuthManager (org.neo4j.kernel.api.security.AuthManager)1 CommunityDefaultDatabaseResolver (org.neo4j.server.security.systemgraph.CommunityDefaultDatabaseResolver)1 SystemNanoClock (org.neo4j.time.SystemNanoClock)1