Search in sources :

Example 1 with DataSourceManager

use of org.neo4j.kernel.impl.transaction.state.DataSourceManager in project neo4j by neo4j.

the class LocalDatabaseTest method doNotRestartServicesIfAlreadyStarted.

@Test
public void doNotRestartServicesIfAlreadyStarted() throws Throwable {
    DataSourceManager dataSourceManager = mock(DataSourceManager.class);
    FileSystemWatcherService watcherService = mock(FileSystemWatcherService.class);
    LocalDatabase localDatabase = newLocalDatabase(newAvailabilityGuard(), dataSourceManager, watcherService);
    localDatabase.start();
    verify(dataSourceManager).start();
    verify(watcherService).start();
    reset(dataSourceManager);
    reset(watcherService);
    localDatabase.start();
    localDatabase.start();
    verify(dataSourceManager, times(0)).start();
    verify(watcherService, times(0)).start();
}
Also used : FileSystemWatcherService(org.neo4j.kernel.impl.util.watcher.FileSystemWatcherService) DataSourceManager(org.neo4j.kernel.impl.transaction.state.DataSourceManager) Test(org.junit.Test)

Example 2 with DataSourceManager

use of org.neo4j.kernel.impl.transaction.state.DataSourceManager in project neo4j by neo4j.

the class LocalDatabaseTest method availabilityGuardRaisedBeforeDataSourceManagerIsStoppedForStoreCopy.

@Test
public void availabilityGuardRaisedBeforeDataSourceManagerIsStoppedForStoreCopy() throws Throwable {
    AvailabilityGuard guard = mock(AvailabilityGuard.class);
    DataSourceManager dataSourceManager = mock(DataSourceManager.class);
    LocalDatabase localDatabase = newLocalDatabase(guard, dataSourceManager);
    localDatabase.stopForStoreCopy();
    InOrder inOrder = inOrder(guard, dataSourceManager);
    // guard should be raised twice - once during construction and once during stop
    inOrder.verify(guard, times(2)).require(any());
    inOrder.verify(dataSourceManager).stop();
}
Also used : InOrder(org.mockito.InOrder) AvailabilityGuard(org.neo4j.kernel.AvailabilityGuard) DataSourceManager(org.neo4j.kernel.impl.transaction.state.DataSourceManager) Test(org.junit.Test)

Example 3 with DataSourceManager

use of org.neo4j.kernel.impl.transaction.state.DataSourceManager in project neo4j by neo4j.

the class LocalDatabaseTest method availabilityGuardRaisedBeforeDataSourceManagerIsStopped.

@Test
public void availabilityGuardRaisedBeforeDataSourceManagerIsStopped() throws Throwable {
    AvailabilityGuard guard = mock(AvailabilityGuard.class);
    DataSourceManager dataSourceManager = mock(DataSourceManager.class);
    LocalDatabase localDatabase = newLocalDatabase(guard, dataSourceManager);
    localDatabase.stop();
    InOrder inOrder = inOrder(guard, dataSourceManager);
    // guard should be raised twice - once during construction and once during stop
    inOrder.verify(guard, times(2)).require(any());
    inOrder.verify(dataSourceManager).stop();
}
Also used : InOrder(org.mockito.InOrder) AvailabilityGuard(org.neo4j.kernel.AvailabilityGuard) DataSourceManager(org.neo4j.kernel.impl.transaction.state.DataSourceManager) Test(org.junit.Test)

Example 4 with DataSourceManager

use of org.neo4j.kernel.impl.transaction.state.DataSourceManager in project neo4j by neo4j.

the class HighAvailabilityMemberStateMachineTest method neoStoreDataSourceSupplierMock.

private static DataSourceManager neoStoreDataSourceSupplierMock() {
    DataSourceManager dataSourceManager = new DataSourceManager();
    dataSourceManager.register(mock(NeoStoreDataSource.class));
    return dataSourceManager;
}
Also used : NeoStoreDataSource(org.neo4j.kernel.NeoStoreDataSource) DataSourceManager(org.neo4j.kernel.impl.transaction.state.DataSourceManager)

Example 5 with DataSourceManager

use of org.neo4j.kernel.impl.transaction.state.DataSourceManager in project neo4j by neo4j.

the class HighAvailabilityModeSwitcherTest method neoStoreDataSourceSupplierMock.

private static DataSourceManager neoStoreDataSourceSupplierMock() {
    DataSourceManager dataSourceManager = new DataSourceManager();
    dataSourceManager.register(mock(NeoStoreDataSource.class));
    return dataSourceManager;
}
Also used : NeoStoreDataSource(org.neo4j.kernel.NeoStoreDataSource) DataSourceManager(org.neo4j.kernel.impl.transaction.state.DataSourceManager)

Aggregations

DataSourceManager (org.neo4j.kernel.impl.transaction.state.DataSourceManager)6 Test (org.junit.Test)4 NeoStoreDataSource (org.neo4j.kernel.NeoStoreDataSource)3 InOrder (org.mockito.InOrder)2 AvailabilityGuard (org.neo4j.kernel.AvailabilityGuard)2 StartupStatistics (org.neo4j.kernel.impl.core.StartupStatistics)1 FileSystemWatcherService (org.neo4j.kernel.impl.util.watcher.FileSystemWatcherService)1